CMS 3D CMS Logo

PFHGCalRecHitCreator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFHGCalRecHitCreator_h
2 #define RecoParticleFlow_PFClusterProducer_PFHGCalRecHitCreator_h
3 
5 
9 
15 
22 
24 
25 template <typename DET, PFLayer::Layer Layer, DetId::Detector det, unsigned subdet>
27 public:
29  : PFRecHitCreatorBase(iConfig, iC) {
31  geometryInstance_ = iConfig.getParameter<std::string>("geometryInstance");
32  }
33 
34  void importRecHits(std::unique_ptr<reco::PFRecHitCollection>& out,
35  std::unique_ptr<reco::PFRecHitCollection>& cleaned,
36  const edm::Event& iEvent,
37  const edm::EventSetup& iSetup) override {
38  // Setup RecHitTools to properly compute the position of the HGCAL Cells vie their DetIds
40  iSetup.get<CaloGeometryRecord>().get(geoHandle);
41  recHitTools_.setGeometry(*geoHandle);
42 
43  for (unsigned int i = 0; i < qualityTests_.size(); ++i) {
44  qualityTests_.at(i)->beginEvent(iEvent, iSetup);
45  }
46 
48  iEvent.getByToken(recHitToken_, recHitHandle);
49  const HGCRecHitCollection& rechits = *recHitHandle;
50 
51  const CaloGeometry* geom = geoHandle.product();
52 
53  unsigned skipped_rechits = 0;
54  for (const auto& hgrh : rechits) {
55  const DET detid(hgrh.detid());
56 
57  if (det != detid.det() or (subdet != 0 and subdet != detid.subdetId())) {
58  throw cms::Exception("IncorrectHGCSubdetector")
59  << "det expected: " << det << " det gotten: " << detid.det() << " ; "
60  << "subdet expected: " << subdet << " subdet gotten: " << detid.subdetId() << std::endl;
61  }
62 
63  double energy = hgrh.energy();
64  double time = hgrh.time();
65 
66  auto thisCell = geom->getSubdetectorGeometry(det, subdet)->getGeometry(detid);
67 
68  // find rechit geometry
69  if (!thisCell) {
70  LogDebug("PFHGCalRecHitCreator") << "warning detid " << detid.rawId() << " not found in geometry" << std::endl;
71  ++skipped_rechits;
72  continue;
73  }
74 
75  reco::PFRecHit rh(thisCell, detid.rawId(), Layer, energy);
76 
77  bool rcleaned = false;
78  bool keep = true;
79 
80  //Apply Q tests
81  for (unsigned int i = 0; i < qualityTests_.size(); ++i) {
82  if (!qualityTests_.at(i)->test(rh, hgrh, rcleaned)) {
83  keep = false;
84  }
85  }
86 
87  if (keep) {
88  rh.setTime(time);
89  out->push_back(rh);
90  } else if (rcleaned)
91  cleaned->push_back(rh);
92  }
93  edm::LogInfo("HGCalRecHitCreator") << "Skipped " << skipped_rechits << " out of " << rechits.size() << " rechits!"
94  << std::endl;
95  edm::LogInfo("HGCalRecHitCreator") << "Created " << out->size() << " PFRecHits!" << std::endl;
96  }
97 
98 protected:
101 
102 private:
104 };
105 
110 
114 
119 
120 #endif
EcalPreshowerTopology.h
PFHGCalRecHitCreator
Definition: PFHGCalRecHitCreator.h:26
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFRecHitCreatorBase.h
PFHGCalHSiRecHitCreator
PFHGCalRecHitCreator< HGCSiliconDetId, PFLayer::HGCAL, DetId::HGCalHSi, ForwardEmpty > PFHGCalHSiRecHitCreator
Definition: PFHGCalRecHitCreator.h:116
hgcal::RecHitTools
Definition: RecHitTools.h:23
mps_fire.i
i
Definition: mps_fire.py:428
PFHGCalRecHitCreator::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: PFHGCalRecHitCreator.h:103
EcalBarrelGeometry.h
CaloNavigator.h
HGCScintillatorDetId.h
PFHGCHEBRecHitCreator
PFHGCalRecHitCreator< HcalDetId, PFLayer::HGCAL, DetId::Hcal, HcalEndcap > PFHGCHEBRecHitCreator
Definition: PFHGCalRecHitCreator.h:113
PFHGCalRecHitCreator::geometryInstance_
std::string geometryInstance_
Definition: PFHGCalRecHitCreator.h:100
edm::EDGetTokenT
Definition: EDGetToken.h:33
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
HGCSiliconDetId.h
EcalBarrelTopology.h
edm::SortedCollection
Definition: SortedCollection.h:49
PFHGCEERecHitCreator
PFHGCalRecHitCreator< HGCalDetId, PFLayer::HGCAL, DetId::Forward, HGCEE > PFHGCEERecHitCreator
Definition: PFHGCalRecHitCreator.h:111
PFRecHitCreatorBase
Definition: PFRecHitCreatorBase.h:23
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
HcalGeometry.h
LayerTriplets::Layer
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
CaloGeometry
Definition: CaloGeometry.h:21
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
PFHGCalRecHitCreator::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: PFHGCalRecHitCreator.h:34
TruncatedPyramid.h
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition: PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PFHGCHEFRecHitCreator
PFHGCalRecHitCreator< HGCalDetId, PFLayer::HGCAL, DetId::Forward, HGCHEF > PFHGCHEFRecHitCreator
Definition: PFHGCalRecHitCreator.h:112
PFHGCalHScRecHitCreator
PFHGCalRecHitCreator< HGCScintillatorDetId, PFLayer::HGCAL, DetId::HGCalHSc, ForwardEmpty > PFHGCalHScRecHitCreator
Definition: PFHGCalRecHitCreator.h:118
CaloSubdetectorGeometry.h
HGCRecHitCollections.h
HGCalGeometry.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
EcalEndcapGeometry.h
EcalEndcapTopology.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
PFHGCalRecHitCreator::PFHGCalRecHitCreator
PFHGCalRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition: PFHGCalRecHitCreator.h:28
get
#define get
CaloCellGeometry.h
HGCalDetId.h
DetId.h
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
Exception
Definition: hltDiff.cc:246
CaloGeometry.h
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFHGCalEERecHitCreator
PFHGCalRecHitCreator< HGCSiliconDetId, PFLayer::HGCAL, DetId::HGCalEE, ForwardEmpty > PFHGCalEERecHitCreator
Definition: PFHGCalRecHitCreator.h:115
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
ntuplemaker.time
time
Definition: ntuplemaker.py:310
edm::Event
Definition: Event.h:73
PFHGCalRecHitCreator::recHitToken_
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_
Definition: PFHGCalRecHitCreator.h:99
keep
const int keep
Definition: GenParticlePruner.cc:48
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
RecHitTools.h