CMS 3D CMS Logo

JetIDProducer.cc
Go to the documentation of this file.
3 
4 #include <vector>
5 
6 //
7 // constants, enums and typedefs
8 //
9 
10 //
11 // static data member definitions
12 //
13 
14 //
15 // constructors and destructor
16 //
18  : src_(iConfig.getParameter<edm::InputTag>("src")),
19  helper_(iConfig, consumesCollector()),
20  muHelper_(iConfig, consumesCollector()) {
21  produces<reco::JetIDValueMap>();
22 
23  input_jet_token_ = consumes<edm::View<reco::CaloJet> >(src_);
24 }
25 
27 
28 //
29 // member functions
30 //
31 
32 // ------------ method called to produce the data ------------
34  // get the input jets
36  iEvent.getByToken(input_jet_token_, h_jets);
37 
38  // allocate the jet--->jetid value map
39  auto jetIdValueMap = std::make_unique<reco::JetIDValueMap>();
40  // instantiate the filler with the map
41  reco::JetIDValueMap::Filler filler(*jetIdValueMap);
42 
43  // allocate the vector of ids
44  size_t njets = h_jets->size();
45  std::vector<reco::JetID> ids(njets);
46 
47  // loop over the jets
48  for (edm::View<reco::CaloJet>::const_iterator jetsBegin = h_jets->begin(), jetsEnd = h_jets->end(), ijet = jetsBegin;
49  ijet != jetsEnd;
50  ++ijet) {
51  // get the id from each jet
52  helper_.calculate(iEvent, iSetup, *ijet);
53 
54  muHelper_.calculate(iEvent, iSetup, *ijet);
55 
56  ids[ijet - jetsBegin].fHPD = helper_.fHPD();
57  ids[ijet - jetsBegin].fRBX = helper_.fRBX();
58  ids[ijet - jetsBegin].n90Hits = helper_.n90Hits();
59  ids[ijet - jetsBegin].fSubDetector1 = helper_.fSubDetector1();
60  ids[ijet - jetsBegin].fSubDetector2 = helper_.fSubDetector2();
61  ids[ijet - jetsBegin].fSubDetector3 = helper_.fSubDetector3();
62  ids[ijet - jetsBegin].fSubDetector4 = helper_.fSubDetector4();
63  ids[ijet - jetsBegin].restrictedEMF = helper_.restrictedEMF();
64  ids[ijet - jetsBegin].nHCALTowers = helper_.nHCALTowers();
65  ids[ijet - jetsBegin].nECALTowers = helper_.nECALTowers();
66  ids[ijet - jetsBegin].approximatefHPD = helper_.approximatefHPD();
67  ids[ijet - jetsBegin].approximatefRBX = helper_.approximatefRBX();
68  ids[ijet - jetsBegin].hitsInN90 = helper_.hitsInN90();
69 
70  ids[ijet - jetsBegin].numberOfHits2RPC = muHelper_.numberOfHits2RPC();
71  ids[ijet - jetsBegin].numberOfHits3RPC = muHelper_.numberOfHits3RPC();
72  ids[ijet - jetsBegin].numberOfHitsRPC = muHelper_.numberOfHitsRPC();
73 
74  ids[ijet - jetsBegin].fEB = helper_.fEB();
75  ids[ijet - jetsBegin].fEE = helper_.fEE();
76  ids[ijet - jetsBegin].fHB = helper_.fHB();
77  ids[ijet - jetsBegin].fHE = helper_.fHE();
78  ids[ijet - jetsBegin].fHO = helper_.fHO();
79  ids[ijet - jetsBegin].fLong = helper_.fLong();
80  ids[ijet - jetsBegin].fShort = helper_.fShort();
81  ids[ijet - jetsBegin].fLS = helper_.fLSbad();
82  ids[ijet - jetsBegin].fHFOOT = helper_.fHFOOT();
83  }
84 
85  // set up the map
86  filler.insert(h_jets, ids.begin(), ids.end());
87 
88  // fill the vals
89  filler.fill();
90 
91  // write map to the event
92  iEvent.put(std::move(jetIdValueMap));
93 }
94 
95 //define this as a plug-in
double fSubDetector1() const
Definition: JetIDHelper.h:49
double approximatefRBX() const
Definition: JetIDHelper.h:68
double fSubDetector2() const
Definition: JetIDHelper.h:50
double fLSbad() const
Definition: JetIDHelper.h:60
double fSubDetector4() const
Definition: JetIDHelper.h:52
reco::helper::JetIDHelper helper_
Definition: JetIDProducer.h:54
void calculate(const edm::Event &event, const edm::EventSetup &setup, const reco::CaloJet &jet, const int iDbg=0)
Definition: JetIDHelper.cc:93
~JetIDProducer() override
void calculate(const edm::Event &event, const edm::EventSetup &isetup, const reco::Jet &jet, const int iDbg=0)
edm::InputTag src_
Definition: JetIDProducer.h:53
int iEvent
Definition: GenABIO.cc:224
JetIDProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double fHFOOT() const
Definition: JetIDHelper.h:61
double approximatefHPD() const
Definition: JetIDHelper.h:67
reco::helper::JetMuonHitsIDHelper muHelper_
Definition: JetIDProducer.h:55
double fShort() const
Definition: JetIDHelper.h:59
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jet_token_
Definition: JetIDProducer.h:57
double fSubDetector3() const
Definition: JetIDHelper.h:51
double restrictedEMF() const
Definition: JetIDHelper.h:63
double fLong() const
Definition: JetIDHelper.h:58
def move(src, dest)
Definition: eostools.py:511