CMS 3D CMS Logo

List of all members | Public Member Functions | Protected 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_
 

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

References Exception, relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByToken(), ecaldqm::getGeometry(), CaloGeometry::getSubdetectorGeometry(), mps_fire::i, keep, LogDebug, edm::ESHandle< T >::product(), PFRecHitCreatorBase::qualityTests_, TrackInfoProducer_cfi::rechits, PFHGCalRecHitCreator< DET, Layer, subdet >::recHitToken_, and ntuplemaker::time.

34  {
35 
36  for (unsigned int i=0;i<qualityTests_.size();++i) {
37  qualityTests_.at(i)->beginEvent(iEvent,iSetup);
38  }
39 
41  iEvent.getByToken(recHitToken_,recHitHandle);
42  const HGCRecHitCollection& rechits = *recHitHandle;
43 
45  iSetup.get<CaloGeometryRecord>().get(geoHandle);
46  const CaloGeometry* geom = geoHandle.product();
47 
48  unsigned skipped_rechits = 0;
49  for (const auto & hgrh : rechits) {
50  const DET detid(hgrh.detid());
51 
52  if( subdet != detid.subdetId() ) {
53  throw cms::Exception("IncorrectHGCSubdetector")
54  << "subdet expected: " << subdet
55  << " subdet gotten: " << detid.subdetId() << std::endl;
56  }
57 
58  double energy = hgrh.energy();
59  double time = hgrh.time();
60 
61  const CaloCellGeometry *thisCell = geom->getSubdetectorGeometry(detid.det(),detid.subdetId())->getGeometry(detid);
62 
63  // find rechit geometry
64  if(!thisCell) {
65  LogDebug("PFHGCalRecHitCreator")
66  <<"warning detid "<<detid.rawId()
67  <<" not found in geometry"<<std::endl;
68  ++skipped_rechits;
69  continue;
70  }
71 
72 
73  reco::PFRecHit rh(thisCell, detid.rawId(),Layer,
74  energy);
75 
76  // rh.setOriginalRecHit(edm::Ref<HGCRecHitCollection>(recHitHandle,i));
77 
78 
79  bool rcleaned = false;
80  bool keep=true;
81 
82  //Apply Q tests
83  for (unsigned int i=0;i<qualityTests_.size();++i) {
84  if (!qualityTests_.at(i)->test(rh,hgrh,rcleaned)) {
85  keep = false;
86  }
87  }
88 
89  if(keep) {
90  rh.setTime(time);
91  out->push_back(rh);
92  }
93  else if (rcleaned)
94  cleaned->push_back(rh);
95  }
96  edm::LogInfo("HGCalRecHitCreator")
97  << "Skipped " << skipped_rechits
98  << " out of " << rechits.size() << " rechits!" << std::endl;
99  edm::LogInfo("HGCalRecHitCreator")
100  << "Created " << out->size() << " PFRecHits!" << std::endl;
101  }
#define LogDebug(id)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
CaloGeometry const * getGeometry()
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
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_
const T & get() const
Definition: EventSetup.h:56
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