CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlCaIsoTracksProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //#define EDM_ML_DEBUG
3 
4 // system include files
5 #include <atomic>
6 #include <memory>
7 #include <string>
8 #include <cmath>
9 #include <iostream>
10 #include <sstream>
11 #include <fstream>
12 #include <vector>
13 #include <boost/regex.hpp>
14 
15 // user include files
25 
52 
54 
59 
73 
74 //#define EDM_ML_DEBUG
75 //
76 // class declaration
77 //
78 
79 namespace AlCaIsoTracks {
80  struct Counters {
81  Counters() : nAll_(0), nGood_(0), nRange_(0) {}
82  mutable std::atomic<unsigned int> nAll_, nGood_, nRange_;
83  };
84 } // namespace AlCaIsoTracks
85 
86 class AlCaIsoTracksProducer : public edm::stream::EDProducer<edm::GlobalCache<AlCaIsoTracks::Counters> > {
87 public:
89  ~AlCaIsoTracksProducer() override;
90 
91  static std::unique_ptr<AlCaIsoTracks::Counters> initializeGlobalCache(edm::ParameterSet const&) {
92  return std::make_unique<AlCaIsoTracks::Counters>();
93  }
94 
95  void produce(edm::Event&, edm::EventSetup const&) override;
96  void endStream() override;
97  static void globalEndJob(const AlCaIsoTracks::Counters* counters);
98  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
99 
100 private:
101  void beginRun(edm::Run const&, edm::EventSetup const&) override;
102  void endRun(edm::Run const&, edm::EventSetup const&) override;
104  const std::vector<std::string>& triggerNames_,
105  edm::Handle<reco::TrackCollection>& trkCollection,
106  math::XYZPoint& leadPV,
107  edm::Handle<EcalRecHitCollection>& barrelRecHitsHandle,
108  edm::Handle<EcalRecHitCollection>& endcapRecHitsHandle,
110  double ptL1,
111  double etaL1,
112  double phiL1);
114  double& ptL1,
115  double& etaL1,
116  double& phiL1);
117 
118  // ----------member data ---------------------------
120  unsigned int nRun_, nAll_, nGood_, nRange_;
122  const std::vector<std::string> trigNames_;
124  const double a_coneR_, a_mipR_;
127  const double pTrackLow_, pTrackHigh_;
128  const int preScale_;
133  double a_charIsoR_;
136 
148 };
149 
151  : nRun_(0),
152  nAll_(0),
153  nGood_(0),
154  nRange_(0),
155  trigNames_(iConfig.getParameter<std::vector<std::string> >("triggers")),
156  theTrackQuality_(iConfig.getParameter<std::string>("trackQuality")),
157  processName_(iConfig.getParameter<std::string>("processName")),
158  a_coneR_(iConfig.getParameter<double>("coneRadius")),
159  a_mipR_(iConfig.getParameter<double>("coneRadiusMIP")),
160  maxRestrictionP_(iConfig.getParameter<double>("maxTrackP")),
161  slopeRestrictionP_(iConfig.getParameter<double>("slopeTrackP")),
162  pTrackMin_(iConfig.getParameter<double>("minimumTrackP")),
163  eEcalMax_(iConfig.getParameter<double>("maximumEcalEnergy")),
164  eIsolate_(iConfig.getParameter<double>("isolationEnergy")),
165  pTrackLow_(iConfig.getParameter<double>("momentumRangeLow")),
166  pTrackHigh_(iConfig.getParameter<double>("momentumRangeHigh")),
167  preScale_(iConfig.getParameter<int>("preScaleFactor")),
168  labelGenTrack_(iConfig.getParameter<edm::InputTag>("TrackLabel")),
169  labelRecVtx_(iConfig.getParameter<edm::InputTag>("VertexLabel")),
170  labelBS_(iConfig.getParameter<edm::InputTag>("BeamSpotLabel")),
171  labelEB_(iConfig.getParameter<edm::InputTag>("EBRecHitLabel")),
172  labelEE_(iConfig.getParameter<edm::InputTag>("EERecHitLabel")),
173  labelHBHE_(iConfig.getParameter<edm::InputTag>("HBHERecHitLabel")),
174  labelHltGT_(iConfig.getParameter<edm::InputTag>("L1GTSeedLabel")),
175  labelTriggerEvent_(iConfig.getParameter<edm::InputTag>("TriggerEventLabel")),
176  labelTriggerResults_(iConfig.getParameter<edm::InputTag>("TriggerResultLabel")),
177  labelIsoTk_(iConfig.getParameter<std::string>("IsoTrackLabel")) {
178  // Get the run parameters
179  // Different isolation cuts are described in DN-2016/029
180  // Tight cut uses 2 GeV; Loose cut uses 10 GeV
181  // Eta dependent cut uses (maxRestrictionP_ * exp(|ieta|*log(2.5)/18))
182  // with the factor for exponential slopeRestrictionP_ = log(2.5)/18
183  // maxRestrictionP_ = 8 GeV as came from a study
184  const double isolationRadius(28.9);
185  selectionParameter_.minPt = iConfig.getParameter<double>("minTrackPt");
186  ;
188  selectionParameter_.maxDxyPV = iConfig.getParameter<double>("maxDxyPV");
189  selectionParameter_.maxDzPV = iConfig.getParameter<double>("maxDzPV");
190  selectionParameter_.maxChi2 = iConfig.getParameter<double>("maxChi2");
191  selectionParameter_.maxDpOverP = iConfig.getParameter<double>("maxDpOverP");
192  selectionParameter_.minOuterHit = iConfig.getParameter<int>("minOuterHit");
193  selectionParameter_.minLayerCrossed = iConfig.getParameter<int>("minLayerCrossed");
194  selectionParameter_.maxInMiss = iConfig.getParameter<int>("maxInMiss");
195  selectionParameter_.maxOutMiss = iConfig.getParameter<int>("maxOutMiss");
196  a_charIsoR_ = a_coneR_ + isolationRadius;
197 
198  // define tokens for access
199  tok_hltGT_ = consumes<trigger::TriggerFilterObjectWithRefs>(labelHltGT_);
200  tok_trigEvt_ = consumes<trigger::TriggerEvent>(labelTriggerEvent_);
201  tok_trigRes_ = consumes<edm::TriggerResults>(labelTriggerResults_);
202  tok_genTrack_ = consumes<reco::TrackCollection>(labelGenTrack_);
203  tok_recVtx_ = consumes<reco::VertexCollection>(labelRecVtx_);
204  tok_bs_ = consumes<reco::BeamSpot>(labelBS_);
205  tok_EB_ = consumes<EcalRecHitCollection>(labelEB_);
206  tok_EE_ = consumes<EcalRecHitCollection>(labelEE_);
207  tok_hbhe_ = consumes<HBHERecHitCollection>(labelHBHE_);
208  // for event setup
209  tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
210  tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>();
211 
212  edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n"
213  << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality "
214  << theTrackQuality_ << "\t minQuality " << selectionParameter_.minQuality
215  << "\t maxDxyPV " << selectionParameter_.maxDxyPV << "\t maxDzPV "
217  << "\t maxDpOverP " << selectionParameter_.maxDpOverP << "\t minOuterHit "
218  << selectionParameter_.minOuterHit << "\t minLayerCrossed "
219  << selectionParameter_.minLayerCrossed << "\t maxInMiss "
220  << selectionParameter_.maxInMiss << "\t maxOutMiss "
222  << "\t a_coneR " << a_coneR_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR "
223  << a_mipR_ << "\t pTrackMin " << pTrackMin_ << "\t eEcalMax " << eEcalMax_
224  << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ "
225  << slopeRestrictionP_ << "\t eIsolate_ " << eIsolate_ << "\t Process "
226  << processName_ << "\n"
227  << "\t Precale factor " << preScale_ << "\t in momentum range " << pTrackLow_ << ":"
228  << pTrackHigh_;
229  for (unsigned int k = 0; k < trigNames_.size(); ++k)
230  edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k];
231 
232  //create also IsolatedPixelTrackCandidateCollection which contains isolation info and reference to primary track
233  produces<reco::HcalIsolatedTrackCandidateCollection>(labelIsoTk_);
234  produces<reco::VertexCollection>(labelRecVtx_.label());
235  produces<EcalRecHitCollection>(labelEB_.instance());
236  produces<EcalRecHitCollection>(labelEE_.instance());
237  produces<HBHERecHitCollection>(labelHBHE_.label());
238 
239  edm::LogVerbatim("HcalIsoTrack") << " Expected to produce the collections:\n"
240  << "reco::HcalIsolatedTrackCandidateCollection "
241  << " with label HcalIsolatedTrackCollection\n"
242  << "reco::VertexCollection with label " << labelRecVtx_.label() << "\n"
243  << "EcalRecHitCollection with label EcalRecHitsEB\n"
244  << "EcalRecHitCollection with label EcalRecHitsEE\n"
245  << "HBHERecHitCollection with label " << labelHBHE_.label();
246 }
247 
249 
252  // producer for (HCAL isolated tracks)
253  desc.add<edm::InputTag>("TrackLabel", edm::InputTag("generalTracks"));
254  desc.add<edm::InputTag>("VertexLabel", edm::InputTag("offlinePrimaryVertices"));
255  desc.add<edm::InputTag>("BeamSpotLabel", edm::InputTag("offlineBeamSpot"));
256  desc.add<edm::InputTag>("EBRecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
257  desc.add<edm::InputTag>("EERecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
258  desc.add<edm::InputTag>("HBHERecHitLabel", edm::InputTag("hbhereco"));
259  desc.add<edm::InputTag>("L1GTSeedLabel", edm::InputTag("hltL1sV0SingleJet60"));
260  desc.add<edm::InputTag>("TriggerEventLabel", edm::InputTag("hltTriggerSummaryAOD", "", "HLT"));
261  desc.add<edm::InputTag>("TriggerResultLabel", edm::InputTag("TriggerResults", "", "HLT"));
262  desc.add<std::string>("IsoTrackLabel", "HcalIsolatedTrackCollection");
263  std::vector<std::string> triggers = {"HLT_IsoTrackHB", "HLT_IsoTrackHE"};
264  desc.add<std::vector<std::string> >("triggers", triggers);
265  desc.add<std::string>("processName", "HLT");
266  // following 10 parameters are parameters to select good tracks
267  desc.add<std::string>("trackQuality", "highPurity");
268  desc.add<double>("minTrackPt", 1.0);
269  desc.add<double>("maxDxyPV", 10.0);
270  desc.add<double>("maxDzPV", 100.0);
271  desc.add<double>("maxChi2", 5.0);
272  desc.add<double>("maxDpOverP", 0.1);
273  desc.add<int>("minOuterHit", 4);
274  desc.add<int>("minLayerCrossed", 8);
275  desc.add<int>("maxInMiss", 2);
276  desc.add<int>("maxOutMiss", 2);
277  // Minimum momentum of selected isolated track and signal zone
278  desc.add<double>("coneRadius", 34.98);
279  desc.add<double>("minimumTrackP", 20.0);
280  // signal zone in ECAL and MIP energy cutoff
281  desc.add<double>("coneRadiusMIP", 14.0);
282  desc.add<double>("maximumEcalEnergy", 2.0);
283  // following 3 parameters are for isolation cuts and described in the code
284  desc.add<double>("maxTrackP", 8.0);
285  desc.add<double>("slopeTrackP", 0.05090504066);
286  desc.add<double>("isolationEnergy", 10.0);
287  // Prescale events only containing isolated tracks in the range
288  desc.add<double>("momentumRangeLow", 20.0);
289  desc.add<double>("momentumRangeHigh", 40.0);
290  desc.add<int>("preScaleFactor", 10);
291  descriptions.add("alcaisotrk", desc);
292 }
293 
295  nAll_++;
296 #ifdef EDM_ML_DEBUG
297  edm::LogVerbatim("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity "
298  << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing();
299 #endif
300  bool valid(true);
301  //Step1: Get all the relevant containers
302  trigger::TriggerEvent triggerEvent;
303  auto const& triggerEventHandle = iEvent.getHandle(tok_trigEvt_);
304  if (!triggerEventHandle.isValid()) {
305  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerEvent_;
306  valid = false;
307  }
308  auto const& triggerResults = iEvent.getHandle(tok_trigRes_);
309  if (!triggerResults.isValid()) {
310  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerResults_;
311  valid = false;
312  }
313 
314  auto trkCollection = iEvent.getHandle(tok_genTrack_);
315  if (!trkCollection.isValid()) {
316  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_;
317  valid = false;
318  }
319 
320  auto const& recVtxs = iEvent.getHandle(tok_recVtx_);
321  if (!recVtxs.isValid()) {
322  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_;
323  valid = false;
324  }
325 
326  auto const& beamSpotH = iEvent.getHandle(tok_bs_);
327  math::XYZPoint leadPV(0, 0, 0);
328  if (valid) {
329  if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
330  leadPV = math::XYZPoint((*recVtxs)[0].x(), (*recVtxs)[0].y(), (*recVtxs)[0].z());
331  } else if (beamSpotH.isValid()) {
332  leadPV = beamSpotH->position();
333  }
334  }
335 #ifdef EDM_ML_DEBUG
336  edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV;
337 #endif
338 
339  auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_);
340  if (!barrelRecHitsHandle.isValid()) {
341  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_;
342  valid = false;
343  }
344  auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_);
345  if (!endcapRecHitsHandle.isValid()) {
346  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_;
347  valid = false;
348  }
349  auto hbhe = iEvent.getHandle(tok_hbhe_);
350  if (!hbhe.isValid()) {
351  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_;
352  valid = false;
353  }
354 
355  //Get L1 trigger object
356  double ptL1(0), etaL1(0), phiL1(0);
357  auto const& l1trigobj = iEvent.getHandle(tok_hltGT_);
358 
359  if (l1trigobj.isValid()) {
360  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
361  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
362  setPtEtaPhi(l1tauobjref, ptL1, etaL1, phiL1);
363 
364  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
365  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
366  setPtEtaPhi(l1jetobjref, ptL1, etaL1, phiL1);
367 
368  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
369  l1trigobj->getObjects(trigger::TriggerL1ForJet, l1forjetobjref);
370  setPtEtaPhi(l1forjetobjref, ptL1, etaL1, phiL1);
371  } else {
372  valid = false;
373  }
374 
375  auto outputHcalIsoTrackColl = std::make_unique<reco::HcalIsolatedTrackCandidateCollection>();
376  auto outputVColl = std::make_unique<reco::VertexCollection>();
377  auto outputEBColl = std::make_unique<EBRecHitCollection>();
378  auto outputEEColl = std::make_unique<EERecHitCollection>();
379  auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
380 
381  //For valid HLT record
382  if (!valid) {
383  edm::LogWarning("HcalIsoTrack") << "Error! Can't get some of the products";
384  } else {
385  trigger::TriggerEvent triggerEvent = *(triggerEventHandle.product());
386  if (triggerResults.isValid()) {
388  const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
390  triggerNames_,
391  trkCollection,
392  leadPV,
393  barrelRecHitsHandle,
394  endcapRecHitsHandle,
395  hbhe,
396  ptL1,
397  etaL1,
398  phiL1);
399 #ifdef EDM_ML_DEBUG
400  edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksProducer::select returns " << isotk->size()
401  << " isolated tracks";
402 #endif
403 
404  if (!isotk->empty()) {
405  int ntrin(0), ntrout(0);
406  for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
407  ++itr) {
408  if (itr->p() > pTrackLow_ && itr->p() < pTrackHigh_)
409  ntrin++;
410  else
411  ntrout++;
412  }
413  bool selectEvent = ntrout > 0;
414  if (!selectEvent && ntrin > 0) {
415  ++nRange_;
416  if (preScale_ <= 1)
417  selectEvent = true;
418  else if (nRange_ % preScale_ == 1)
419  selectEvent = true;
420  }
421  if (selectEvent) {
422  for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
423  ++itr)
424  outputHcalIsoTrackColl->push_back(*itr);
425 
426  for (reco::VertexCollection::const_iterator vtx = recVtxs->begin(); vtx != recVtxs->end(); ++vtx)
427  outputVColl->push_back(*vtx);
428 
429  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = barrelRecHitsHandle->begin();
430  ehit != barrelRecHitsHandle->end();
431  ++ehit)
432  outputEBColl->push_back(*ehit);
433 
434  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = endcapRecHitsHandle->begin();
435  ehit != endcapRecHitsHandle->end();
436  ++ehit)
437  outputEEColl->push_back(*ehit);
438 
439  for (std::vector<HBHERecHit>::const_iterator hhit = hbhe->begin(); hhit != hbhe->end(); ++hhit)
440  outputHBHEColl->push_back(*hhit);
441  ++nGood_;
442  }
443  }
444  }
445  }
446  iEvent.put(std::move(outputHcalIsoTrackColl), labelIsoTk_);
447  iEvent.put(std::move(outputVColl), labelRecVtx_.label());
448  iEvent.put(std::move(outputEBColl), labelEB_.instance());
449  iEvent.put(std::move(outputEEColl), labelEE_.instance());
450  iEvent.put(std::move(outputHBHEColl), labelHBHE_.label());
451 }
452 
454  globalCache()->nAll_ += nAll_;
455  globalCache()->nGood_ += nGood_;
456  globalCache()->nRange_ += nRange_;
457 }
458 
460  edm::LogVerbatim("HcalIsoTrack") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events and "
461  << count->nRange_ << " events in the momentum raange";
462 }
463 
464 void AlCaIsoTracksProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
465  bool changed(false);
466  edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init "
467  << hltConfig_.init(iRun, iSetup, processName_, changed);
468 
469  bField = &(iSetup.getData(tok_magField_));
470  geo = &(iSetup.getData(tok_geom_));
471 }
472 
474  edm::LogVerbatim("HcalIsoTrack") << "endRun [" << nRun_ << "] " << iRun.run();
475  ++nRun_;
476 }
477 
480  const std::vector<std::string>& triggerNames_,
481  edm::Handle<reco::TrackCollection>& trkCollection,
482  math::XYZPoint& leadPV,
483  edm::Handle<EcalRecHitCollection>& barrelRecHitsHandle,
484  edm::Handle<EcalRecHitCollection>& endcapRecHitsHandle,
486  double ptL1,
487  double etaL1,
488  double phiL1) {
490  bool ok(false);
491 
492  // Find a good HLT trigger
493  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
494  int hlt = triggerResults->accept(iHLT);
495  for (unsigned int i = 0; i < trigNames_.size(); ++i) {
496  if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) {
497  if (hlt > 0) {
498  ok = true;
499  }
500  edm::LogVerbatim("HcalIsoTrack") << "The trigger we are looking for " << triggerNames_[iHLT] << " Flag " << hlt
501  << ":" << ok;
502  }
503  }
504  }
505 
506  //Propagate tracks to calorimeter surface)
507  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
508  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false);
509 
510  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
511  unsigned int nTracks(0), nselTracks(0);
512  for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end();
513  trkDetItr++, nTracks++) {
514  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
515  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p());
516 #ifdef EDM_ML_DEBUG
517  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|"
518  << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p();
519 #endif
520  //Selection of good track
521  bool qltyFlag = spr::goodTrack(pTrack, leadPV, selectionParameter_, false);
522 #ifdef EDM_ML_DEBUG
523  edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|"
524  << trkDetItr->okHCAL;
525 #endif
526  if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
527  double t_p = pTrack->p();
528  nselTracks++;
529  int nRH_eMipDR(0), nNearTRKs(0);
530  double eMipDR = spr::eCone_ecal(geo,
531  barrelRecHitsHandle,
532  endcapRecHitsHandle,
533  trkDetItr->pointHCAL,
534  trkDetItr->pointECAL,
535  a_mipR_,
536  trkDetItr->directionECAL,
537  nRH_eMipDR);
538  double hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, false);
539  HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL);
540  int ieta = detId.ietaAbs();
541  double eIsolation = (maxRestrictionP_ * exp(slopeRestrictionP_ * ((double)(ieta))));
542  if (eIsolation < eIsolate_)
543  eIsolation = eIsolate_;
544 #ifdef EDM_ML_DEBUG
545  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|"
546  << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << " e_MIP " << eMipDR
547  << " Chg Isolation " << hmaxNearP << ":" << eIsolation;
548 #endif
549  if (t_p > pTrackMin_ && eMipDR < eEcalMax_ && hmaxNearP < eIsolation) {
550  reco::HcalIsolatedTrackCandidate newCandidate(v4);
551  newCandidate.SetMaxP(hmaxNearP);
552  newCandidate.SetEnergyEcal(eMipDR);
553  newCandidate.setL1(ptL1, etaL1, phiL1);
554  newCandidate.SetEtaPhiEcal((trkDetItr->pointECAL).eta(), (trkDetItr->pointECAL).phi());
555  HcalDetId detId = HcalDetId(trkDetItr->detIdHCAL);
556  newCandidate.SetEtaPhiHcal(
557  (trkDetItr->pointHCAL).eta(), (trkDetItr->pointHCAL).phi(), detId.ieta(), detId.iphi());
558  int indx(0);
559  for (reco::TrackCollection::const_iterator trkItr1 = trkCollection->begin(); trkItr1 != trkCollection->end();
560  ++trkItr1, ++indx) {
561  const reco::Track* pTrack1 = &(*trkItr1);
562  if (pTrack1 == pTrack) {
563  reco::TrackRef tRef = reco::TrackRef(trkCollection, indx);
564  newCandidate.setTrack(tRef);
565  break;
566  }
567  }
568  trackCollection->push_back(newCandidate);
569  }
570  }
571  }
572  return trackCollection;
573 }
574 
576  double& ptL1,
577  double& etaL1,
578  double& phiL1) {
579  for (unsigned int p = 0; p < objref.size(); p++) {
580  if (objref[p]->pt() > ptL1) {
581  ptL1 = objref[p]->pt();
582  phiL1 = objref[p]->phi();
583  etaL1 = objref[p]->eta();
584  }
585  }
586 }
587 
589 
RunNumber_t run() const
Definition: EventID.h:38
double p() const
momentum vector magnitude
Definition: TrackBase.h:631
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
Definition: EventID.h:40
reco::HcalIsolatedTrackCandidateCollection * select(edm::Handle< edm::TriggerResults > const &triggerResults, const std::vector< std::string > &triggerNames_, edm::Handle< reco::TrackCollection > &trkCollection, math::XYZPoint &leadPV, edm::Handle< EcalRecHitCollection > &barrelRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapRecHitsHandle, edm::Handle< HBHERecHitCollection > &hbhe, double ptL1, double etaL1, double phiL1)
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
const edm::InputTag labelEE_
RunNumber_t run() const
Definition: RunBase.h:40
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
AlCaIsoTracksProducer(edm::ParameterSet const &, const AlCaIsoTracks::Counters *count)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
void beginRun(edm::Run const &, edm::EventSetup const &) override
const edm::InputTag labelHBHE_
const CaloGeometry * geo
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:64
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
void produce(edm::Event &, edm::EventSetup const &) override
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
const edm::InputTag labelHltGT_
const edm::InputTag labelBS_
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
const edm::InputTag labelTriggerEvent_
static void globalEndJob(const AlCaIsoTracks::Counters *counters)
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:275
const std::string processName_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const std::string theTrackQuality_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
int iEvent
Definition: GenABIO.cc:224
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t uint32_t CAHitNtupletGeneratorKernelsGPU::Counters * counters
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
std::vector< HcalIsolatedTrackCandidate > HcalIsolatedTrackCandidateCollection
collectin of HcalIsolatedTrackCandidate objects
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
void SetEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
double pt() const
track transverse momentum
Definition: TrackBase.h:637
void setPtEtaPhi(std::vector< edm::Ref< l1extra::L1JetParticleCollection > > &objref, double &ptL1, double &etaL1, double &phiL1)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
def move
Definition: eostools.py:511
void SetEtaPhiHcal(double eta, double phi, int ieta, int iphi)
eta, phi at HCAL surface
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
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)
const MagneticField * bField
static std::string const triggerResults
Definition: EdmProvDump.cc:44
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
std::atomic< unsigned int > nGood_
void endRun(edm::Run const &, edm::EventSetup const &) override
tuple trackCollection
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
static std::unique_ptr< AlCaIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
void setL1(double pt, double eta, double phi)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::atomic< unsigned int > nAll_
std::string const & label() const
Definition: InputTag.h:36
const std::vector< std::string > trigNames_
spr::trackSelectionParameters selectionParameter_
edm::EventID id() const
Definition: EventBase.h:59
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
reco::TrackBase::TrackQuality minQuality
const edm::InputTag labelRecVtx_
void setTrack(const reco::TrackRef &tr)
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
const edm::InputTag labelTriggerResults_
std::string const & instance() const
Definition: InputTag.h:37
std::atomic< unsigned int > nRange_
const edm::InputTag labelEB_
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
Definition: Run.h:45
const edm::InputTag labelGenTrack_