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.

References get, edm::ParameterSet::getParameter(), 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")),
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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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_
#define get

◆ ~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.

References eeRechitCollection_, eeUncalibRecHitCollection_, edm::Event::getByToken(), hebRechitCollection_, hebUncalibRecHitCollection_, hefRechitCollection_, hefUncalibRecHitCollection_, hfnoseRechitCollection_, hfnoseUncalibRecHitCollection_, edm::HandleBase::isValid(), eostools::move(), edm::Handle< T >::product(), edm::Event::put(), edm::SortedCollection< T, SORT >::size(), jetUpdater_cfi::sort, 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  // reserve for the expected size of the vectors
102  eeRecHits->reserve(eeUncalibRecHits->size());
103  hefRecHits->reserve(hefUncalibRecHits->size());
104  hebRecHits->reserve(hebUncalibRecHits->size());
105 
106  // loop over uncalibrated rechits to make calibrated ones
107  worker_->run(evt, *eeUncalibRecHits, *eeRecHits);
108 
109  // loop over uncalibrated rechits to make calibrated ones
110  worker_->run(evt, *hefUncalibRecHits, *hefRecHits);
111 
112  // loop over uncalibrated rechits to make calibrated ones
113  worker_->run(evt, *hebUncalibRecHits, *hebRecHits);
114 
115  std::sort(eeRecHits->begin(), eeRecHits->end());
116  std::sort(hefRecHits->begin(), hefRecHits->end());
117  std::sort(hebRecHits->begin(), hebRecHits->end());
118 
119  // put the collection of recunstructed hits in the event
120  LogInfo("HGCalRecHitInfo") << "total # HGCee calibrated rechits: " << eeRecHits->size();
121  LogInfo("HGCalRecHitInfo") << "total # HGChef calibrated rechits: " << hefRecHits->size();
122  LogInfo("HGCalRecHitInfo") << "total # HGCheb calibrated rechits: " << hebRecHits->size();
123 
124  evt.put(std::move(eeRecHits), eeRechitCollection_);
125  evt.put(std::move(hefRecHits), hefRechitCollection_);
126  evt.put(std::move(hebRecHits), hebRechitCollection_);
127 
128  // do the same for HFNose hits
129  if (pHGChfnoseUncalibRecHits.isValid()) {
130  auto hfnoseRecHits = std::make_unique<HGChfnoseRecHitCollection>();
131  hfnoseRecHits->reserve(hfnoseUncalibRecHits->size());
132  worker_->run(evt, *hfnoseUncalibRecHits, *hfnoseRecHits);
133  std::sort(hfnoseRecHits->begin(), hfnoseRecHits->end());
134  LogInfo("HGCalRecHitInfo") << "total # HGChfnose calibrated rechits: " << hfnoseRecHits->size();
135  evt.put(std::move(hfnoseRecHits), hfnoseRechitCollection_);
136  }
137 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const std::string hfnoseRechitCollection_
size_type size() const
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
const edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > hefUncalibRecHitCollection_
const edm::EDGetTokenT< HGCeeUncalibratedRecHitCollection > eeUncalibRecHitCollection_
const std::string hefRechitCollection_
Log< level::Info, false > LogInfo
const std::string eeRechitCollection_
bool isValid() const
Definition: HandleBase.h:70
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

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().