CMS 3D CMS Logo

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