CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalRecHitProducer Class Reference
Inheritance diagram for HGCalRecHitProducer:
edm::stream::EDProducer<>

Public Member Functions

 HGCalRecHitProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~HGCalRecHitProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const std::string eeRechitCollection_
 
const edm::EDGetTokenT< HGCeeUncalibratedRecHitCollectioneeUncalibRecHitCollection_
 
const std::string hebRechitCollection_
 
const edm::EDGetTokenT< HGChebUncalibratedRecHitCollectionhebUncalibRecHitCollection_
 
const std::string hefRechitCollection_
 
const edm::EDGetTokenT< HGChefUncalibratedRecHitCollectionhefUncalibRecHitCollection_
 
const std::string hfnoseRechitCollection_
 
const edm::EDGetTokenT< HGChfnoseUncalibratedRecHitCollectionhfnoseUncalibRecHitCollection_
 
std::unique_ptr< HGCalRecHitWorkerBaseClassworker_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

produce HGCAL rechits from uncalibrated rechits

simplified version of Ecal code

Author
Valeri Andreev (ported to 76X by L. Gray, add HFNose by Sunanda)

Definition at line 26 of file HGCalRecHitProducer.cc.

Constructor & Destructor Documentation

HGCalRecHitProducer::HGCalRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 45 of file HGCalRecHitProducer.cc.

References eeRechitCollection_, timingPdfMaker::get, edm::ParameterSet::getParameter(), hebRechitCollection_, hefRechitCollection_, hfnoseRechitCollection_, and AlCaHLTBitMon_QueryRunRegistry::string.

47  consumes<HGCeeUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEuncalibRecHitCollection"))),
48  hefUncalibRecHitCollection_(consumes<HGChefUncalibratedRecHitCollection>(
49  ps.getParameter<edm::InputTag>("HGCHEFuncalibRecHitCollection"))),
50  hebUncalibRecHitCollection_(consumes<HGChebUncalibratedRecHitCollection>(
51  ps.getParameter<edm::InputTag>("HGCHEBuncalibRecHitCollection"))),
52  hfnoseUncalibRecHitCollection_(consumes<HGChfnoseUncalibratedRecHitCollection>(
53  ps.getParameter<edm::InputTag>("HGCHFNoseuncalibRecHitCollection"))),
54  eeRechitCollection_(ps.getParameter<std::string>("HGCEErechitCollection")),
55  hefRechitCollection_(ps.getParameter<std::string>("HGCHEFrechitCollection")),
56  hebRechitCollection_(ps.getParameter<std::string>("HGCHEBrechitCollection")),
57  hfnoseRechitCollection_(ps.getParameter<std::string>("HGCHFNoserechitCollection")),
59  produces<HGCeeRecHitCollection>(eeRechitCollection_);
60  produces<HGChefRecHitCollection>(hefRechitCollection_);
61  produces<HGChebRecHitCollection>(hebRechitCollection_);
62  produces<HGChfnoseRecHitCollection>(hfnoseRechitCollection_);
63 }
T getParameter(std::string const &) const
const std::string hfnoseRechitCollection_
const edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > hefUncalibRecHitCollection_
const edm::EDGetTokenT< HGCeeUncalibratedRecHitCollection > eeUncalibRecHitCollection_
const std::string hefRechitCollection_
const std::string eeRechitCollection_
const std::string hebRechitCollection_
std::unique_ptr< HGCalRecHitWorkerBaseClass > worker_
const edm::EDGetTokenT< HGChebUncalibratedRecHitCollection > hebUncalibRecHitCollection_
const edm::EDGetTokenT< HGChfnoseUncalibratedRecHitCollection > hfnoseUncalibRecHitCollection_
HGCalRecHitProducer::~HGCalRecHitProducer ( )
override

Definition at line 65 of file HGCalRecHitProducer.cc.

65 {}

Member Function Documentation

void HGCalRecHitProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 67 of file HGCalRecHitProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), DEFINE_FWK_MODULE, eeRechitCollection_, eeUncalibRecHitCollection_, edm::SortedCollection< T, SORT >::end(), edm::Event::getByToken(), hebRechitCollection_, hebUncalibRecHitCollection_, hefRechitCollection_, hefUncalibRecHitCollection_, hfnoseRechitCollection_, hfnoseUncalibRecHitCollection_, edm::HandleBase::isValid(), eostools::move(), edm::Handle< T >::product(), edm::Event::put(), and worker_.

67  {
68  using namespace edm;
69 
70  Handle<HGCeeUncalibratedRecHitCollection> pHGCeeUncalibRecHits;
71  Handle<HGChefUncalibratedRecHitCollection> pHGChefUncalibRecHits;
72  Handle<HGChebUncalibratedRecHitCollection> pHGChebUncalibRecHits;
73  Handle<HGChfnoseUncalibratedRecHitCollection> pHGChfnoseUncalibRecHits;
74 
75  const HGCeeUncalibratedRecHitCollection* eeUncalibRecHits = nullptr;
76  const HGChefUncalibratedRecHitCollection* hefUncalibRecHits = nullptr;
77  const HGChebUncalibratedRecHitCollection* hebUncalibRecHits = nullptr;
78  const HGChfnoseUncalibratedRecHitCollection* hfnoseUncalibRecHits = nullptr;
79 
80  // get the HGC uncalib rechit collection
81  evt.getByToken(eeUncalibRecHitCollection_, pHGCeeUncalibRecHits);
82  eeUncalibRecHits = pHGCeeUncalibRecHits.product();
83 
84  evt.getByToken(hefUncalibRecHitCollection_, pHGChefUncalibRecHits);
85  hefUncalibRecHits = pHGChefUncalibRecHits.product();
86 
87  evt.getByToken(hebUncalibRecHitCollection_, pHGChebUncalibRecHits);
88  hebUncalibRecHits = pHGChebUncalibRecHits.product();
89 
90  evt.getByToken(hfnoseUncalibRecHitCollection_, pHGChfnoseUncalibRecHits);
91  if (pHGChfnoseUncalibRecHits.isValid())
92  hfnoseUncalibRecHits = pHGChfnoseUncalibRecHits.product();
93 
94  // collection of rechits to put in the event
95  auto eeRecHits = std::make_unique<HGCeeRecHitCollection>();
96  auto hefRecHits = std::make_unique<HGChefRecHitCollection>();
97  auto hebRecHits = std::make_unique<HGChebRecHitCollection>();
98 
99  worker_->set(es);
100 
101  // loop over uncalibrated rechits to make calibrated ones
102  for (auto it = eeUncalibRecHits->begin(); it != eeUncalibRecHits->end(); ++it) {
103  worker_->run(evt, *it, *eeRecHits);
104  }
105 
106  // loop over uncalibrated rechits to make calibrated ones
107  for (auto it = hefUncalibRecHits->begin(); it != hefUncalibRecHits->end(); ++it) {
108  worker_->run(evt, *it, *hefRecHits);
109  }
110 
111  // loop over uncalibrated rechits to make calibrated ones
112  for (auto it = hebUncalibRecHits->begin(); it != hebUncalibRecHits->end(); ++it) {
113  worker_->run(evt, *it, *hebRecHits);
114  }
115 
116  // sort collections before attempting recovery, to avoid insertion of double recHits
117  eeRecHits->sort();
118  hefRecHits->sort();
119  hebRecHits->sort();
120 
121  // put the collection of recunstructed hits in the event
122  LogInfo("HGCalRecHitInfo") << "total # HGCee calibrated rechits: " << eeRecHits->size();
123  LogInfo("HGCalRecHitInfo") << "total # HGChef calibrated rechits: " << hefRecHits->size();
124  LogInfo("HGCalRecHitInfo") << "total # HGCheb calibrated rechits: " << hebRecHits->size();
125 
126  evt.put(std::move(eeRecHits), eeRechitCollection_);
127  evt.put(std::move(hefRecHits), hefRechitCollection_);
128  evt.put(std::move(hebRecHits), hebRechitCollection_);
129 
130  // do the same for HFNose hits
131  if (pHGChfnoseUncalibRecHits.isValid()) {
132  auto hfnoseRecHits = std::make_unique<HGChfnoseRecHitCollection>();
133  for (auto it = hfnoseUncalibRecHits->begin(); it != hfnoseUncalibRecHits->end(); ++it) {
134  worker_->run(evt, *it, *hfnoseRecHits);
135  }
136  hfnoseRecHits->sort();
137  LogInfo("HGCalRecHitInfo") << "total # HGChfnose calibrated rechits: " << hfnoseRecHits->size();
138  evt.put(std::move(hfnoseRecHits), hfnoseRechitCollection_);
139  }
140 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const std::string hfnoseRechitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > hefUncalibRecHitCollection_
const edm::EDGetTokenT< HGCeeUncalibratedRecHitCollection > eeUncalibRecHitCollection_
const std::string hefRechitCollection_
bool isValid() const
Definition: HandleBase.h:70
const_iterator end() const
const std::string eeRechitCollection_
T const * product() const
Definition: Handle.h:69
const std::string hebRechitCollection_
HLT enums.
std::unique_ptr< HGCalRecHitWorkerBaseClass > worker_
const edm::EDGetTokenT< HGChebUncalibratedRecHitCollection > hebUncalibRecHitCollection_
const edm::EDGetTokenT< HGChfnoseUncalibratedRecHitCollection > hfnoseUncalibRecHitCollection_
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const

Member Data Documentation

const std::string HGCalRecHitProducer::eeRechitCollection_
private

Definition at line 37 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

const edm::EDGetTokenT<HGCeeUncalibratedRecHitCollection> HGCalRecHitProducer::eeUncalibRecHitCollection_
private

Definition at line 33 of file HGCalRecHitProducer.cc.

Referenced by produce().

const std::string HGCalRecHitProducer::hebRechitCollection_
private

Definition at line 39 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

const edm::EDGetTokenT<HGChebUncalibratedRecHitCollection> HGCalRecHitProducer::hebUncalibRecHitCollection_
private

Definition at line 35 of file HGCalRecHitProducer.cc.

Referenced by produce().

const std::string HGCalRecHitProducer::hefRechitCollection_
private

Definition at line 38 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

const edm::EDGetTokenT<HGChefUncalibratedRecHitCollection> HGCalRecHitProducer::hefUncalibRecHitCollection_
private

Definition at line 34 of file HGCalRecHitProducer.cc.

Referenced by produce().

const std::string HGCalRecHitProducer::hfnoseRechitCollection_
private

Definition at line 40 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

const edm::EDGetTokenT<HGChfnoseUncalibratedRecHitCollection> HGCalRecHitProducer::hfnoseUncalibRecHitCollection_
private

Definition at line 36 of file HGCalRecHitProducer.cc.

Referenced by produce().

std::unique_ptr<HGCalRecHitWorkerBaseClass> HGCalRecHitProducer::worker_
private

Definition at line 42 of file HGCalRecHitProducer.cc.

Referenced by produce().