CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
PFPSRecHitCreator Class Referencefinal

#include <PFPSRecHitCreator.h>

Inheritance diagram for PFPSRecHitCreator:
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
 
 PFPSRecHitCreator (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

edm::EDGetTokenT< EcalRecHitCollectionrecHitToken_
 
- 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

Definition at line 27 of file PFPSRecHitCreator.h.

Constructor & Destructor Documentation

PFPSRecHitCreator::PFPSRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 30 of file PFPSRecHitCreator.h.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and recHitToken_.

30  :
31  PFRecHitCreatorBase(iConfig,iC)
32  {
34  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_

Member Function Documentation

void PFPSRecHitCreator::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 PFPSRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), DetId::Ecal, EcalPreshower, Exception, edm::EventSetup::get(), edm::Event::getByToken(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), keep, eostools::move(), PFLayer::NONE, PFLayer::PS1, PFLayer::PS2, PFRecHitCreatorBase::qualityTests_, and recHitToken_.

36  {
37 
38  beginEvent(iEvent,iSetup);
39 
42  iSetup.get<CaloGeometryRecord>().get(geoHandle);
43 
44  // get the ecal geometry
45  const CaloSubdetectorGeometry *psGeometry =
47 
48  iEvent.getByToken(recHitToken_,recHitHandle);
49  for( const auto& erh : *recHitHandle ) {
50  ESDetId detid(erh.detid());
51  auto energy = erh.energy();
52 
54 
55  switch( detid.plane() ) {
56  case 1:
57  layer = PFLayer::PS1;
58  break;
59  case 2:
60  layer = PFLayer::PS2;
61  break;
62  default:
63  throw cms::Exception("PFRecHitBadInput")
64  <<"incorrect preshower plane !! plane number "
65  <<detid.plane()<<std::endl;
66  }
67 
68 
69 
70  const CaloCellGeometry * thisCell= psGeometry->getGeometry(detid);
71 
72  // find rechit geometry
73  if(!thisCell) {
74  edm::LogError("PFPSRecHitCreator")
75  <<"warning detid "<<detid.rawId()
76  <<" not found in geometry"<<std::endl;
77  continue;
78  }
79 
80  out->emplace_back(thisCell, detid.rawId(),layer,energy);
81  auto & rh = out->back();
82  rh.setDepth(detid.plane());
83  rh.setTime(erh.time());
84 
85  bool rcleaned = false;
86  bool keep=true;
87  bool hi = true; // all ES rhs are produced, independently on the ECAL SRP decision
88 
89  //Apply Q tests
90  for( const auto& qtest : qualityTests_ ) {
91  if (!qtest->test(rh,erh,rcleaned,hi)) {
92  keep = false;
93  }
94  }
95 
96  if (rcleaned)
97  cleaned->push_back(std::move(out->back()));
98  if(!keep)
99  out->pop_back();
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:508
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const int keep
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Layer
layer definition
Definition: PFLayer.h:31
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> PFPSRecHitCreator::recHitToken_
protected

Definition at line 106 of file PFPSRecHitCreator.h.

Referenced by importRecHits(), and PFPSRecHitCreator().