CMS 3D CMS Logo

HcalIsoTrkSimAnalyzer.cc
Go to the documentation of this file.
1 // system include files
2 #include <atomic>
3 #include <cmath>
4 #include <memory>
5 #include <string>
6 #include <vector>
7 
8 // Root objects
9 #include "TROOT.h"
10 #include "TSystem.h"
11 #include "TFile.h"
12 #include "TProfile.h"
13 #include "TDirectory.h"
14 #include "TTree.h"
15 #include "TLorentzVector.h"
16 #include "TInterpreter.h"
17 
20 
24 
25 // Vertices
29 
30 //Triggers
37 
42 
46 
47 //Generator information
52 
55 
63 
69 
82 
83 //#define EDM_ML_DEBUG
84 
85 class HcalIsoTrkSimAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
86 public:
88  ~HcalIsoTrkSimAnalyzer() override = default;
89 
90  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
91 
92 private:
93  void analyze(edm::Event const&, edm::EventSetup const&) override;
94  void beginJob() override;
95  void beginRun(edm::Run const&, edm::EventSetup const&) override;
96  void endRun(edm::Run const&, edm::EventSetup const&) override;
97 
98  std::array<int, 3> fillTree(std::vector<math::XYZTLorentzVector>& vecL1,
99  std::vector<math::XYZTLorentzVector>& vecL3,
100  math::XYZPoint& leadPV,
101  std::vector<spr::propagatedGenParticleID>& trackIDs,
102  const CaloGeometry* geo,
103  const CaloTopology* topo,
104  const HcalTopology* theHBHETopology,
105  const EcalChannelStatus* theEcalChStatus,
106  const EcalSeverityLevelAlgo* theEcalSevlv,
107  edm::Handle<EcalRecHitCollection>& barrelRecHitsHandle,
108  edm::Handle<EcalRecHitCollection>& endcapRecHitsHandle,
110  const edm::Handle<CaloTowerCollection>& towerHandle,
112  const HcalRespCorrs* respCorrs);
114  double rhoh(const edm::Handle<CaloTowerCollection>&);
115  double eThreshold(const DetId& id, const CaloGeometry* geo) const;
116  DetId newId(const DetId&);
117  void storeEnergy(int indx,
118  const HcalRespCorrs* respCorrs,
119  const std::vector<DetId>& ids,
120  std::vector<double>& edet,
121  double& eHcal,
122  std::vector<unsigned int>* detIds,
123  std::vector<double>* hitEnergies);
124  bool notaMuon(const reco::GenParticle* pTrack);
125 
128  const std::vector<std::string> trigNames_;
131  const double ptMin_, etaMax_;
136  const double pTrackLow_, pTrackHigh_;
138  const int useRaw_, dataType_, mode_;
142  const double hitEthrEE2_, hitEthrEE3_;
143  const double hitEthrEELo_, hitEthrEEHi_;
147  const std::vector<int> oldID_, newDepth_;
148  const bool hep17_;
149  const bool usePFThresh_;
152 
164 
175 
176  unsigned int nRun_, nLow_, nHigh_;
180 
181  std::vector<double> etabins_, phibins_;
182  std::vector<int> oldDet_, oldEta_, oldDepth_;
184 
185  TTree *tree, *tree2;
186  unsigned int t_RunNo, t_EventNo;
199  std::vector<unsigned int>*t_DetIds, *t_DetIds1, *t_DetIds3;
200  std::vector<double>*t_HitEnergies, *t_HitEnergies1, *t_HitEnergies3;
201  std::vector<bool>*t_trgbits, *t_hltbits;
202  bool t_L1Bit;
205  std::vector<int>*t_ietaAll, *t_ietaGood, *t_trackType;
206 };
207 
209  : trigNames_(iConfig.getParameter<std::vector<std::string> >("triggers")),
210  processName_(iConfig.getParameter<std::string>("processName")),
211  l1Filter_(iConfig.getParameter<std::string>("l1Filter")),
212  l2Filter_(iConfig.getParameter<std::string>("l2Filter")),
213  l3Filter_(iConfig.getParameter<std::string>("l3Filter")),
214  ptMin_(iConfig.getParameter<double>("pTMin")),
215  etaMax_(iConfig.getParameter<double>("maxChargedHadronEta")),
216  a_coneR_(iConfig.getParameter<double>("coneRadius")),
217  a_mipR_(iConfig.getParameter<double>("coneRadiusMIP")),
218  a_mipR2_(iConfig.getParameter<double>("coneRadiusMIP2")),
219  a_mipR3_(iConfig.getParameter<double>("coneRadiusMIP3")),
220  a_mipR4_(iConfig.getParameter<double>("coneRadiusMIP4")),
221  a_mipR5_(iConfig.getParameter<double>("coneRadiusMIP5")),
222  pTrackMin_(iConfig.getParameter<double>("minimumTrackP")),
223  eEcalMax_(iConfig.getParameter<double>("maximumEcalEnergy")),
224  maxRestrictionP_(iConfig.getParameter<double>("maxTrackP")),
225  slopeRestrictionP_(iConfig.getParameter<double>("slopeTrackP")),
226  hcalScale_(iConfig.getUntrackedParameter<double>("hHcalScale", 1.0)),
227  eIsolate1_(iConfig.getParameter<double>("isolationEnergyTight")),
228  eIsolate2_(iConfig.getParameter<double>("isolationEnergyLoose")),
229  pTrackLow_(iConfig.getParameter<double>("momentumLow")),
230  pTrackHigh_(iConfig.getParameter<double>("momentumHigh")),
231  prescaleLow_(iConfig.getParameter<int>("prescaleLow")),
232  prescaleHigh_(iConfig.getParameter<int>("prescaleHigh")),
233  useRaw_(iConfig.getUntrackedParameter<int>("useRaw", 0)),
234  dataType_(iConfig.getUntrackedParameter<int>("dataType", 0)),
235  mode_(iConfig.getUntrackedParameter<int>("outMode", 11)),
236  ignoreTrigger_(iConfig.getUntrackedParameter<bool>("ignoreTriggers", false)),
237  useL1Trigger_(iConfig.getUntrackedParameter<bool>("useL1Trigger", false)),
238  unCorrect_(iConfig.getUntrackedParameter<bool>("unCorrect", false)),
239  collapseDepth_(iConfig.getUntrackedParameter<bool>("collapseDepth", false)),
240  hitEthrEB_(iConfig.getParameter<double>("EBHitEnergyThreshold")),
241  hitEthrEE0_(iConfig.getParameter<double>("EEHitEnergyThreshold0")),
242  hitEthrEE1_(iConfig.getParameter<double>("EEHitEnergyThreshold1")),
243  hitEthrEE2_(iConfig.getParameter<double>("EEHitEnergyThreshold2")),
244  hitEthrEE3_(iConfig.getParameter<double>("EEHitEnergyThreshold3")),
245  hitEthrEELo_(iConfig.getParameter<double>("EEHitEnergyThresholdLow")),
246  hitEthrEEHi_(iConfig.getParameter<double>("EEHitEnergyThresholdHigh")),
247  triggerEvent_(iConfig.getParameter<edm::InputTag>("labelTriggerEvent")),
248  theTriggerResultsLabel_(iConfig.getParameter<edm::InputTag>("labelTriggerResult")),
249  labelGenTrack_(iConfig.getParameter<std::string>("labelTrack")),
250  labelRecVtx_(iConfig.getParameter<std::string>("labelVertex")),
251  labelEB_(iConfig.getParameter<std::string>("labelEBRecHit")),
252  labelEE_(iConfig.getParameter<std::string>("labelEERecHit")),
253  labelHBHE_(iConfig.getParameter<std::string>("labelHBHERecHit")),
254  labelTower_(iConfig.getParameter<std::string>("labelCaloTower")),
255  l1TrigName_(iConfig.getUntrackedParameter<std::string>("l1TrigName", "L1_SingleJet60")),
256  oldID_(iConfig.getUntrackedParameter<std::vector<int> >("oldID")),
257  newDepth_(iConfig.getUntrackedParameter<std::vector<int> >("newDepth")),
258  hep17_(iConfig.getUntrackedParameter<bool>("hep17")),
259  usePFThresh_(iConfig.getParameter<bool>("usePFThreshold")),
260  labelBS_(iConfig.getParameter<std::string>("labelBeamSpot")),
261  modnam_(iConfig.getUntrackedParameter<std::string>("moduleName", "")),
262  prdnam_(iConfig.getUntrackedParameter<std::string>("producerName", "")),
263  algTag_(iConfig.getParameter<edm::InputTag>("algInputTag")),
264  extTag_(iConfig.getParameter<edm::InputTag>("extInputTag")),
265  tok_trigEvt_(consumes<trigger::TriggerEvent>(triggerEvent_)),
266  tok_trigRes_(consumes<edm::TriggerResults>(theTriggerResultsLabel_)),
267  tok_bs_(consumes<reco::BeamSpot>(labelBS_)),
268  tok_recVtx_((modnam_.empty()) ? consumes<reco::VertexCollection>(labelRecVtx_)
269  : consumes<reco::VertexCollection>(edm::InputTag(modnam_, labelRecVtx_, prdnam_))),
270  tok_EB_((modnam_.empty()) ? consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit", labelEB_))
271  : consumes<EcalRecHitCollection>(edm::InputTag(modnam_, labelEB_, prdnam_))),
272  tok_EE_((modnam_.empty()) ? consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit", labelEE_))
273  : consumes<EcalRecHitCollection>(edm::InputTag(modnam_, labelEE_, prdnam_))),
274  tok_hbhe_((modnam_.empty()) ? consumes<HBHERecHitCollection>(labelHBHE_)
275  : consumes<HBHERecHitCollection>(edm::InputTag(modnam_, labelHBHE_, prdnam_))),
276  tok_ew_(consumes<GenEventInfoProduct>(edm::InputTag("generator"))),
277  tok_parts_(consumes<reco::GenParticleCollection>(edm::InputTag("genParticles"))),
278  tok_cala_(consumes<CaloTowerCollection>(labelTower_)),
279  tok_alg_(consumes<BXVector<GlobalAlgBlk> >(algTag_)),
282  tok_ecalChStatus_(esConsumes<EcalChannelStatus, EcalChannelStatusRcd>()),
285  tok_caloTopology_(esConsumes<CaloTopology, CaloTopologyRecord>()),
289  tok_ecalPFRecHitThresholds_(esConsumes<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd>()),
290  nRun_(0),
291  nLow_(0),
292  nHigh_(0),
293  hdc_(nullptr) {
294  usesResource(TFileService::kSharedResource);
295 
296  //now do whatever initialization is needed
297  const double isolationRadius(28.9), innerR(10.0), outerR(30.0);
298  a_charIsoR_ = a_coneR_ + isolationRadius;
299  a_coneR1_ = a_coneR_ + innerR;
300  a_coneR2_ = a_coneR_ + outerR;
301  // Different isolation cuts are described in DN-2016/029
302  // Tight cut uses 2 GeV; Loose cut uses 10 GeV
303  // Eta dependent cut uses (maxRestrictionP_ * exp(|ieta|*log(2.5)/18))
304  // with the factor for exponential slopeRestrictionP_ = log(2.5)/18
305  // maxRestrictionP_ = 8 GeV as came from a study
306 
307  for (unsigned int k = 0; k < oldID_.size(); ++k) {
308  oldDet_.emplace_back((oldID_[k] / 10000) % 10);
309  oldEta_.emplace_back((oldID_[k] / 100) % 100);
310  oldDepth_.emplace_back(oldID_[k] % 100);
311  }
312 
313  l1GtUtils_ =
315 
316  if (modnam_.empty()) {
317  edm::LogVerbatim("HcalIsoTrack") << "Labels used " << triggerEvent_ << " " << theTriggerResultsLabel_ << " "
318  << labelBS_ << " " << labelRecVtx_ << " " << labelGenTrack_ << " "
319  << edm::InputTag("ecalRecHit", labelEB_) << " "
320  << edm::InputTag("ecalRecHit", labelEE_) << " " << labelHBHE_ << " "
321  << labelTower_;
322  } else {
323  edm::LogVerbatim("HcalIsoTrack") << "Labels used " << triggerEvent_ << " " << theTriggerResultsLabel_ << " "
324  << labelBS_ << " " << edm::InputTag(modnam_, labelRecVtx_, prdnam_) << " "
325  << labelGenTrack_ << " " << edm::InputTag(modnam_, labelEB_, prdnam_) << " "
328  }
329 
330  edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n"
331  << "\t minPt " << ptMin_ << "\t etaMax " << etaMax_ << "\t a_coneR " << a_coneR_
332  << ":" << a_coneR1_ << ":" << a_coneR2_ << "\t a_charIsoR " << a_charIsoR_
333  << "\t a_mipR " << a_mipR_ << "\t a_mipR2 " << a_mipR2_ << "\t a_mipR3 " << a_mipR3_
334  << "\t a_mipR4 " << a_mipR4_ << "\t a_mipR5 " << a_mipR5_ << "\n pTrackMin_ "
335  << pTrackMin_ << "\t eEcalMax_ " << eEcalMax_ << "\t maxRestrictionP_ "
336  << maxRestrictionP_ << "\t slopeRestrictionP_ " << slopeRestrictionP_
337  << "\t eIsolateStrong_ " << eIsolate1_ << "\t eIsolateSoft_ " << eIsolate2_
338  << "\t hcalScale_ " << hcalScale_ << "\n\t momentumLow_ " << pTrackLow_
339  << "\t prescaleLow_ " << prescaleLow_ << "\t momentumHigh_ " << pTrackHigh_
340  << "\t prescaleHigh_ " << prescaleHigh_ << "\n\t useRaw_ " << useRaw_
341  << "\t ignoreTrigger_ " << ignoreTrigger_ << "\n\t useL1Trigegr_ " << useL1Trigger_
342  << "\t dataType_ " << dataType_ << "\t mode_ " << mode_
343  << "\t unCorrect_ " << unCorrect_ << "\t collapseDepth_ " << collapseDepth_
344  << "\t L1TrigName_ " << l1TrigName_ << "\nThreshold flag used " << usePFThresh_
345  << " value for EB " << hitEthrEB_ << " EE " << hitEthrEE0_ << ":" << hitEthrEE1_
346  << ":" << hitEthrEE2_ << ":" << hitEthrEE3_ << ":" << hitEthrEELo_ << ":"
347  << hitEthrEEHi_;
348  edm::LogVerbatim("HcalIsoTrack") << "Process " << processName_ << " L1Filter:" << l1Filter_
349  << " L2Filter:" << l2Filter_ << " L3Filter:" << l3Filter_;
350  for (unsigned int k = 0; k < trigNames_.size(); ++k) {
351  edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k];
352  }
353  edm::LogVerbatim("HcalIsoTrack") << oldID_.size() << " DetIDs to be corrected with HEP17 flag:" << hep17_;
354  for (unsigned int k = 0; k < oldID_.size(); ++k)
355  edm::LogVerbatim("HcalIsoTrack") << "[" << k << "] Det " << oldDet_[k] << " EtaAbs " << oldEta_[k] << " Depth "
356  << oldDepth_[k] << ":" << newDepth_[k];
357 
358  for (int i = 0; i < 10; i++)
359  phibins_.push_back(-M_PI + 0.1 * (2 * i + 1) * M_PI);
360  for (int i = 0; i < 8; ++i)
361  etabins_.push_back(-2.1 + 0.6 * i);
362  etadist_ = etabins_[1] - etabins_[0];
363  phidist_ = phibins_[1] - phibins_[0];
364  etahalfdist_ = 0.5 * etadist_;
365  phihalfdist_ = 0.5 * phidist_;
366  edm::LogVerbatim("HcalIsoTrack") << "EtaDist " << etadist_ << " " << etahalfdist_ << " PhiDist " << phidist_ << " "
367  << phihalfdist_;
368  unsigned int k1(0), k2(0);
369  for (auto phi : phibins_) {
370  edm::LogVerbatim("HcalIsoTrack") << "phibin_[" << k1 << "] " << phi;
371  ++k1;
372  }
373  for (auto eta : etabins_) {
374  edm::LogVerbatim("HcalIsoTrack") << "etabin_[" << k2 << "] " << eta;
375  ++k2;
376  }
377 }
378 
380  t_Run = iEvent.id().run();
381  t_Event = iEvent.id().event();
383 #ifdef EDM_ML_DEBUG
384  edm::LogVerbatim("HcalIsoTrack") << "Run " << t_Run << " Event " << t_Event << " type " << t_DataType
385  << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing();
386 #endif
387  //Get magnetic field and ECAL channel status
388  const MagneticField* bField = &iSetup.getData(tok_bFieldH_);
389  const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_);
390  const EcalSeverityLevelAlgo* theEcalSevlv = &iSetup.getData(tok_sevlv_);
391 
392  // get calogeometry and calotopology
393  const CaloGeometry* geo = &iSetup.getData(tok_geom_);
394  const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_);
395  const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_);
396 
397  // get response correction
398  const HcalRespCorrs* resp = &iSetup.getData(tok_resp_);
399  HcalRespCorrs* respCorrs = new HcalRespCorrs(*resp);
400  respCorrs->setTopo(theHBHETopology);
401 
402  // get ECAL thresholds
404 
405  // get particle data table
406  const HepPDT::ParticleDataTable* pdt = &iSetup.getData(tok_pdt_);
407 
408  //=== genParticle information
409  bool okC(true);
411  if (!genParticles.isValid()) {
412  edm::LogWarning("HcalIsoTrack") << "Cannot access the genParticles collection";
413  okC = false;
414  }
415 
416  //event weight for FLAT sample
417  t_EventWeight = 1.0;
419  if (genEventInfo.isValid())
420  t_EventWeight = genEventInfo->weight();
421 
422  //Define the best vertex and the beamspot
423  const edm::Handle<reco::VertexCollection> recVtxs = iEvent.getHandle(tok_recVtx_);
424  const edm::Handle<reco::BeamSpot> beamSpotH = iEvent.getHandle(tok_bs_);
425  math::XYZPoint leadPV(0, 0, 0);
426  t_goodPV = t_nVtx = 0;
427  if (recVtxs.isValid() && !(recVtxs->empty())) {
428  t_nVtx = recVtxs->size();
429  for (unsigned int k = 0; k < recVtxs->size(); ++k) {
430  if (!((*recVtxs)[k].isFake()) && ((*recVtxs)[k].ndof() > 4)) {
431  if (t_goodPV == 0)
432  leadPV = math::XYZPoint((*recVtxs)[k].x(), (*recVtxs)[k].y(), (*recVtxs)[k].z());
433  t_goodPV++;
434  }
435  }
436  }
437  if (t_goodPV == 0 && beamSpotH.isValid()) {
438  leadPV = beamSpotH->position();
439  }
441 #ifdef EDM_ML_DEBUG
442  edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV << " out of " << t_goodPV << " vertex";
443  if (beamSpotH.isValid()) {
444  edm::LogVerbatim("HcalIsoTrack") << " Beam Spot " << beamSpotH->position();
445  }
446 #endif
447  // RecHits
448  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle = iEvent.getHandle(tok_EB_);
449  if (!barrelRecHitsHandle.isValid()) {
450  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_;
451  okC = false;
452  }
453  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle = iEvent.getHandle(tok_EE_);
454  if (!endcapRecHitsHandle.isValid()) {
455  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_;
456  okC = false;
457  }
459  if (!hbhe.isValid()) {
460  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_;
461  okC = false;
462  }
463  const edm::Handle<CaloTowerCollection> caloTower = iEvent.getHandle(tok_cala_);
464 
465  //Propagate tracks to calorimeter surface)
466  std::vector<spr::propagatedGenParticleID> trackIDs =
467  spr::propagateCALO(genParticles, pdt, geo, bField, etaMax_, false);
468  std::vector<math::XYZTLorentzVector> vecL1, vecL3;
469  t_RunNo = iEvent.id().run();
470  t_EventNo = iEvent.id().event();
471  t_Tracks = (genParticles.product())->size();
472  t_TracksProp = trackIDs.size();
473  t_ietaAll->clear();
474  t_ietaGood->clear();
475  t_trackType->clear();
476  t_trgbits->clear();
477  t_hltbits->clear();
478 #ifdef EDM_ML_DEBUG
479  edm::LogVerbatim("HcalIsoTrack") << "# of propagated tracks " << t_TracksProp << " out of " << t_Tracks
480  << " with Trigger " << ignoreTrigger_;
481 #endif
482 
483  //Trigger
484  t_trgbits->assign(trigNames_.size(), false);
485  t_hltbits->assign(trigNames_.size(), false);
487  t_L1Bit = true;
488  t_TrigPass = false;
489 
490  if (!ignoreTrigger_) {
491  //L1
493  const std::vector<std::pair<std::string, bool> >& finalDecisions = l1GtUtils_->decisionsFinal();
494  for (const auto& decision : finalDecisions) {
495  if (decision.first.find(l1TrigName_) != std::string::npos) {
496  t_L1Bit = decision.second;
497  break;
498  }
499  }
500 #ifdef EDM_ML_DEBUG
501  edm::LogVerbatim("HcalIsoTrack") << "Trigger Information for " << l1TrigName_ << " is " << t_L1Bit
502  << " from a list of " << finalDecisions.size() << " decisions";
503 #endif
504 
505  //HLT
507  if (triggerResults.isValid()) {
508  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
509  const std::vector<std::string>& names = triggerNames.triggerNames();
510  if (!trigNames_.empty()) {
511  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
512  int hlt = triggerResults->accept(iHLT);
513  for (unsigned int i = 0; i < trigNames_.size(); ++i) {
514  if (names[iHLT].find(trigNames_[i]) != std::string::npos) {
515  t_trgbits->at(i) = (hlt > 0);
516  t_hltbits->at(i) = (hlt > 0);
517  if (hlt > 0)
518  t_TrigPass = true;
519 #ifdef EDM_ML_DEBUG
520  edm::LogVerbatim("HcalIsoTrack")
521  << "This trigger " << names[iHLT] << " Flag " << hlt << ":" << t_trgbits->at(i);
522 #endif
523  }
524  }
525  }
526  }
527  }
528 #ifdef EDM_ML_DEBUG
529  edm::LogVerbatim("HcalIsoTrack") << "HLT Information shows " << t_TrigPass << ":" << trigNames_.empty() << ":"
530  << okC;
531 #endif
532  }
533 
534  std::array<int, 3> ntksave{{0, 0, 0}};
535  if (ignoreTrigger_ || useL1Trigger_) {
536  t_l1pt = t_l1eta = t_l1phi = 0;
537  t_l3pt = t_l3eta = t_l3phi = 0;
538  if (ignoreTrigger_ || t_L1Bit)
539  ntksave = fillTree(vecL1,
540  vecL3,
541  leadPV,
542  trackIDs,
543  geo,
544  caloTopology,
545  theHBHETopology,
546  theEcalChStatus,
547  theEcalSevlv,
548  barrelRecHitsHandle,
549  endcapRecHitsHandle,
550  hbhe,
551  caloTower,
552  genParticles,
553  respCorrs);
554  t_TracksSaved = ntksave[0];
555  t_TracksLoose = ntksave[1];
556  t_TracksTight = ntksave[2];
557  } else {
559  edm::Handle<trigger::TriggerEvent> triggerEventHandle = iEvent.getHandle(tok_trigEvt_);
560  if (!triggerEventHandle.isValid()) {
561  edm::LogWarning("HcalIsoTrack") << "Error! Can't get the product " << triggerEvent_.label();
562  } else if (okC) {
563  triggerEvent = *(triggerEventHandle.product());
565  const trigger::TriggerObjectCollection& TOC(triggerEvent.getObjects());
566  bool done(false);
567  if (triggerResults.isValid()) {
568  std::vector<std::string> modules;
569  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
570  const std::vector<std::string>& names = triggerNames.triggerNames();
571  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
572  bool ok = (t_TrigPass) || (trigNames_.empty());
573  if (ok) {
574  unsigned int triggerindx = hltConfig_.triggerIndex(names[iHLT]);
575  const std::vector<std::string>& moduleLabels(hltConfig_.moduleLabels(triggerindx));
576  std::vector<math::XYZTLorentzVector> vecL2;
577  vecL1.clear();
578  vecL3.clear();
579  //loop over all trigger filters in event (i.e. filters passed)
580  for (unsigned int ifilter = 0; ifilter < triggerEvent.sizeFilters(); ++ifilter) {
581  std::vector<int> Keys;
582  std::string label = triggerEvent.filterTag(ifilter).label();
583  //loop over keys to objects passing this filter
584  for (unsigned int imodule = 0; imodule < moduleLabels.size(); imodule++) {
585  if (label.find(moduleLabels[imodule]) != std::string::npos) {
586 #ifdef EDM_ML_DEBUG
587  edm::LogVerbatim("HcalIsoTrack") << "FilterName " << label;
588 #endif
589  for (unsigned int ifiltrKey = 0; ifiltrKey < triggerEvent.filterKeys(ifilter).size(); ++ifiltrKey) {
590  Keys.push_back(triggerEvent.filterKeys(ifilter)[ifiltrKey]);
591  const trigger::TriggerObject& TO(TOC[Keys[ifiltrKey]]);
592  math::XYZTLorentzVector v4(TO.px(), TO.py(), TO.pz(), TO.energy());
593  if (label.find(l2Filter_) != std::string::npos) {
594  vecL2.push_back(v4);
595  } else if (label.find(l3Filter_) != std::string::npos) {
596  vecL3.push_back(v4);
597  } else if ((label.find(l1Filter_) != std::string::npos) || (l1Filter_.empty())) {
598  vecL1.push_back(v4);
599  }
600 #ifdef EDM_ML_DEBUG
601  edm::LogVerbatim("HcalIsoTrack")
602  << "key " << ifiltrKey << " : pt " << TO.pt() << " eta " << TO.eta() << " phi " << TO.phi()
603  << " mass " << TO.mass() << " Id " << TO.id();
604 #endif
605  }
606 #ifdef EDM_ML_DEBUG
607  edm::LogVerbatim("HcalIsoTrack")
608  << "sizes " << vecL1.size() << ":" << vecL2.size() << ":" << vecL3.size();
609 #endif
610  }
611  }
612  }
614  math::XYZTLorentzVector mindRvec1;
615  double mindR1(999);
616  for (unsigned int i = 0; i < vecL2.size(); i++) {
617  double dr = dR(vecL1[0], vecL2[i]);
618 #ifdef EDM_ML_DEBUG
619  edm::LogVerbatim("HcalIsoTrack") << "lvl2[" << i << "] dR " << dr;
620 #endif
621  if (dr < mindR1) {
622  mindR1 = dr;
623  mindRvec1 = vecL2[i];
624  }
625  }
626 #ifdef EDM_ML_DEBUG
627  edm::LogVerbatim("HcalIsoTrack") << "L2 object closest to L1 " << mindRvec1 << " at Dr " << mindR1;
628 #endif
629 
630  if (!vecL1.empty()) {
631  t_l1pt = vecL1[0].pt();
632  t_l1eta = vecL1[0].eta();
633  t_l1phi = vecL1[0].phi();
634  } else {
635  t_l1pt = t_l1eta = t_l1phi = 0;
636  }
637  if (!vecL3.empty()) {
638  t_l3pt = vecL3[0].pt();
639  t_l3eta = vecL3[0].eta();
640  t_l3phi = vecL3[0].phi();
641  } else {
642  t_l3pt = t_l3eta = t_l3phi = 0;
643  }
644  // Now fill in the tree for each selected track
645  if (!done) {
646  ntksave = fillTree(vecL1,
647  vecL3,
648  leadPV,
649  trackIDs,
650  geo,
651  caloTopology,
652  theHBHETopology,
653  theEcalChStatus,
654  theEcalSevlv,
655  barrelRecHitsHandle,
656  endcapRecHitsHandle,
657  hbhe,
658  caloTower,
659  genParticles,
660  respCorrs);
661  t_TracksSaved += ntksave[0];
662  t_TracksLoose += ntksave[1];
663  t_TracksTight += ntksave[2];
664  done = true;
665  }
666  }
667  }
668  }
669  }
670  }
671 #ifdef EDM_ML_DEBUG
672  edm::LogVerbatim("HcalIsoTrack") << "Final results on selected tracks " << t_TracksSaved << ":" << t_TracksLoose
673  << ":" << t_TracksTight;
674 #endif
676  tree2->Fill();
677 }
678 
681  tree = fs->make<TTree>("CalibTree", "CalibTree");
682 
683  tree->Branch("t_Run", &t_Run, "t_Run/I");
684  tree->Branch("t_Event", &t_Event, "t_Event/I");
685  tree->Branch("t_DataType", &t_DataType, "t_DataType/I");
686  tree->Branch("t_ieta", &t_ieta, "t_ieta/I");
687  tree->Branch("t_iphi", &t_iphi, "t_iphi/I");
688  tree->Branch("t_EventWeight", &t_EventWeight, "t_EventWeight/D");
689  tree->Branch("t_nVtx", &t_nVtx, "t_nVtx/I");
690  tree->Branch("t_nTrk", &t_nTrk, "t_nTrk/I");
691  tree->Branch("t_goodPV", &t_goodPV, "t_goodPV/I");
692  tree->Branch("t_l1pt", &t_l1pt, "t_l1pt/D");
693  tree->Branch("t_l1eta", &t_l1eta, "t_l1eta/D");
694  tree->Branch("t_l1phi", &t_l1phi, "t_l1phi/D");
695  tree->Branch("t_l3pt", &t_l3pt, "t_l3pt/D");
696  tree->Branch("t_l3eta", &t_l3eta, "t_l3eta/D");
697  tree->Branch("t_l3phi", &t_l3phi, "t_l3phi/D");
698  tree->Branch("t_p", &t_p, "t_p/D");
699  tree->Branch("t_pt", &t_pt, "t_pt/D");
700  tree->Branch("t_phi", &t_phi, "t_phi/D");
701  tree->Branch("t_mindR1", &t_mindR1, "t_mindR1/D");
702  tree->Branch("t_mindR2", &t_mindR2, "t_mindR2/D");
703  tree->Branch("t_eMipDR", &t_eMipDR, "t_eMipDR/D");
704  tree->Branch("t_eMipDR2", &t_eMipDR2, "t_eMipDR2/D");
705  tree->Branch("t_eMipDR3", &t_eMipDR3, "t_eMipDR3/D");
706  tree->Branch("t_eMipDR4", &t_eMipDR4, "t_eMipDR4/D");
707  tree->Branch("t_eMipDR5", &t_eMipDR5, "t_eMipDR5/D");
708  tree->Branch("t_eHcal", &t_eHcal, "t_eHcal/D");
709  tree->Branch("t_eHcal10", &t_eHcal10, "t_eHcal10/D");
710  tree->Branch("t_eHcal30", &t_eHcal30, "t_eHcal30/D");
711  tree->Branch("t_hmaxNearP", &t_hmaxNearP, "t_hmaxNearP/D");
712  tree->Branch("t_emaxNearP", &t_emaxNearP, "t_emaxNearP/D");
713  tree->Branch("t_eAnnular", &t_eAnnular, "t_eAnnular/D");
714  tree->Branch("t_hAnnular", &t_hAnnular, "t_hAnnular/D");
715  tree->Branch("t_rhoh", &t_rhoh, "t_rhoh/D");
716  tree->Branch("t_selectTk", &t_selectTk, "t_selectTk/O");
717  tree->Branch("t_qltyFlag", &t_qltyFlag, "t_qltyFlag/O");
718  tree->Branch("t_qltyMissFlag", &t_qltyMissFlag, "t_qltyMissFlag/O");
719  tree->Branch("t_qltyPVFlag", &t_qltyPVFlag, "t_qltyPVFlag/O");
720  tree->Branch("t_gentrackP", &t_gentrackP, "t_gentrackP/D");
721 
722  t_DetIds = new std::vector<unsigned int>();
723  t_DetIds1 = new std::vector<unsigned int>();
724  t_DetIds3 = new std::vector<unsigned int>();
725  t_HitEnergies = new std::vector<double>();
726  t_HitEnergies1 = new std::vector<double>();
727  t_HitEnergies3 = new std::vector<double>();
728  t_trgbits = new std::vector<bool>();
729  tree->Branch("t_DetIds", "std::vector<unsigned int>", &t_DetIds);
730  tree->Branch("t_HitEnergies", "std::vector<double>", &t_HitEnergies);
731  tree->Branch("t_trgbits", "std::vector<bool>", &t_trgbits);
732  tree->Branch("t_DetIds1", "std::vector<unsigned int>", &t_DetIds1);
733  tree->Branch("t_DetIds3", "std::vector<unsigned int>", &t_DetIds3);
734  tree->Branch("t_HitEnergies1", "std::vector<double>", &t_HitEnergies1);
735  tree->Branch("t_HitEnergies3", "std::vector<double>", &t_HitEnergies3);
736 
737  tree2 = fs->make<TTree>("EventInfo", "Event Information");
738 
739  tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i");
740  tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i");
741  tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I");
742  tree2->Branch("t_TracksProp", &t_TracksProp, "t_TracksProp/I");
743  tree2->Branch("t_TracksSaved", &t_TracksSaved, "t_TracksSaved/I");
744  tree2->Branch("t_TracksLoose", &t_TracksLoose, "t_TracksLoose/I");
745  tree2->Branch("t_TracksTight", &t_TracksTight, "t_TracksTight/I");
746  tree2->Branch("t_TrigPass", &t_TrigPass, "t_TrigPass/O");
747  tree2->Branch("t_TrigPassSel", &t_TrigPassSel, "t_TrigPassSel/O");
748  tree2->Branch("t_L1Bit", &t_L1Bit, "t_L1Bit/O");
749  tree2->Branch("t_allvertex", &t_allvertex, "t_allvertex/I");
750  t_hltbits = new std::vector<bool>();
751  t_ietaAll = new std::vector<int>();
752  t_ietaGood = new std::vector<int>();
753  t_trackType = new std::vector<int>();
754  tree2->Branch("t_ietaAll", "std::vector<int>", &t_ietaAll);
755  tree2->Branch("t_ietaGood", "std::vector<int>", &t_ietaGood);
756  tree2->Branch("t_trackType", "std::vector<int>", &t_trackType);
757  tree2->Branch("t_hltbits", "std::vector<bool>", &t_hltbits);
758 }
759 
760 // ------------ method called when starting to processes a run ------------
761 void HcalIsoTrkSimAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
762  hdc_ = &iSetup.getData(tok_ddrec_);
763 
764  bool changed_(true);
765  bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_);
766  edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " process " << processName_
767  << " init flag " << flag << " change flag " << changed_;
768  // check if trigger names in (new) config
769  if (changed_) {
770 #ifdef EDM_ML_DEBUG
771  edm::LogVerbatim("HcalIsoTrack") << "New trigger menu found !!!";
772 #endif
773  const unsigned int n(hltConfig_.size());
774  for (unsigned itrig = 0; itrig < trigNames_.size(); itrig++) {
775  unsigned int triggerindx = hltConfig_.triggerIndex(trigNames_[itrig]);
776  if (triggerindx >= n) {
777  edm::LogWarning("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " does not exist in "
778  << "the current menu";
779 #ifdef EDM_ML_DEBUG
780  } else {
781  edm::LogVerbatim("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " exists";
782 #endif
783  }
784  }
785  }
786 }
787 
788 // ------------ method called when ending the processing of a run ------------
790  nRun_++;
791  edm::LogVerbatim("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run();
792 }
793 
796  std::vector<std::string> trig = {"HLT_PFJet40",
797  "HLT_PFJet60",
798  "HLT_PFJet80",
799  "HLT_PFJet140",
800  "HLT_PFJet200",
801  "HLT_PFJet260",
802  "HLT_PFJet320",
803  "HLT_PFJet400",
804  "HLT_PFJet450",
805  "HLT_PFJet500"};
806  desc.add<std::vector<std::string> >("triggers", trig);
807  desc.add<std::string>("processName", "HLT");
808  desc.add<std::string>("l1Filter", "");
809  desc.add<std::string>("l2Filter", "L2Filter");
810  desc.add<std::string>("l3Filter", "Filter");
811  desc.add<double>("pTMin", 1.0), desc.add<double>("maxChargedHadronEta", 3.0);
812  // Minimum momentum of selected isolated track and signal zone
813  desc.add<double>("minimumTrackP", 10.0);
814  desc.add<double>("coneRadius", 34.98);
815  // signal zone in ECAL and MIP energy cutoff
816  desc.add<double>("coneRadiusMIP", 14.0);
817  desc.add<double>("coneRadiusMIP2", 18.0);
818  desc.add<double>("coneRadiusMIP3", 20.0);
819  desc.add<double>("coneRadiusMIP4", 22.0);
820  desc.add<double>("coneRadiusMIP5", 24.0);
821  desc.add<double>("maximumEcalEnergy", 2.0);
822  // following 4 parameters are for isolation cuts and described in the code
823  desc.add<double>("maxTrackP", 8.0);
824  desc.add<double>("slopeTrackP", 0.05090504066);
825  desc.add<double>("isolationEnergyTight", 2.0);
826  desc.add<double>("isolationEnergyLoose", 10.0);
827  // energy thershold for ECAL (from Egamma group)
828  desc.add<double>("EBHitEnergyThreshold", 0.08);
829  desc.add<double>("EEHitEnergyThreshold0", 0.30);
830  desc.add<double>("EEHitEnergyThreshold1", 0.00);
831  desc.add<double>("EEHitEnergyThreshold2", 0.00);
832  desc.add<double>("EEHitEnergyThreshold3", 0.00);
833  desc.add<double>("EEHitEnergyThresholdLow", 0.30);
834  desc.add<double>("EEHitEnergyThresholdHigh", 0.30);
835  // prescale factors
836  desc.add<double>("momentumLow", 40.0);
837  desc.add<double>("momentumHigh", 60.0);
838  desc.add<int>("prescaleLow", 1);
839  desc.add<int>("prescaleHigh", 1);
840  // various labels for collections used in the code
841  desc.add<edm::InputTag>("labelTriggerEvent", edm::InputTag("hltTriggerSummaryAOD", "", "HLT"));
842  desc.add<edm::InputTag>("labelTriggerResult", edm::InputTag("TriggerResults", "", "HLT"));
843  desc.add<std::string>("labelTrack", "generalTracks");
844  desc.add<std::string>("labelVertex", "offlinePrimaryVertices");
845  desc.add<std::string>("labelEBRecHit", "EcalRecHitsEB");
846  desc.add<std::string>("labelEERecHit", "EcalRecHitsEE");
847  desc.add<std::string>("labelHBHERecHit", "hbhereco");
848  desc.add<std::string>("labelBeamSpot", "offlineBeamSpot");
849  desc.add<std::string>("labelCaloTower", "towerMaker");
850  desc.add<edm::InputTag>("algInputTag", edm::InputTag("gtStage2Digis"));
851  desc.add<edm::InputTag>("extInputTag", edm::InputTag("gtStage2Digis"));
852  desc.addUntracked<std::string>("moduleName", "");
853  desc.addUntracked<std::string>("producerName", "");
854  // Various flags used for selecting tracks, choice of energy Method2/0
855  // Data type 0/1 for single jet trigger or others
856  desc.addUntracked<int>("useRaw", 0);
857  desc.addUntracked<bool>("ignoreTriggers", false);
858  desc.addUntracked<bool>("useL1Trigger", false);
859  desc.addUntracked<double>("hcalScale", 1.0);
860  desc.addUntracked<int>("dataType", 0);
861  desc.addUntracked<bool>("unCorrect", false);
862  desc.addUntracked<bool>("collapseDepth", false);
863  desc.addUntracked<std::string>("l1TrigName", "L1_SingleJet60");
864  desc.addUntracked<int>("outMode", 11);
865  std::vector<int> dummy;
866  desc.addUntracked<std::vector<int> >("oldID", dummy);
867  desc.addUntracked<std::vector<int> >("newDepth", dummy);
868  desc.addUntracked<bool>("hep17", false);
869  desc.add<bool>("usePFThreshold", true);
870  descriptions.add("hcalIsoTrkSimAnalyzer", desc);
871 }
872 
873 std::array<int, 3> HcalIsoTrkSimAnalyzer::fillTree(std::vector<math::XYZTLorentzVector>& vecL1,
874  std::vector<math::XYZTLorentzVector>& vecL3,
875  math::XYZPoint& leadPV,
876  std::vector<spr::propagatedGenParticleID>& trackIDs,
877  const CaloGeometry* geo,
878  const CaloTopology* caloTopology,
879  const HcalTopology* theHBHETopology,
880  const EcalChannelStatus* theEcalChStatus,
881  const EcalSeverityLevelAlgo* theEcalSevlv,
882  edm::Handle<EcalRecHitCollection>& barrelRecHitsHandle,
883  edm::Handle<EcalRecHitCollection>& endcapRecHitsHandle,
887  const HcalRespCorrs* respCorrs) {
888  int nSave(0), nLoose(0), nTight(0);
889  //Loop over tracks
890  unsigned int nTracks(0);
891  t_nTrk = trackIDs.size();
892  t_rhoh = (tower.isValid()) ? rhoh(tower) : 0;
893  for (auto const& trkDetItr : trackIDs) {
894  const reco::GenParticle* pTrack = &(*(trkDetItr.trkItr));
895  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p());
896 #ifdef EDM_ML_DEBUG
897  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|"
898  << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p();
899 #endif
900  t_mindR2 = 999;
901  for (unsigned int k = 0; k < vecL3.size(); ++k) {
902  double dr = dR(vecL3[k], v4);
903  if (dr < t_mindR2) {
904  t_mindR2 = dr;
905  }
906  }
907  t_mindR1 = (!vecL1.empty()) ? dR(vecL1[0], v4) : 999;
908 #ifdef EDM_ML_DEBUG
909  edm::LogVerbatim("HcalIsoTrack") << "Closest L3 object at dr :" << t_mindR2 << " and from L1 " << t_mindR1;
910 #endif
911  t_ieta = t_iphi = 0;
912  if (trkDetItr.okHCAL) {
913  HcalDetId detId = (HcalDetId)(trkDetItr.detIdHCAL);
914  t_ieta = detId.ieta();
915  t_iphi = detId.iphi();
916  if (t_p > 40.0 && t_p <= 60.0)
917  t_ietaAll->emplace_back(t_ieta);
918  }
919  //Selection of good track
921  double eIsolation = maxRestrictionP_ * exp(slopeRestrictionP_ * std::abs((double)t_ieta));
922  if (eIsolation < eIsolate1_)
923  eIsolation = eIsolate1_;
924  if (eIsolation < eIsolate2_)
925  eIsolation = eIsolate2_;
926 #ifdef EDM_ML_DEBUG
927  edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << t_qltyFlag << "|" << trkDetItr.okECAL << "|"
928  << trkDetItr.okHCAL << " eIsolation " << eIsolation;
929 #endif
930  t_qltyFlag = (t_selectTk && trkDetItr.okECAL && trkDetItr.okHCAL);
931  bool notMuon = notaMuon(pTrack);
932  if (t_qltyFlag && notMuon) {
933  int nNearTRKs(0);
935  std::vector<DetId> eIds;
936  std::vector<double> eHit;
938  barrelRecHitsHandle,
939  endcapRecHitsHandle,
940  trkDetItr.pointHCAL,
941  trkDetItr.pointECAL,
942  a_mipR_,
943  trkDetItr.directionECAL,
944  eIds,
945  eHit);
946  double eEcal(0);
947  for (unsigned int k = 0; k < eIds.size(); ++k) {
948  if (eHit[k] > eThreshold(eIds[k], geo))
949  eEcal += eHit[k];
950  }
951 #ifdef EDM_ML_DEBUG
952  edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << t_eMipDR << ":" << eEcal;
953 #endif
954  t_eMipDR = eEcal;
957  std::vector<DetId> eIds2;
958  std::vector<double> eHit2;
960  barrelRecHitsHandle,
961  endcapRecHitsHandle,
962  trkDetItr.pointHCAL,
963  trkDetItr.pointECAL,
964  a_mipR2_,
965  trkDetItr.directionECAL,
966  eIds2,
967  eHit2);
968  double eEcal2(0);
969  for (unsigned int k = 0; k < eIds2.size(); ++k) {
970  if (eHit2[k] > eThreshold(eIds2[k], geo))
971  eEcal2 += eHit2[k];
972  }
973 #ifdef EDM_ML_DEBUG
974  edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << t_eMipDR2 << ":" << eEcal2;
975 #endif
976  t_eMipDR2 = eEcal2;
979  std::vector<DetId> eIds3;
980  std::vector<double> eHit3;
982  barrelRecHitsHandle,
983  endcapRecHitsHandle,
984  trkDetItr.pointHCAL,
985  trkDetItr.pointECAL,
986  a_mipR3_,
987  trkDetItr.directionECAL,
988  eIds3,
989  eHit3);
990  double eEcal3(0);
991  for (unsigned int k = 0; k < eIds3.size(); ++k) {
992  if (eHit3[k] > eThreshold(eIds3[k], geo))
993  eEcal3 += eHit3[k];
994  }
995 #ifdef EDM_ML_DEBUG
996  edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << t_eMipDR3 << ":" << eEcal3;
997 #endif
998  t_eMipDR3 = eEcal3;
1001  std::vector<DetId> eIds4;
1002  std::vector<double> eHit4;
1003  t_eMipDR4 = spr::eCone_ecal(geo,
1004  barrelRecHitsHandle,
1005  endcapRecHitsHandle,
1006  trkDetItr.pointHCAL,
1007  trkDetItr.pointECAL,
1008  a_mipR4_,
1009  trkDetItr.directionECAL,
1010  eIds4,
1011  eHit4);
1012  double eEcal4(0);
1013  for (unsigned int k = 0; k < eIds4.size(); ++k) {
1014  if (eHit4[k] > eThreshold(eIds4[k], geo))
1015  eEcal4 += eHit4[k];
1016  }
1017 #ifdef EDM_ML_DEBUG
1018  edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << t_eMipDR4 << ":" << eEcal4;
1019 #endif
1020  t_eMipDR4 = eEcal4;
1023  std::vector<DetId> eIds5;
1024  std::vector<double> eHit5;
1025  t_eMipDR5 = spr::eCone_ecal(geo,
1026  barrelRecHitsHandle,
1027  endcapRecHitsHandle,
1028  trkDetItr.pointHCAL,
1029  trkDetItr.pointECAL,
1030  a_mipR5_,
1031  trkDetItr.directionECAL,
1032  eIds5,
1033  eHit5);
1034  double eEcal5(0);
1035  for (unsigned int k = 0; k < eIds5.size(); ++k) {
1036  if (eHit5[k] > eThreshold(eIds5[k], geo))
1037  eEcal5 += eHit5[k];
1038  }
1039 #ifdef EDM_ML_DEBUG
1040  edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << t_eMipDR5 << ":" << eEcal5;
1041 #endif
1042  t_eMipDR5 = eEcal5;
1044 
1045  t_emaxNearP = spr::chargeIsolationGenEcal(nTracks, trackIDs, geo, caloTopology, 15, 15);
1046  const DetId cellE(trkDetItr.detIdECAL);
1047  std::pair<double, bool> e11x11P = spr::eECALmatrix(cellE,
1048  barrelRecHitsHandle,
1049  endcapRecHitsHandle,
1050  *theEcalChStatus,
1051  geo,
1052  caloTopology,
1053  theEcalSevlv,
1054  5,
1055  5,
1056  -100.0,
1057  -100.0,
1058  -100.0,
1059  100.0);
1060  std::pair<double, bool> e15x15P = spr::eECALmatrix(cellE,
1061  barrelRecHitsHandle,
1062  endcapRecHitsHandle,
1063  *theEcalChStatus,
1064  geo,
1065  caloTopology,
1066  theEcalSevlv,
1067  7,
1068  7,
1069  -100.0,
1070  -100.0,
1071  -100.0,
1072  100.0);
1073  if (e11x11P.second && e15x15P.second) {
1074  t_eAnnular = (e15x15P.first - e11x11P.first);
1075  } else {
1076  t_eAnnular = -(e15x15P.first - e11x11P.first);
1077  }
1078  t_hmaxNearP = spr::chargeIsolationGenCone(nTracks, trackIDs, a_charIsoR_, nNearTRKs, false);
1079  const DetId cellH(trkDetItr.detIdHCAL);
1080  double h5x5 = spr::eHCALmatrix(
1081  theHBHETopology, cellH, hbhe, 2, 2, false, true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1082  double h7x7 = spr::eHCALmatrix(
1083  theHBHETopology, cellH, hbhe, 3, 3, false, true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1084  t_hAnnular = h7x7 - h5x5;
1085 #ifdef EDM_ML_DEBUG
1086  edm::LogVerbatim("HcalIsoTrack") << "max p Near (Ecal) " << t_emaxNearP << " (Hcal) " << t_hmaxNearP
1087  << " Annular E (Ecal) " << e11x11P.first << ":" << e15x15P.first << ":"
1088  << t_eAnnular << " (Hcal) " << h5x5 << ":" << h7x7 << ":" << t_hAnnular;
1089 #endif
1090  t_gentrackP = pTrack->p();
1091  if (t_eMipDR < eEcalMax_ && t_hmaxNearP < eIsolation) {
1092  t_DetIds->clear();
1093  t_HitEnergies->clear();
1094  t_DetIds1->clear();
1095  t_HitEnergies1->clear();
1096  t_DetIds3->clear();
1097  t_HitEnergies3->clear();
1098  int nRecHits(-999), nRecHits1(-999), nRecHits3(-999);
1099  std::vector<DetId> ids, ids1, ids3;
1100  std::vector<double> edet0, edet1, edet3;
1101  t_eHcal = spr::eCone_hcal(geo,
1102  hbhe,
1103  trkDetItr.pointHCAL,
1104  trkDetItr.pointECAL,
1105  a_coneR_,
1106  trkDetItr.directionHCAL,
1107  nRecHits,
1108  ids,
1109  edet0,
1110  useRaw_);
1111  if (!oldID_.empty()) {
1112  for (unsigned k = 0; k < ids.size(); ++k)
1113  ids[k] = newId(ids[k]);
1114  }
1115  storeEnergy(0, respCorrs, ids, edet0, t_eHcal, t_DetIds, t_HitEnergies);
1116 
1117  //----- hcal energy in the extended cone 1 (a_coneR+10) --------------
1118  t_eHcal10 = spr::eCone_hcal(geo,
1119  hbhe,
1120  trkDetItr.pointHCAL,
1121  trkDetItr.pointECAL,
1122  a_coneR1_,
1123  trkDetItr.directionHCAL,
1124  nRecHits1,
1125  ids1,
1126  edet1,
1127  useRaw_);
1128  if (!oldID_.empty()) {
1129  for (unsigned k = 0; k < ids1.size(); ++k)
1130  ids1[k] = newId(ids1[k]);
1131  }
1132  storeEnergy(1, respCorrs, ids1, edet1, t_eHcal10, t_DetIds1, t_HitEnergies1);
1133 
1134  //----- hcal energy in the extended cone 3 (a_coneR+30) --------------
1135  t_eHcal30 = spr::eCone_hcal(geo,
1136  hbhe,
1137  trkDetItr.pointHCAL,
1138  trkDetItr.pointECAL,
1139  a_coneR2_,
1140  trkDetItr.directionHCAL,
1141  nRecHits3,
1142  ids3,
1143  edet3,
1144  useRaw_);
1145  if (!oldID_.empty()) {
1146  for (unsigned k = 0; k < ids3.size(); ++k)
1147  ids3[k] = newId(ids3[k]);
1148  }
1149  storeEnergy(3, respCorrs, ids3, edet3, t_eHcal30, t_DetIds3, t_HitEnergies3);
1150 
1151  t_p = pTrack->p();
1152  t_pt = pTrack->pt();
1153  t_phi = pTrack->phi();
1154 
1155 #ifdef EDM_ML_DEBUG
1156  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << t_pt << "|"
1157  << pTrack->eta() << "|" << t_phi << "|" << t_p << " Generator Level p "
1158  << t_gentrackP;
1159  edm::LogVerbatim("HcalIsoTrack") << "e_MIP " << t_eMipDR << " Chg Isolation " << t_hmaxNearP << " eHcal"
1160  << t_eHcal << " ieta " << t_ieta << " Quality " << t_qltyMissFlag << ":"
1161  << t_qltyPVFlag << ":" << t_selectTk;
1162  for (unsigned int ll = 0; ll < t_DetIds->size(); ll++) {
1163  edm::LogVerbatim("HcalIsoTrack")
1164  << "det id is = " << t_DetIds->at(ll) << " hit enery is = " << t_HitEnergies->at(ll);
1165  }
1166  for (unsigned int ll = 0; ll < t_DetIds1->size(); ll++) {
1167  edm::LogVerbatim("HcalIsoTrack")
1168  << "det id is = " << t_DetIds1->at(ll) << " hit enery is = " << t_HitEnergies1->at(ll);
1169  }
1170  for (unsigned int ll = 0; ll < t_DetIds3->size(); ll++) {
1171  edm::LogVerbatim("HcalIsoTrack")
1172  << "det id is = " << t_DetIds3->at(ll) << " hit enery is = " << t_HitEnergies3->at(ll);
1173  }
1174 #endif
1175  bool accept(false);
1176  if (t_p > pTrackMin_) {
1177  if (t_p < pTrackLow_) {
1178  ++nLow_;
1179  if (prescaleLow_ <= 1)
1180  accept = true;
1181  else if (nLow_ % prescaleLow_ == 1)
1182  accept = true;
1183  } else if (t_p > pTrackHigh_) {
1184  ++nHigh_;
1185  if (prescaleHigh_ <= 1)
1186  accept = true;
1187  else if (nHigh_ % prescaleHigh_ == 1)
1188  accept = true;
1189  } else {
1190  accept = true;
1191  }
1192  }
1193  if (accept) {
1194  tree->Fill();
1195  nSave++;
1196  int type(0);
1197  if (t_eMipDR < 1.0) {
1198  if (t_hmaxNearP < eIsolate2_) {
1199  ++nLoose;
1200  type = 1;
1201  }
1202  if (t_hmaxNearP < eIsolate1_) {
1203  ++nTight;
1204  type = 2;
1205  }
1206  }
1207  if (t_p > 40.0 && t_p <= 60.0 && t_selectTk) {
1208  t_ietaGood->emplace_back(t_ieta);
1209  t_trackType->emplace_back(type);
1210  }
1211 #ifdef EDM_ML_DEBUG
1212  for (unsigned int k = 0; k < t_trgbits->size(); k++) {
1213  edm::LogVerbatim("HcalIsoTrack") << "trigger bit is = " << t_trgbits->at(k);
1214  }
1215 #endif
1216  }
1217  }
1218  }
1219  ++nTracks;
1220  }
1221  std::array<int, 3> i3{{nSave, nLoose, nTight}};
1222  return i3;
1223 }
1224 
1226  return reco::deltaR(vec1.eta(), vec1.phi(), vec2.eta(), vec2.phi());
1227 }
1228 
1230  std::vector<double> sumPFNallSMDQH2;
1231  sumPFNallSMDQH2.reserve(phibins_.size() * etabins_.size());
1232 
1233  for (auto eta : etabins_) {
1234  for (auto phi : phibins_) {
1235  double hadder = 0;
1236  for (const auto& pf_it : (*tower)) {
1237  if (fabs(eta - pf_it.eta()) > etahalfdist_)
1238  continue;
1239  if (fabs(reco::deltaPhi(phi, pf_it.phi())) > phihalfdist_)
1240  continue;
1241  hadder += pf_it.hadEt();
1242  }
1243  sumPFNallSMDQH2.emplace_back(hadder);
1244  }
1245  }
1246 
1247  double evt_smdq(0);
1248  std::sort(sumPFNallSMDQH2.begin(), sumPFNallSMDQH2.end());
1249  if (sumPFNallSMDQH2.size() % 2)
1250  evt_smdq = sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 1) / 2];
1251  else
1252  evt_smdq = (sumPFNallSMDQH2[sumPFNallSMDQH2.size() / 2] + sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 2) / 2]) / 2.;
1253  double rhoh = evt_smdq / (etadist_ * phidist_);
1254 #ifdef EDM_ML_DEBUG
1255  edm::LogVerbatim("HcalIsoTrack") << "Rho " << evt_smdq << ":" << rhoh;
1256 #endif
1257  return rhoh;
1258 }
1259 
1260 double HcalIsoTrkSimAnalyzer::eThreshold(const DetId& id, const CaloGeometry* geo) const {
1261  double eThr(hitEthrEB_);
1262  if (usePFThresh_) {
1263  eThr = static_cast<double>((*eThresholds_)[id]);
1264  } else {
1265  const GlobalPoint& pos = geo->getPosition(id);
1266  double eta = std::abs(pos.eta());
1267  if (id.subdetId() != EcalBarrel) {
1268  eThr = (((eta * hitEthrEE3_ + hitEthrEE2_) * eta + hitEthrEE1_) * eta + hitEthrEE0_);
1269  if (eThr < hitEthrEELo_)
1270  eThr = hitEthrEELo_;
1271  else if (eThr > hitEthrEEHi_)
1272  eThr = hitEthrEEHi_;
1273  }
1274  }
1275  return eThr;
1276 }
1277 
1279  HcalDetId hid(id);
1280  if (hep17_ && ((hid.iphi() < 63) || (hid.iphi() > 66) || (hid.zside() < 0)))
1281  return id;
1282  for (unsigned int k = 0; k < oldID_.size(); ++k) {
1283  if ((hid.subdetId() == oldDet_[k]) && (hid.ietaAbs() == oldEta_[k]) && (hid.depth() == oldDepth_[k])) {
1284  return static_cast<DetId>(HcalDetId(hid.subdet(), hid.ieta(), hid.iphi(), newDepth_[k]));
1285  }
1286  }
1287  return id;
1288 }
1289 
1291  const HcalRespCorrs* respCorrs,
1292  const std::vector<DetId>& ids,
1293  std::vector<double>& edet,
1294  double& eHcal,
1295  std::vector<unsigned int>* detIds,
1296  std::vector<double>* hitEnergies) {
1297  double ehcal(0);
1298  if (unCorrect_) {
1299  for (unsigned int k = 0; k < ids.size(); ++k) {
1300  double corr = (respCorrs->getValues(ids[k]))->getValue();
1301  if (corr != 0)
1302  edet[k] /= corr;
1303  ehcal += edet[k];
1304  }
1305  } else {
1306  for (const auto& en : edet)
1307  ehcal += en;
1308  }
1309  if ((std::abs(ehcal - eHcal) > 0.001) && (!unCorrect_))
1310  edm::LogWarning("HcalIsoTrack") << "Check inconsistent energies: " << indx << " " << eHcal << ":" << ehcal
1311  << " from " << ids.size() << " cells";
1312  eHcal = hcalScale_ * ehcal;
1313 
1314  if (collapseDepth_) {
1315  std::map<HcalDetId, double> hitMap;
1316  for (unsigned int k = 0; k < ids.size(); ++k) {
1317  HcalDetId id = hdc_->mergedDepthDetId(HcalDetId(ids[k]));
1318  auto itr = hitMap.find(id);
1319  if (itr == hitMap.end()) {
1320  hitMap[id] = edet[k];
1321  } else {
1322  (itr->second) += edet[k];
1323  }
1324  }
1325  detIds->reserve(hitMap.size());
1326  hitEnergies->reserve(hitMap.size());
1327  for (const auto& hit : hitMap) {
1328  detIds->emplace_back(hit.first.rawId());
1329  hitEnergies->emplace_back(hit.second);
1330  }
1331  } else {
1332  detIds->reserve(ids.size());
1333  hitEnergies->reserve(ids.size());
1334  for (unsigned int k = 0; k < ids.size(); ++k) {
1335  detIds->emplace_back(ids[k].rawId());
1336  hitEnergies->emplace_back(edet[k]);
1337  }
1338  }
1339 #ifdef EDM_ML_DEBUG
1340  edm::LogVerbatim("HcalIsoTrack") << "Input to storeEnergy with " << ids.size() << " cells";
1341  for (unsigned int k = 0; k < ids.size(); ++k)
1342  edm::LogVerbatim("HcalIsoTrack") << "Hit [" << k << "] " << HcalDetId(ids[k]) << " E " << edet[k];
1343  edm::LogVerbatim("HcalIsoTrack") << "Output of storeEnergy with " << detIds->size() << " cells and Etot " << eHcal;
1344  for (unsigned int k = 0; k < detIds->size(); ++k)
1345  edm::LogVerbatim("HcalIsoTrack") << "Hit [" << k << "] " << HcalDetId((*detIds)[k]) << " E " << (*hitEnergies)[k];
1346 #endif
1347 }
1348 
1350  int id = pTrack->pdgId();
1351  bool flag = ((id != 13) && (id != -13) && (pTrack->charge() != 0));
1352 #ifdef EDM_ML_DEBUG
1353  edm::LogVerbatim("HcalIsoTrack") << "notaMuon: ID " << id << " charge " << pTrack->charge() << " Flag " << flag;
1354 #endif
1355  return flag;
1356 }
1357 
1358 //define this as a plug-in
size
Write out results.
static const std::string kSharedResource
Definition: TFileService.h:76
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1, int useRaw=0, bool debug=false)
Log< level::Info, true > LogVerbatim
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
const std::vector< int > newDepth_
void beginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
HcalIsoTrkSimAnalyzer(edm::ParameterSet const &)
std::vector< double > * t_HitEnergies3
double pz() const final
z coordinate of momentum vector
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
double pt() const final
transverse momentum
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
HcalDetId mergedDepthDetId(const HcalDetId &id) const
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
const Point & position() const
position
Definition: BeamSpot.h:59
HepPDT::ParticleDataTable ParticleDataTable
std::vector< double > * t_HitEnergies
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
T const * product() const
Definition: Handle.h:70
const std::string labelRecVtx_
const std::vector< std::string > trigNames_
l1t::L1TGlobalUtil * l1GtUtils_
double chargeIsolationGenCone(unsigned int trkIndex, std::vector< spr::propagatedGenParticleID > &trackIDs, double dR, int &nNearTRKs, bool debug=false)
const edm::InputTag algTag_
std::vector< int > * t_ietaGood
std::vector< double > etabins_
std::vector< double > phibins_
std::string const & label() const
Definition: InputTag.h:36
const edm::InputTag triggerEvent_
std::vector< bool > * t_hltbits
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
double chargeIsolationGenEcal(unsigned int trkIndex, std::vector< spr::propagatedGenParticleID > &trackIDs, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
float energy() const
Definition: TriggerObject.h:61
std::vector< unsigned int > * t_DetIds1
const std::string names[nVars_]
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
const Item * getValues(DetId fId, bool throwOnFail=true) const
edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_caloTopology_
DetId newId(const DetId &)
int pdgId() const final
PDG identifier.
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double rhoh(const edm::Handle< CaloTowerCollection > &)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
char const * label
const std::vector< int > oldID_
bool notaMuon(const reco::GenParticle *pTrack)
double px() const final
x coordinate of momentum vector
std::vector< int > oldDepth_
int iEvent
Definition: GenABIO.cc:224
RunNumber_t run() const
Definition: RunBase.h:40
double p() const final
magnitude of momentum vector
dictionary corr
const EcalPFRecHitThresholds * eThresholds_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
unsigned int size() const
number of trigger paths in trigger table
std::vector< double > vec1
Definition: HCALResponse.h:15
edm::EDGetTokenT< BXVector< GlobalAlgBlk > > tok_alg_
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
const HcalDDDRecConstants * hdc_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< int > * t_ietaAll
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
void storeEnergy(int indx, const HcalRespCorrs *respCorrs, const std::vector< DetId > &ids, std::vector< double > &edet, double &eHcal, std::vector< unsigned int > *detIds, std::vector< double > *hitEnergies)
int id() const
getters
Definition: TriggerObject.h:51
std::vector< int > * t_trackType
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::array< int, 3 > fillTree(std::vector< math::XYZTLorentzVector > &vecL1, std::vector< math::XYZTLorentzVector > &vecL3, math::XYZPoint &leadPV, std::vector< spr::propagatedGenParticleID > &trackIDs, const CaloGeometry *geo, const CaloTopology *topo, const HcalTopology *theHBHETopology, const EcalChannelStatus *theEcalChStatus, const EcalSeverityLevelAlgo *theEcalSevlv, edm::Handle< EcalRecHitCollection > &barrelRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapRecHitsHandle, edm::Handle< HBHERecHitCollection > &hbhe, const edm::Handle< CaloTowerCollection > &towerHandle, edm::Handle< reco::GenParticleCollection > &genParticles, const HcalRespCorrs *respCorrs)
static std::string const triggerResults
Definition: EdmProvDump.cc:47
const edm::InputTag extTag_
double py() const final
y coordinate of momentum vector
std::vector< unsigned int > * t_DetIds3
~HcalIsoTrkSimAnalyzer() override=default
edm::EDGetTokenT< reco::GenParticleCollection > tok_parts_
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
#define M_PI
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
edm::EDGetTokenT< CaloTowerCollection > tok_cala_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_ecalChStatus_
Definition: DetId.h:17
std::vector< unsigned int > * t_DetIds
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > tok_ecalPFRecHitThresholds_
void analyze(edm::Event const &, edm::EventSetup const &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< double > * t_HitEnergies1
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
bool isValid() const
Definition: HandleBase.h:70
const std::string processName_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
fixed size matrix
HLT enums.
std::vector< bool > * t_trgbits
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
const std::vector< std::pair< std::string, bool > > & decisionsFinal()
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > tok_pdt_
const std::string labelGenTrack_
Definition: tree.py:1
Log< level::Warning, false > LogWarning
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
double eThreshold(const DetId &id, const CaloGeometry *geo) const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
double phi() const final
momentum azimuthal angle
const edm::InputTag theTriggerResultsLabel_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
void setTopo(const HcalTopology *topo)
void retrieveL1(const edm::Event &iEvent, const edm::EventSetup &evSetup)
initialize the class (mainly reserve)
Definition: Run.h:45
int charge() const final
electric charge
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)
double eta() const final
momentum pseudorapidity
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164