CMS 3D CMS Logo

PFEcalEndcapRecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFEcalEndcapRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFEcalEndcapRecHitCreator_h
3 
9 
13 
19 
29 
31 public:
33  : PFRecHitCreatorBase(iConfig, cc),
34  recHitToken_(cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("src"))),
35  elecMap_(nullptr),
37  mappingToken_(cc.esConsumes<edm::Transition::BeginLuminosityBlock>()) {
38  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
39  if (not srF.label().empty())
40  srFlagToken_ = cc.consumes<EESrFlagCollection>(srF);
41  }
42 
43  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>& out,
44  std::unique_ptr<reco::PFRecHitCollection>& cleaned,
45  const edm::Event& iEvent,
46  const edm::EventSetup& iSetup) override {
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  }
103 
104  void init(const edm::EventSetup& es) override { elecMap_ = &es.getData(mappingToken_); }
105 
106 protected:
107  bool isHighInterest(const EEDetId& detid) {
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  }
116 
117  EcalScDetId readOutUnitOf(const EEDetId& detid) const {
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  }
125 
128 
130 
131  // Ecal electronics/geometrical mapping
133  // selective readout flags collection
135 
136 private:
139 };
140 
141 #endif
EcalPreshowerTopology.h
PFRecHitCreatorBase.h
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
PFEcalEndcapRecHitCreator::srFlagToken_
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
Definition: PFEcalEndcapRecHitCreator.h:127
EcalBarrelGeometry.h
CaloNavigator.h
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
EcalEndcapGeometry
Definition: EcalEndcapGeometry.h:20
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
EcalElectronicsMapping::getEcalScDetId
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
Definition: EcalElectronicsMapping.cc:799
PFEcalEndcapRecHitCreator::init
void init(const edm::EventSetup &es) override
Definition: PFEcalEndcapRecHitCreator.h:104
EBDetId.h
EEDetId.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
EcalBarrelTopology.h
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 >
PFEcalEndcapRecHitCreator
Definition: PFEcalEndcapRecHitCreator.h:30
PFEcalEndcapRecHitCreator::PFEcalEndcapRecHitCreator
PFEcalEndcapRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
Definition: PFEcalEndcapRecHitCreator.h:32
PFRecHitCreatorBase
Definition: PFRecHitCreatorBase.h:23
EcalElectronicsId::dccId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
Definition: EcalElectronicsId.h:31
edm::Handle
Definition: AssociativeIterator.h:50
EcalRecHitCollections.h
EcalElectronicsId::towerId
int towerId() const
get the tower id
Definition: EcalElectronicsId.h:33
DetId
Definition: DetId.h:17
PFEcalEndcapRecHitCreator::srFlagHandle_
edm::Handle< EESrFlagCollection > srFlagHandle_
Definition: PFEcalEndcapRecHitCreator.h:134
TruncatedPyramid.h
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
EcalMappingRcd.h
EcalScDetId
Definition: EcalScDetId.h:24
EcalDigiCollections.h
PFEcalEndcapRecHitCreator::importRecHits
void importRecHits(std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PFEcalEndcapRecHitCreator.h:43
edm::ESHandle< CaloGeometry >
EcalElectronicsMapping::getElectronicsId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
Definition: EcalElectronicsMapping.cc:324
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
EcalRecHit.h
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
EEDetId
Definition: EEDetId.h:14
CaloGeometryRecord.h
EcalTrigTowerDetId.h
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
EcalTrigTowerConstituentsMap
Definition: EcalTrigTowerConstituentsMap.h:19
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
PFEcalEndcapRecHitCreator::elecMap_
const EcalElectronicsMapping * elecMap_
Definition: PFEcalEndcapRecHitCreator.h:132
EcalEndcapGeometry.h
EcalEndcapTopology.h
EcalSrFlag
Definition: EcalSrFlag.h:10
EcalElectronicsMapping.h
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
edm::EventSetup
Definition: EventSetup.h:58
DetId::Ecal
Definition: DetId.h:27
cc
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
hi
Definition: EPCuts.h:4
PFEcalEndcapRecHitCreator::mappingToken_
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
Definition: PFEcalEndcapRecHitCreator.h:138
CaloCellGeometry.h
EcalTrigTowerConstituentsMap.h
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
PFEcalEndcapRecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFEcalEndcapRecHitCreator.h:137
EcalSrFlag::SRF_FULL
static const int SRF_FULL
Definition: EcalSrFlag.h:24
PFEcalEndcapRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition: PFEcalEndcapRecHitCreator.h:126
Exception
Definition: hltDiff.cc:245
CaloGeometry.h
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFEcalEndcapRecHitCreator::isHighInterest
bool isHighInterest(const EEDetId &detid)
Definition: PFEcalEndcapRecHitCreator.h:107
PFEcalEndcapRecHitCreator::readOutUnitOf
EcalScDetId readOutUnitOf(const EEDetId &detid) const
Definition: PFEcalEndcapRecHitCreator.h:117
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
PFEcalEndcapRecHitCreator::eTTmap_
const EcalTrigTowerConstituentsMap * eTTmap_
Definition: PFEcalEndcapRecHitCreator.h:129
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45