CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Attributes
PFHBHERecHitCreator Class Reference

#include <PFHBHERecHitCreator.h>

Inheritance diagram for PFHBHERecHitCreator:
PFRecHitCreatorBase

Public Member Functions

void importRecHits (std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 PFHBHERecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
 
- Public Member Functions inherited from PFRecHitCreatorBase
virtual void init (const edm::EventSetup &es)
 
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
 
virtual ~PFRecHitCreatorBase ()=default
 

Protected Attributes

edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 

Additional Inherited Members

- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Detailed Description

Definition at line 19 of file PFHBHERecHitCreator.h.

Constructor & Destructor Documentation

◆ PFHBHERecHitCreator()

PFHBHERecHitCreator::PFHBHERecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector cc 
)
inline

Definition at line 21 of file PFHBHERecHitCreator.h.

22  : PFRecHitCreatorBase(iConfig, cc),
24  geomToken_(cc.esConsumes()) {}
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_

Member Function Documentation

◆ importRecHits()

void PFHBHERecHitCreator::importRecHits ( std::unique_ptr< reco::PFRecHitCollection > &  out,
std::unique_ptr< reco::PFRecHitCollection > &  cleaned,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverridevirtual

Implements PFRecHitCreatorBase.

Definition at line 26 of file PFHBHERecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), TauDecayModes::dec, hcalRecHitTable_cff::depth, ALCARECOPPSCalTrackBasedSel_cff::detid, HBHEDarkening_cff::energy, geomToken_, CaloSubdetectorGeometry::getGeometry(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, HcalBarrel, HcalEndcap, iEvent, runTheMatrix::keep, nano_mu_digi_cff::layer, eostools::move(), MillePedeFileConverter_cfg::out, PFRecHitCreatorBase::qualityTests_, recHitToken_, reco::PFRecHit::setTime(), and hcalRecHitTable_cff::time.

29  {
30  beginEvent(iEvent, iSetup);
31 
33 
35 
36  // get the ecal geometry
37  const CaloSubdetectorGeometry* hcalBarrelGeo = geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalBarrel);
38  const CaloSubdetectorGeometry* hcalEndcapGeo = geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalEndcap);
39 
40  iEvent.getByToken(recHitToken_, recHitHandle);
41  for (const auto& erh : *recHitHandle) {
42  const HcalDetId detid = erh.idFront();
43  HcalSubdetector esd = (HcalSubdetector)detid.subdetId();
44 
45  auto energy = erh.energy();
46  auto time = erh.time();
47  auto depth = detid.depth();
48 
51  switch (esd) {
52  case HcalBarrel:
53  thisCell = hcalBarrelGeo->getGeometry(detid);
55  break;
56 
57  case HcalEndcap:
58  thisCell = hcalEndcapGeo->getGeometry(detid);
60  break;
61  default:
62  break;
63  }
64 
65  // find rechit geometry
66  if (!thisCell) {
67  edm::LogError("PFHBHERecHitCreator") << "warning detid " << std::hex << detid.rawId() << std::dec << " "
68  << detid << " not found in geometry" << std::endl;
69  continue;
70  }
71 
72  reco::PFRecHit rh(std::move(thisCell), detid.rawId(), layer, energy);
73  rh.setTime(time); //Mike: This we will use later
74  rh.setDepth(depth);
75 
76  bool rcleaned = false;
77  bool keep = true;
78 
79  //Apply Q tests
80  for (const auto& qtest : qualityTests_) {
81  if (!qtest->test(rh, erh, rcleaned)) {
82  keep = false;
83  }
84  }
85 
86  if (keep) {
87  out->push_back(std::move(rh));
88  } else if (rcleaned)
89  cleaned->push_back(std::move(rh));
90  }
91  }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
virtual CellMayOwnPtr getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:32
HcalSubdetector
Definition: HcalAssistant.h:31
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
void setTime(double time)
Definition: PFRecHit.h:71
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Layer
layer definition
Definition: PFLayer.h:29
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_

Member Data Documentation

◆ geomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> PFHBHERecHitCreator::geomToken_
private

Definition at line 97 of file PFHBHERecHitCreator.h.

Referenced by importRecHits().

◆ recHitToken_

edm::EDGetTokenT<edm::SortedCollection<HBHERecHit> > PFHBHERecHitCreator::recHitToken_
protected

Definition at line 94 of file PFHBHERecHitCreator.h.

Referenced by importRecHits().