CMS 3D CMS Logo

L1TrackSelectionProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1TTrackMatch
4 // Class: L1TrackSelectionProducer
5 //
18 //
19 // Original Author: Alexx Perloff
20 // Created: Thu, 16 Dec 2021 19:02:50 GMT
21 //
22 //
23 
24 // system include files
25 #include <algorithm>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 // Xilinx HLS includes
31 #include <ap_fixed.h>
32 #include <ap_int.h>
33 
34 // user include files
60 
61 //
62 // class declaration
63 //
64 
66 public:
68  ~L1TrackSelectionProducer() override;
69 
70  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
71 
72 private:
73  // ----------constants, enums and typedefs ---------
74  // Relevant constants for the converted track word
76  kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1, // Width of pt
77  kPtMagSize = 9, // Width of pt magnitude (unsigned)
78  kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize, // Width of eta
79  kEtaMagSize = 3, // Width of eta magnitude (signed)
80  };
81 
83  typedef std::vector<L1Track> TTTrackCollection;
87  typedef std::unique_ptr<TTTrackRefCollection> TTTrackRefCollectionUPtr;
88 
89  // ----------member functions ----------------------
90  void printDebugInfo(const TTTrackCollectionHandle& l1TracksHandle,
91  const TTTrackRefCollectionUPtr& vTTTrackOutput,
92  const TTTrackRefCollectionUPtr& vTTTrackEmulationOutput,
93  const TTTrackRefCollectionUPtr& vTTTrackAssociatedOutput,
94  const TTTrackRefCollectionUPtr& vTTTrackAssociatedEmulationOutput) const;
95  void printTrackInfo(edm::LogInfo& log, const L1Track& track, bool printEmulation = false) const;
96  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
97 
98  // ----------selectors -----------------------------
99  // Based on recommendations from https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideGenericSelectors
102  TTTrackPtMinSelector(const edm::ParameterSet& cfg) : ptMin_(cfg.template getParameter<double>("ptMin")) {}
103  bool operator()(const L1Track& t) const { return t.momentum().perp() >= ptMin_; }
104 
105  private:
106  double ptMin_;
107  };
110  TTTrackWordPtMinSelector(const edm::ParameterSet& cfg) : ptMin_(cfg.template getParameter<double>("ptMin")) {}
111  bool operator()(const L1Track& t) const {
112  ap_uint<TrackBitWidths::kPtSize> ptEmulationBits = t.getTrackWord()(
113  TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
114  ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
115  ptEmulation.V = ptEmulationBits.range();
116  return ptEmulation.to_double() >= ptMin_;
117  }
118 
119  private:
120  double ptMin_;
121  };
125  : absEtaMax_(cfg.template getParameter<double>("absEtaMax")) {}
126  bool operator()(const L1Track& t) const { return std::abs(t.momentum().eta()) <= absEtaMax_; }
127 
128  private:
129  double absEtaMax_;
130  };
134  : absEtaMax_(cfg.template getParameter<double>("absEtaMax")) {}
135  bool operator()(const L1Track& t) const {
136  TTTrack_TrackWord::tanl_t etaEmulationBits = t.getTanlWord();
137  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
138  etaEmulation.V = etaEmulationBits.range();
139  return std::abs(etaEmulation.to_double()) <= absEtaMax_;
140  }
141 
142  private:
143  double absEtaMax_;
144  };
147  TTTrackAbsZ0MaxSelector(const edm::ParameterSet& cfg) : absZ0Max_(cfg.template getParameter<double>("absZ0Max")) {}
148  bool operator()(const L1Track& t) const { return std::abs(t.z0()) <= absZ0Max_; }
149 
150  private:
151  double absZ0Max_;
152  };
156  : absZ0Max_(cfg.template getParameter<double>("absZ0Max")) {}
157  bool operator()(const L1Track& t) const {
158  double floatZ0 = t.undigitizeSignedValue(
159  t.getZ0Bits(), TTTrack_TrackWord::TrackBitWidths::kZ0Size, TTTrack_TrackWord::stepZ0, 0.0);
160  return std::abs(floatZ0) <= absZ0Max_;
161  }
162 
163  private:
164  double absZ0Max_;
165  };
169  : nStubsMin_(cfg.template getParameter<double>("nStubsMin")) {}
170  bool operator()(const L1Track& t) const { return t.getStubRefs().size() >= nStubsMin_; }
171 
172  private:
173  double nStubsMin_;
174  };
178  : nStubsMin_(cfg.template getParameter<double>("nStubsMin")) {}
179  bool operator()(const L1Track& t) const { return t.getNStubs() >= nStubsMin_; }
180 
181  private:
182  double nStubsMin_;
183  };
186  : nPSStubsMin_(nStubsMin), tTopo_(tTopo) {}
188  : nPSStubsMin_(cfg.template getParameter<double>("nPSStubsMin")), tTopo_(tTopo) {}
189  bool operator()(const L1Track& t) const {
190  int nPSStubs = 0;
191  for (const auto& stub : t.getStubRefs()) {
192  DetId detId(stub->getDetId());
193  if (detId.det() == DetId::Detector::Tracker) {
194  if ((detId.subdetId() == StripSubdetector::TOB && tTopo_.tobLayer(detId) <= 3) ||
195  (detId.subdetId() == StripSubdetector::TID && tTopo_.tidRing(detId) <= 9))
196  nPSStubs++;
197  }
198  }
199  return nPSStubs >= nPSStubsMin_;
200  }
201 
202  private:
203  double nPSStubsMin_;
205  };
207  TTTrackBendChi2MaxSelector(double bendChi2Max) : bendChi2Max_(bendChi2Max) {}
209  : bendChi2Max_(cfg.template getParameter<double>("reducedBendChi2Max")) {}
210  bool operator()(const L1Track& t) const { return t.stubPtConsistency() < bendChi2Max_; }
211 
212  private:
213  double bendChi2Max_;
214  };
216  TTTrackWordBendChi2MaxSelector(double bendChi2Max) : bendChi2Max_(bendChi2Max) {}
218  : bendChi2Max_(cfg.template getParameter<double>("reducedBendChi2Max")) {}
219  bool operator()(const L1Track& t) const { return t.getBendChi2() < bendChi2Max_; }
220 
221  private:
222  double bendChi2Max_;
223  };
227  : reducedChi2RZMax_(cfg.template getParameter<double>("reducedChi2RZMax")) {}
228  bool operator()(const L1Track& t) const { return t.chi2ZRed() < reducedChi2RZMax_; }
229 
230  private:
232  };
236  : reducedChi2RZMax_(cfg.template getParameter<double>("reducedChi2RZMax")) {}
237  bool operator()(const L1Track& t) const { return t.getChi2RZ() < reducedChi2RZMax_; }
238 
239  private:
241  };
245  : reducedChi2RPhiMax_(cfg.template getParameter<double>("reducedChi2RPhiMax")) {}
246  bool operator()(const L1Track& t) const { return t.chi2XYRed() < reducedChi2RPhiMax_; }
247 
248  private:
250  };
254  : reducedChi2RPhiMax_(cfg.template getParameter<double>("reducedChi2RPhiMax")) {}
255  bool operator()(const L1Track& t) const { return t.getChi2RPhi() < reducedChi2RPhiMax_; }
256 
257  private:
259  };
261  TTTrackDeltaZMaxSelector(const std::vector<double>& deltaZMaxEtaBounds, const std::vector<double>& deltaZMax)
264  : deltaZMaxEtaBounds_(cfg.template getParameter<double>("deltaZMaxEtaBounds")),
265  deltaZMax_(cfg.template getParameter<double>("deltaZMax")) {}
266  bool operator()(const L1Track& t, const l1t::Vertex& v) const {
267  size_t etaIndex =
268  std::upper_bound(deltaZMaxEtaBounds_.begin(), deltaZMaxEtaBounds_.end(), std::abs(t.momentum().eta())) -
269  deltaZMaxEtaBounds_.begin() - 1;
270  if (etaIndex > deltaZMax_.size() - 1)
271  etaIndex = deltaZMax_.size() - 1;
272  return std::abs(v.z0() - t.z0()) <= deltaZMax_[etaIndex];
273  }
274 
275  private:
276  std::vector<double> deltaZMaxEtaBounds_;
277  std::vector<double> deltaZMax_;
278  };
280  TTTrackWordDeltaZMaxSelector(const std::vector<double>& deltaZMaxEtaBounds, const std::vector<double>& deltaZMax)
283  : deltaZMaxEtaBounds_(cfg.template getParameter<double>("deltaZMaxEtaBounds")),
284  deltaZMax_(cfg.template getParameter<double>("deltaZMax")) {}
285  bool operator()(const L1Track& t, const l1t::VertexWord& v) const {
286  TTTrack_TrackWord::tanl_t etaEmulationBits = t.getTanlWord();
287  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
288  etaEmulation.V = etaEmulationBits.range();
289  size_t etaIndex =
290  std::upper_bound(deltaZMaxEtaBounds_.begin(), deltaZMaxEtaBounds_.end(), std::abs(etaEmulation.to_double())) -
291  deltaZMaxEtaBounds_.begin() - 1;
292  if (etaIndex > deltaZMax_.size() - 1)
293  etaIndex = deltaZMax_.size() - 1;
294  l1t::VertexWord::vtxz0_t fixedTkZ0 = t.undigitizeSignedValue(
295  t.getZ0Bits(), TTTrack_TrackWord::TrackBitWidths::kZ0Size, TTTrack_TrackWord::stepZ0, 0.0);
296 
297  return std::abs(v.z0() - fixedTkZ0.to_double()) <= deltaZMax_[etaIndex];
298  }
299 
300  private:
301  std::vector<double> deltaZMaxEtaBounds_;
302  std::vector<double> deltaZMax_;
303  };
304 
316 
317  // ----------member data ---------------------------
326  std::vector<double> deltaZMaxEtaBounds_, deltaZMax_;
329  int debug_;
330 };
331 
332 //
333 // constructors and destructor
334 //
336  : l1TracksToken_(consumes<TTTrackCollection>(iConfig.getParameter<edm::InputTag>("l1TracksInputTag"))),
338  outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")),
339  cutSet_(iConfig.getParameter<edm::ParameterSet>("cutSet")),
340 
341  ptMin_(cutSet_.getParameter<double>("ptMin")),
342  absEtaMax_(cutSet_.getParameter<double>("absEtaMax")),
343  absZ0Max_(cutSet_.getParameter<double>("absZ0Max")),
344  bendChi2Max_(cutSet_.getParameter<double>("reducedBendChi2Max")),
345  reducedChi2RZMax_(cutSet_.getParameter<double>("reducedChi2RZMax")),
346  reducedChi2RPhiMax_(cutSet_.getParameter<double>("reducedChi2RPhiMax")),
347  nStubsMin_(cutSet_.getParameter<int>("nStubsMin")),
348  nPSStubsMin_(cutSet_.getParameter<int>("nPSStubsMin")),
349  deltaZMaxEtaBounds_(cutSet_.getParameter<std::vector<double>>("deltaZMaxEtaBounds")),
350  deltaZMax_(cutSet_.getParameter<std::vector<double>>("deltaZMax")),
351 
352  useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>("useDisplacedTracksDeltaZOverride")),
353  processSimulatedTracks_(iConfig.getParameter<bool>("processSimulatedTracks")),
354  processEmulatedTracks_(iConfig.getParameter<bool>("processEmulatedTracks")),
355  debug_(iConfig.getParameter<int>("debug")) {
356  // Confirm the the configuration makes sense
358  throw cms::Exception("You must process at least one of the track collections (simulated or emulated).");
359  }
360 
361  if (deltaZMax_.size() != deltaZMaxEtaBounds_.size() - 1) {
362  throw cms::Exception("The number of deltaZ cuts does not match the number of eta bins!");
363  }
364 
366  deltaZMax_ = std::vector<double>(deltaZMax_.size(), useDisplacedTracksDeltaZOverride_);
367  }
368 
369  // Get additional input tags and define the EDM output based on the previous configuration parameters
370  doDeltaZCutSim_ = false;
371  doDeltaZCutEmu_ = false;
373  produces<TTTrackRefCollection>(outputCollectionName_);
374  if (iConfig.exists("l1VerticesInputTag")) {
375  l1VerticesToken_ = consumes<l1t::VertexCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesInputTag"));
376  doDeltaZCutSim_ = true;
377  produces<TTTrackRefCollection>(outputCollectionName_ + "Associated");
378  }
379  }
381  produces<TTTrackRefCollection>(outputCollectionName_ + "Emulation");
382  if (iConfig.exists("l1VerticesEmulationInputTag")) {
384  consumes<l1t::VertexWordCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesEmulationInputTag"));
385  doDeltaZCutEmu_ = true;
386  produces<TTTrackRefCollection>(outputCollectionName_ + "AssociatedEmulation");
387  }
388  }
389 }
390 
392 
393 //
394 // member functions
395 //
396 
398  const TTTrackRefCollectionUPtr& vTTTrackOutput,
399  const TTTrackRefCollectionUPtr& vTTTrackEmulationOutput,
400  const TTTrackRefCollectionUPtr& vTTTrackAssociatedOutput,
401  const TTTrackRefCollectionUPtr& vTTTrackAssociatedEmulationOutput) const {
402  edm::LogInfo log("L1TrackSelectionProducer");
403  log << "The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
404  for (const auto& track : *l1TracksHandle) {
405  printTrackInfo(log, track, debug_ >= 4);
406  }
407  log << "\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() << "\n\n";
409  log << "The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
410  for (const auto& track : *vTTTrackOutput) {
411  printTrackInfo(log, *track, debug_ >= 4);
412  }
413  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() << "\n\n";
414  }
416  log << "The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are "
417  "... \n";
418  for (const auto& track : *vTTTrackEmulationOutput) {
419  printTrackInfo(log, *track, debug_ >= 4);
420  }
421  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() << "\n\n";
422  }
424  TTTrackRefCollection inSimButNotEmu;
425  TTTrackRefCollection inEmuButNotSim;
426  std::set_difference(vTTTrackOutput->begin(),
427  vTTTrackOutput->end(),
428  vTTTrackEmulationOutput->begin(),
429  vTTTrackEmulationOutput->end(),
430  std::back_inserter(inSimButNotEmu));
431  std::set_difference(vTTTrackEmulationOutput->begin(),
432  vTTTrackEmulationOutput->end(),
433  vTTTrackOutput->begin(),
434  vTTTrackOutput->end(),
435  std::back_inserter(inEmuButNotSim));
436  log << "The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected "
437  "by cutting on the emulated values ... \n";
438  for (const auto& track : inSimButNotEmu) {
439  printTrackInfo(log, *track, debug_ >= 3);
440  }
441  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
442  << "The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected "
443  "by cutting on the simulated values ... \n";
444  for (const auto& track : inEmuButNotSim) {
445  printTrackInfo(log, *track, debug_ >= 3);
446  }
447  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
448  }
450  log << "The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, "
451  "chi2rphi, z0) values are ... \n";
452  for (const auto& track : *vTTTrackAssociatedOutput) {
453  printTrackInfo(log, *track, debug_ >= 4);
454  }
455  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() << "\n\n";
456  }
458  log << "The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, "
459  "chi2rz, chi2rphi, z0) values are "
460  "... \n";
461  for (const auto& track : *vTTTrackAssociatedEmulationOutput) {
462  printTrackInfo(log, *track, debug_ >= 4);
463  }
464  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() << "\n\n";
465  }
467  TTTrackRefCollection inSimButNotEmu;
468  TTTrackRefCollection inEmuButNotSim;
469  std::set_difference(vTTTrackAssociatedOutput->begin(),
470  vTTTrackAssociatedOutput->end(),
471  vTTTrackAssociatedEmulationOutput->begin(),
472  vTTTrackAssociatedEmulationOutput->end(),
473  std::back_inserter(inSimButNotEmu));
474  std::set_difference(vTTTrackAssociatedEmulationOutput->begin(),
475  vTTTrackAssociatedEmulationOutput->end(),
476  vTTTrackAssociatedOutput->begin(),
477  vTTTrackAssociatedOutput->end(),
478  std::back_inserter(inEmuButNotSim));
479  log << "The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected "
480  "by cutting on the emulated values ... \n";
481  for (const auto& track : inSimButNotEmu) {
482  printTrackInfo(log, *track, debug_ >= 3);
483  }
484  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
485  << "The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected "
486  "by cutting on the simulated values ... \n";
487  for (const auto& track : inEmuButNotSim) {
488  printTrackInfo(log, *track, debug_ >= 3);
489  }
490  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
491  }
492 }
493 
494 void L1TrackSelectionProducer::printTrackInfo(edm::LogInfo& log, const L1Track& track, bool printEmulation) const {
495  log << "\t(" << track.momentum().perp() << ", " << track.momentum().eta() << ", " << track.momentum().phi() << ", "
496  << track.getStubRefs().size() << ", " << track.stubPtConsistency() << ", " << track.chi2ZRed() << ", "
497  << track.chi2XYRed() << ", " << track.z0() << ")\n";
498 
499  if (printEmulation) {
500  ap_uint<TrackBitWidths::kPtSize> ptEmulationBits = track.getTrackWord()(
501  TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
502  ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
503  ptEmulation.V = ptEmulationBits.range();
504  TTTrack_TrackWord::tanl_t etaEmulationBits = track.getTanlWord();
505  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
506  etaEmulation.V = etaEmulationBits.range();
507  double floatTkZ0 = track.undigitizeSignedValue(
508  track.getZ0Bits(), TTTrack_TrackWord::TrackBitWidths::kZ0Size, TTTrack_TrackWord::stepZ0, 0.0);
509  double floatTkPhi = track.undigitizeSignedValue(
510  track.getPhiBits(), TTTrack_TrackWord::TrackBitWidths::kPhiSize, TTTrack_TrackWord::stepPhi0, 0.0);
511  log << "\t\t(" << ptEmulation.to_double() << ", " << etaEmulation.to_double() << ", " << floatTkPhi << ", "
512  << track.getNStubs() << ", " << track.getBendChi2() << ", " << track.getChi2RZ() << ", " << track.getChi2RPhi()
513  << ", " << floatTkZ0 << ")\n";
514  }
515 }
516 
517 // ------------ method called to produce the data ------------
519  auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
520  auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollection>();
521  auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
522  auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollection>();
523 
524  // Tracker Topology
525  const TrackerTopology& tTopo = iSetup.getData(tTopoToken_);
526 
527  TTTrackCollectionHandle l1TracksHandle;
528  edm::Handle<l1t::VertexCollection> l1VerticesHandle;
529  edm::Handle<l1t::VertexWordCollection> l1VerticesEmulationHandle;
530 
531  l1t::Vertex leadingVertex;
532  l1t::VertexWord leadingEmulationVertex;
533 
534  iEvent.getByToken(l1TracksToken_, l1TracksHandle);
535  size_t nOutputApproximate = l1TracksHandle->size();
537  if (doDeltaZCutSim_) {
538  iEvent.getByToken(l1VerticesToken_, l1VerticesHandle);
539  leadingVertex = l1VerticesHandle->at(0);
540  if (debug_ >= 2) {
541  edm::LogInfo("L1TrackSelectionProducer") << "leading vertex z0 = " << leadingVertex.z0();
542  }
543  }
544  vTTTrackOutput->reserve(nOutputApproximate);
545  vTTTrackAssociatedOutput->reserve(nOutputApproximate);
546  }
548  if (doDeltaZCutEmu_) {
549  iEvent.getByToken(l1VerticesEmulationToken_, l1VerticesEmulationHandle);
550  leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
551  if (debug_ >= 2) {
552  edm::LogInfo("L1TrackSelectionProducer") << "leading emulation vertex z0 = " << leadingEmulationVertex.z0();
553  }
554  }
555  vTTTrackEmulationOutput->reserve(nOutputApproximate);
556  vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
557  }
558 
565  TTTrackNPSStubsMinSelector nPSStubsSel(nPSStubsMin_, tTopo);
566 
567  for (size_t i = 0; i < nOutputApproximate; i++) {
568  const auto& track = l1TracksHandle->at(i);
569 
570  // Select tracks based on the floating point TTTrack
571  if (processSimulatedTracks_ && kinSel(track) && nPSStubsSel(track) && chi2Sel(track)) {
572  vTTTrackOutput->push_back(TTTrackRef(l1TracksHandle, i));
573  if (doDeltaZCutSim_ && deltaZSel(track, leadingVertex)) {
574  vTTTrackAssociatedOutput->push_back(TTTrackRef(l1TracksHandle, i));
575  }
576  }
577 
578  // Select tracks based on the bitwise accurate TTTrack_TrackWord
579  if (processEmulatedTracks_ && kinSelEmu(track) && chi2SelEmu(track)) {
580  vTTTrackEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
581  if (doDeltaZCutEmu_ && deltaZSelEmu(track, leadingEmulationVertex)) {
582  vTTTrackAssociatedEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
583  }
584  }
585  }
586 
587  if (debug_ >= 2) {
588  printDebugInfo(l1TracksHandle,
589  vTTTrackOutput,
590  vTTTrackEmulationOutput,
591  vTTTrackAssociatedOutput,
592  vTTTrackAssociatedEmulationOutput);
593  }
594 
595  // Put the outputs into the event
597  iEvent.put(std::move(vTTTrackOutput), outputCollectionName_);
598  if (doDeltaZCutSim_) {
599  iEvent.put(std::move(vTTTrackAssociatedOutput), outputCollectionName_ + "Associated");
600  }
601  }
603  iEvent.put(std::move(vTTTrackEmulationOutput), outputCollectionName_ + "Emulation");
604  if (doDeltaZCutEmu_) {
605  iEvent.put(std::move(vTTTrackAssociatedEmulationOutput), outputCollectionName_ + "AssociatedEmulation");
606  }
607  }
608 }
609 
610 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
612  //L1TrackSelectionProducer
614  desc.add<edm::InputTag>("l1TracksInputTag", edm::InputTag("l1tTTTracksFromTrackletEmulation", "Level1TTTracks"));
615  desc.addOptional<edm::InputTag>("l1VerticesInputTag", edm::InputTag("l1tVertexFinder", "l1vertices"));
616  desc.addOptional<edm::InputTag>("l1VerticesEmulationInputTag",
617  edm::InputTag("l1tVertexFinderEmulator", "l1verticesEmulation"));
618  desc.add<std::string>("outputCollectionName", "Level1TTTracksSelected");
619  {
620  edm::ParameterSetDescription descCutSet;
621  descCutSet.add<double>("ptMin", 2.0)->setComment("pt must be greater than this value, [GeV]");
622  descCutSet.add<double>("absEtaMax", 2.4)->setComment("absolute value of eta must be less than this value");
623  descCutSet.add<double>("absZ0Max", 15.0)->setComment("z0 must be less than this value, [cm]");
624  descCutSet.add<int>("nStubsMin", 4)->setComment("number of stubs must be greater than or equal to this value");
625  descCutSet.add<int>("nPSStubsMin", 0)
626  ->setComment("number of stubs in the PS Modules must be greater than or equal to this value");
627 
628  descCutSet.add<double>("reducedBendChi2Max", 2.25)->setComment("bend chi2 must be less than this value");
629  descCutSet.add<double>("reducedChi2RZMax", 5.0)->setComment("chi2rz/dof must be less than this value");
630  descCutSet.add<double>("reducedChi2RPhiMax", 20.0)->setComment("chi2rphi/dof must be less than this value");
631 
632  descCutSet.add<std::vector<double>>("deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
633  ->setComment("these values define the bin boundaries in |eta|");
634  descCutSet.add<std::vector<double>>("deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
635  ->setComment(
636  "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, "
637  "[cm]");
638  desc.add<edm::ParameterSetDescription>("cutSet", descCutSet);
639  }
640  desc.add<double>("useDisplacedTracksDeltaZOverride", -1.0)
641  ->setComment("override the deltaZ cut value for displaced tracks");
642  desc.add<bool>("processSimulatedTracks", true)
643  ->setComment("return selected tracks after cutting on the floating point values");
644  desc.add<bool>("processEmulatedTracks", true)
645  ->setComment("return selected tracks after cutting on the bitwise emulated values");
646  desc.add<int>("debug", 0)->setComment("Verbosity levels: 0, 1, 2, 3");
647  descriptions.addWithDefaultLabel(desc);
648 }
649 
650 //define this as a plug-in
L1TrackSelectionProducer(const edm::ParameterSet &)
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int tobLayer(const DetId &id) const
edm::Handle< TTTrackCollection > TTTrackCollectionHandle
float floatZ0(z0_t z0)
Definition: datatypes.h:163
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
TTTrackDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
AndSelector< TTTrackBendChi2MaxSelector, TTTrackChi2RZMaxSelector, TTTrackChi2RPhiMaxSelector > TTTrackBendChi2Chi2RZChi2RPhiMaxSelector
AndSelector< TTTrackWordBendChi2MaxSelector, TTTrackWordChi2RZMaxSelector, TTTrackWordChi2RPhiMaxSelector > TTTrackWordBendChi2Chi2RZChi2RPhiMaxSelector
AndSelector< TTTrackWordPtMinSelector, TTTrackWordAbsEtaMaxSelector, TTTrackWordAbsZ0MaxSelector, TTTrackWordNStubsMinSelector > TTTrackWordPtMinEtaMaxZ0MaxNStubsMinSelector
void printDebugInfo(const TTTrackCollectionHandle &l1TracksHandle, const TTTrackRefCollectionUPtr &vTTTrackOutput, const TTTrackRefCollectionUPtr &vTTTrackEmulationOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedEmulationOutput) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
AndSelector< TTTrackPtMinSelector, TTTrackAbsEtaMaxSelector, TTTrackAbsZ0MaxSelector, TTTrackNStubsMinSelector > TTTrackPtMinEtaMaxZ0MaxNStubsMinSelector
constexpr float ptMin
TTTrackNPSStubsMinSelector(const edm::ParameterSet &cfg, const TrackerTopology &tTopo)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< TTTrackRefCollection > TTTrackRefCollectionUPtr
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TTTrackNPSStubsMinSelector(double nStubsMin, const TrackerTopology &tTopo)
int iEvent
Definition: GenABIO.cc:224
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
Definition: VertexWord.h:65
std::vector< double > deltaZMaxEtaBounds_
edm::EDGetTokenT< l1t::VertexCollection > l1VerticesToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Ref< TTTrackCollection > TTTrackRef
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool operator()(const L1Track &t, const l1t::Vertex &v) const
const edm::ParameterSet cutSet_
static constexpr auto TOB
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< L1Track > TTTrackCollection
Log< level::Info, false > LogInfo
Definition: DetId.h:17
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
void printTrackInfo(edm::LogInfo &log, const L1Track &track, bool printEmulation=false) const
static constexpr double stepPhi0
double z0() const
Definition: VertexWord.h:158
bool operator()(const L1Track &t, const l1t::VertexWord &v) const
edm::RefVector< TTTrackCollection > TTTrackRefCollection
edm::EDGetTokenT< l1t::VertexWordCollection > l1VerticesEmulationToken_
HLT enums.
ap_uint< TrackBitWidths::kTanlSize > tanl_t
unsigned int tidRing(const DetId &id) const
float z0() const
Definition: Vertex.h:21
static constexpr double stepZ0
TTTrackWordDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
static constexpr auto TID
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< TTTrackCollection > l1TracksToken_