CMS 3D CMS Logo

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