CMS 3D CMS Logo

PFHcalRecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFHcalRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFHcalRecHitCreator_h
3 
5 
11 
18 
20 
21 template <typename Digi, typename Geometry, PFLayer::Layer Layer, int Detector>
23 public:
25  : PFRecHitCreatorBase(iConfig, cc),
26  recHitToken_(cc.consumes<edm::SortedCollection<Digi> >(iConfig.getParameter<edm::InputTag>("src"))),
29 
30  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>& out,
31  std::unique_ptr<reco::PFRecHitCollection>& cleaned,
32  const edm::Event& iEvent,
33  const edm::EventSetup& iSetup) override {
34  beginEvent(iEvent, iSetup);
35 
37 
39  edm::ESHandle<HcalTopology> hcalTopology = iSetup.getHandle(topoToken_);
40 
41  // get the hcal geometry and topology
43  const Geometry* hcalGeo = dynamic_cast<const Geometry*>(gTmp);
44  const HcalTopology* theHcalTopology = hcalTopology.product();
45 
46  iEvent.getByToken(recHitToken_, recHitHandle);
47  for (const auto& erh : *recHitHandle) {
48  HcalDetId detid = (HcalDetId)erh.detid();
50 
51  //since hbhe are together kill other detector
52  if (esd != Detector && Detector != HcalOther)
53  continue;
54 
55  if (theHcalTopology->getMergePositionFlag() && esd == HcalEndcap) {
56  detid = theHcalTopology->idFront(detid);
57  }
58 
59  auto energy = erh.energy();
60  auto time = erh.time();
61  auto depth = detid.depth();
62 
63  auto thisCell = hcalGeo->getGeometry(detid);
64 
65  // find rechit geometry
66  if (!thisCell) {
67  edm::LogError("PFHcalRecHitCreator")
68  << "warning detid " << detid.rawId() << " 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  int hoDepth_;
96 
97 private:
100 };
101 
107 
108 #endif
HcalOther
Definition: HcalAssistant.h:38
PFHORecHitCreator
PFHcalRecHitCreator< HORecHit, CaloSubdetectorGeometry, PFLayer::HCAL_BARREL2, HcalOuter > PFHORecHitCreator
Definition: PFHcalRecHitCreator.h:103
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFRecHitCreatorBase.h
CaloNavigator.h
HcalTopology::idFront
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: PFRecHitCreatorBase.h:43
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalTopology
Definition: HcalTopology.h:26
DetId::Hcal
Definition: DetId.h:28
PFHcalRecHitCreator::PFHcalRecHitCreator
PFHcalRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
Definition: PFHcalRecHitCreator.h:24
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
TrendClient_cfi.Digi
Digi
Definition: TrendClient_cfi.py:7
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
PFHcalRecHitCreator::hoDepth_
int hoDepth_
Definition: PFHcalRecHitCreator.h:95
protons_cff.time
time
Definition: protons_cff.py:35
HcalRecNumberingRecord.h
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
PFRecHitCreatorBase
Definition: PFRecHitCreatorBase.h:23
HcalTopology::getMergePositionFlag
bool getMergePositionFlag() const
Definition: HcalTopology.h:167
edm::Handle
Definition: AssociativeIterator.h:50
LayerTriplets::Layer
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
HFRecHit.h
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
PFHBRecHitCreator
PFHcalRecHitCreator< HBHERecHit, CaloSubdetectorGeometry, PFLayer::HCAL_BARREL1, HcalBarrel > PFHBRecHitCreator
Definition: PFHcalRecHitCreator.h:102
edm::ESHandle< CaloGeometry >
PFHFEMRecHitCreator
PFHcalRecHitCreator< HFRecHit, CaloSubdetectorGeometry, PFLayer::HF_EM, HcalForward > PFHFEMRecHitCreator
Definition: PFHcalRecHitCreator.h:105
PFHcalRecHitCreator::topoToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
Definition: PFHcalRecHitCreator.h:99
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
runTheMatrix.keep
keep
Definition: runTheMatrix.py:345
PFHFHADRecHitCreator
PFHcalRecHitCreator< HFRecHit, CaloSubdetectorGeometry, PFLayer::HF_HAD, HcalForward > PFHFHADRecHitCreator
Definition: PFHcalRecHitCreator.h:106
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
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
edm::EventSetup
Definition: EventSetup.h:58
HcalSubdetector.h
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cc
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
PFHcalRecHitCreator
Definition: PFHcalRecHitCreator.h:22
HBHERecHit.h
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
PFHERecHitCreator
PFHcalRecHitCreator< HBHERecHit, CaloSubdetectorGeometry, PFLayer::HCAL_ENDCAP, HcalEndcap > PFHERecHitCreator
Definition: PFHcalRecHitCreator.h:104
PFHcalRecHitCreator::recHitToken_
edm::EDGetTokenT< edm::SortedCollection< Digi > > recHitToken_
Definition: PFHcalRecHitCreator.h:94
PFHcalRecHitCreator::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: PFHcalRecHitCreator.h:30
align::Detector
Definition: StructureType.h:92
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
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
PFHcalRecHitCreator::geomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: PFHcalRecHitCreator.h:98
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
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
Geometry
Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See...
Definition: DMRtrends.cc:182