CMS 3D CMS Logo

TrackFinder.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <sstream>
5 
7  : setup_(iConfig, iConsumes),
8  sector_processors_(),
9  tokenDTPhi_(iConsumes.consumes<emtf::DTTag::digi_collection>(iConfig.getParameter<edm::InputTag>("DTPhiInput"))),
10  tokenDTTheta_(
11  iConsumes.consumes<emtf::DTTag::theta_digi_collection>(iConfig.getParameter<edm::InputTag>("DTThetaInput"))),
12  tokenCSC_(iConsumes.consumes<emtf::CSCTag::digi_collection>(iConfig.getParameter<edm::InputTag>("CSCInput"))),
13  tokenCSCComparator_(iConsumes.consumes<emtf::CSCTag::comparator_digi_collection>(
14  iConfig.getParameter<edm::InputTag>("CSCComparatorInput"))),
15  tokenRPC_(iConsumes.consumes<emtf::RPCTag::digi_collection>(iConfig.getParameter<edm::InputTag>("RPCInput"))),
16  tokenCPPF_(iConsumes.consumes<emtf::CPPFTag::digi_collection>(iConfig.getParameter<edm::InputTag>("CPPFInput"))),
17  tokenGEM_(iConsumes.consumes<emtf::GEMTag::digi_collection>(iConfig.getParameter<edm::InputTag>("GEMInput"))),
18  tokenME0_(iConsumes.consumes<emtf::ME0Tag::digi_collection>(iConfig.getParameter<edm::InputTag>("ME0Input"))),
19  verbose_(iConfig.getUntrackedParameter<int>("verbosity")) {}
20 
22 
24  const edm::EventSetup& iSetup,
25  EMTFHitCollection& out_hits,
26  EMTFTrackCollection& out_tracks) {
27  // Clear output collections
28  out_hits.clear();
29  out_tracks.clear();
30 
31  // Check and update geometry, conditions, versions, sp LUTs, and pt assignment engine
32  setup_.reload(iEvent, iSetup);
33 
34  auto tp_geom_ = &(setup_.getGeometryTranslator());
35 
36  // Check versions
37  if (verbose_ > 0) { // debug
38  std::cout << "Event: " << iEvent.id() << " isData: " << iEvent.isRealData() << " useO2O: " << setup_.useO2O()
39  << " era: " << setup_.era() << " fw_ver: " << setup_.get_fw_version()
40  << " pt_lut_ver: " << setup_.get_pt_lut_version()
41  << " pt_lut_ver in engine: " << setup_.getPtAssignmentEngine()->get_pt_lut_version()
42  << " pc_lut_ver: " << setup_.get_pc_lut_version()
43  << " pc_lut_ver in cond (i): " << setup_.getConditionHelper().get_pc_lut_version()
44  << " pc_lut_ver in cond (ii): " << setup_.getConditionHelper().get_pc_lut_version_unchecked()
45  << std::endl;
46  }
47 
48  // ___________________________________________________________________________
49  // Extract all trigger primitives
50 
51  TriggerPrimitiveCollection muon_primitives;
52 
53  EMTFSubsystemCollector collector;
54 
55  auto iConfig = setup_.getConfig();
56  auto useDT = iConfig.getParameter<bool>("DTEnable");
57  auto useCSC = iConfig.getParameter<bool>("CSCEnable");
58  auto useRPC = iConfig.getParameter<bool>("RPCEnable");
59  auto useIRPC = iConfig.getParameter<bool>("IRPCEnable");
60  auto useCPPF = iConfig.getParameter<bool>("CPPFEnable");
61  auto useGEM = iConfig.getParameter<bool>("GEMEnable");
62  auto useME0 = iConfig.getParameter<bool>("ME0Enable");
63 
64  if (useCSC) {
65  collector.extractPrimitives(emtf::CSCTag(), tp_geom_, iEvent, tokenCSC_, muon_primitives);
66  //collector.extractPrimitives(emtf::CSCTag(), tp_geom_, iEvent, tokenCSC_, tokenCSCComparator_, muon_primitives);
67  }
68  if (useRPC && useCPPF) {
69  collector.extractPrimitives(emtf::CPPFTag(), tp_geom_, iEvent, tokenCPPF_, muon_primitives);
70  } else if (useRPC) {
71  collector.extractPrimitives(emtf::RPCTag(), tp_geom_, iEvent, tokenRPC_, muon_primitives);
72  }
73  if (useIRPC) {
74  collector.extractPrimitives(emtf::IRPCTag(), tp_geom_, iEvent, tokenRPC_, muon_primitives);
75  }
76  if (useGEM) {
77  collector.extractPrimitives(emtf::GEMTag(), tp_geom_, iEvent, tokenGEM_, muon_primitives);
78  }
79  if (useME0) {
80  collector.extractPrimitives(emtf::ME0Tag(), tp_geom_, iEvent, tokenME0_, muon_primitives);
81  }
82  if (useDT) {
83  collector.extractPrimitives(emtf::DTTag(), tp_geom_, iEvent, tokenDTPhi_, tokenDTTheta_, muon_primitives);
84  }
85 
86  // Check trigger primitives. The printout is really verbose.
87  if (verbose_ > 2) { // debug
88  std::cout << "Num of TriggerPrimitive: " << muon_primitives.size() << std::endl;
89  for (const auto& p : muon_primitives) {
90  p.print(std::cout);
91  }
92  }
93 
94  // ___________________________________________________________________________
95  // Run the sector processors
96 
98  for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) {
100  (sector - emtf::MIN_TRIGSECTOR);
101 
102  sector_processors_.at(es).configure(&setup_, verbose_, endcap, sector);
103  sector_processors_.at(es).process(iEvent.id(), muon_primitives, out_hits, out_tracks);
104  }
105  }
106 
107  // ___________________________________________________________________________
108  // Check emulator input and output. They are printed as raw text that is
109  // used by the firmware simulator to do comparisons.
110  if (verbose_ > 1) { // debug
111  emtf::dump_fw_raw_input(out_hits, out_tracks);
112  }
113 
114  return;
115 }
const ConditionHelper & getConditionHelper() const
Definition: EMTFSetup.h:31
constexpr int MIN_ENDCAP
Definition: Common.h:45
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:27
void dump_fw_raw_input(const l1t::EMTFHitCollection &out_hits, const l1t::EMTFTrackCollection &out_tracks)
Definition: DebugTools.cc:6
const edm::EDGetToken tokenCSC_
Definition: TrackFinder.h:37
const edm::EDGetToken tokenCPPF_
Definition: TrackFinder.h:40
const edm::EDGetToken tokenDTPhi_
Definition: TrackFinder.h:35
Definition: Event.h:15
l1t::EMTFHitCollection EMTFHitCollection
Definition: Common.h:23
unsigned int get_pc_lut_version_unchecked() const
const edm::EDGetToken tokenDTTheta_
Definition: TrackFinder.h:36
TrackFinder(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iConsumes)
Definition: TrackFinder.cc:6
const GeometryTranslator & getGeometryTranslator() const
Definition: EMTFSetup.h:29
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
EMTFSetup setup_
Definition: TrackFinder.h:30
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetToken tokenGEM_
Definition: TrackFinder.h:41
unsigned get_fw_version() const
Definition: EMTFSetup.h:47
unsigned get_pc_lut_version() const
Definition: EMTFSetup.h:49
const edm::EDGetToken tokenRPC_
Definition: TrackFinder.h:39
int get_pt_lut_version() const
void extractPrimitives(T tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
const edm::EDGetToken tokenME0_
Definition: TrackFinder.h:42
emtf::sector_array< SectorProcessor > sector_processors_
Definition: TrackFinder.h:32
PtAssignmentEngine * getPtAssignmentEngine() const
Definition: EMTFSetup.h:37
const edm::ParameterSet & getConfig() const
Definition: EMTFSetup.h:52
bool useO2O() const
Definition: EMTFSetup.h:54
constexpr int MAX_ENDCAP
Definition: Common.h:46
HLT enums.
unsigned get_pt_lut_version() const
Definition: EMTFSetup.h:48
void process(const edm::Event &iEvent, const edm::EventSetup &iSetup, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks)
Definition: TrackFinder.cc:23
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
std::string era() const
Definition: EMTFSetup.h:55
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
unsigned int get_pc_lut_version() const
void reload(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: EMTFSetup.cc:41