CMS 3D CMS Logo

PFHBHERecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreator_h
3 
5 
11 
17 
20 public:
22  : PFRecHitCreatorBase(iConfig, cc),
23  recHitToken_(cc.consumes<edm::SortedCollection<HBHERecHit> >(iConfig.getParameter<edm::InputTag>("src"))),
25 
26  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>& out,
27  std::unique_ptr<reco::PFRecHitCollection>& cleaned,
28  const edm::Event& iEvent,
29  const edm::EventSetup& iSetup) override {
30  beginEvent(iEvent, iSetup);
31 
33 
35 
36  // get the ecal geometry
37  const CaloSubdetectorGeometry* hcalBarrelGeo = geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalBarrel);
38  const CaloSubdetectorGeometry* hcalEndcapGeo = geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalEndcap);
39 
40  iEvent.getByToken(recHitToken_, recHitHandle);
41  for (const auto& erh : *recHitHandle) {
42  const HcalDetId detid = erh.idFront();
44 
45  auto energy = erh.energy();
46  auto time = erh.time();
47  auto depth = detid.depth();
48 
49  std::shared_ptr<const CaloCellGeometry> thisCell = nullptr;
51  switch (esd) {
52  case HcalBarrel:
53  thisCell = hcalBarrelGeo->getGeometry(detid);
55  break;
56 
57  case HcalEndcap:
58  thisCell = hcalEndcapGeo->getGeometry(detid);
60  break;
61  default:
62  break;
63  }
64 
65  // find rechit geometry
66  if (!thisCell) {
67  edm::LogError("PFHBHERecHitCreator") << "warning detid " << std::hex << detid.rawId() << std::dec << " "
68  << detid << " not found in geometry" << std::endl;
69  continue;
70  }
71 
72  reco::PFRecHit rh(thisCell, detid.rawId(), layer, energy);
73  rh.setTime(time); //Mike: This we will use later
74  rh.setDepth(depth);
75 
76  bool rcleaned = false;
77  bool keep = true;
78 
79  //Apply Q tests
80  for (const auto& qtest : qualityTests_) {
81  if (!qtest->test(rh, erh, rcleaned)) {
82  keep = false;
83  }
84  }
85 
86  if (keep) {
87  out->push_back(std::move(rh));
88  } else if (rcleaned)
89  cleaned->push_back(std::move(rh));
90  }
91  }
92 
93 protected:
95 
96 private:
98 };
99 
100 #endif
PFRecHitCreatorBase.h
CaloNavigator.h
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
PFHBHERecHitCreator::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: PFHBHERecHitCreator.h:26
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HBHERecHit
Definition: HBHERecHit.h:13
DetId::Hcal
Definition: DetId.h:28
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
PFLayer::HCAL_ENDCAP
Definition: PFLayer.h:37
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
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
PFRecHitCreatorBase
Definition: PFRecHitCreatorBase.h:23
HcalBarrel
Definition: HcalAssistant.h:33
edm::Handle
Definition: AssociativeIterator.h:50
HFRecHit.h
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
PFLayer::HCAL_BARREL1
Definition: PFLayer.h:35
edm::ESHandle< CaloGeometry >
PFHBHERecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFHBHERecHitCreator.h:97
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
CaloGeometryRecord.h
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
PFLayer::Layer
Layer
layer definition
Definition: PFLayer.h:29
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
HcalDetId
Definition: HcalDetId.h:12
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
HcalSubdetector.h
PFHBHERecHitCreator::PFHBHERecHitCreator
PFHBHERecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
Definition: PFHBHERecHitCreator.h:21
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cc
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
PFHBHERecHitCreator
Definition: PFHBHERecHitCreator.h:19
HBHERecHit.h
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalTopology.h
CaloCellGeometry.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
HcalEndcap
Definition: HcalAssistant.h:34
CaloGeometry.h
PFHBHERecHitCreator::recHitToken_
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_
Definition: PFHBHERecHitCreator.h:94
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
HcalRecHitCollections.h
HORecHit.h
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
reco::PFRecHit::setTime
void setTime(double time)
Definition: PFRecHit.h:73
edm::Event
Definition: Event.h:73
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
edm::ConsumesCollector
Definition: ConsumesCollector.h:45