CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Attributes
PFPSRecHitCreator Class Referencefinal

#include <PFPSRecHitCreator.h>

Inheritance diagram for PFPSRecHitCreator:
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
 
 PFPSRecHitCreator (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< EcalRecHitCollectionrecHitToken_
 
- 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 26 of file PFPSRecHitCreator.h.

Constructor & Destructor Documentation

◆ PFPSRecHitCreator()

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

Definition at line 28 of file PFPSRecHitCreator.h.

29  : PFRecHitCreatorBase(iConfig, cc),
31  geomToken_(cc.esConsumes()) {}

Member Function Documentation

◆ importRecHits()

void PFPSRecHitCreator::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 33 of file PFPSRecHitCreator.h.

36  {
37  beginEvent(iEvent, iSetup);
38 
41 
42  // get the ecal geometry
44 
45  iEvent.getByToken(recHitToken_, recHitHandle);
46  for (const auto& erh : *recHitHandle) {
47  ESDetId detid(erh.detid());
48  auto energy = erh.energy();
49 
51 
52  switch (detid.plane()) {
53  case 1:
55  break;
56  case 2:
58  break;
59  default:
60  throw cms::Exception("PFRecHitBadInput")
61  << "incorrect preshower plane !! plane number " << detid.plane() << std::endl;
62  }
63 
64  auto thisCell = psGeometry->getGeometry(detid);
65 
66  // find rechit geometry
67  if (!thisCell) {
68  edm::LogError("PFPSRecHitCreator")
69  << "warning detid " << detid.rawId() << " not found in geometry" << std::endl;
70  continue;
71  }
72 
73  out->emplace_back(thisCell, detid.rawId(), layer, energy);
74  auto& rh = out->back();
75  rh.setDepth(detid.plane());
76  rh.setTime(erh.time());
77 
78  bool rcleaned = false;
79  bool keep = true;
80  bool hi = true; // all ES rhs are produced, independently on the ECAL SRP decision
81 
82  //Apply Q tests
83  for (const auto& qtest : qualityTests_) {
84  if (!qtest->test(rh, erh, rcleaned, hi)) {
85  keep = false;
86  }
87  }
88 
89  if (rcleaned)
90  cleaned->push_back(std::move(out->back()));
91  if (!keep)
92  out->pop_back();
93  }
94  }

References PFRecHitCreatorBase::beginEvent(), DetId::Ecal, EcalPreshower, HCALHighEnergyHPDFilter_cfi::energy, Exception, geomToken_, CaloSubdetectorGeometry::getGeometry(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), iEvent, runTheMatrix::keep, phase1PixelTopology::layer, eostools::move(), PFLayer::NONE, MillePedeFileConverter_cfg::out, PFLayer::PS1, PFLayer::PS2, PFRecHitCreatorBase::qualityTests_, and recHitToken_.

Member Data Documentation

◆ geomToken_

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

Definition at line 100 of file PFPSRecHitCreator.h.

Referenced by importRecHits().

◆ recHitToken_

edm::EDGetTokenT<EcalRecHitCollection> PFPSRecHitCreator::recHitToken_
protected

Definition at line 97 of file PFPSRecHitCreator.h.

Referenced by importRecHits().

PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::SortedCollection< EcalRecHit >
ESDetId
Definition: ESDetId.h:15
edm::Handle
Definition: AssociativeIterator.h:50
PFRecHitCreatorBase::PFRecHitCreatorBase
PFRecHitCreatorBase()
Definition: PFRecHitCreatorBase.h:25
PFLayer::PS1
Definition: PFLayer.h:31
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
PFLayer::NONE
Definition: PFLayer.h:34
PFPSRecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFPSRecHitCreator.h:100
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
PFLayer::Layer
Layer
layer definition
Definition: PFLayer.h:29
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
PFPSRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition: PFPSRecHitCreator.h:97
CaloSubdetectorGeometry::getGeometry
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition: CaloSubdetectorGeometry.cc:36
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DetId::Ecal
Definition: DetId.h:27
cc
EcalPreshower
Definition: EcalSubdetector.h:10
hi
Definition: EPCuts.h:4
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PFLayer::PS2
Definition: PFLayer.h:30
edm::InputTag
Definition: InputTag.h:15