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, iC) {
35  auto srF = iConfig.getParameter<edm::InputTag>("srFlags");
36  if (not srF.label().empty())
38  elecMap_ = nullptr;
39  }
40 
41  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>& out,
42  std::unique_ptr<reco::PFRecHitCollection>& cleaned,
43  const edm::Event& iEvent,
44  const edm::EventSetup& iSetup) override {
45  beginEvent(iEvent, iSetup);
46 
48 
50  iSetup.get<CaloGeometryRecord>().get(geoHandle);
51 
52  bool useSrF = false;
53  if (not srFlagToken_.isUninitialized()) {
54  iEvent.getByToken(srFlagToken_, srFlagHandle_);
55  useSrF = true;
56  }
57 
58  // get the ecal geometry
60 
61  const EcalEndcapGeometry* ecalGeo = dynamic_cast<const EcalEndcapGeometry*>(gTmp);
62 
63  iEvent.getByToken(recHitToken_, recHitHandle);
64  for (const auto& erh : *recHitHandle) {
65  const DetId& detid = erh.detid();
66  auto energy = erh.energy();
67  auto time = erh.time();
68 
69  bool hi = (useSrF ? isHighInterest(detid) : true);
70 
71  std::shared_ptr<const CaloCellGeometry> thisCell = ecalGeo->getGeometry(detid);
72 
73  // find rechit geometry
74  if (!thisCell) {
75  throw cms::Exception("PFEcalEndcapRecHitCreator") << "detid " << detid.rawId() << "not found in geometry";
76  }
77 
78  out->emplace_back(thisCell, detid.rawId(), PFLayer::ECAL_ENDCAP, energy);
79 
80  auto& rh = out->back();
81 
82  bool rcleaned = false;
83  bool keep = true;
84 
85  //Apply Q tests
86  for (const auto& qtest : qualityTests_) {
87  if (!qtest->test(rh, erh, rcleaned, hi)) {
88  keep = false;
89  }
90  }
91 
92  if (keep) {
93  rh.setTime(time);
94  rh.setDepth(1);
95  } else {
96  if (rcleaned)
97  cleaned->push_back(std::move(out->back()));
98  out->pop_back();
99  }
100  }
101  }
102 
103  void init(const edm::EventSetup& es) override {
105  es.get<EcalMappingRcd>().get(ecalmapping);
106  elecMap_ = ecalmapping.product();
107  }
108 
109 protected:
110  bool isHighInterest(const EEDetId& detid) {
111  bool result = false;
112  auto srf = srFlagHandle_->find(readOutUnitOf(detid));
113  if (srf == srFlagHandle_->end())
114  return false;
115  else
116  result = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL);
117  return result;
118  }
119 
120  EcalScDetId readOutUnitOf(const EEDetId& detid) const {
121  const EcalElectronicsId& EcalElecId = elecMap_->getElectronicsId(detid);
122  int iDCC = EcalElecId.dccId();
123  int iDccChan = EcalElecId.towerId();
124  const bool ignoreSingle = true;
125  const std::vector<EcalScDetId> id = elecMap_->getEcalScDetId(iDCC, iDccChan, ignoreSingle);
126  return !id.empty() ? id[0] : EcalScDetId();
127  }
128 
131 
133 
134  // Ecal electronics/geometrical mapping
136  // selective readout flags collection
138 };
139 
140 #endif
EcalPreshowerTopology.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFRecHitCreatorBase.h
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
PFEcalEndcapRecHitCreator::srFlagToken_
edm::EDGetTokenT< EESrFlagCollection > srFlagToken_
Definition: PFEcalEndcapRecHitCreator.h:130
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
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
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:103
EBDetId.h
EEDetId.h
EcalBarrelTopology.h
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 >
PFEcalEndcapRecHitCreator
Definition: PFEcalEndcapRecHitCreator.h:30
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:137
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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:41
edm::ESHandle< CaloGeometry >
EcalElectronicsMapping::getElectronicsId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
Definition: EcalElectronicsMapping.cc:324
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
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
PFEcalEndcapRecHitCreator::PFEcalEndcapRecHitCreator
PFEcalEndcapRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition: PFEcalEndcapRecHitCreator.h:32
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
EcalTrigTowerConstituentsMap
Definition: EcalTrigTowerConstituentsMap.h:19
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
PFEcalEndcapRecHitCreator::elecMap_
const EcalElectronicsMapping * elecMap_
Definition: PFEcalEndcapRecHitCreator.h:135
EcalEndcapGeometry.h
EcalEndcapTopology.h
EcalSrFlag
Definition: EcalSrFlag.h:10
EcalElectronicsMapping.h
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
edm::EventSetup
Definition: EventSetup.h:57
DetId::Ecal
Definition: DetId.h:27
get
#define get
EcalRecHit.h
hi
Definition: EPCuts.h:4
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
EcalMappingRcd
Definition: EcalMappingRcd.h:15
EcalSrFlag::SRF_FULL
static const int SRF_FULL
Definition: EcalSrFlag.h:24
PFEcalEndcapRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition: PFEcalEndcapRecHitCreator.h:129
Exception
Definition: hltDiff.cc:246
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:110
PFEcalEndcapRecHitCreator::readOutUnitOf
EcalScDetId readOutUnitOf(const EEDetId &detid) const
Definition: PFEcalEndcapRecHitCreator.h:120
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:132
ntuplemaker.time
time
Definition: ntuplemaker.py:310
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
edm::Event
Definition: Event.h:73
keep
const int keep
Definition: GenParticlePruner.cc:48
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45