CMS 3D CMS Logo

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

#include <PFHGCalRecHitCreator.h>

Inheritance diagram for PFHGCalRecHitCreator< DET, Layer, 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, unsigned subdet>
class PFHGCalRecHitCreator< DET, Layer, subdet >

Definition at line 26 of file PFHGCalRecHitCreator.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Member Data Documentation

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