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 &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
virtual void init (const edm::EventSetup &es)
 
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
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

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 iC 
)
inline

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

References HCALHighEnergyHPDFilter_cfi::energy, Exception, relativeConstraints::geom, edm::EventSetup::get(), get, mps_fire::i, iEvent, keep, LogDebug, or, MillePedeFileConverter_cfg::out, edm::ESHandle< T >::product(), PFRecHitCreatorBase::qualityTests_, TrackInfoProducer_cfi::rechits, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitToken_, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitTools_, hgcal::RecHitTools::setGeometry(), and ntuplemaker::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

◆ 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
mps_fire.i
i
Definition: mps_fire.py:355
PFHGCalRecHitCreator::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: PFHGCalRecHitCreator.h:103
PFHGCalRecHitCreator::geometryInstance_
std::string geometryInstance_
Definition: PFHGCalRecHitCreator.h:100
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm::LogInfo
Definition: MessageLogger.h:254
edm::SortedCollection
Definition: SortedCollection.h:49
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
TrackInfoProducer_cfi.rechits
rechits
Definition: TrackInfoProducer_cfi.py:9
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
Exception
Definition: hltDiff.cc:246
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
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
ntuplemaker.time
time
Definition: ntuplemaker.py:310
PFHGCalRecHitCreator::recHitToken_
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_
Definition: PFHGCalRecHitCreator.h:99
keep
const int keep
Definition: GenParticlePruner.cc:48
edm::InputTag
Definition: InputTag.h:15