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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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_
 
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)

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 beamerCreator::create(), eeRechitCollection_, reco::get(), edm::ParameterSet::getParameter(), hebRechitCollection_, hefRechitCollection_, AlCaHLTBitMon_QueryRunRegistry::string, and worker_.

45  :
46  eeUncalibRecHitCollection_( consumes<HGCeeUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("HGCEEuncalibRecHitCollection") ) ),
47  hefUncalibRecHitCollection_( consumes<HGChefUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("HGCHEFuncalibRecHitCollection") ) ),
48  hebUncalibRecHitCollection_( consumes<HGChebUncalibratedRecHitCollection>( ps.getParameter<edm::InputTag>("HGCHEBuncalibRecHitCollection") ) ),
49  eeRechitCollection_( ps.getParameter<std::string>("HGCEErechitCollection") ),
50  hefRechitCollection_( ps.getParameter<std::string>("HGCHEFrechitCollection") ),
51  hebRechitCollection_( ps.getParameter<std::string>("HGCHEBrechitCollection") ) {
52  produces< HGCeeRecHitCollection >(eeRechitCollection_);
53  produces< HGChefRecHitCollection >(hefRechitCollection_);
54  produces< HGChebRecHitCollection >(hebRechitCollection_);
55 
56  const std::string& componentType = ps.getParameter<std::string>("algo");
57  worker_.reset( HGCalRecHitWorkerFactory::get()->create(componentType, ps) );
58 }
T getParameter(std::string const &) const
def create(alignables, pedeDump, additionalData, outputFile, config)
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_
T get(const Candidate &c)
Definition: component.h:55
HGCalRecHitProducer::~HGCalRecHitProducer ( )
override

Definition at line 60 of file HGCalRecHitProducer.cc.

60  {
61 }

Member Function Documentation

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

Definition at line 64 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_, eostools::move(), edm::Handle< T >::product(), edm::Event::put(), and worker_.

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

Member Data Documentation

const std::string HGCalRecHitProducer::eeRechitCollection_
private

Definition at line 38 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

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

Definition at line 35 of file HGCalRecHitProducer.cc.

Referenced by produce().

const std::string HGCalRecHitProducer::hebRechitCollection_
private

Definition at line 40 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

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

Definition at line 37 of file HGCalRecHitProducer.cc.

Referenced by produce().

const std::string HGCalRecHitProducer::hefRechitCollection_
private

Definition at line 39 of file HGCalRecHitProducer.cc.

Referenced by HGCalRecHitProducer(), and produce().

const edm::EDGetTokenT<HGChefUncalibratedRecHitCollection> HGCalRecHitProducer::hefUncalibRecHitCollection_
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 HGCalRecHitProducer(), and produce().