CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
PFHcalRecHitCreator< Digi, Geometry, Layer, Detector > Class Template Referencefinal

#include <PFHcalRecHitCreator.h>

Inheritance diagram for PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >:
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
 
 PFHcalRecHitCreator (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

int hoDepth_
 
edm::EDGetTokenT< edm::SortedCollection< Digi > > recHitToken_
 
- 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 Digi, typename Geometry, PFLayer::Layer Layer, int Detector>
class PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >

Definition at line 22 of file PFHcalRecHitCreator.h.

Constructor & Destructor Documentation

template<typename Digi , typename Geometry , PFLayer::Layer Layer, int Detector>
PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::PFHcalRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 25 of file PFHcalRecHitCreator.h.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::recHitToken_.

25  :
26  PFRecHitCreatorBase(iConfig,iC)
27  {
29  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::SortedCollection< Digi > > recHitToken_

Member Function Documentation

template<typename Digi , typename Geometry , PFLayer::Layer Layer, int Detector>
void PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::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 31 of file PFHcalRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), particleFlowClusterECALTimeSelected_cfi::depth, HcalDetId::depth(), align::Detector, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalEndcap, HcalOther, HcalTopology::idFront(), keep, eostools::move(), edm::ESHandle< T >::product(), PFRecHitCreatorBase::qualityTests_, DetId::rawId(), PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::recHitToken_, reco::PFRecHit::setTime(), DetId::subdetId(), ntuplemaker::time, and HcalTopology::withSpecialRBXHBHE().

31  {
32 
33 
34  beginEvent(iEvent,iSetup);
35 
37 
39  iSetup.get<CaloGeometryRecord>().get(geoHandle);
40  edm::ESHandle<HcalTopology> hcalTopology;
41  iSetup.get<HcalRecNumberingRecord>().get( hcalTopology );
42 
43  // get the hcal geometry and topology
44  const CaloSubdetectorGeometry *gTmp =
46  const Geometry *hcalGeo =dynamic_cast< const Geometry* > (gTmp);
47  const HcalTopology *theHcalTopology = hcalTopology.product();
48 
49  iEvent.getByToken(recHitToken_,recHitHandle);
50  for( const auto& erh : *recHitHandle ) {
51  HcalDetId detid = (HcalDetId)erh.detid();
53 
54  //since hbhe are together kill other detector
55  if (esd !=Detector && Detector != HcalOther )
56  continue;
57 
58  if (theHcalTopology->withSpecialRBXHBHE() && esd == HcalEndcap) {
59  detid = theHcalTopology->idFront(detid);
60  }
61 
62  auto energy = erh.energy();
63  auto time = erh.time();
64  auto depth =detid.depth();
65 
66 
67  const CaloCellGeometry * thisCell= hcalGeo->getGeometry(detid);
68 
69  // find rechit geometry
70  if(!thisCell) {
71  edm::LogError("PFHcalRecHitCreator")
72  <<"warning detid "<<detid.rawId()
73  <<" not found in geometry"<<std::endl;
74  continue;
75  }
76 
77 
78  reco::PFRecHit rh(thisCell, detid.rawId(),Layer,
79  energy);
80  rh.setTime(time); //Mike: This we will use later
81  rh.setDepth(depth);
82 
83 
84  bool rcleaned = false;
85  bool keep=true;
86 
87  //Apply Q tests
88  for( const auto& qtest : qualityTests_ ) {
89  if (!qtest->test(rh,erh,rcleaned)) {
90  keep = false;
91 
92  }
93  }
94 
95  if(keep) {
96  out->push_back(std::move(rh));
97  }
98  else if (rcleaned)
99  cleaned->push_back(std::move(rh));
100  }
101  }
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
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const int keep
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
HcalSubdetector
Definition: HcalAssistant.h:31
edm::EDGetTokenT< edm::SortedCollection< Digi > > recHitToken_
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
void setTime(double time)
Definition: PFRecHit.h:79
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
const T & get() const
Definition: EventSetup.h:55
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
bool withSpecialRBXHBHE() const
Definition: HcalTopology.h:162
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename Digi , typename Geometry , PFLayer::Layer Layer, int Detector>
int PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::hoDepth_
protected

Definition at line 107 of file PFHcalRecHitCreator.h.

template<typename Digi , typename Geometry , PFLayer::Layer Layer, int Detector>
edm::EDGetTokenT<edm::SortedCollection<Digi> > PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::recHitToken_
protected