CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Attributes
PFHGCalRecHitCreator< DET, Layer, det, subdet > Class Template Reference

#include <PFHGCalRecHitCreator.h>

Inheritance diagram for PFHGCalRecHitCreator< DET, Layer, det, subdet >:
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
 
 PFHGCalRecHitCreator (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

std::string geometryInstance_
 
edm::EDGetTokenT< HGCRecHitCollectionrecHitToken_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 
hgcal::RecHitTools recHitTools_
 

Additional Inherited Members

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

Detailed Description

template<typename DET, PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
class PFHGCalRecHitCreator< DET, Layer, det, subdet >

Definition at line 26 of file PFHGCalRecHitCreator.h.

Constructor & Destructor Documentation

◆ PFHGCalRecHitCreator()

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
PFHGCalRecHitCreator< DET, Layer, det, subdet >::PFHGCalRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector cc 
)
inline

Definition at line 28 of file PFHGCalRecHitCreator.h.

29  : PFRecHitCreatorBase(iConfig, cc),
30  recHitToken_(cc.consumes<HGCRecHitCollection>(iConfig.getParameter<edm::InputTag>("src"))),
31  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
32  geomToken_(cc.esConsumes()) {}

Member Function Documentation

◆ importRecHits()

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
void PFHGCalRecHitCreator< DET, Layer, det, subdet >::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 34 of file PFHGCalRecHitCreator.h.

37  {
38  // Setup RecHitTools to properly compute the position of the HGCAL Cells vie their DetIds
40  recHitTools_.setGeometry(*geoHandle);
41 
42  for (unsigned int i = 0; i < qualityTests_.size(); ++i) {
43  qualityTests_.at(i)->beginEvent(iEvent, iSetup);
44  }
45 
47  iEvent.getByToken(recHitToken_, recHitHandle);
48  const HGCRecHitCollection& rechits = *recHitHandle;
49 
50  const CaloGeometry* geom = geoHandle.product();
51 
52  unsigned skipped_rechits = 0;
53  for (const auto& hgrh : rechits) {
54  const DET detid(hgrh.detid());
55 
56  if (det != detid.det() or (subdet != 0 and subdet != detid.subdetId())) {
57  throw cms::Exception("IncorrectHGCSubdetector")
58  << "det expected: " << det << " det gotten: " << detid.det() << " ; "
59  << "subdet expected: " << subdet << " subdet gotten: " << detid.subdetId() << std::endl;
60  }
61 
62  double energy = hgrh.energy();
63  double time = hgrh.time();
64 
65  auto thisCell = geom->getSubdetectorGeometry(det, subdet)->getGeometry(detid);
66 
67  // find rechit geometry
68  if (!thisCell) {
69  LogDebug("PFHGCalRecHitCreator") << "warning detid " << detid.rawId() << " not found in geometry" << std::endl;
70  ++skipped_rechits;
71  continue;
72  }
73 
74  reco::PFRecHit rh(thisCell, detid.rawId(), Layer, energy);
75 
76  bool rcleaned = false;
77  bool keep = true;
78 
79  //Apply Q tests
80  for (unsigned int i = 0; i < qualityTests_.size(); ++i) {
81  if (!qualityTests_.at(i)->test(rh, hgrh, rcleaned)) {
82  keep = false;
83  }
84  }
85 
86  if (keep) {
87  rh.setTime(time);
88  out->push_back(rh);
89  } else if (rcleaned)
90  cleaned->push_back(rh);
91  }
92  edm::LogInfo("HGCalRecHitCreator") << "Skipped " << skipped_rechits << " out of " << rechits.size() << " rechits!"
93  << std::endl;
94  edm::LogInfo("HGCalRecHitCreator") << "Created " << out->size() << " PFRecHits!" << std::endl;
95  }

References HCALHighEnergyHPDFilter_cfi::energy, Exception, relativeConstraints::geom, PFHGCalRecHitCreator< DET, Layer, det, subdet >::geomToken_, edm::EventSetup::getHandle(), mps_fire::i, iEvent, runTheMatrix::keep, LogDebug, or, MillePedeFileConverter_cfg::out, edm::ESHandle< T >::product(), PFRecHitCreatorBase::qualityTests_, HI_PhotonSkim_cff::rechits, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitToken_, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitTools_, hgcal::RecHitTools::setGeometry(), and protons_cff::time.

Member Data Documentation

◆ geometryInstance_

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
std::string PFHGCalRecHitCreator< DET, Layer, det, subdet >::geometryInstance_
protected

Definition at line 99 of file PFHGCalRecHitCreator.h.

◆ geomToken_

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> PFHGCalRecHitCreator< DET, Layer, det, subdet >::geomToken_
private

◆ recHitToken_

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
edm::EDGetTokenT<HGCRecHitCollection> PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitToken_
protected

◆ recHitTools_

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
hgcal::RecHitTools PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitTools_
private
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFHGCalRecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFHGCalRecHitCreator.h:103
mps_fire.i
i
Definition: mps_fire.py:428
PFHGCalRecHitCreator::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: PFHGCalRecHitCreator.h:102
PFHGCalRecHitCreator::geometryInstance_
std::string geometryInstance_
Definition: PFHGCalRecHitCreator.h:99
protons_cff.time
time
Definition: protons_cff.py:35
edm::SortedCollection
Definition: SortedCollection.h:49
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
LayerTriplets::Layer
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
PFRecHitCreatorBase::PFRecHitCreatorBase
PFRecHitCreatorBase()
Definition: PFRecHitCreatorBase.h:25
CaloGeometry
Definition: CaloGeometry.h:21
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
cc
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
Exception
Definition: hltDiff.cc:245
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PFHGCalRecHitCreator::recHitToken_
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_
Definition: PFHGCalRecHitCreator.h:98
edm::InputTag
Definition: InputTag.h:15