CMS 3D CMS Logo

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