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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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::HGCalRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 45 of file HGCalRecHitProducer.cc.

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")),
58  worker_{HGCalRecHitWorkerFactory::get()->create(ps.getParameter<std::string>("algo"), ps, consumesCollector())} {
59  produces<HGCeeRecHitCollection>(eeRechitCollection_);
60  produces<HGChefRecHitCollection>(hefRechitCollection_);
61  produces<HGChebRecHitCollection>(hebRechitCollection_);
62  produces<HGChfnoseRecHitCollection>(hfnoseRechitCollection_);
63 }

References get, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~HGCalRecHitProducer()

HGCalRecHitProducer::~HGCalRecHitProducer ( )
override

Definition at line 65 of file HGCalRecHitProducer.cc.

65 {}

Member Function Documentation

◆ produce()

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

Definition at line 67 of file HGCalRecHitProducer.cc.

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 }

References edm::SortedCollection< T, SORT >::begin(), 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_.

Member Data Documentation

◆ eeRechitCollection_

const std::string HGCalRecHitProducer::eeRechitCollection_
private

Definition at line 37 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ eeUncalibRecHitCollection_

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

Definition at line 33 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hebRechitCollection_

const std::string HGCalRecHitProducer::hebRechitCollection_
private

Definition at line 39 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hebUncalibRecHitCollection_

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

Definition at line 35 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hefRechitCollection_

const std::string HGCalRecHitProducer::hefRechitCollection_
private

Definition at line 38 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hefUncalibRecHitCollection_

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

Definition at line 34 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hfnoseRechitCollection_

const std::string HGCalRecHitProducer::hfnoseRechitCollection_
private

Definition at line 40 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ hfnoseUncalibRecHitCollection_

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

Definition at line 36 of file HGCalRecHitProducer.cc.

Referenced by produce().

◆ worker_

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

Definition at line 42 of file HGCalRecHitProducer.cc.

Referenced by produce().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
HGCalRecHitProducer::hebRechitCollection_
const std::string hebRechitCollection_
Definition: HGCalRecHitProducer.cc:39
HGCalRecHitProducer::hebUncalibRecHitCollection_
const edm::EDGetTokenT< HGChebUncalibratedRecHitCollection > hebUncalibRecHitCollection_
Definition: HGCalRecHitProducer.cc:35
edm
HLT enums.
Definition: AlignableModifier.h:19
HGCalRecHitProducer::hefRechitCollection_
const std::string hefRechitCollection_
Definition: HGCalRecHitProducer.cc:38
HGCalRecHitProducer::eeRechitCollection_
const std::string eeRechitCollection_
Definition: HGCalRecHitProducer.cc:37
edm::SortedCollection
Definition: SortedCollection.h:49
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
HGCalRecHitProducer::worker_
std::unique_ptr< HGCalRecHitWorkerBaseClass > worker_
Definition: HGCalRecHitProducer.cc:42
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
HGCalRecHitProducer::hfnoseUncalibRecHitCollection_
const edm::EDGetTokenT< HGChfnoseUncalibratedRecHitCollection > hfnoseUncalibRecHitCollection_
Definition: HGCalRecHitProducer.cc:36
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalRecHitProducer::eeUncalibRecHitCollection_
const edm::EDGetTokenT< HGCeeUncalibratedRecHitCollection > eeUncalibRecHitCollection_
Definition: HGCalRecHitProducer.cc:33
HGCalRecHitProducer::hfnoseRechitCollection_
const std::string hfnoseRechitCollection_
Definition: HGCalRecHitProducer.cc:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HGCalRecHitProducer::hefUncalibRecHitCollection_
const edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > hefUncalibRecHitCollection_
Definition: HGCalRecHitProducer.cc:34
edm::InputTag
Definition: InputTag.h:15