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

Member Data Documentation

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

Definition at line 105 of file PFPSRecHitCreator.h.

Referenced by importRecHits(), and PFPSRecHitCreator().