CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 edm::ConsumesCollector::consumes(), 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())
41  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
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(), DetId::Ecal, PFLayer::ECAL_ENDCAP, EcalEndcap, HCALHighEnergyHPDFilter_cfi::energy, Exception, 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.

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  std::shared_ptr<const CaloCellGeometry> thisCell = ecalGeo->getGeometry(detid);
73 
74  // find rechit geometry
75  if (!thisCell) {
76  throw cms::Exception("PFEcalEndcapRecHitCreator") << "detid " << detid.rawId() << "not found in geometry";
77  }
78 
79  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_ENDCAP, energy);
80 
81  auto& rh = out->back();
82 
83  bool rcleaned = false;
84  bool keep = true;
85 
86  //Apply Q tests
87  for (const auto& qtest : qualityTests_) {
88  if (!qtest->test(rh, erh, rcleaned, hi)) {
89  keep = false;
90  }
91  }
92 
93  if (keep) {
94  rh.setTime(time);
95  rh.setDepth(1);
96  } else {
97  if (rcleaned)
98  cleaned->push_back(std::move(out->back()));
99  out->pop_back();
100  }
101  }
102  }
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:151
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: DetId.h:17
edm::Handle< EESrFlagCollection > srFlagHandle_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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 104 of file PFEcalEndcapRecHitCreator.h.

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

104 { elecMap_ = &es.getData(mappingToken_); }
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
const EcalElectronicsMapping * elecMap_

◆ isHighInterest()

bool PFEcalEndcapRecHitCreator::isHighInterest ( const EEDetId detid)
inlineprotected

Definition at line 107 of file PFEcalEndcapRecHitCreator.h.

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

Referenced by importRecHits().

107  {
108  bool result = false;
109  auto srf = srFlagHandle_->find(readOutUnitOf(detid));
110  if (srf == srFlagHandle_->end())
111  return false;
112  else
113  result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
114  return result;
115  }
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 117 of file PFEcalEndcapRecHitCreator.h.

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

Referenced by isHighInterest().

117  {
118  const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(detid);
119  int iDCC = EcalElecId.dccId();
120  int iDccChan = EcalElecId.towerId();
121  const bool ignoreSingle = true;
122  const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
123  return !id.empty() ? id[0] : EcalScDetId();
124  }
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 132 of file PFEcalEndcapRecHitCreator.h.

Referenced by init(), and readOutUnitOf().

◆ eTTmap_

const EcalTrigTowerConstituentsMap* PFEcalEndcapRecHitCreator::eTTmap_
protected

Definition at line 129 of file PFEcalEndcapRecHitCreator.h.

◆ geomToken_

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

Definition at line 137 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits().

◆ mappingToken_

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

Definition at line 138 of file PFEcalEndcapRecHitCreator.h.

Referenced by init().

◆ recHitToken_

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

Definition at line 126 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits().

◆ srFlagHandle_

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

Definition at line 134 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and isHighInterest().

◆ srFlagToken_

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

Definition at line 127 of file PFEcalEndcapRecHitCreator.h.

Referenced by importRecHits(), and PFEcalEndcapRecHitCreator().