CMS 3D CMS Logo

CastorJetIDProducer.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")), helper_() {
19  produces<reco::CastorJetIDValueMap>();
20 
21  input_jet_token_ = consumes<edm::View<reco::BasicJet> >(src_);
22 }
23 
25 
26 //
27 // member functions
28 //
29 
30 // ------------ method called to produce the data ------------
32  // get the input jets
34  iEvent.getByToken(input_jet_token_, h_jets);
35 
36  // allocate the jet--->jetid value map
37  auto castorjetIdValueMap = std::make_unique<reco::CastorJetIDValueMap>();
38  // instantiate the filler with the map
39  reco::CastorJetIDValueMap::Filler filler(*castorjetIdValueMap);
40 
41  // allocate the vector of ids
42  size_t njets = h_jets->size();
43  std::vector<reco::CastorJetID> ids(njets);
44 
45  // loop over the jets
46  for (edm::View<reco::BasicJet>::const_iterator jetsBegin = h_jets->begin(), jetsEnd = h_jets->end(), ijet = jetsBegin;
47  ijet != jetsEnd;
48  ++ijet) {
49  // get the id from each jet
50  helper_.calculate(iEvent, *ijet);
51 
52  ids[ijet - jetsBegin].emEnergy = helper_.emEnergy();
53  ids[ijet - jetsBegin].hadEnergy = helper_.hadEnergy();
54  ids[ijet - jetsBegin].fem = helper_.fem();
55  ids[ijet - jetsBegin].depth = helper_.depth();
56  ids[ijet - jetsBegin].width = helper_.width();
57  ids[ijet - jetsBegin].fhot = helper_.fhot();
58  ids[ijet - jetsBegin].sigmaz = helper_.sigmaz();
59  ids[ijet - jetsBegin].nTowers = helper_.nTowers();
60  }
61 
62  // set up the map
63  filler.insert(h_jets, ids.begin(), ids.end());
64 
65  // fill the vals
66  filler.fill();
67 
68  // write map to the event
69  iEvent.put(std::move(castorjetIdValueMap));
70 }
71 
72 //define this as a plug-in
reco::helper::CastorJetIDHelper::sigmaz
double sigmaz() const
Definition: CastorJetIDHelper.h:31
reco::helper::CastorJetIDHelper::fem
double fem() const
Definition: CastorJetIDHelper.h:27
reco::helper::CastorJetIDHelper::depth
double depth() const
Definition: CastorJetIDHelper.h:29
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::helper::CastorJetIDHelper::nTowers
int nTowers() const
Definition: CastorJetIDHelper.h:32
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
CastorJetIDProducer
Definition: CastorJetIDProducer.h:40
CastorJetIDProducer::CastorJetIDProducer
CastorJetIDProducer(const edm::ParameterSet &)
Definition: CastorJetIDProducer.cc:17
CastorJetID.h
reco::helper::CastorJetIDHelper::calculate
void calculate(const edm::Event &event, const reco::BasicJet &jet)
Definition: CastorJetIDHelper.cc:26
edm::Handle
Definition: AssociativeIterator.h:50
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CastorJetIDProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CastorJetIDProducer.cc:31
CastorJetIDProducer::input_jet_token_
edm::EDGetTokenT< edm::View< reco::BasicJet > > input_jet_token_
Definition: CastorJetIDProducer.h:52
reco::helper::CastorJetIDHelper::emEnergy
double emEnergy() const
Definition: CastorJetIDHelper.h:25
CastorJetIDProducer::helper_
reco::helper::CastorJetIDHelper helper_
Definition: CastorJetIDProducer.h:50
edm::ParameterSet
Definition: ParameterSet.h:47
CastorJetIDProducer::src_
edm::InputTag src_
Definition: CastorJetIDProducer.h:49
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
CastorJetIDProducer::~CastorJetIDProducer
~CastorJetIDProducer() override
Definition: CastorJetIDProducer.cc:24
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
CastorJetIDProducer.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
BTaggingMonitoring_cff.njets
njets
Definition: BTaggingMonitoring_cff.py:10
reco::helper::CastorJetIDHelper::hadEnergy
double hadEnergy() const
Definition: CastorJetIDHelper.h:26
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
edm::Event
Definition: Event.h:73
reco::helper::CastorJetIDHelper::fhot
double fhot() const
Definition: CastorJetIDHelper.h:30
reco::helper::CastorJetIDHelper::width
double width() const
Definition: CastorJetIDHelper.h:28