CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private 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 &cc)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
 
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_
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordtowerToken_
 

Detailed Description

Definition at line 28 of file PFEcalBarrelRecHitCreator.h.

Constructor & Destructor Documentation

◆ PFEcalBarrelRecHitCreator()

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

Definition at line 30 of file PFEcalBarrelRecHitCreator.h.

31  : PFRecHitCreatorBase(iConfig, cc),
33  triggerTowerMap_(nullptr),
34  geomToken_(cc.esConsumes()),
36  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
37  if (not srF.label().empty())
38  srFlagToken_ = cc.consumes<EBSrFlagCollection>(srF);
39  }

References edm::ParameterSet::getParameter(), and srFlagToken_.

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 41 of file PFEcalBarrelRecHitCreator.h.

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

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

◆ init()

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

Reimplemented from PFRecHitCreatorBase.

Definition at line 102 of file PFEcalBarrelRecHitCreator.h.

References edm::EventSetup::getData(), towerToken_, and triggerTowerMap_.

◆ isHighInterest()

bool PFEcalBarrelRecHitCreator::isHighInterest ( const EBDetId detid)
inlineprotected

Definition at line 105 of file PFEcalBarrelRecHitCreator.h.

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

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 115 of file PFEcalBarrelRecHitCreator.h.

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

References EcalTrigTowerConstituentsMap::towerOf(), and triggerTowerMap_.

Referenced by isHighInterest().

Member Data Documentation

◆ geomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> PFEcalBarrelRecHitCreator::geomToken_
private

Definition at line 126 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits().

◆ recHitToken_

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

Definition at line 117 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits().

◆ srFlagHandle_

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

Definition at line 123 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

◆ srFlagToken_

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

Definition at line 118 of file PFEcalBarrelRecHitCreator.h.

Referenced by importRecHits(), and PFEcalBarrelRecHitCreator().

◆ towerToken_

edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> PFEcalBarrelRecHitCreator::towerToken_
private

Definition at line 127 of file PFEcalBarrelRecHitCreator.h.

Referenced by init().

◆ triggerTowerMap_

const EcalTrigTowerConstituentsMap* PFEcalBarrelRecHitCreator::triggerTowerMap_
protected

Definition at line 121 of file PFEcalBarrelRecHitCreator.h.

Referenced by init(), and readOutUnitOf().

PFEcalBarrelRecHitCreator::srFlagToken_
edm::EDGetTokenT< EBSrFlagCollection > srFlagToken_
Definition: PFEcalBarrelRecHitCreator.h:118
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
protons_cff.time
time
Definition: protons_cff.py:35
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
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
edm::Transition::BeginLuminosityBlock
PFEcalBarrelRecHitCreator::isHighInterest
bool isHighInterest(const EBDetId &detid)
Definition: PFEcalBarrelRecHitCreator.h:105
PFEcalBarrelRecHitCreator::triggerTowerMap_
const EcalTrigTowerConstituentsMap * triggerTowerMap_
Definition: PFEcalBarrelRecHitCreator.h:121
funct::true
true
Definition: Factorize.h:173
EcalBarrelGeometry
Definition: EcalBarrelGeometry.h:19
PFEcalBarrelRecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFEcalBarrelRecHitCreator.h:126
EcalSrFlag
Definition: EcalSrFlag.h:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
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
cc
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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
hi
Definition: EPCuts.h:4
PFEcalBarrelRecHitCreator::readOutUnitOf
EcalTrigTowerDetId readOutUnitOf(const EBDetId &detid) const
Definition: PFEcalBarrelRecHitCreator.h:115
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
PFEcalBarrelRecHitCreator::towerToken_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > towerToken_
Definition: PFEcalBarrelRecHitCreator.h:127
EcalSrFlag::SRF_FULL
static const int SRF_FULL
Definition: EcalSrFlag.h:24
Exception
Definition: hltDiff.cc:245
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFEcalBarrelRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition: PFEcalBarrelRecHitCreator.h:117
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
PFEcalBarrelRecHitCreator::srFlagHandle_
edm::Handle< EBSrFlagCollection > srFlagHandle_
Definition: PFEcalBarrelRecHitCreator.h:123
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13168
edm::InputTag
Definition: InputTag.h:15