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