CMS 3D CMS Logo

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

#include <PFEcalEndcapRecHitCreator.h>

Inheritance diagram for PFEcalEndcapRecHitCreator:
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
 
 PFEcalEndcapRecHitCreator (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 EEDetId &detid)
 
EcalScDetId readOutUnitOf (const EEDetId &detid) const
 
- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Protected Attributes

const EcalElectronicsMappingelecMap_
 
const EcalTrigTowerConstituentsMapeTTmap_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitToken_
 
edm::Handle< EESrFlagCollectionsrFlagHandle_
 
edm::EDGetTokenT< EESrFlagCollectionsrFlagToken_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdmappingToken_
 

Detailed Description

Definition at line 30 of file PFEcalEndcapRecHitCreator.h.

Constructor & Destructor Documentation

◆ PFEcalEndcapRecHitCreator()

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

Definition at line 32 of file PFEcalEndcapRecHitCreator.h.

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

33  : PFRecHitCreatorBase(iConfig, cc),
35  elecMap_(nullptr),
36  geomToken_(cc.esConsumes()),
38  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
39  if (not srF.label().empty())
40  srFlagToken_ = cc.consumes<EESrFlagCollection>(srF);
41  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
const EcalElectronicsMapping * elecMap_

Member Function Documentation

◆ importRecHits()

void PFEcalEndcapRecHitCreator::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 43 of file PFEcalEndcapRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), ALCARECOPPSCalTrackBasedSel_cff::detid, DetId::Ecal, PFLayer::ECAL_ENDCAP, EcalEndcap, HBHEDarkening_cff::energy, Exception, geomToken_, CaloSubdetectorGeometry::getGeometry(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), iEvent, isHighInterest(), runTheMatrix::keep, eostools::move(), MillePedeFileConverter_cfg::out, PFRecHitCreatorBase::qualityTests_, recHitToken_, srFlagHandle_, srFlagToken_, and hcalRecHitTable_cff::time.

46  {
47  beginEvent(iEvent, iSetup);
48 
50 
52 
53  bool useSrF = false;
54  if (not srFlagToken_.isUninitialized()) {
55  iEvent.getByToken(srFlagToken_, srFlagHandle_);
56  useSrF = true;
57  }
58 
59  // get the ecal geometry
61 
62  const EcalEndcapGeometry* ecalGeo = dynamic_cast<const EcalEndcapGeometry*>(gTmp);
63 
64  iEvent.getByToken(recHitToken_, recHitHandle);
65  for (const auto& erh : *recHitHandle) {
66  const DetId& detid = erh.detid();
67  auto energy = erh.energy();
68  auto time = erh.time();
69 
70  bool hi = (useSrF ? isHighInterest(detid) : true);
71 
72  {
73  auto thisCell = ecalGeo->getGeometry(detid);
74 
75  // find rechit geometry
76  if (!thisCell) {
77  throw cms::Exception("PFEcalEndcapRecHitCreator") << "detid " << detid.rawId() << "not found in geometry";
78  }
79 
80  out->emplace_back(std::move(thisCell), detid.rawId(), PFLayer::ECAL_ENDCAP, energy);
81  }
82  auto& rh = out->back();
83 
84  bool rcleaned = false;
85  bool keep = true;
86 
87  //Apply Q tests
88  for (const auto& qtest : qualityTests_) {
89  if (!qtest->test(rh, erh, rcleaned, hi)) {
90  keep = false;
91  }
92  }
93 
94  if (keep) {
95  rh.setTime(time);
96  rh.setDepth(1);
97  } else {
98  if (rcleaned)
99  cleaned->push_back(std::move(out->back()));
100  out->pop_back();
101  }
102  }
103  }
virtual CellMayOwnPtr getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
bool isHighInterest(const EEDetId &detid)
int iEvent
Definition: GenABIO.cc:224
Definition: EPCuts.h:4
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Definition: DetId.h:17
edm::Handle< EESrFlagCollection > srFlagHandle_
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511

◆ init()

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

Reimplemented from PFRecHitCreatorBase.

Definition at line 105 of file PFEcalEndcapRecHitCreator.h.

References elecMap_, edm::EventSetup::getData(), and mappingToken_.

105 { elecMap_ = &es.getData(mappingToken_); }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
const EcalElectronicsMapping * elecMap_

◆ isHighInterest()

bool PFEcalEndcapRecHitCreator::isHighInterest ( const EEDetId detid)
inlineprotected

Definition at line 108 of file PFEcalEndcapRecHitCreator.h.

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

Referenced by importRecHits().

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  }
static const int SRF_FULL
Definition: EcalSrFlag.h:24
EcalScDetId readOutUnitOf(const EEDetId &detid) const
edm::Handle< EESrFlagCollection > srFlagHandle_

◆ readOutUnitOf()

EcalScDetId PFEcalEndcapRecHitCreator::readOutUnitOf ( const EEDetId detid) const
inlineprotected

Definition at line 118 of file PFEcalEndcapRecHitCreator.h.

References EcalElectronicsId::dccId(), ALCARECOPPSCalTrackBasedSel_cff::detid, elecMap_, EcalElectronicsMapping::getEcalScDetId(), EcalElectronicsMapping::getElectronicsId(), and EcalElectronicsId::towerId().

Referenced by isHighInterest().

118  {
119  const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(detid);
120  int iDCC = EcalElecId.dccId();
121  int iDccChan = EcalElecId.towerId();
122  const bool ignoreSingle = true;
123  const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
124  return !id.empty() ? id[0] : EcalScDetId();
125  }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int towerId() const
get the tower id
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
const EcalElectronicsMapping * elecMap_

Member Data Documentation

◆ elecMap_

const EcalElectronicsMapping* PFEcalEndcapRecHitCreator::elecMap_
protected

Definition at line 133 of file PFEcalEndcapRecHitCreator.h.

Referenced by init(), and readOutUnitOf().

◆ eTTmap_

const EcalTrigTowerConstituentsMap* PFEcalEndcapRecHitCreator::eTTmap_
protected

Definition at line 130 of file PFEcalEndcapRecHitCreator.h.

◆ geomToken_

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

Definition at line 138 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits().

◆ mappingToken_

edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> PFEcalEndcapRecHitCreator::mappingToken_
private

Definition at line 139 of file PFEcalEndcapRecHitCreator.h.

Referenced by init().

◆ recHitToken_

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

Definition at line 127 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits().

◆ srFlagHandle_

edm::Handle<EESrFlagCollection> PFEcalEndcapRecHitCreator::srFlagHandle_
protected

Definition at line 135 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

◆ srFlagToken_

edm::EDGetTokenT<EESrFlagCollection> PFEcalEndcapRecHitCreator::srFlagToken_
protected

Definition at line 128 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and PFEcalEndcapRecHitCreator().