CMS 3D CMS Logo

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