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
JetID.h
reco::helper::JetIDHelper::fHPD
double fHPD() const
Definition: JetIDHelper.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::helper::JetIDHelper::calculate
void calculate(const edm::Event &event, const edm::EventSetup &setup, const reco::CaloJet &jet, const int iDbg=0)
Definition: JetIDHelper.cc:93
JetIDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
reco::helper::JetIDHelper::fSubDetector2
double fSubDetector2() const
Definition: JetIDHelper.h:47
JetIDProducer::input_jet_token_
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jet_token_
Definition: JetIDProducer.h:57
reco::helper::JetIDHelper::fLSbad
double fLSbad() const
Definition: JetIDHelper.h:57
reco::helper::JetIDHelper::fSubDetector4
double fSubDetector4() const
Definition: JetIDHelper.h:49
JetIDProducer::~JetIDProducer
~JetIDProducer() override
Definition: JetIDProducer.cc:26
reco::helper::JetMuonHitsIDHelper::numberOfHitsRPC
int numberOfHitsRPC() const
Definition: JetMuonHitsIDHelper.h:37
JetIDProducer::helper_
reco::helper::JetIDHelper helper_
Definition: JetIDProducer.h:54
reco::helper::JetIDHelper::n90Hits
int n90Hits() const
Definition: JetIDHelper.h:45
reco::helper::JetMuonHitsIDHelper::numberOfHits3RPC
int numberOfHits3RPC() const
Definition: JetMuonHitsIDHelper.h:35
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
reco::helper::JetIDHelper::approximatefRBX
double approximatefRBX() const
Definition: JetIDHelper.h:65
reco::helper::JetIDHelper::nECALTowers
int nECALTowers() const
Definition: JetIDHelper.h:62
JetIDProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: JetIDProducer.cc:33
JetIDProducer::JetIDProducer
JetIDProducer(const edm::ParameterSet &)
Definition: JetIDProducer.cc:17
reco::helper::JetIDHelper::nHCALTowers
int nHCALTowers() const
Definition: JetIDHelper.h:61
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
reco::helper::JetIDHelper::fEB
double fEB() const
Definition: JetIDHelper.h:50
reco::helper::JetIDHelper::fHO
double fHO() const
Definition: JetIDHelper.h:54
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
JetIDProducer::muHelper_
reco::helper::JetMuonHitsIDHelper muHelper_
Definition: JetIDProducer.h:55
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::helper::JetIDHelper::fHFOOT
double fHFOOT() const
Definition: JetIDHelper.h:58
reco::helper::JetIDHelper::fHE
double fHE() const
Definition: JetIDHelper.h:53
reco::helper::JetIDHelper::fEE
double fEE() const
Definition: JetIDHelper.h:51
edm::EventSetup
Definition: EventSetup.h:57
reco::helper::JetMuonHitsIDHelper::calculate
void calculate(const edm::Event &event, const edm::EventSetup &isetup, const reco::Jet &jet, const int iDbg=0)
Definition: JetMuonHitsIDHelper.cc:44
reco::helper::JetIDHelper::fRBX
double fRBX() const
Definition: JetIDHelper.h:44
reco::helper::JetIDHelper::approximatefHPD
double approximatefHPD() const
Definition: JetIDHelper.h:64
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::helper::JetIDHelper::hitsInN90
int hitsInN90() const
Definition: JetIDHelper.h:66
BTaggingMonitoring_cff.njets
njets
Definition: BTaggingMonitoring_cff.py:10
JetIDProducer::src_
edm::InputTag src_
Definition: JetIDProducer.h:53
reco::helper::JetIDHelper::fShort
double fShort() const
Definition: JetIDHelper.h:56
reco::helper::JetIDHelper::restrictedEMF
double restrictedEMF() const
Definition: JetIDHelper.h:60
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::helper::Filler
Definition: ValueMap.h:22
reco::helper::JetIDHelper::fLong
double fLong() const
Definition: JetIDHelper.h:55
edm::Event
Definition: Event.h:73
JetIDProducer
Definition: JetIDProducer.h:44
reco::helper::JetIDHelper::fSubDetector3
double fSubDetector3() const
Definition: JetIDHelper.h:48
reco::helper::JetIDHelper::fHB
double fHB() const
Definition: JetIDHelper.h:52
reco::helper::JetMuonHitsIDHelper::numberOfHits2RPC
int numberOfHits2RPC() const
Definition: JetMuonHitsIDHelper.h:34
reco::helper::JetIDHelper::fSubDetector1
double fSubDetector1() const
Definition: JetIDHelper.h:46