CMS 3D CMS Logo

HcalHBHEMuonHighEtaAnalyzer.cc
Go to the documentation of this file.
1 #include <fstream>
2 #include <vector>
3 #include <TTree.h>
4 
5 // user include files
15 
26 
28 
38 
41 
44 
48 
52 
69 
70 //#define EDM_ML_DEBUG
71 
72 class HcalHBHEMuonHighEtaAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
73 public:
75 
76  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
77 
78 private:
79  void beginJob() override;
80  void analyze(edm::Event const&, edm::EventSetup const&) override;
81  void beginRun(edm::Run const&, edm::EventSetup const&) override;
82  void endRun(edm::Run const&, edm::EventSetup const&) override {}
83 
84  bool analyzeMuon(edm::Event const&, math::XYZPoint&);
86  bool analyzeTracks(const reco::Track*, math::XYZPoint&, int, std::vector<spr::propagatedTrackID>&, bool);
87  void clearVectors();
88  int matchId(const HcalDetId&, const HcalDetId&);
89  double activeLength(const DetId&);
90  bool isGoodVertex(const reco::Vertex&);
91  double respCorr(const DetId&);
92  double gainFactor(const HcalDbService*, const HcalDetId&);
93  int depth16HE(int, int);
94  bool goodCell(const HcalDetId&, const reco::Track*, const CaloGeometry*, const MagneticField*);
96 
97  // ----------member data ---------------------------
100  const double etaMin_, emaxNearPThr_;
102  const int useRaw_, verbosity_;
105  const int maxDepth_;
106 
113 
123 
125  int kount_;
127 
137 
141 
143  static const int depthMax_ = 7;
144  TTree* tree_;
146  std::vector<bool> mediumMuon_;
147  std::vector<double> ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_;
148  std::vector<double> isolationR04_, isolationR03_;
149  std::vector<double> ecalEnergy_, hcalEnergy_, hoEnergy_;
150  std::vector<bool> matchedId_, hcalHot_;
151  std::vector<double> ecal3x3Energy_, hcal1x1Energy_;
152  std::vector<unsigned int> ecalDetId_, hcalDetId_, ehcalDetId_;
153  std::vector<int> hcal_ieta_, hcal_iphi_;
154  std::vector<double> hcalDepthEnergy_[depthMax_];
155  std::vector<double> hcalDepthActiveLength_[depthMax_];
156  std::vector<double> hcalDepthEnergyHot_[depthMax_];
157  std::vector<double> hcalDepthActiveLengthHot_[depthMax_];
158  std::vector<double> hcalDepthChargeHot_[depthMax_];
159  std::vector<double> hcalDepthChargeHotBG_[depthMax_];
160  std::vector<double> hcalDepthEnergyCorr_[depthMax_];
161  std::vector<double> hcalDepthEnergyHotCorr_[depthMax_];
162  std::vector<bool> hcalDepthMatch_[depthMax_];
163  std::vector<bool> hcalDepthMatchHot_[depthMax_];
165  std::vector<double> emaxNearP_, trackDz_;
168 
169  std::vector<HcalDDDRecConstants::HcalActiveLength> actHB, actHE;
170  std::map<DetId, double> corrValue_;
172 };
173 
175  : labelEBRecHit_(iConfig.getParameter<edm::InputTag>("labelEBRecHit")),
176  labelEERecHit_(iConfig.getParameter<edm::InputTag>("labelEERecHit")),
177  labelHBHERecHit_(iConfig.getParameter<edm::InputTag>("labelHBHERecHit")),
178  labelVtx_(iConfig.getParameter<std::string>("labelVertex")),
179  labelMuon_(iConfig.getParameter<std::string>("labelMuon")),
180  labelGenTrack_(iConfig.getParameter<std::string>("labelTrack")),
181  etaMin_(iConfig.getParameter<double>("etaMin")),
182  emaxNearPThr_(iConfig.getParameter<double>("emaxNearPThreshold")),
183  analyzeMuon_(iConfig.getParameter<bool>("analyzeMuon")),
184  unCorrect_(iConfig.getParameter<bool>("unCorrect")),
185  collapseDepth_(iConfig.getParameter<bool>("collapseDepth")),
186  isItPlan1_(iConfig.getParameter<bool>("isItPlan1")),
187  getCharge_(iConfig.getParameter<bool>("getCharge")),
188  useRaw_(iConfig.getParameter<int>("useRaw")),
189  verbosity_(iConfig.getParameter<int>("verbosity")),
190  theTrackQuality_(iConfig.getUntrackedParameter<std::string>("trackQuality")),
191  fileInCorr_(iConfig.getUntrackedParameter<std::string>("fileInCorr", "")),
192  ignoreHECorr_(iConfig.getUntrackedParameter<bool>("ignoreHECorr", false)),
193  isItPreRecHit_(iConfig.getUntrackedParameter<bool>("isItPreRecHit", false)),
194  writeRespCorr_(iConfig.getUntrackedParameter<bool>("writeRespCorr", false)),
195  maxDepth_(iConfig.getUntrackedParameter<int>("maxDepth", 7)),
196  tok_Vtx_(consumes<reco::VertexCollection>(labelVtx_)),
197  tok_EB_(consumes<EcalRecHitCollection>(labelEBRecHit_)),
198  tok_EE_(consumes<EcalRecHitCollection>(labelEERecHit_)),
199  tok_HBHE_(consumes<HBHERecHitCollection>(labelHBHERecHit_)),
200  tok_Muon_(consumes<reco::MuonCollection>(labelMuon_)),
201  tok_genTrack_(consumes<reco::TrackCollection>(labelGenTrack_)),
203  tok_htopo_(esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>()),
204  tok_respcorr_(esConsumes<HcalRespCorrs, HcalRespCorrsRcd, edm::Transition::BeginRun>()),
205  tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
210  tok_dbservice_(esConsumes<HcalDbService, HcalDbRecord>()),
211  hdc_(nullptr),
212  theHBHETopology_(nullptr),
213  respCorrs_(nullptr),
214  tree_(nullptr) {
215  usesResource(TFileService::kSharedResource);
216  //now do what ever initialization is needed
217  kount_ = 0;
218 
220  selectionParameter_.minPt = iConfig.getUntrackedParameter<double>("minTrackPt");
222  selectionParameter_.maxDxyPV = iConfig.getUntrackedParameter<double>("maxDxyPV");
223  selectionParameter_.maxDzPV = iConfig.getUntrackedParameter<double>("maxDzPV");
224  selectionParameter_.maxChi2 = iConfig.getUntrackedParameter<double>("maxChi2");
225  selectionParameter_.maxDpOverP = iConfig.getUntrackedParameter<double>("maxDpOverP");
228 
230  edm::LogVerbatim("HBHEMuon") << "Labels used: Track " << labelGenTrack_ << " Vtx " << labelVtx_ << " EB "
231  << labelEBRecHit_ << " EE " << labelEERecHit_ << " HBHE " << labelHBHERecHit_ << " MU "
232  << labelMuon_;
233 
234  if (!fileInCorr_.empty()) {
235  std::ifstream infile(fileInCorr_.c_str());
236  if (infile.is_open()) {
237  while (true) {
238  unsigned int id;
239  double cfac;
240  infile >> id >> cfac;
241  if (!infile.good())
242  break;
243  corrValue_[DetId(id)] = cfac;
244  }
245  infile.close();
246  }
247  }
248  useMyCorr_ = (!corrValue_.empty());
249  edm::LogVerbatim("HBHEMuon") << "Flags used: UseRaw " << useRaw_ << " GetCharge " << getCharge_ << " UnCorrect "
250  << unCorrect_ << " IgnoreHECorr " << ignoreHECorr_ << " CollapseDepth " << collapseDepth_
251  << ":" << mergedDepth_ << " IsItPlan1 " << isItPlan1_ << " IsItPreRecHit "
252  << isItPreRecHit_ << " UseMyCorr " << useMyCorr_;
253 }
254 
255 //
256 // member functions
257 //
258 
259 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
262  desc.add<edm::InputTag>("labelEBRecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
263  desc.add<edm::InputTag>("labelEERecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
264  desc.add<edm::InputTag>("labelHBHERecHit", edm::InputTag("hbhereco"));
265  desc.add<std::string>("labelVertex", "offlinePrimaryVertices");
266  desc.add<std::string>("labelMuon", "muons");
267  desc.add<std::string>("labelTrack", "generalTracks");
268  desc.add<double>("etaMin", 2.0);
269  desc.add<double>("emaxNearPThreshold", 10.0);
270  desc.add<bool>("analyzeMuon", true);
271  desc.add<bool>("unCorrect", true);
272  desc.add<bool>("collapseDepth", false);
273  desc.add<bool>("isItPlan1", false);
274  desc.add<bool>("getCharge", true);
275  desc.add<int>("useRaw", 0);
276  desc.add<int>("verbosity", 0);
277  desc.addUntracked<std::string>("fileInCorr", "");
278  desc.addUntracked<std::string>("trackQuality", "highPurity");
279  desc.addUntracked<double>("minTrackPt", 1.0);
280  desc.addUntracked<double>("maxDxyPV", 0.02);
281  desc.addUntracked<double>("maxDzPV", 100.0);
282  desc.addUntracked<double>("maxChi2", 5.0);
283  desc.addUntracked<double>("maxDpOverP", 0.1);
284  desc.addUntracked<bool>("ignoreHECorr", false);
285  desc.addUntracked<bool>("isItPreRecHit", false);
286  desc.addUntracked<bool>("writeRespCorr", false);
287  desc.addUntracked<int>("maxDepth", 7);
288  descriptions.add("hcalHBHEMuonHighEta", desc);
289 }
290 
291 // ------------ method called once each job just before starting event loop ------------
294  tree_ = fs->make<TTree>("HBHEMuonHighEta", "HBHEMuonHighEta");
295  tree_->Branch("pt_of_muon", &ptGlob_);
296  tree_->Branch("eta_of_muon", &etaGlob_);
297  tree_->Branch("phi_of_muon", &phiGlob_);
298  tree_->Branch("energy_of_muon", &energyMuon_);
299  tree_->Branch("p_of_muon", &pMuon_);
300  tree_->Branch("MediumMuon", &mediumMuon_);
301  tree_->Branch("IsolationR04", &isolationR04_);
302  tree_->Branch("IsolationR03", &isolationR03_);
303  tree_->Branch("ecal_3into3", &ecalEnergy_);
304  tree_->Branch("hcal_3into3", &hcalEnergy_);
305  tree_->Branch("ho_3into3", &hoEnergy_);
306  tree_->Branch("emaxNearP", &emaxNearP_);
307 
308  tree_->Branch("Run_No", &runNumber_);
309  tree_->Branch("Event_No", &eventNumber_);
310  tree_->Branch("GoodVertex", &goodVertex_);
311  tree_->Branch("matchedId", &matchedId_);
312  tree_->Branch("hcal_cellHot", &hcalHot_);
313  tree_->Branch("ecal_3x3", &ecal3x3Energy_);
314  tree_->Branch("hcal_1x1", &hcal1x1Energy_);
315  tree_->Branch("ecal_detID", &ecalDetId_);
316  tree_->Branch("hcal_detID", &hcalDetId_);
317  tree_->Branch("ehcal_detID", &ehcalDetId_);
318  tree_->Branch("hcal_ieta", &hcal_ieta_);
319  tree_->Branch("hcal_iphi", &hcal_iphi_);
320 
321  char name[100];
322  for (int k = 0; k < maxDepth_; ++k) {
323  sprintf(name, "hcal_edepth%d", (k + 1));
324  tree_->Branch(name, &hcalDepthEnergy_[k]);
325  sprintf(name, "hcal_activeL%d", (k + 1));
326  tree_->Branch(name, &hcalDepthActiveLength_[k]);
327  sprintf(name, "hcal_edepthHot%d", (k + 1));
328  tree_->Branch(name, &hcalDepthEnergyHot_[k]);
329  sprintf(name, "hcal_activeHotL%d", (k + 1));
331  sprintf(name, "hcal_cdepthHot%d", (k + 1));
332  tree_->Branch(name, &hcalDepthChargeHot_[k]);
333  sprintf(name, "hcal_cdepthHotBG%d", (k + 1));
334  tree_->Branch(name, &hcalDepthChargeHotBG_[k]);
335  sprintf(name, "hcal_edepthCorrect%d", (k + 1));
336  tree_->Branch(name, &hcalDepthEnergyCorr_[k]);
337  sprintf(name, "hcal_edepthHotCorrect%d", (k + 1));
338  tree_->Branch(name, &hcalDepthEnergyHotCorr_[k]);
339  sprintf(name, "hcal_depthMatch%d", (k + 1));
340  tree_->Branch(name, &hcalDepthMatch_[k]);
341  sprintf(name, "hcal_depthMatchHot%d", (k + 1));
342  tree_->Branch(name, &hcalDepthMatchHot_[k]);
343  }
344  tree_->Branch("activeLength", &hcalActiveLength_);
345  tree_->Branch("activeLengthHot", &hcalActiveLengthHot_);
346  tree_->Branch("trackDz", &trackDz_);
347  tree_->Branch("trackLayerCrossed", &trackLayerCrossed_);
348  tree_->Branch("trackOuterHit", &trackOuterHit_);
349  tree_->Branch("trackMissedInnerHits", &trackMissedInnerHits_);
350  tree_->Branch("trackMissedOuterHits", &trackMissedOuterHits_);
351 }
352 
353 // ------------ method called for each event ------------
355  ++kount_;
356  clearVectors();
357  runNumber_ = iEvent.id().run();
358  eventNumber_ = iEvent.id().event();
359 #ifdef EDM_ML_DEBUG
360  edm::LogVerbatim("HBHEMuon") << "Run " << runNumber_ << " Event " << eventNumber_;
361 #endif
362 
363  // get handles to calogeometry and calotopology
364  bField_ = &iSetup.getData(tok_magField_);
366  sevlv_ = &iSetup.getData(tok_sevlv_);
367  caloTopology_ = &iSetup.getData(tok_topo_);
369 
370  // Relevant blocks from iEvent
372 
373  iEvent.getByToken(tok_EB_, barrelRecHitsHandle_);
374  iEvent.getByToken(tok_EE_, endcapRecHitsHandle_);
375  iEvent.getByToken(tok_HBHE_, hbhe_);
376 
377  // require a good vertex
378  math::XYZPoint pvx;
379  goodVertex_ = 0;
380  if (!vtx.isValid()) {
381 #ifdef EDM_ML_DEBUG
382  edm::LogVerbatim("HBHEMuon") << "No Good Vertex found == Reject\n";
383 #endif
384  return;
385  }
386 
387  reco::VertexCollection::const_iterator firstGoodVertex = vtx->end();
388  for (reco::VertexCollection::const_iterator it = vtx->begin(); it != vtx->end(); it++) {
389  if (isGoodVertex(*it)) {
390  if (firstGoodVertex == vtx->end())
391  firstGoodVertex = it;
392  ++goodVertex_;
393  }
394  }
395  if (firstGoodVertex != vtx->end())
396  pvx = firstGoodVertex->position();
397 
398  bool accept(false);
399  if (barrelRecHitsHandle_.isValid() && endcapRecHitsHandle_.isValid() && hbhe_.isValid()) {
401  }
402  if (accept) {
403 #ifdef EDM_ML_DEBUG
404  edm::LogVerbatim("HBHEMuon") << "Total of " << hcal_ieta_.size() << " propagated points";
405  for (unsigned int i = 0; i < hcal_ieta_.size(); ++i)
406  edm::LogVerbatim("HBHEMuon") << "[" << i << "] ieta/iphi for entry to "
407  << "HCAL has value of " << hcal_ieta_[i] << ":" << hcal_iphi_[i];
408  if ((verbosity_ / 100) % 10 > 0) {
409  edm::LogVerbatim("HBHEMuon") << "Sizes:: ptGlob:" << ptGlob_.size() << " etaGlob:" << etaGlob_.size()
410  << " phiGlob:" << phiGlob_.size() << " energyMuon:" << energyMuon_.size()
411  << " pMuon:" << pMuon_.size() << " mediumMuon: " << mediumMuon_.size()
412  << " isolation:" << isolationR04_.size() << ":" << isolationR03_.size()
413  << " e|h|ho energy: " << ecalEnergy_.size() << ":" << hcalEnergy_.size() << ":"
414  << hoEnergy_.size();
415  edm::LogVerbatim("HBHEMuon") << " matchedId:" << matchedId_.size() << " hcalHot:" << hcalHot_.size()
416  << " 3x3|1x1 energy:" << ecal3x3Energy_.size() << ":" << hcal1x1Energy_.size()
417  << " detId:" << ecalDetId_.size() << ":" << hcalDetId_.size() << ":"
418  << ehcalDetId_.size() << " eta|phi:" << hcal_ieta_.size() << ":"
419  << hcal_iphi_.size();
420  edm::LogVerbatim("HBHEMuon") << " activeLength:" << hcalActiveLength_.size() << ":"
421  << hcalActiveLengthHot_.size() << " emaxNearP:" << emaxNearP_.size()
422  << " trackDz: " << trackDz_.size() << " tracks:" << trackLayerCrossed_.size() << ":"
423  << trackOuterHit_.size() << ":" << trackMissedInnerHits_.size() << ":"
424  << trackMissedOuterHits_.size();
425  for (unsigned int i = 0; i < depthMax_; ++i)
426  edm::LogVerbatim("HBHEMuon")
427  << "Depth " << i
428  << " Energy|Length|EnergyHot|LengthHot|Charge|ChargeBG|EnergyCorr|EnergyHotCorr|Match|MatchHot:"
429  << hcalDepthEnergy_[i].size() << ":" << hcalDepthActiveLength_[i].size() << ":"
430  << hcalDepthEnergyHot_[i].size() << ":" << hcalDepthActiveLengthHot_[i].size() << ":"
431  << hcalDepthChargeHot_[i].size() << ":" << hcalDepthChargeHotBG_[i].size() << ":"
432  << hcalDepthEnergyCorr_[i].size() << ":" << hcalDepthEnergyHotCorr_[i].size() << ":"
433  << hcalDepthMatch_[i].size() << ":" << hcalDepthMatchHot_[i].size();
434  }
435 #endif
436  tree_->Fill();
437  }
438 }
439 
440 // ------------ method called when starting to processes a run ------------
442  hdc_ = &iSetup.getData(tok_ddrec_);
443  actHB.clear();
444  actHE.clear();
445  actHB = hdc_->getThickActive(0);
446  actHE = hdc_->getThickActive(1);
447 #ifdef EDM_ML_DEBUG
448  if (verbosity_ % 10 > 0) {
449  unsigned int k1(0), k2(0);
450  edm::LogVerbatim("HBHEMuon") << actHB.size() << " Active Length for HB";
451  for (const auto& act : actHB) {
452  edm::LogVerbatim("HBHEMuon") << "[" << k1 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
453  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
454  << act.iphis[0] << " L " << act.thick;
455  HcalDetId hcid1(HcalBarrel, (act.ieta) * (act.zside), act.iphis[0], act.depth);
456  HcalDetId hcid2 = mergedDepth_ ? hdc_->mergedDepthDetId(hcid1) : hcid1;
457  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2));
458  ++k1;
459  }
460  edm::LogVerbatim("HBHEMuon") << actHE.size() << " Active Length for HE";
461  for (const auto& act : actHE) {
462  edm::LogVerbatim("HBHEMuon") << "[" << k2 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
463  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
464  << act.iphis[0] << " L " << act.thick;
465  HcalDetId hcid1(HcalEndcap, (act.ieta) * (act.zside), act.iphis[0], act.depth);
466  HcalDetId hcid2 = mergedDepth_ ? hdc_->mergedDepthDetId(hcid1) : hcid1;
467  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2));
468  ++k2;
469  }
470  }
471 #endif
472 
474  const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr_);
475  respCorrs_ = new HcalRespCorrs(*resp);
477  geo_ = &iSetup.getData(tok_geom_);
478 
479  // Write correction factors for all HB/HE events
480  if (writeRespCorr_) {
482  const std::vector<DetId>& ids = gHcal->getValidDetIds(DetId::Hcal, 0);
483  edm::LogVerbatim("HBHEMuon") << "\nTable of Correction Factors for Run " << iRun.run() << "\n";
484  for (auto const& id : ids) {
485  if ((id.det() == DetId::Hcal) && ((id.subdetId() == HcalBarrel) || (id.subdetId() == HcalEndcap))) {
486  edm::LogVerbatim("HBHEMuon") << HcalDetId(id) << " " << id.rawId() << " "
487  << (respCorrs_->getValues(id))->getValue();
488  }
489  }
490  }
491 }
492 
494  const edm::Handle<reco::MuonCollection>& _Muon = iEvent.getHandle(tok_Muon_);
495  bool accept = false;
496 
497  if (_Muon.isValid()) {
498  int nTrack(0);
499  std::vector<spr::propagatedTrackID> trkCaloDets;
500  for (const auto& RecMuon : (*(_Muon.product()))) {
501  if (RecMuon.innerTrack().isNonnull()) {
502  const reco::Track* pTrack = (RecMuon.innerTrack()).get();
503  if (std::abs(pTrack->eta()) > etaMin_) {
504  if (analyzeTracks(pTrack, leadPV, nTrack, trkCaloDets, false)) {
505  accept = true;
506  ptGlob_.emplace_back(RecMuon.pt());
507  etaGlob_.emplace_back(RecMuon.eta());
508  phiGlob_.emplace_back(RecMuon.phi());
509  energyMuon_.push_back(RecMuon.energy());
510  pMuon_.emplace_back(RecMuon.p());
511  bool mediumMuon = (((RecMuon.isPFMuon()) && (RecMuon.isGlobalMuon() || RecMuon.isTrackerMuon())) &&
512  (RecMuon.innerTrack()->validFraction() > 0.49));
513  if (mediumMuon) {
514  double chiGlobal = ((RecMuon.globalTrack().isNonnull()) ? RecMuon.globalTrack()->normalizedChi2() : 999);
515  bool goodGlob =
516  (RecMuon.isGlobalMuon() && chiGlobal < 3 && RecMuon.combinedQuality().chi2LocalPosition < 12 &&
517  RecMuon.combinedQuality().trkKink < 20);
518  mediumMuon = muon::segmentCompatibility(RecMuon) > (goodGlob ? 0.303 : 0.451);
519  }
520  mediumMuon_.emplace_back(mediumMuon);
521  bool isoR03 =
522  ((RecMuon.pfIsolationR03().sumChargedHadronPt +
523  std::max(0.,
524  RecMuon.pfIsolationR03().sumNeutralHadronEt + RecMuon.pfIsolationR03().sumPhotonEt -
525  (0.5 * RecMuon.pfIsolationR03().sumPUPt))) /
526  RecMuon.pt());
527  bool isoR04 =
528  ((RecMuon.pfIsolationR04().sumChargedHadronPt +
529  std::max(0.,
530  RecMuon.pfIsolationR04().sumNeutralHadronEt + RecMuon.pfIsolationR04().sumPhotonEt -
531  (0.5 * RecMuon.pfIsolationR04().sumPUPt))) /
532  RecMuon.pt());
533  isolationR03_.emplace_back(isoR03);
534  isolationR04_.emplace_back(isoR04);
535 
536  ecalEnergy_.emplace_back(RecMuon.calEnergy().emS9);
537  hcalEnergy_.emplace_back(RecMuon.calEnergy().hadS9);
538  hoEnergy_.emplace_back(RecMuon.calEnergy().hoS9);
539 #ifdef EDM_ML_DEBUG
540  if ((verbosity_ / 100) % 10 > 0)
541  edm::LogVerbatim("HBHEMuon")
542  << "Muon[" << ptGlob_.size() << "] pt:eta:phi:p " << ptGlob_.back() << ":" << etaGlob_.back() << ":"
543  << phiGlob_.back() << ":" << energyMuon_.back() << ":" << pMuon_.back() << ":"
544  << " Medium:i3:i4 " << mediumMuon_.back() << ":" << isolationR03_.back() << ":"
545  << isolationR04_.back() << ":"
546  << " Energy EC:HC:HO " << ecalEnergy_.back() << ":" << hcalEnergy_.back() << ":" << hoEnergy_.back();
547 #endif
548  }
549  }
550  }
551  }
552  }
553  return accept;
554 }
555 
557  //Get track collection
558  edm::Handle<reco::TrackCollection> trkCollection = iEvent.getHandle(tok_genTrack_);
559  bool accept = false;
560 
561  if (!trkCollection.isValid()) {
562  std::vector<spr::propagatedTrackID> trkCaloDets;
563  spr::propagateCALO(trkCollection, geo_, bField_, theTrackQuality_, trkCaloDets, false);
564  int nTrack(0);
565  std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
566  for (trkDetItr = trkCaloDets.begin(), nTrack = 0; trkDetItr != trkCaloDets.end(); trkDetItr++, nTrack++) {
567  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
568  if (std::abs(pTrack->eta()) > etaMin_) {
569  accept = analyzeTracks(pTrack, leadPV, nTrack, trkCaloDets, true);
570  }
571  }
572  }
573  return accept;
574 }
575 
577  math::XYZPoint& leadPV,
578  int nTrack,
579  std::vector<spr::propagatedTrackID>& trkCaloDets,
580  bool ifHadron) {
581  bool accept(false);
582 
583  if (spr::goodTrack(pTrack, leadPV, selectionParameter_, false)) {
584  spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo_, bField_, false);
585 
586  if (trackID.okECAL && trackID.okHCAL) {
587  double emaxNearP = (ifHadron) ? spr::chargeIsolationEcal(nTrack, trkCaloDets, geo_, caloTopology_, 15, 15) : 0;
588  if (emaxNearP < emaxNearPThr_) {
589  double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
590  double eHcalDepth[depthMax_], eHcalDepthHot[depthMax_];
591  double eHcalDepthC[depthMax_], eHcalDepthHotC[depthMax_];
592  double cHcalDepthHot[depthMax_], cHcalDepthHotBG[depthMax_];
593  double activeL[depthMax_], activeHotL[depthMax_];
594  bool matchDepth[depthMax_], matchDepthHot[depthMax_];
595  HcalDetId eHcalDetId[depthMax_];
596  unsigned int isHot(0);
597  bool tmpmatch(false);
598  int ieta(-1000), iphi(-1000);
599  for (int i = 0; i < depthMax_; ++i) {
600  eHcalDepth[i] = eHcalDepthHot[i] = 0;
601  eHcalDepthC[i] = eHcalDepthHotC[i] = 0;
602  cHcalDepthHot[i] = cHcalDepthHotBG[i] = 0;
603  activeL[i] = activeHotL[i] = 0;
604  matchDepth[i] = matchDepthHot[i] = true;
605  }
606 
608  std::pair<bool, HcalDetId> info = spr::propagateHCALBack(pTrack, geo_, bField_, false);
609  if (info.first)
610  check = info.second;
611 
612  const DetId isoCell(trackID.detIdECAL);
613  std::pair<double, bool> e3x3 = spr::eECALmatrix(isoCell,
617  geo_,
619  sevlv_,
620  1,
621  1,
622  -100.0,
623  -100.0,
624  -500.0,
625  500.0,
626  false);
627  eEcal = e3x3.first;
628 #ifdef EDM_ML_DEBUG
629  if (verbosity_ % 10 > 0)
630  edm::LogVerbatim("HBHEMuon") << "Propagate Track to ECAL: " << e3x3.second << ":" << trackID.okECAL << " E "
631  << eEcal;
632 #endif
633 
634  DetId closestCell(trackID.detIdHCAL);
635  HcalDetId hcidt(closestCell.rawId());
636  if ((hcidt.ieta() == check.ieta()) && (hcidt.iphi() == check.iphi()))
637  tmpmatch = true;
638 #ifdef EDM_ML_DEBUG
639  if (verbosity_ % 10 > 0)
640  edm::LogVerbatim("HBHEMuon") << "Front " << hcidt << " Back " << info.first << ":" << check << " Match "
641  << tmpmatch;
642 #endif
643 
644  HcalSubdetector subdet = hcidt.subdet();
645  ieta = hcidt.ieta();
646  iphi = hcidt.iphi();
647  bool hborhe = (std::abs(ieta) == 16);
648 
650  closestCell,
651  hbhe_,
652  0,
653  0,
654  false,
655  true,
656  -100.0,
657  -100.0,
658  -100.0,
659  -100.0,
660  -500.,
661  500.,
662  useRaw_);
663  std::vector<std::pair<double, int>> ehdepth;
664  spr::energyHCALCell((HcalDetId)closestCell,
665  hbhe_,
666  ehdepth,
667  depthMax_,
668  -100.0,
669  -100.0,
670  -100.0,
671  -100.0,
672  -500.0,
673  500.0,
674  useRaw_,
675  depth16HE(ieta, iphi),
676  false);
677  for (int i = 0; i < depthMax_; ++i)
678  eHcalDetId[i] = HcalDetId();
679  for (unsigned int i = 0; i < ehdepth.size(); ++i) {
680  HcalSubdetector subdet0 =
681  (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi)) ? HcalEndcap : HcalBarrel) : subdet;
682  HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
683  double actL = activeLength(DetId(hcid0));
684  double ene = ehdepth[i].first;
685  bool tmpC(false);
686  if (ene > 0.0) {
687  if (!(theHBHETopology_->validHcal(hcid0))) {
688  edm::LogWarning("HBHEMuon") << "(1) Invalid ID " << hcid0 << " with E = " << ene;
689  edm::LogWarning("HBHEMuon") << HcalDetId(closestCell) << " with " << ehdepth.size() << " depths:";
690  for (const auto& ehd : ehdepth)
691  edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first;
692  } else {
693  tmpC = goodCell(hcid0, pTrack, geo_, bField_);
694  double enec(ene);
695  if (unCorrect_) {
696  double corr = (ignoreHECorr_ && (subdet0 == HcalEndcap)) ? 1.0 : respCorr(DetId(hcid0));
697  if (corr != 0)
698  ene /= corr;
699 #ifdef EDM_ML_DEBUG
700  if (verbosity_ % 10 > 0) {
701  HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc_->mergedDepthDetId(hcid0) : hcid0;
702  edm::LogVerbatim("HBHEMuon") << hcid0 << ":" << id << " Corr " << corr;
703  }
704 #endif
705  }
706  int depth = ehdepth[i].second - 1;
707  if (collapseDepth_) {
708  HcalDetId id = hdc_->mergedDepthDetId(hcid0);
709  depth = id.depth() - 1;
710  }
711  eHcalDepth[depth] += ene;
712  eHcalDepthC[depth] += enec;
713  activeL[depth] += actL;
714  activeLengthTot += actL;
715  matchDepth[depth] = (matchDepth[depth] && tmpC);
716 #ifdef EDM_ML_DEBUG
717  if ((verbosity_ / 10) % 10 > 0)
718  edm::LogVerbatim("HBHEMuon")
719  << hcid0 << " E " << ene << ":" << enec << " L " << actL << " Match " << tmpC;
720 #endif
721  }
722  }
723  }
724 #ifdef EDM_ML_DEBUG
725  if ((verbosity_ / 10) % 10 > 0) {
726  edm::LogVerbatim("HBHEMuon") << hcidt << " Match " << tmpmatch << " Depths " << ehdepth.size();
727  for (unsigned int k = 0; k < ehdepth.size(); ++k)
728  edm::LogVerbatim("HBHEMuon") << " [" << k << ":" << ehdepth[k].second << "] " << matchDepth[k];
729  }
730 #endif
731  HcalDetId hotCell;
732  spr::eHCALmatrix(geo_, theHBHETopology_, closestCell, hbhe_, 1, 1, hotCell, false, useRaw_, false);
733  isHot = matchId(closestCell, hotCell);
734  if (hotCell != HcalDetId()) {
735  subdet = HcalDetId(hotCell).subdet();
736  ieta = HcalDetId(hotCell).ieta();
737  iphi = HcalDetId(hotCell).iphi();
738  hborhe = (std::abs(ieta) == 16);
739  std::vector<std::pair<double, int>> ehdepth;
740  spr::energyHCALCell(hotCell,
741  hbhe_,
742  ehdepth,
743  depthMax_,
744  -100.0,
745  -100.0,
746  -100.0,
747  -100.0,
748  -500.0,
749  500.0,
750  useRaw_,
751  depth16HE(ieta, iphi),
752  false);
753  for (int i = 0; i < depthMax_; ++i)
754  eHcalDetId[i] = HcalDetId();
755  for (unsigned int i = 0; i < ehdepth.size(); ++i) {
756  HcalSubdetector subdet0 =
757  (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi)) ? HcalEndcap : HcalBarrel) : subdet;
758  HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
759  double actL = activeLength(DetId(hcid0));
760  double ene = ehdepth[i].first;
761  bool tmpC(false);
762  if (ene > 0.0) {
763  if (!(theHBHETopology_->validHcal(hcid0))) {
764  edm::LogWarning("HBHEMuon") << "(2) Invalid ID " << hcid0 << " with E = " << ene;
765  edm::LogWarning("HBHEMuon") << HcalDetId(hotCell) << " with " << ehdepth.size() << " depths:";
766  for (const auto& ehd : ehdepth)
767  edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first;
768  } else {
769  tmpC = goodCell(hcid0, pTrack, geo_, bField_);
770  double chg(ene), enec(ene);
771  if (unCorrect_) {
772  double corr = (ignoreHECorr_ && (subdet0 == HcalEndcap)) ? 1.0 : respCorr(DetId(hcid0));
773  if (corr != 0)
774  ene /= corr;
775 #ifdef EDM_ML_DEBUG
776  if (verbosity_ % 10 > 0) {
777  HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc_->mergedDepthDetId(hcid0) : hcid0;
778  edm::LogVerbatim("HBHEMuon")
779  << hcid0 << ":" << id << " Corr " << corr << " E " << ene << ":" << enec;
780  }
781 #endif
782  }
783  if (getCharge_) {
784  double gain = gainFactor(conditions_, hcid0);
785  if (gain != 0)
786  chg /= gain;
787 #ifdef EDM_ML_DEBUG
788  if (verbosity_ % 10 > 0)
789  edm::LogVerbatim("HBHEMuon") << hcid0 << " Gain " << gain << " C " << chg;
790 #endif
791  }
792  int depth = ehdepth[i].second - 1;
793  if (collapseDepth_) {
794  HcalDetId id = hdc_->mergedDepthDetId(hcid0);
795  depth = id.depth() - 1;
796  }
797  eHcalDepthHot[depth] += ene;
798  eHcalDepthHotC[depth] += enec;
799  cHcalDepthHot[depth] += chg;
800  activeHotL[depth] += actL;
801  activeLengthHotTot += actL;
802  matchDepthHot[depth] = (matchDepthHot[depth] && tmpC);
803 #ifdef EDM_ML_DEBUG
804  if ((verbosity_ / 10) % 10 > 0)
805  edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << ene << ":" << enec << " C "
806  << chg << " L " << actL << " Match " << tmpC;
807 #endif
808  }
809  }
810  }
811  }
812 #ifdef EDM_ML_DEBUG
813  edm::LogVerbatim("HBHEMuon") << "Propagate Track to HCAL: " << trackID.okHCAL << " Match " << tmpmatch
814  << " Hot " << isHot << " Energy " << eHcal;
815 #endif
816 
817  accept = true;
818  ecalDetId_.emplace_back((trackID.detIdECAL)());
819  hcalDetId_.emplace_back((trackID.detIdHCAL)());
820  ehcalDetId_.emplace_back((trackID.detIdEHCAL)());
821  emaxNearP_.emplace_back(emaxNearP);
822  matchedId_.emplace_back(tmpmatch);
823  ecal3x3Energy_.emplace_back(eEcal);
824  hcal1x1Energy_.emplace_back(eHcal);
825  hcal_ieta_.emplace_back(ieta);
826  hcal_iphi_.emplace_back(iphi);
827  for (int i = 0; i < maxDepth_; ++i) {
828  hcalDepthEnergy_[i].emplace_back(eHcalDepth[i]);
829  hcalDepthActiveLength_[i].emplace_back(activeL[i]);
830  hcalDepthEnergyHot_[i].emplace_back(eHcalDepthHot[i]);
831  hcalDepthActiveLengthHot_[i].emplace_back(activeHotL[i]);
832  hcalDepthEnergyCorr_[i].emplace_back(eHcalDepthC[i]);
833  hcalDepthEnergyHotCorr_[i].emplace_back(eHcalDepthHotC[i]);
834  hcalDepthChargeHot_[i].emplace_back(cHcalDepthHot[i]);
835  hcalDepthChargeHotBG_[i].emplace_back(cHcalDepthHotBG[i]);
836  hcalDepthMatch_[i].emplace_back(matchDepth[i]);
837  hcalDepthMatchHot_[i].emplace_back(matchDepthHot[i]);
838  }
839  hcalActiveLength_.emplace_back(activeLengthTot);
840  hcalHot_.emplace_back(isHot);
841  hcalActiveLengthHot_.emplace_back(activeLengthHotTot);
842 #ifdef EDM_ML_DEBUG
843  if ((verbosity_ / 100) % 10 > 0) {
844  edm::LogVerbatim("HBHEMuon") << "Track " << std::hex << ecalDetId_.back() << ":" << hcalDetId_.back() << ":"
845  << ehcalDetId_.back() << std::dec << ":" << emaxNearP_.back() << ":"
846  << matchedId_.back() << ":" << ecal3x3Energy_.back() << ":"
847  << hcal1x1Energy_.back() << ":" << hcal_ieta_.back() << ":" << hcal_iphi_.back()
848  << ":" << hcalActiveLength_.back() << ":" << hcalHot_.back() << ":"
849  << hcalActiveLengthHot_.back();
850  for (int i = 0; i < maxDepth_; ++i) {
851  edm::LogVerbatim("HBHEMuon") << "Depth[" << i << "] " << hcalDepthEnergy_[i].back() << ":"
852  << hcalDepthActiveLength_[i].back() << ":" << hcalDepthEnergyHot_[i].back()
853  << ":" << hcalDepthActiveLengthHot_[i].back() << ":"
854  << hcalDepthEnergyCorr_[i].back() << ":" << hcalDepthEnergyHotCorr_[i].back()
855  << ":" << hcalDepthChargeHot_[i].back() << ":"
856  << hcalDepthChargeHotBG_[i].back() << ":" << hcalDepthMatch_[i].back() << ":"
857  << hcalDepthMatchHot_[i].back();
858  }
859  }
860 #endif
861  fillTrackParameters(pTrack, leadPV);
862  }
863  }
864  }
865  return accept;
866 }
867 
870  eventNumber_ = -99999;
871  runNumber_ = -99999;
872  goodVertex_ = -99999;
873 
874  mediumMuon_.clear();
875  ptGlob_.clear();
876  etaGlob_.clear();
877  phiGlob_.clear();
878  energyMuon_.clear();
879  pMuon_.clear();
880  isolationR04_.clear();
881  isolationR03_.clear();
882  ecalEnergy_.clear();
883  hcalEnergy_.clear();
884  hoEnergy_.clear();
885 
886  matchedId_.clear();
887  hcalHot_.clear();
888  ecal3x3Energy_.clear();
889  hcal1x1Energy_.clear();
890  ecalDetId_.clear();
891  hcalDetId_.clear();
892  ehcalDetId_.clear();
893  hcal_ieta_.clear();
894  hcal_iphi_.clear();
895  for (int i = 0; i < depthMax_; ++i) {
896  hcalDepthEnergy_[i].clear();
897  hcalDepthActiveLength_[i].clear();
898  hcalDepthEnergyHot_[i].clear();
899  hcalDepthActiveLengthHot_[i].clear();
900  hcalDepthChargeHot_[i].clear();
901  hcalDepthChargeHotBG_[i].clear();
902  hcalDepthEnergyCorr_[i].clear();
903  hcalDepthEnergyHotCorr_[i].clear();
904  hcalDepthMatch_[i].clear();
905  hcalDepthMatchHot_[i].clear();
906  }
907  hcalActiveLength_.clear();
908  hcalActiveLengthHot_.clear();
909 
910  emaxNearP_.clear();
911  trackDz_.clear();
912  trackLayerCrossed_.clear();
913  trackOuterHit_.clear();
914  trackMissedInnerHits_.clear();
915  trackMissedOuterHits_.clear();
916 }
917 
919  HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
920  HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1);
921  int match = ((kd1 == kd2) ? 1 : 0);
922  return match;
923 }
924 
926  HcalDetId id(hid);
927  int ieta = id.ietaAbs();
928  int zside = id.zside();
929  int iphi = id.iphi();
930  std::vector<int> dpths;
931  if (mergedDepth_) {
932  std::vector<HcalDetId> ids;
933  hdc_->unmergeDepthDetId(id, ids);
934  for (auto idh : ids)
935  dpths.emplace_back(idh.depth());
936  } else {
937  dpths.emplace_back(id.depth());
938  }
939  double lx(0);
940  if (id.subdet() == HcalBarrel) {
941  for (unsigned int i = 0; i < actHB.size(); ++i) {
942  if ((ieta == actHB[i].ieta) && (zside == actHB[i].zside) &&
943  (std::find(dpths.begin(), dpths.end(), actHB[i].depth) != dpths.end()) &&
944  (std::find(actHB[i].iphis.begin(), actHB[i].iphis.end(), iphi) != actHB[i].iphis.end())) {
945  lx += actHB[i].thick;
946  }
947  }
948  } else {
949  for (unsigned int i = 0; i < actHE.size(); ++i) {
950  if ((ieta == actHE[i].ieta) && (zside == actHE[i].zside) &&
951  (std::find(dpths.begin(), dpths.end(), actHE[i].depth) != dpths.end()) &&
952  (std::find(actHE[i].iphis.begin(), actHE[i].iphis.end(), iphi) != actHE[i].iphis.end())) {
953  lx += actHE[i].thick;
954  }
955  }
956  }
957  return lx;
958 }
959 
961  if (vtx.isFake())
962  return false;
963  if (vtx.ndof() < 4)
964  return false;
965  if (vtx.position().Rho() > 2.)
966  return false;
967  if (fabs(vtx.position().Z()) > 24.)
968  return false;
969  return true;
970 }
971 
973  double cfac(1.0);
974  if (useMyCorr_) {
975  auto itr = corrValue_.find(id);
976  if (itr != corrValue_.end())
977  cfac = itr->second;
978  } else if (respCorrs_ != nullptr) {
979  cfac = (respCorrs_->getValues(id))->getValue();
980  }
981  return cfac;
982 }
983 
985  double gain(0.0);
986  const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
987  for (int capid = 0; capid < 4; ++capid)
988  gain += (0.25 * calibs.respcorrgain(capid));
989  return gain;
990 }
991 
993  // Transition between HB/HE is special
994  // For Run 1 or for Plan1 standard reconstruction it is 3
995  // For runs beyond 2018 or in Plan1 for HEP17 it is 4
996  int zside = (ieta > 0) ? 1 : -1;
998  if (isItPlan1_ && (!isItPreRecHit_))
999  depth = 3;
1000 #ifdef EDM_ML_DEBUG
1001  if (verbosity_ % 10 > 0)
1002  edm::LogVerbatim("HBHEMuon") << "Plan1 " << isItPlan1_ << " PreRecHit " << isItPreRecHit_ << " phi " << iphi
1003  << " depth " << depth;
1004 #endif
1005  return depth;
1006 }
1007 
1009  const reco::Track* pTrack,
1010  const CaloGeometry* geo,
1011  const MagneticField* bField) {
1012  std::pair<double, double> rz = hdc_->getRZ(hcid);
1013  bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true;
1014  bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, false);
1015  return match;
1016 }
1017 
1019  trackDz_.emplace_back(pTrack->dz(leadPV));
1020  const reco::HitPattern& hitp = pTrack->hitPattern();
1021  trackLayerCrossed_.emplace_back(hitp.trackerLayersWithMeasurement());
1025 }
1026 
1027 //define this as a plug-in
1029 
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
int matchId(const HcalDetId &, const HcalDetId &)
static const std::string kSharedResource
Definition: TFileService.h:76
Log< level::Info, true > LogVerbatim
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const EcalChannelStatus * theEcalChStatus_
static const TGPicture * info(bool iBackgroundIsBlack)
spr::trackSelectionParameters selectionParameter_
edm::Handle< HBHERecHitCollection > hbhe_
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
Definition: HcalGeometry.cc:76
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
HcalDetId mergedDepthDetId(const HcalDetId &id) const
const edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
const float chg[109]
Definition: CoreSimTrack.cc:5
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
TrackQuality
track quality
Definition: TrackBase.h:150
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
std::vector< double > hcalDepthEnergy_[depthMax_]
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:535
T const * product() const
Definition: Handle.h:70
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const EcalSeverityLevelAlgo * sevlv_
std::vector< bool > hcalDepthMatchHot_[depthMax_]
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
int zside(DetId const &)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
bool analyzeMuon(edm::Event const &, math::XYZPoint &)
std::vector< unsigned int > hcalDetId_
bool goodCell(const HcalDetId &, const reco::Track *, const CaloGeometry *, const MagneticField *)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:629
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
bool isGoodVertex(const reco::Vertex &)
const Item * getValues(DetId fId, bool throwOnFail=true) const
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
double gainFactor(const HcalDbService *, const HcalDetId &)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
int iEvent
Definition: GenABIO.cc:224
RunNumber_t run() const
Definition: RunBase.h:40
const edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
dictionary corr
spr::propagatedTrackDirection propagateHCALBack(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const CaloGeometry *geo, const MagneticField *bField, bool debug=false)
const edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr_
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::vector< double > hcalDepthEnergyHot_[depthMax_]
HcalHBHEMuonHighEtaAnalyzer(const edm::ParameterSet &)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:619
Transition
Definition: Transition.h:12
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
void fillTrackParameters(const reco::Track *, math::XYZPoint)
std::vector< double > hcalDepthActiveLength_[depthMax_]
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
Definition: DetId.h:17
void beginRun(edm::Run const &, edm::EventSetup const &) override
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:554
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
bool analyzeTracks(const reco::Track *, math::XYZPoint &, int, std::vector< spr::propagatedTrackID > &, bool)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void analyze(edm::Event const &, edm::EventSetup const &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
std::vector< unsigned int > ehcalDetId_
bool isValid() const
Definition: HandleBase.h:70
bool validHcal(const HcalDetId &id) const
fixed size matrix
HLT enums.
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::Handle< EcalRecHitCollection > barrelRecHitsHandle_
reco::TrackBase::TrackQuality minQuality
std::vector< HcalActiveLength > getThickActive(const int &type) const
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
std::vector< double > hcalDepthChargeHot_[depthMax_]
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< bool > hcalDepthMatch_[depthMax_]
std::vector< unsigned int > ecalDetId_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
void energyHCALCell(HcalDetId detId, edm::Handle< T > &hits, std::vector< std::pair< double, int > > &energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, int depthHE=3, bool debug=false)
edm::Handle< EcalRecHitCollection > endcapRecHitsHandle_
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
void setTopo(const HcalTopology *topo)
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
bool analyzeHadron(edm::Event const &, math::XYZPoint &)
Definition: Run.h:45
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
double eHCALmatrix(const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, bool debug=false)