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
26 
53 
55 
60 
74 
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
303  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
304  iEvent.getByToken(tok_trigEvt_, triggerEventHandle);
305  if (!triggerEventHandle.isValid()) {
306  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerEvent_;
307  valid = false;
308  }
310  iEvent.getByToken(tok_trigRes_, triggerResults);
311  if (!triggerResults.isValid()) {
312  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerResults_;
313  valid = false;
314  }
315 
317  iEvent.getByToken(tok_genTrack_, trkCollection);
318  if (!trkCollection.isValid()) {
319  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_;
320  valid = false;
321  }
322 
324  iEvent.getByToken(tok_recVtx_, recVtxs);
325  if (!recVtxs.isValid()) {
326  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_;
327  valid = false;
328  }
329 
330  edm::Handle<reco::BeamSpot> beamSpotH;
331  iEvent.getByToken(tok_bs_, beamSpotH);
332  math::XYZPoint leadPV(0, 0, 0);
333  if (valid) {
334  if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
335  leadPV = math::XYZPoint((*recVtxs)[0].x(), (*recVtxs)[0].y(), (*recVtxs)[0].z());
336  } else if (beamSpotH.isValid()) {
337  leadPV = beamSpotH->position();
338  }
339  }
340 #ifdef EDM_ML_DEBUG
341  edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV;
342 #endif
343 
344  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
345  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
346  if (!barrelRecHitsHandle.isValid()) {
347  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_;
348  valid = false;
349  }
350  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
351  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
352  if (!endcapRecHitsHandle.isValid()) {
353  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_;
354  valid = false;
355  }
357  iEvent.getByToken(tok_hbhe_, hbhe);
358  if (!hbhe.isValid()) {
359  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_;
360  valid = false;
361  }
362 
363  //Get L1 trigger object
364  double ptL1(0), etaL1(0), phiL1(0);
366  iEvent.getByToken(tok_hltGT_, l1trigobj);
367 
368  if (l1trigobj.isValid()) {
369  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
370  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
371  setPtEtaPhi(l1tauobjref, ptL1, etaL1, phiL1);
372 
373  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
374  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
375  setPtEtaPhi(l1jetobjref, ptL1, etaL1, phiL1);
376 
377  std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
378  l1trigobj->getObjects(trigger::TriggerL1ForJet, l1forjetobjref);
379  setPtEtaPhi(l1forjetobjref, ptL1, etaL1, phiL1);
380  } else {
381  valid = false;
382  }
383 
384  auto outputHcalIsoTrackColl = std::make_unique<reco::HcalIsolatedTrackCandidateCollection>();
385  auto outputVColl = std::make_unique<reco::VertexCollection>();
386  auto outputEBColl = std::make_unique<EBRecHitCollection>();
387  auto outputEEColl = std::make_unique<EERecHitCollection>();
388  auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
389 
390  //For valid HLT record
391  if (!valid) {
392  edm::LogWarning("HcalIsoTrack") << "Error! Can't get some of the products";
393  } else {
394  trigger::TriggerEvent triggerEvent = *(triggerEventHandle.product());
395  if (triggerResults.isValid()) {
396  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
397  const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
399  triggerNames_,
400  trkCollection,
401  leadPV,
402  barrelRecHitsHandle,
403  endcapRecHitsHandle,
404  hbhe,
405  ptL1,
406  etaL1,
407  phiL1);
408 #ifdef EDM_ML_DEBUG
409  edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksProducer::select returns " << isotk->size()
410  << " isolated tracks";
411 #endif
412 
413  if (!isotk->empty()) {
414  int ntrin(0), ntrout(0);
415  for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
416  ++itr) {
417  if (itr->p() > pTrackLow_ && itr->p() < pTrackHigh_)
418  ntrin++;
419  else
420  ntrout++;
421  }
422  bool selectEvent = ntrout > 0;
423  if (!selectEvent && ntrin > 0) {
424  ++nRange_;
425  if (preScale_ <= 1)
426  selectEvent = true;
427  else if (nRange_ % preScale_ == 1)
428  selectEvent = true;
429  }
430  if (selectEvent) {
431  for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
432  ++itr)
433  outputHcalIsoTrackColl->push_back(*itr);
434 
435  for (reco::VertexCollection::const_iterator vtx = recVtxs->begin(); vtx != recVtxs->end(); ++vtx)
436  outputVColl->push_back(*vtx);
437 
438  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = barrelRecHitsHandle->begin();
439  ehit != barrelRecHitsHandle->end();
440  ++ehit)
441  outputEBColl->push_back(*ehit);
442 
443  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit = endcapRecHitsHandle->begin();
444  ehit != endcapRecHitsHandle->end();
445  ++ehit)
446  outputEEColl->push_back(*ehit);
447 
448  for (std::vector<HBHERecHit>::const_iterator hhit = hbhe->begin(); hhit != hbhe->end(); ++hhit)
449  outputHBHEColl->push_back(*hhit);
450  ++nGood_;
451  }
452  }
453  }
454  }
455  iEvent.put(std::move(outputHcalIsoTrackColl), labelIsoTk_);
456  iEvent.put(std::move(outputVColl), labelRecVtx_.label());
457  iEvent.put(std::move(outputEBColl), labelEB_.instance());
458  iEvent.put(std::move(outputEEColl), labelEE_.instance());
459  iEvent.put(std::move(outputHBHEColl), labelHBHE_.label());
460 }
461 
463  globalCache()->nAll_ += nAll_;
464  globalCache()->nGood_ += nGood_;
465  globalCache()->nRange_ += nRange_;
466 }
467 
469  edm::LogVerbatim("HcalIsoTrack") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events and "
470  << count->nRange_ << " events in the momentum raange";
471 }
472 
473 void AlCaIsoTracksProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
474  bool changed(false);
475  edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init "
476  << hltConfig_.init(iRun, iSetup, processName_, changed);
477 
478  bField = &(iSetup.getData(tok_magField_));
479  geo = &(iSetup.getData(tok_geom_));
480 }
481 
483  edm::LogVerbatim("HcalIsoTrack") << "endRun [" << nRun_ << "] " << iRun.run();
484  ++nRun_;
485 }
486 
489  const std::vector<std::string>& triggerNames_,
490  edm::Handle<reco::TrackCollection>& trkCollection,
491  math::XYZPoint& leadPV,
492  edm::Handle<EcalRecHitCollection>& barrelRecHitsHandle,
493  edm::Handle<EcalRecHitCollection>& endcapRecHitsHandle,
495  double ptL1,
496  double etaL1,
497  double phiL1) {
499  bool ok(false);
500 
501  // Find a good HLT trigger
502  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
503  int hlt = triggerResults->accept(iHLT);
504  for (unsigned int i = 0; i < trigNames_.size(); ++i) {
505  if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) {
506  if (hlt > 0) {
507  ok = true;
508  }
509  edm::LogVerbatim("HcalIsoTrack") << "The trigger we are looking for " << triggerNames_[iHLT] << " Flag " << hlt
510  << ":" << ok;
511  }
512  }
513  }
514 
515  //Propagate tracks to calorimeter surface)
516  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
517  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false);
518 
519  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
520  unsigned int nTracks(0), nselTracks(0);
521  for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end();
522  trkDetItr++, nTracks++) {
523  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
524  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p());
525 #ifdef EDM_ML_DEBUG
526  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|"
527  << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p();
528 #endif
529  //Selection of good track
530  bool qltyFlag = spr::goodTrack(pTrack, leadPV, selectionParameter_, false);
531 #ifdef EDM_ML_DEBUG
532  edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|"
533  << trkDetItr->okHCAL;
534 #endif
535  if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
536  double t_p = pTrack->p();
537  nselTracks++;
538  int nRH_eMipDR(0), nNearTRKs(0);
539  double eMipDR = spr::eCone_ecal(geo,
540  barrelRecHitsHandle,
541  endcapRecHitsHandle,
542  trkDetItr->pointHCAL,
543  trkDetItr->pointECAL,
544  a_mipR_,
545  trkDetItr->directionECAL,
546  nRH_eMipDR);
547  double hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, false);
548  HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL);
549  int ieta = detId.ietaAbs();
550  double eIsolation = (maxRestrictionP_ * exp(slopeRestrictionP_ * ((double)(ieta))));
551  if (eIsolation < eIsolate_)
552  eIsolation = eIsolate_;
553 #ifdef EDM_ML_DEBUG
554  edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|"
555  << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << " e_MIP " << eMipDR
556  << " Chg Isolation " << hmaxNearP << ":" << eIsolation;
557 #endif
558  if (t_p > pTrackMin_ && eMipDR < eEcalMax_ && hmaxNearP < eIsolation) {
559  reco::HcalIsolatedTrackCandidate newCandidate(v4);
560  newCandidate.SetMaxP(hmaxNearP);
561  newCandidate.SetEnergyEcal(eMipDR);
562  newCandidate.setL1(ptL1, etaL1, phiL1);
563  newCandidate.SetEtaPhiEcal((trkDetItr->pointECAL).eta(), (trkDetItr->pointECAL).phi());
564  HcalDetId detId = HcalDetId(trkDetItr->detIdHCAL);
565  newCandidate.SetEtaPhiHcal(
566  (trkDetItr->pointHCAL).eta(), (trkDetItr->pointHCAL).phi(), detId.ieta(), detId.iphi());
567  int indx(0);
568  for (reco::TrackCollection::const_iterator trkItr1 = trkCollection->begin(); trkItr1 != trkCollection->end();
569  ++trkItr1, ++indx) {
570  const reco::Track* pTrack1 = &(*trkItr1);
571  if (pTrack1 == pTrack) {
572  reco::TrackRef tRef = reco::TrackRef(trkCollection, indx);
573  newCandidate.setTrack(tRef);
574  break;
575  }
576  }
577  trackCollection->push_back(newCandidate);
578  }
579  }
580  }
581  return trackCollection;
582 }
583 
585  double& ptL1,
586  double& etaL1,
587  double& phiL1) {
588  for (unsigned int p = 0; p < objref.size(); p++) {
589  if (objref[p]->pt() > ptL1) {
590  ptL1 = objref[p]->pt();
591  phiL1 = objref[p]->phi();
592  etaL1 = objref[p]->eta();
593  }
594  }
595 }
596 
598 
ConfigurationDescriptions.h
spr::trackSelectionParameters::maxDxyPV
double maxDxyPV
Definition: TrackSelection.h:22
AlCaIsoTracksProducer::tok_EB_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Definition: AlCaIsoTracksProducer.cc:143
reco::HcalIsolatedTrackCandidate::SetEtaPhiEcal
void SetEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
Definition: HcalIsolatedTrackCandidate.h:85
TrackExtra.h
DDAxes::y
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:428
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
AlCaIsoTracksProducer::tok_geom_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Definition: AlCaIsoTracksProducer.cc:146
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:129
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:631
trigger::TriggerL1ForJet
Definition: TriggerTypeDefs.h:34
EcalSeverityLevelAlgoRcd.h
edm::Run
Definition: Run.h:45
AlCaIsoTracksProducer
Definition: AlCaIsoTracksProducer.cc:86
TriggerEvent.h
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs >
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:130
AlCaIsoTracksProducer::slopeRestrictionP_
const double slopeRestrictionP_
Definition: AlCaIsoTracksProducer.cc:125
AlCaIsoTracksProducer::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: AlCaIsoTracksProducer.cc:482
AlCaIsoTracksProducer::hltConfig_
HLTConfigProvider hltConfig_
Definition: AlCaIsoTracksProducer.cc:119
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:487
AlCaIsoTracksProducer::labelBS_
const edm::InputTag labelBS_
Definition: AlCaIsoTracksProducer.cc:129
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
AlCaIsoTracksProducer::tok_hltGT_
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
Definition: AlCaIsoTracksProducer.cc:137
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:126
TriggerFilterObjectWithRefs.h
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
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:150
DDAxes::x
AlCaIsoTracksProducer::globalEndJob
static void globalEndJob(const AlCaIsoTracks::Counters *counters)
Definition: AlCaIsoTracksProducer.cc:468
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:41
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle< edm::TriggerResults >
AlCaIsoTracksProducer::labelHBHE_
const edm::InputTag labelHBHE_
Definition: AlCaIsoTracksProducer.cc:130
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:452
EcalRecHitCollections.h
edm::Ref
Definition: AssociativeIterator.h:58
AlCaIsoTracksProducer::tok_recVtx_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
Definition: AlCaIsoTracksProducer.cc:141
AlCaIsoTracksProducer::labelIsoTk_
const std::string labelIsoTk_
Definition: AlCaIsoTracksProducer.cc:132
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
AlCaIsoTracksProducer::labelHltGT_
const edm::InputTag labelHltGT_
Definition: AlCaIsoTracksProducer.cc:130
MakerMacros.h
CaloGeometry
Definition: CaloGeometry.h:21
AlCaIsoTracksProducer::pTrackLow_
const double pTrackLow_
Definition: AlCaIsoTracksProducer.cc:127
Track.h
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:643
AlCaIsoTracks::Counters::Counters
Counters()
Definition: AlCaIsoTracksProducer.cc:81
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:294
ChargeIsolation.h
DDAxes::z
reco::Track
Definition: Track.h:27
ProductID.h
IdealMagneticFieldRecord.h
AlCaIsoTracksProducer::selectionParameter_
spr::trackSelectionParameters selectionParameter_
Definition: AlCaIsoTracksProducer.cc:121
AlCaIsoTracksProducer::nRange_
unsigned int nRange_
Definition: AlCaIsoTracksProducer.cc:120
AlCaIsoTracksProducer::endStream
void endStream() override
Definition: AlCaIsoTracksProducer.cc:462
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
spr::trackSelectionParameters::minPt
double minPt
Definition: TrackSelection.h:20
AlCaIsoTracksProducer::~AlCaIsoTracksProducer
~AlCaIsoTracksProducer() override
Definition: AlCaIsoTracksProducer.cc:248
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:144
AlCaIsoTracksProducer::tok_trigRes_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
Definition: AlCaIsoTracksProducer.cc:139
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:120
AlCaIsoTracksProducer::pTrackHigh_
const double pTrackHigh_
Definition: AlCaIsoTracksProducer.cc:127
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:288
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:130
reco::TrackBase::phi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
AlCaIsoTracksProducer::preScale_
const int preScale_
Definition: AlCaIsoTracksProducer.cc:128
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
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
AlCaIsoTracksProducer::a_coneR_
const double a_coneR_
Definition: AlCaIsoTracksProducer.cc:124
AlCaIsoTracksProducer::tok_trigEvt_
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
Definition: AlCaIsoTracksProducer.cc:138
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
AlCaIsoTracksProducer::labelTriggerEvent_
const edm::InputTag labelTriggerEvent_
Definition: AlCaIsoTracksProducer.cc:131
edm::ParameterSet
Definition: ParameterSet.h:47
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
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:142
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:652
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:125
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::stream::EDProducer
Definition: EDProducer.h:38
AlCaIsoTracksProducer::a_mipR_
const double a_mipR_
Definition: AlCaIsoTracksProducer.cc:124
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:145
HLTConfigProvider.h
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
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
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
AlCaIsoTracksProducer::trigNames_
const std::vector< std::string > trigNames_
Definition: AlCaIsoTracksProducer.cc:122
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
CaloTopology.h
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
AlCaIsoTracksProducer::a_charIsoR_
double a_charIsoR_
Definition: AlCaIsoTracksProducer.cc:133
AlCaIsoTracksProducer::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: AlCaIsoTracksProducer.cc:473
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:123
DDAxes::phi
CaloSubdetectorTopology.h
AlCaIsoTracksProducer::theTrackQuality_
const std::string theTrackQuality_
Definition: AlCaIsoTracksProducer.cc:123
HcalTopology.h
EcalTrigTowerConstituentsMap.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HLTConfigProvider
Definition: HLTConfigProvider.h:29
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:126
AlCaIsoTracksProducer::nGood_
unsigned int nGood_
Definition: AlCaIsoTracksProducer.cc:120
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:584
AlCaIsoTracksProducer::initializeGlobalCache
static std::unique_ptr< AlCaIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
Definition: AlCaIsoTracksProducer.cc:91
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
DetId.h
Frameworkfwd.h
trigger::TriggerL1TauJet
Definition: TriggerTypeDefs.h:35
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
CaloPropagateTrack.h
AlCaIsoTracksProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: AlCaIsoTracksProducer.cc:250
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:120
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:131
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalRecHitCollections.h
Exception.h
AlCaIsoTracksProducer::tok_genTrack_
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
Definition: AlCaIsoTracksProducer.cc:140
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
AlCaIsoTracksProducer::labelGenTrack_
const edm::InputTag labelGenTrack_
Definition: AlCaIsoTracksProducer.cc:129
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:126
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
AlCaIsoTracksProducer::geo
const CaloGeometry * geo
Definition: AlCaIsoTracksProducer.cc:135
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
edm::Log
Definition: MessageLogger.h:70
L1JetParticle.h
edm::InputTag
Definition: InputTag.h:15
reco::HcalIsolatedTrackCandidate::SetEnergyEcal
void SetEnergyEcal(double a)
Definition: HcalIsolatedTrackCandidate.h:82
EcalChannelStatusRcd.h
AlCaIsoTracksProducer::tok_magField_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
Definition: AlCaIsoTracksProducer.cc:147
ValidationMatrix.hlt
hlt
Definition: ValidationMatrix.py:459
AlCaIsoTracksProducer::bField
const MagneticField * bField
Definition: AlCaIsoTracksProducer.cc:134