1 #ifndef CANDIDATES_PRODUCER
2 #define CANDIDATES_PRODUCER
4 #include <CommonTools/Utils/interface/StringCutObjectSelector.h>
6 #include <cp3_llbb/Framework/interface/Producer.h>
8 template<
typename ObjectType>
13 m_cut(config.getUntrackedParameter<std::string>(
"cut",
"1"))
21 template<
typename T,
typename U>
22 void fill_candidate(
const T& p,
const U* gen) {
23 p4.push_back(LorentzVector(p.pt(), p.eta(), p.phi(), p.energy()));
24 y.push_back(p.rapidity());
25 charge.push_back(p.charge());
28 matched.push_back(
true);
29 gen_p4.push_back(LorentzVector(gen->pt(), gen->eta(), gen->phi(), gen->energy()));
30 gen_y.push_back(gen->y());
31 gen_charge.push_back(gen->charge());
33 matched.push_back(
false);
34 gen_p4.push_back(LorentzVector(0., 0., 0., 0.));
36 gen_charge.push_back(0.);
40 bool pass_cut(
const ObjectType& p) {
46 StringCutObjectSelector<ObjectType> m_cut;
50 std::vector<LorentzVector>& p4 =
tree[
"p4"].write<std::vector<LorentzVector>>();
51 std::vector<float>& y =
tree[
"y"].transient_write<std::vector<float>>();
52 std::vector<int8_t>& charge =
tree[
"charge"].transient_write<std::vector<int8_t>>();
54 std::vector<bool>& matched =
tree[
"has_matched_gen_particle"].write<std::vector<bool>>();
55 std::vector<LorentzVector>& gen_p4 =
tree[
"gen_p4"].write<std::vector<LorentzVector>>();
56 std::vector<float>& gen_y =
tree[
"gen_y"].transient_write<std::vector<float>>();
57 std::vector<int8_t>& gen_charge =
tree[
"gen_charge"].transient_write<std::vector<int8_t>>();
Definition: CandidatesProducer.h:9
Base class for Framework producers.
Definition: Producer.h:33
ROOT::TreeGroup tree
Access point to output tree.
Definition: Producer.h:132
Producer(const std::string &name, const ROOT::TreeGroup &tree_, const edm::ParameterSet &config)
Base constructor.
Definition: Producer.h:46