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  //edm::LogInfo("L1TrackSelectionProducer") << "produce::Emulation track properties::ap_uint(bits) = " << ptEmulationBits.to_string(2)
117  // << " ap_ufixed(bits) = " << ptEmulation.to_string(2) << " ap_ufixed(float) = " << ptEmulation.to_double();
118  return ptEmulation.to_double() >= ptMin_;
119  }
120 
121  private:
122  double ptMin_;
123  };
127  : absEtaMax_(cfg.template getParameter<double>("absEtaMax")) {}
128  bool operator()(const L1Track& t) const { return std::abs(t.momentum().eta()) <= absEtaMax_; }
129 
130  private:
131  double absEtaMax_;
132  };
136  : absEtaMax_(cfg.template getParameter<double>("absEtaMax")) {}
137  bool operator()(const L1Track& t) const {
138  TTTrack_TrackWord::tanl_t etaEmulationBits = t.getTanlWord();
139  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
140  etaEmulation.V = etaEmulationBits.range();
141  return std::abs(etaEmulation.to_double()) <= absEtaMax_;
142  }
143 
144  private:
145  double absEtaMax_;
146  };
149  TTTrackAbsZ0MaxSelector(const edm::ParameterSet& cfg) : absZ0Max_(cfg.template getParameter<double>("absZ0Max")) {}
150  bool operator()(const L1Track& t) const { return std::abs(t.z0()) <= absZ0Max_; }
151 
152  private:
153  double absZ0Max_;
154  };
158  : absZ0Max_(cfg.template getParameter<double>("absZ0Max")) {}
159  bool operator()(const L1Track& t) const { return std::abs(t.getZ0()) <= absZ0Max_; }
160 
161  private:
162  double absZ0Max_;
163  };
167  : nStubsMin_(cfg.template getParameter<double>("nStubsMin")) {}
168  bool operator()(const L1Track& t) const { return t.getStubRefs().size() >= nStubsMin_; }
169 
170  private:
171  double nStubsMin_;
172  };
176  : nStubsMin_(cfg.template getParameter<double>("nStubsMin")) {}
177  bool operator()(const L1Track& t) const { return t.getNStubs() >= nStubsMin_; }
178 
179  private:
180  double nStubsMin_;
181  };
184  : nPSStubsMin_(nStubsMin), tTopo_(tTopo) {}
186  : nPSStubsMin_(cfg.template getParameter<double>("nPSStubsMin")), tTopo_(tTopo) {}
187  bool operator()(const L1Track& t) const {
188  int nPSStubs = 0;
189  for (const auto& stub : t.getStubRefs()) {
190  DetId detId(stub->getDetId());
191  if (detId.det() == DetId::Detector::Tracker) {
192  if ((detId.subdetId() == StripSubdetector::TOB && tTopo_.tobLayer(detId) <= 3) ||
193  (detId.subdetId() == StripSubdetector::TID && tTopo_.tidRing(detId) <= 9))
194  nPSStubs++;
195  }
196  }
197  return nPSStubs >= nPSStubsMin_;
198  }
199 
200  private:
201  double nPSStubsMin_;
203  };
205  TTTrackBendChi2MaxSelector(double bendChi2Max) : bendChi2Max_(bendChi2Max) {}
207  : bendChi2Max_(cfg.template getParameter<double>("reducedBendChi2Max")) {}
208  bool operator()(const L1Track& t) const { return t.stubPtConsistency() < bendChi2Max_; }
209 
210  private:
211  double bendChi2Max_;
212  };
214  TTTrackWordBendChi2MaxSelector(double bendChi2Max) : bendChi2Max_(bendChi2Max) {}
216  : bendChi2Max_(cfg.template getParameter<double>("reducedBendChi2Max")) {}
217  bool operator()(const L1Track& t) const { return t.getBendChi2() < bendChi2Max_; }
218 
219  private:
220  double bendChi2Max_;
221  };
225  : reducedChi2RZMax_(cfg.template getParameter<double>("reducedChi2RZMax")) {}
226  bool operator()(const L1Track& t) const { return t.chi2ZRed() < reducedChi2RZMax_; }
227 
228  private:
230  };
234  : reducedChi2RZMax_(cfg.template getParameter<double>("reducedChi2RZMax")) {}
235  bool operator()(const L1Track& t) const { return t.getChi2RZ() < reducedChi2RZMax_; }
236 
237  private:
239  };
243  : reducedChi2RPhiMax_(cfg.template getParameter<double>("reducedChi2RPhiMax")) {}
244  bool operator()(const L1Track& t) const { return t.chi2XYRed() < reducedChi2RPhiMax_; }
245 
246  private:
248  };
252  : reducedChi2RPhiMax_(cfg.template getParameter<double>("reducedChi2RPhiMax")) {}
253  bool operator()(const L1Track& t) const { return t.getChi2RPhi() < reducedChi2RPhiMax_; }
254 
255  private:
257  };
259  TTTrackDeltaZMaxSelector(const std::vector<double>& deltaZMaxEtaBounds, const std::vector<double>& deltaZMax)
262  : deltaZMaxEtaBounds_(cfg.template getParameter<double>("deltaZMaxEtaBounds")),
263  deltaZMax_(cfg.template getParameter<double>("deltaZMax")) {}
264  bool operator()(const L1Track& t, const l1t::Vertex& v) const {
265  size_t etaIndex =
266  std::lower_bound(deltaZMaxEtaBounds_.begin(), deltaZMaxEtaBounds_.end(), std::abs(t.momentum().eta())) -
267  deltaZMaxEtaBounds_.begin() - 1;
268  if (etaIndex > deltaZMax_.size() - 1)
269  etaIndex = deltaZMax_.size() - 1;
270  return std::abs(v.z0() - t.z0()) <= deltaZMax_[etaIndex];
271  }
272 
273  private:
274  std::vector<double> deltaZMaxEtaBounds_;
275  std::vector<double> deltaZMax_;
276  };
278  TTTrackWordDeltaZMaxSelector(const std::vector<double>& deltaZMaxEtaBounds, const std::vector<double>& deltaZMax)
281  : deltaZMaxEtaBounds_(cfg.template getParameter<double>("deltaZMaxEtaBounds")),
282  deltaZMax_(cfg.template getParameter<double>("deltaZMax")) {}
283  bool operator()(const L1Track& t, const l1t::VertexWord& v) const {
284  size_t etaIndex =
285  std::lower_bound(deltaZMaxEtaBounds_.begin(), deltaZMaxEtaBounds_.end(), std::abs(t.momentum().eta())) -
286  deltaZMaxEtaBounds_.begin() - 1;
287  if (etaIndex > deltaZMax_.size() - 1)
288  etaIndex = deltaZMax_.size() - 1;
289  return std::abs(v.z0() - t.getZ0()) <= deltaZMax_[etaIndex];
290  }
291 
292  private:
293  std::vector<double> deltaZMaxEtaBounds_;
294  std::vector<double> deltaZMax_;
295  };
296 
308 
309  // ----------member data ---------------------------
318  std::vector<double> deltaZMaxEtaBounds_, deltaZMax_;
321  int debug_;
322 };
323 
324 //
325 // constructors and destructor
326 //
328  : l1TracksToken_(consumes<TTTrackCollection>(iConfig.getParameter<edm::InputTag>("l1TracksInputTag"))),
330  outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")),
331  cutSet_(iConfig.getParameter<edm::ParameterSet>("cutSet")),
332 
333  ptMin_(cutSet_.getParameter<double>("ptMin")),
334  absEtaMax_(cutSet_.getParameter<double>("absEtaMax")),
335  absZ0Max_(cutSet_.getParameter<double>("absZ0Max")),
336  bendChi2Max_(cutSet_.getParameter<double>("reducedBendChi2Max")),
337  reducedChi2RZMax_(cutSet_.getParameter<double>("reducedChi2RZMax")),
338  reducedChi2RPhiMax_(cutSet_.getParameter<double>("reducedChi2RPhiMax")),
339  nStubsMin_(cutSet_.getParameter<int>("nStubsMin")),
340  nPSStubsMin_(cutSet_.getParameter<int>("nPSStubsMin")),
341  deltaZMaxEtaBounds_(cutSet_.getParameter<std::vector<double>>("deltaZMaxEtaBounds")),
342  deltaZMax_(cutSet_.getParameter<std::vector<double>>("deltaZMax")),
343 
344  useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>("useDisplacedTracksDeltaZOverride")),
345  processSimulatedTracks_(iConfig.getParameter<bool>("processSimulatedTracks")),
346  processEmulatedTracks_(iConfig.getParameter<bool>("processEmulatedTracks")),
347  debug_(iConfig.getParameter<int>("debug")) {
348  // Confirm the the configuration makes sense
350  throw cms::Exception("You must process at least one of the track collections (simulated or emulated).");
351  }
352 
353  if (deltaZMax_.size() != deltaZMaxEtaBounds_.size() - 1) {
354  throw cms::Exception("The number of deltaZ cuts does not match the number of eta bins!");
355  }
356 
358  deltaZMax_ = std::vector<double>(deltaZMax_.size(), useDisplacedTracksDeltaZOverride_);
359  }
360 
361  // Get additional input tags and define the EDM output based on the previous configuration parameters
362  doDeltaZCutSim_ = false;
363  doDeltaZCutEmu_ = false;
365  produces<TTTrackRefCollection>(outputCollectionName_);
366  if (iConfig.exists("l1VerticesInputTag")) {
367  l1VerticesToken_ = consumes<l1t::VertexCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesInputTag"));
368  doDeltaZCutSim_ = true;
369  produces<TTTrackRefCollection>(outputCollectionName_ + "Associated");
370  }
371  }
373  produces<TTTrackRefCollection>(outputCollectionName_ + "Emulation");
374  if (iConfig.exists("l1VerticesEmulationInputTag")) {
376  consumes<l1t::VertexWordCollection>(iConfig.getParameter<edm::InputTag>("l1VerticesEmulationInputTag"));
377  doDeltaZCutEmu_ = true;
378  produces<TTTrackRefCollection>(outputCollectionName_ + "AssociatedEmulation");
379  }
380  }
381 }
382 
384 
385 //
386 // member functions
387 //
388 
390  const TTTrackRefCollectionUPtr& vTTTrackOutput,
391  const TTTrackRefCollectionUPtr& vTTTrackEmulationOutput,
392  const TTTrackRefCollectionUPtr& vTTTrackAssociatedOutput,
393  const TTTrackRefCollectionUPtr& vTTTrackAssociatedEmulationOutput) const {
394  edm::LogInfo log("L1TrackSelectionProducer");
395  log << "The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
396  for (const auto& track : *l1TracksHandle) {
397  printTrackInfo(log, track, debug_ >= 4);
398  }
399  log << "\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() << "\n\n";
401  log << "The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
402  for (const auto& track : *vTTTrackOutput) {
403  printTrackInfo(log, *track, debug_ >= 4);
404  }
405  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() << "\n\n";
406  }
408  log << "The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are "
409  "... \n";
410  for (const auto& track : *vTTTrackEmulationOutput) {
411  printTrackInfo(log, *track, debug_ >= 4);
412  }
413  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() << "\n\n";
414  }
416  TTTrackRefCollection inSimButNotEmu;
417  TTTrackRefCollection inEmuButNotSim;
418  std::set_difference(vTTTrackOutput->begin(),
419  vTTTrackOutput->end(),
420  vTTTrackEmulationOutput->begin(),
421  vTTTrackEmulationOutput->end(),
422  std::back_inserter(inSimButNotEmu));
423  std::set_difference(vTTTrackEmulationOutput->begin(),
424  vTTTrackEmulationOutput->end(),
425  vTTTrackOutput->begin(),
426  vTTTrackOutput->end(),
427  std::back_inserter(inEmuButNotSim));
428  log << "The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected "
429  "by cutting on the emulated values ... \n";
430  for (const auto& track : inSimButNotEmu) {
431  printTrackInfo(log, *track, debug_ >= 3);
432  }
433  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
434  << "The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected "
435  "by cutting on the simulated values ... \n";
436  for (const auto& track : inEmuButNotSim) {
437  printTrackInfo(log, *track, debug_ >= 3);
438  }
439  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
440  }
442  log << "The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, "
443  "chi2rphi, z0) values are ... \n";
444  for (const auto& track : *vTTTrackAssociatedOutput) {
445  printTrackInfo(log, *track, debug_ >= 4);
446  }
447  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() << "\n\n";
448  }
450  log << "The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, "
451  "chi2rz, chi2rphi, z0) values are "
452  "... \n";
453  for (const auto& track : *vTTTrackAssociatedEmulationOutput) {
454  printTrackInfo(log, *track, debug_ >= 4);
455  }
456  log << "\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() << "\n\n";
457  }
459  TTTrackRefCollection inSimButNotEmu;
460  TTTrackRefCollection inEmuButNotSim;
461  std::set_difference(vTTTrackAssociatedOutput->begin(),
462  vTTTrackAssociatedOutput->end(),
463  vTTTrackAssociatedEmulationOutput->begin(),
464  vTTTrackAssociatedEmulationOutput->end(),
465  std::back_inserter(inSimButNotEmu));
466  std::set_difference(vTTTrackAssociatedEmulationOutput->begin(),
467  vTTTrackAssociatedEmulationOutput->end(),
468  vTTTrackAssociatedOutput->begin(),
469  vTTTrackAssociatedOutput->end(),
470  std::back_inserter(inEmuButNotSim));
471  log << "The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected "
472  "by cutting on the emulated values ... \n";
473  for (const auto& track : inSimButNotEmu) {
474  printTrackInfo(log, *track, debug_ >= 3);
475  }
476  log << "\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() << "\n\n"
477  << "The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected "
478  "by cutting on the simulated values ... \n";
479  for (const auto& track : inEmuButNotSim) {
480  printTrackInfo(log, *track, debug_ >= 3);
481  }
482  log << "\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() << "\n\n";
483  }
484 }
485 
486 void L1TrackSelectionProducer::printTrackInfo(edm::LogInfo& log, const L1Track& track, bool printEmulation) const {
487  log << "\t(" << track.momentum().perp() << ", " << track.momentum().eta() << ", " << track.momentum().phi() << ", "
488  << track.getStubRefs().size() << ", " << track.stubPtConsistency() << ", " << track.chi2ZRed() << ", "
489  << track.chi2XYRed() << ", " << track.z0() << ")\n";
490 
491  if (printEmulation) {
492  ap_uint<TrackBitWidths::kPtSize> ptEmulationBits = track.getTrackWord()(
493  TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
494  ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
495  ptEmulation.V = ptEmulationBits.range();
496  TTTrack_TrackWord::tanl_t etaEmulationBits = track.getTanlWord();
497  ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
498  etaEmulation.V = etaEmulationBits.range();
499  log << "\t\t(" << ptEmulation.to_double() << ", " << etaEmulation.to_double() << ", " << track.getPhi() << ", "
500  << track.getNStubs() << ", " << track.getBendChi2() << ", " << track.getChi2RZ() << ", " << track.getChi2RPhi()
501  << ", " << track.getZ0() << ")\n";
502  }
503 }
504 
505 // ------------ method called to produce the data ------------
507  auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
508  auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollection>();
509  auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
510  auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollection>();
511 
512  // Tracker Topology
513  const TrackerTopology& tTopo = iSetup.getData(tTopoToken_);
514 
515  TTTrackCollectionHandle l1TracksHandle;
516  edm::Handle<l1t::VertexCollection> l1VerticesHandle;
517  edm::Handle<l1t::VertexWordCollection> l1VerticesEmulationHandle;
518 
519  l1t::Vertex leadingVertex;
520  l1t::VertexWord leadingEmulationVertex;
521 
522  iEvent.getByToken(l1TracksToken_, l1TracksHandle);
523  size_t nOutputApproximate = l1TracksHandle->size();
525  if (doDeltaZCutSim_) {
526  iEvent.getByToken(l1VerticesToken_, l1VerticesHandle);
527  leadingVertex = l1VerticesHandle->at(0);
528  if (debug_ >= 2) {
529  edm::LogInfo("L1TrackSelectionProducer") << "leading vertex z0 = " << leadingVertex.z0();
530  }
531  }
532  vTTTrackOutput->reserve(nOutputApproximate);
533  vTTTrackAssociatedOutput->reserve(nOutputApproximate);
534  }
536  if (doDeltaZCutEmu_) {
537  iEvent.getByToken(l1VerticesEmulationToken_, l1VerticesEmulationHandle);
538  leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
539  if (debug_ >= 2) {
540  edm::LogInfo("L1TrackSelectionProducer") << "leading emulation vertex z0 = " << leadingEmulationVertex.z0();
541  }
542  }
543  vTTTrackEmulationOutput->reserve(nOutputApproximate);
544  vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
545  }
546 
553  TTTrackNPSStubsMinSelector nPSStubsSel(nPSStubsMin_, tTopo);
554 
555  for (size_t i = 0; i < nOutputApproximate; i++) {
556  const auto& track = l1TracksHandle->at(i);
557 
558  // Select tracks based on the floating point TTTrack
559  if (processSimulatedTracks_ && kinSel(track) && nPSStubsSel(track) && chi2Sel(track)) {
560  vTTTrackOutput->push_back(TTTrackRef(l1TracksHandle, i));
561  if (doDeltaZCutSim_ && deltaZSel(track, leadingVertex)) {
562  vTTTrackAssociatedOutput->push_back(TTTrackRef(l1TracksHandle, i));
563  }
564  }
565 
566  // Select tracks based on the bitwise accurate TTTrack_TrackWord
567  if (processEmulatedTracks_ && kinSelEmu(track) && chi2SelEmu(track)) {
568  vTTTrackEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
569  if (doDeltaZCutEmu_ && deltaZSelEmu(track, leadingEmulationVertex)) {
570  vTTTrackAssociatedEmulationOutput->push_back(TTTrackRef(l1TracksHandle, i));
571  }
572  }
573  }
574 
575  if (debug_ >= 2) {
576  printDebugInfo(l1TracksHandle,
577  vTTTrackOutput,
578  vTTTrackEmulationOutput,
579  vTTTrackAssociatedOutput,
580  vTTTrackAssociatedEmulationOutput);
581  }
582 
583  // Put the outputs into the event
585  iEvent.put(std::move(vTTTrackOutput), outputCollectionName_);
586  if (doDeltaZCutSim_) {
587  iEvent.put(std::move(vTTTrackAssociatedOutput), outputCollectionName_ + "Associated");
588  }
589  }
591  iEvent.put(std::move(vTTTrackEmulationOutput), outputCollectionName_ + "Emulation");
592  if (doDeltaZCutEmu_) {
593  iEvent.put(std::move(vTTTrackAssociatedEmulationOutput), outputCollectionName_ + "AssociatedEmulation");
594  }
595  }
596 }
597 
598 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
600  //L1TrackSelectionProducer
602  desc.add<edm::InputTag>("l1TracksInputTag", edm::InputTag("l1tTTTracksFromTrackletEmulation", "Level1TTTracks"));
603  desc.addOptional<edm::InputTag>("l1VerticesInputTag", edm::InputTag("l1tVertexFinder", "l1vertices"));
604  desc.addOptional<edm::InputTag>("l1VerticesEmulationInputTag",
605  edm::InputTag("l1tVertexFinderEmulator", "l1verticesEmulation"));
606  desc.add<std::string>("outputCollectionName", "Level1TTTracksSelected");
607  {
608  edm::ParameterSetDescription descCutSet;
609  descCutSet.add<double>("ptMin", 2.0)->setComment("pt must be greater than this value, [GeV]");
610  descCutSet.add<double>("absEtaMax", 2.4)->setComment("absolute value of eta must be less than this value");
611  descCutSet.add<double>("absZ0Max", 15.0)->setComment("z0 must be less than this value, [cm]");
612  descCutSet.add<int>("nStubsMin", 4)->setComment("number of stubs must be greater than or equal to this value");
613  descCutSet.add<int>("nPSStubsMin", 0)
614  ->setComment("number of stubs in the PS Modules must be greater than or equal to this value");
615 
616  descCutSet.add<double>("reducedBendChi2Max", 2.25)->setComment("bend chi2 must be less than this value");
617  descCutSet.add<double>("reducedChi2RZMax", 5.0)->setComment("chi2rz/dof must be less than this value");
618  descCutSet.add<double>("reducedChi2RPhiMax", 20.0)->setComment("chi2rphi/dof must be less than this value");
619 
620  descCutSet.add<std::vector<double>>("deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
621  ->setComment("these values define the bin boundaries in |eta|");
622  descCutSet.add<std::vector<double>>("deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
623  ->setComment(
624  "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, "
625  "[cm]");
626  desc.add<edm::ParameterSetDescription>("cutSet", descCutSet);
627  }
628  desc.add<double>("useDisplacedTracksDeltaZOverride", -1.0)
629  ->setComment("override the deltaZ cut value for displaced tracks");
630  desc.add<bool>("processSimulatedTracks", true)
631  ->setComment("return selected tracks after cutting on the floating point values");
632  desc.add<bool>("processEmulatedTracks", true)
633  ->setComment("return selected tracks after cutting on the bitwise emulated values");
634  desc.add<int>("debug", 0)->setComment("Verbosity levels: 0, 1, 2, 3");
635  descriptions.addWithDefaultLabel(desc);
636 }
637 
638 //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
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
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 getData(T &iHolder) const
Definition: EventSetup.h:122
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
double z0() const
Definition: VertexWord.h:156
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
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_