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 36 of file PFHGCalRecHitCreator.h.

References 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.

36  {
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
60  << " det gotten: " << detid.det() << " ; "
61  << "subdet expected: " << subdet
62  << " subdet gotten: " << detid.subdetId() << std::endl;
63  }
64 
65  double energy = hgrh.energy();
66  double time = hgrh.time();
67 
68  auto thisCell = geom->getSubdetectorGeometry(det,subdet)->getGeometry(detid);
69 
70  // find rechit geometry
71  if(!thisCell) {
72  LogDebug("PFHGCalRecHitCreator")
73  <<"warning detid "<<detid.rawId()
74  <<" not found in geometry"<<std::endl;
75  ++skipped_rechits;
76  continue;
77  }
78 
79  reco::PFRecHit rh(thisCell, detid.rawId(),Layer,
80  energy);
81 
82  bool rcleaned = false;
83  bool keep=true;
84 
85  //Apply Q tests
86  for (unsigned int i=0;i<qualityTests_.size();++i) {
87  if (!qualityTests_.at(i)->test(rh,hgrh,rcleaned)) {
88  keep = false;
89  }
90  }
91 
92  if(keep) {
93  rh.setTime(time);
94  out->push_back(rh);
95  }
96  else if (rcleaned)
97  cleaned->push_back(rh);
98  }
99  edm::LogInfo("HGCalRecHitCreator")
100  << "Skipped " << skipped_rechits
101  << " out of " << rechits.size() << " rechits!" << std::endl;
102  edm::LogInfo("HGCalRecHitCreator")
103  << "Created " << out->size() << " PFRecHits!" << std::endl;
104  }
#define LogDebug(id)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
hgcal::RecHitTools recHitTools_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:73
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:32
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:68
T const * product() const
Definition: ESHandle.h:84
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