CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
PFEcalBarrelRecHitCreator Class Reference

#include <PFEcalBarrelRecHitCreator.h>

Inheritance diagram for PFEcalBarrelRecHitCreator:
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)
 
void init (const edm::EventSetup &es)
 
 PFEcalBarrelRecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
virtual ~PFRecHitCreatorBase ()=default
 

Protected Member Functions

bool isHighInterest (const EBDetId &detid)
 
EcalTrigTowerDetId readOutUnitOf (const EBDetId &detid) const
 
- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Protected Attributes

edm::EDGetTokenT< EcalRecHitCollectionrecHitToken_
 
edm::Handle< EBSrFlagCollectionsrFlagHandle_
 
edm::EDGetTokenT< EBSrFlagCollectionsrFlagToken_
 
const EcalTrigTowerConstituentsMaptriggerTowerMap_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
 

Detailed Description

Definition at line 28 of file PFEcalBarrelRecHitCreator.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file PFEcalBarrelRecHitCreator.h.

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

31  :
32  PFRecHitCreatorBase(iConfig,iC)
33  {
36  triggerTowerMap_ = 0;
37  }
edm::EDGetTokenT< EBSrFlagCollection > srFlagToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
const EcalTrigTowerConstituentsMap * triggerTowerMap_

Member Function Documentation

void PFEcalBarrelRecHitCreator::importRecHits ( std::unique_ptr< reco::PFRecHitCollection > &  out,
std::unique_ptr< reco::PFRecHitCollection > &  cleaned,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlinevirtual

Implements PFRecHitCreatorBase.

Definition at line 39 of file PFEcalBarrelRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), DetId::Ecal, PFLayer::ECAL_BARREL, EcalBarrel, Exception, edm::EventSetup::get(), edm::Event::getByToken(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), isHighInterest(), keep, eostools::move(), PFRecHitCreatorBase::qualityTests_, DetId::rawId(), recHitToken_, srFlagHandle_, srFlagToken_, and ntuplemaker::time.

39  {
40 
41  beginEvent(iEvent,iSetup);
42 
44 
46  iSetup.get<CaloGeometryRecord>().get(geoHandle);
47 
49 
50  // get the ecal geometry
51  const CaloSubdetectorGeometry *gTmp =
53 
54  const EcalBarrelGeometry *ecalGeo =dynamic_cast< const EcalBarrelGeometry* > (gTmp);
55 
56  iEvent.getByToken(recHitToken_,recHitHandle);
57  for(const auto& erh : *recHitHandle ) {
58  const DetId& detid = erh.detid();
59  auto energy = erh.energy();
60  auto time = erh.time();
61  bool hi = isHighInterest(detid);
62 
63  const CaloCellGeometry * thisCell= ecalGeo->getGeometry(detid);
64 
65  // find rechit geometry
66  if(!thisCell) {
67  throw cms::Exception("PFEcalBarrelRecHitCreator")
68  << "detid " << detid.rawId() << "not found in geometry";
69  }
70 
71  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_BARREL, energy);
72 
73  auto & rh = out->back();
74 
75  bool rcleaned = false;
76  bool keep=true;
77 
78  //Apply Q tests
79  for( const auto& qtest : qualityTests_ ) {
80  if (!qtest->test(rh,erh,rcleaned,hi)) {
81  keep = false;
82  }
83  }
84 
85  if(keep) {
86  rh.setTime(time);
87  rh.setDepth(1);
88  }
89  else {
90  if (rcleaned)
91  cleaned->push_back(std::move(out->back()));
92  out->pop_back();
93  }
94  }
95  }
edm::EDGetTokenT< EBSrFlagCollection > srFlagToken_
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
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const int keep
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: DetId.h:18
edm::Handle< EBSrFlagCollection > srFlagHandle_
const T & get() const
Definition: EventSetup.h:56
bool isHighInterest(const EBDetId &detid)
def move(src, dest)
Definition: eostools.py:510
void PFEcalBarrelRecHitCreator::init ( const edm::EventSetup es)
inlinevirtual

Reimplemented from PFRecHitCreatorBase.

Definition at line 97 of file PFEcalBarrelRecHitCreator.h.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and triggerTowerMap_.

97  {
98 
100  es.get<IdealGeometryRecord>().get(hTriggerTowerMap);
101  triggerTowerMap_ = hTriggerTowerMap.product();
102 
103  }
const T & get() const
Definition: EventSetup.h:56
const EcalTrigTowerConstituentsMap * triggerTowerMap_
T const * product() const
Definition: ESHandle.h:86
bool PFEcalBarrelRecHitCreator::isHighInterest ( const EBDetId detid)
inlineprotected

Definition at line 108 of file PFEcalBarrelRecHitCreator.h.

References readOutUnitOf(), mps_fire::result, EcalSrFlag::SRF_FULL, and srFlagHandle_.

Referenced by importRecHits().

108  {
109  bool result=false;
111  if(srf==srFlagHandle_->end()) return false;
112  else result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
113  return result;
114  }
std::vector< EBSrFlag >::const_iterator const_iterator
static const int SRF_FULL
Definition: EcalSrFlag.h:24
edm::Handle< EBSrFlagCollection > srFlagHandle_
EcalTrigTowerDetId readOutUnitOf(const EBDetId &detid) const
EcalTrigTowerDetId PFEcalBarrelRecHitCreator::readOutUnitOf ( const EBDetId detid) const
inlineprotected

Definition at line 116 of file PFEcalBarrelRecHitCreator.h.

References EcalTrigTowerConstituentsMap::towerOf(), and triggerTowerMap_.

Referenced by isHighInterest().

116  {
117  return triggerTowerMap_->towerOf(detid);
118  }
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
const EcalTrigTowerConstituentsMap * triggerTowerMap_

Member Data Documentation

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

Definition at line 120 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and PFEcalBarrelRecHitCreator().

edm::Handle<EBSrFlagCollection> PFEcalBarrelRecHitCreator::srFlagHandle_
protected

Definition at line 126 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

edm::EDGetTokenT<EBSrFlagCollection> PFEcalBarrelRecHitCreator::srFlagToken_
protected

Definition at line 121 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and PFEcalBarrelRecHitCreator().

const EcalTrigTowerConstituentsMap* PFEcalBarrelRecHitCreator::triggerTowerMap_
protected

Definition at line 124 of file PFEcalBarrelRecHitCreator.h.

Referenced by init(), PFEcalBarrelRecHitCreator(), and readOutUnitOf().