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) override
 
void init (const edm::EventSetup &es) override
 
 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::PFEcalBarrelRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 30 of file PFEcalBarrelRecHitCreator.h.

31  : PFRecHitCreatorBase(iConfig, iC) {
33  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
34  if (not srF.label().empty())
36  triggerTowerMap_ = nullptr;
37  }

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

Member Function Documentation

◆ importRecHits()

void PFEcalBarrelRecHitCreator::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 39 of file PFEcalBarrelRecHitCreator.h.

42  {
43  beginEvent(iEvent, iSetup);
44 
46 
48  iSetup.get<CaloGeometryRecord>().get(geoHandle);
49 
50  bool useSrF = false;
51  if (not srFlagToken_.isUninitialized()) {
52  iEvent.getByToken(srFlagToken_, srFlagHandle_);
53  useSrF = true;
54  }
55 
56  // get the ecal geometry
58 
59  const EcalBarrelGeometry* ecalGeo = dynamic_cast<const EcalBarrelGeometry*>(gTmp);
60 
61  iEvent.getByToken(recHitToken_, recHitHandle);
62  for (const auto& erh : *recHitHandle) {
63  const DetId& detid = erh.detid();
64  auto energy = erh.energy();
65  auto time = erh.time();
66  auto flags = erh.flagsBits();
67  bool hi = (useSrF ? isHighInterest(detid) : true);
68 
69  const auto thisCell = ecalGeo->getGeometry(detid);
70 
71  // find rechit geometry
72  if (!thisCell) {
73  throw cms::Exception("PFEcalBarrelRecHitCreator") << "detid " << detid.rawId() << "not found in geometry";
74  }
75 
76  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_BARREL, energy, flags);
77 
78  auto& rh = out->back();
79 
80  bool rcleaned = false;
81  bool keep = true;
82 
83  //Apply Q tests
84  for (const auto& qtest : qualityTests_) {
85  if (!qtest->test(rh, erh, rcleaned, hi)) {
86  keep = false;
87  }
88  }
89 
90  if (keep) {
91  rh.setTime(time);
92  rh.setDepth(1);
93  } else {
94  if (rcleaned)
95  cleaned->push_back(std::move(out->back()));
96  out->pop_back();
97  }
98  }
99  }

References PFRecHitCreatorBase::beginEvent(), DetId::Ecal, PFLayer::ECAL_BARREL, EcalBarrel, HCALHighEnergyHPDFilter_cfi::energy, Exception, HLT_2018_cff::flags, edm::EventSetup::get(), get, CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), iEvent, isHighInterest(), keep, eostools::move(), MillePedeFileConverter_cfg::out, PFRecHitCreatorBase::qualityTests_, DetId::rawId(), recHitToken_, srFlagHandle_, srFlagToken_, and ntuplemaker::time.

◆ init()

void PFEcalBarrelRecHitCreator::init ( const edm::EventSetup es)
inlineoverridevirtual

Reimplemented from PFRecHitCreatorBase.

Definition at line 101 of file PFEcalBarrelRecHitCreator.h.

101  {
103  es.get<IdealGeometryRecord>().get(hTriggerTowerMap);
104  triggerTowerMap_ = hTriggerTowerMap.product();
105  }

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

◆ isHighInterest()

bool PFEcalBarrelRecHitCreator::isHighInterest ( const EBDetId detid)
inlineprotected

Definition at line 108 of file PFEcalBarrelRecHitCreator.h.

108  {
109  bool result = false;
110  auto srf = srFlagHandle_->find(readOutUnitOf(detid));
111  if (srf == srFlagHandle_->end())
112  return false;
113  else
114  result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
115  return result;
116  }

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

Referenced by importRecHits().

◆ readOutUnitOf()

EcalTrigTowerDetId PFEcalBarrelRecHitCreator::readOutUnitOf ( const EBDetId detid) const
inlineprotected

Definition at line 118 of file PFEcalBarrelRecHitCreator.h.

118 { return triggerTowerMap_->towerOf(detid); }

References EcalTrigTowerConstituentsMap::towerOf(), and triggerTowerMap_.

Referenced by isHighInterest().

Member Data Documentation

◆ recHitToken_

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

Definition at line 120 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and PFEcalBarrelRecHitCreator().

◆ srFlagHandle_

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

Definition at line 126 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

◆ srFlagToken_

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

Definition at line 121 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and PFEcalBarrelRecHitCreator().

◆ triggerTowerMap_

const EcalTrigTowerConstituentsMap* PFEcalBarrelRecHitCreator::triggerTowerMap_
protected

Definition at line 124 of file PFEcalBarrelRecHitCreator.h.

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

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFEcalBarrelRecHitCreator::srFlagToken_
edm::EDGetTokenT< EBSrFlagCollection > srFlagToken_
Definition: PFEcalBarrelRecHitCreator.h:121
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::SortedCollection< EcalRecHit >
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
PFLayer::ECAL_BARREL
Definition: PFLayer.h:33
PFRecHitCreatorBase::PFRecHitCreatorBase
PFRecHitCreatorBase()
Definition: PFRecHitCreatorBase.h:25
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
PFEcalBarrelRecHitCreator::isHighInterest
bool isHighInterest(const EBDetId &detid)
Definition: PFEcalBarrelRecHitCreator.h:108
PFEcalBarrelRecHitCreator::triggerTowerMap_
const EcalTrigTowerConstituentsMap * triggerTowerMap_
Definition: PFEcalBarrelRecHitCreator.h:124
funct::true
true
Definition: Factorize.h:173
EcalBarrelGeometry
Definition: EcalBarrelGeometry.h:19
EcalSrFlag
Definition: EcalSrFlag.h:10
iEvent
int iEvent
Definition: GenABIO.cc:224
CaloSubdetectorGeometry::getGeometry
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.
Definition: CaloSubdetectorGeometry.cc:36
DetId::Ecal
Definition: DetId.h:27
get
#define get
EcalTrigTowerConstituentsMap::towerOf
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
Definition: EcalTrigTowerConstituentsMap.cc:11
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
hi
Definition: HiEvtPlaneList.h:38
PFEcalBarrelRecHitCreator::readOutUnitOf
EcalTrigTowerDetId readOutUnitOf(const EBDetId &detid) const
Definition: PFEcalBarrelRecHitCreator.h:118
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalSrFlag::SRF_FULL
static const int SRF_FULL
Definition: EcalSrFlag.h:24
Exception
Definition: hltDiff.cc:246
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
PFEcalBarrelRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition: PFEcalBarrelRecHitCreator.h:120
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:303
PFEcalBarrelRecHitCreator::srFlagHandle_
edm::Handle< EBSrFlagCollection > srFlagHandle_
Definition: PFEcalBarrelRecHitCreator.h:126
ntuplemaker.time
time
Definition: ntuplemaker.py:310
keep
const int keep
Definition: GenParticlePruner.cc:48
HLT_2018_cff.flags
flags
Definition: HLT_2018_cff.py:11758
edm::InputTag
Definition: InputTag.h:15
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27