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

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

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.

References HCALHighEnergyHPDFilter_cfi::energy, Exception, relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByToken(), hgcal::RecHitTools::getEventSetup(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), mps_fire::i, keep, LogDebug, or, edm::ESHandle< T >::product(), PFRecHitCreatorBase::qualityTests_, TrackInfoProducer_cfi::rechits, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitToken_, PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitTools_, and ntuplemaker::time.

37  {
38  // Setup RecHitTools to properly compute the position of the HGCAL Cells vie their DetIds
40 
41  for (unsigned int i = 0; i < qualityTests_.size(); ++i) {
42  qualityTests_.at(i)->beginEvent(iEvent, iSetup);
43  }
44 
46  iEvent.getByToken(recHitToken_, recHitHandle);
47  const HGCRecHitCollection& rechits = *recHitHandle;
48 
50  iSetup.get<CaloGeometryRecord>().get(geoHandle);
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  }
#define LogDebug(id)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
hgcal::RecHitTools recHitTools_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:70
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
const int keep
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
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
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.
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_

Member Data Documentation

template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
std::string PFHGCalRecHitCreator< DET, Layer, det, subdet >::geometryInstance_
protected
template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
edm::EDGetTokenT<HGCRecHitCollection> PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitToken_
protected
template<typename DET , PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
hgcal::RecHitTools PFHGCalRecHitCreator< DET, Layer, det, subdet >::recHitTools_
private