CMS 3D CMS Logo

L1MuDTTrackFinder.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTrackFinder
4 //
5 // Description: L1 barrel Muon Trigger Track Finder
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 // J. Troconiz UAM Madrid
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 
27 //-------------------------------
28 // Collaborating Class Headers --
29 //-------------------------------
30 
43 
44 using namespace std;
45 
46 //---------------------------------
47 // class L1MuDTTrackFinder
48 //---------------------------------
49 
50 //----------------
51 // Constructors --
52 //----------------
53 
55  // set configuration parameters
56  if (m_config == nullptr)
57  m_config = new L1MuDTTFConfig(ps);
58 
59  if (m_config->Debug(1))
60  cout << endl;
61  if (m_config->Debug(1))
62  cout << "**** entering L1MuDTTrackFinder ****" << endl;
63  if (m_config->Debug(1))
64  cout << endl;
65 
66  m_spmap = new L1MuDTSecProcMap();
67  m_epvec.reserve(12);
68  m_wsvec.reserve(12);
69  m_ms = nullptr;
70 
71  _cache.reserve(4 * 17);
72  _cache0.reserve(144 * 17);
73 
74  m_DTDigiToken = iC.consumes<L1MuDTChambPhContainer>(m_config->getDTDigiInputTag());
75 }
76 
77 //--------------
78 // Destructor --
79 //--------------
80 
82  delete m_spmap;
83 
84  vector<L1MuDTEtaProcessor*>::iterator it_ep = m_epvec.begin();
85  while (it_ep != m_epvec.end()) {
86  delete (*it_ep);
87  it_ep++;
88  }
89  m_epvec.clear();
90 
91  vector<L1MuDTWedgeSorter*>::iterator it_ws = m_wsvec.begin();
92  while (it_ws != m_wsvec.end()) {
93  delete (*it_ws);
94  it_ws++;
95  }
96  m_wsvec.clear();
97 
98  delete m_ms;
99 
100  if (m_config)
101  delete m_config;
102  m_config = nullptr;
103 }
104 
105 //--------------
106 // Operations --
107 //--------------
108 
109 //
110 // setup MTTF configuration
111 //
113  // build the barrel Muon Trigger Track Finder
114 
115  if (m_config->Debug(1))
116  cout << endl;
117  if (m_config->Debug(1))
118  cout << "**** L1MuDTTrackFinder building ****" << endl;
119  if (m_config->Debug(1))
120  cout << endl;
121 
122  // create new sector processors
123  for (int wh = -3; wh <= 3; wh++) {
124  if (wh == 0)
125  continue;
126  for (int sc = 0; sc < 12; sc++) {
127  L1MuDTSecProcId tmpspid(wh, sc);
128  L1MuDTSectorProcessor* sp = new L1MuDTSectorProcessor(*this, tmpspid, std::move(iC));
129  if (m_config->Debug(2))
130  cout << "creating " << tmpspid << endl;
131  m_spmap->insert(tmpspid, sp);
132  }
133  }
134 
135  // create new eta processors and wedge sorters
136  for (int sc = 0; sc < 12; sc++) {
137  L1MuDTEtaProcessor* ep = new L1MuDTEtaProcessor(*this, sc, std::move(iC));
138  if (m_config->Debug(2))
139  cout << "creating Eta Processor " << sc << endl;
140  m_epvec.push_back(ep);
141  L1MuDTWedgeSorter* ws = new L1MuDTWedgeSorter(*this, sc);
142  if (m_config->Debug(2))
143  cout << "creating Wedge Sorter " << sc << endl;
144  m_wsvec.push_back(ws);
145  }
146 
147  // create new muon sorter
148  if (m_config->Debug(2))
149  cout << "creating DT Muon Sorter " << endl;
150  m_ms = new L1MuDTMuonSorter(*this);
151 }
152 
153 //
154 // run MTTF
155 //
157  // run the barrel Muon Trigger Track Finder
158 
160  e.getByToken(m_DTDigiToken, dttrig);
161  if (dttrig->getContainer()->empty())
162  return;
163 
164  if (m_config->Debug(2))
165  cout << endl;
166  if (m_config->Debug(2))
167  cout << "**** L1MuDTTrackFinder processing ****" << endl;
168  if (m_config->Debug(2))
169  cout << endl;
170 
171  int bx_min = m_config->getBxMin();
172  int bx_max = m_config->getBxMax();
173 
174  for (int bx = bx_min; bx <= bx_max; bx++) {
175  if (dttrig->bxEmpty(bx))
176  continue;
177 
178  if (m_config->Debug(2))
179  cout << "L1MuDTTrackFinder processing bunch-crossing : " << bx << endl;
180 
181  // reset MTTF
182  reset();
183 
184  // run sector processors
185  L1MuDTSecProcMap::SPmap_iter it_sp = m_spmap->begin();
186  while (it_sp != m_spmap->end()) {
187  if (m_config->Debug(2))
188  cout << "running " << (*it_sp).second->id() << endl;
189  if ((*it_sp).second)
190  (*it_sp).second->run(bx, e, c);
191  if (m_config->Debug(2) && (*it_sp).second)
192  (*it_sp).second->print();
193  it_sp++;
194  }
195 
196  // run eta processors
197  vector<L1MuDTEtaProcessor*>::iterator it_ep = m_epvec.begin();
198  while (it_ep != m_epvec.end()) {
199  if (m_config->Debug(2))
200  cout << "running Eta Processor " << (*it_ep)->id() << endl;
201  if (*it_ep)
202  (*it_ep)->run(bx, e, c);
203  if (m_config->Debug(2) && *it_ep)
204  (*it_ep)->print();
205  it_ep++;
206  }
207 
208  // read sector processors
209  it_sp = m_spmap->begin();
210  while (it_sp != m_spmap->end()) {
211  if (m_config->Debug(2))
212  cout << "reading " << (*it_sp).second->id() << endl;
213  for (int number = 0; number < 2; number++) {
214  const L1MuDTTrack* cand = (*it_sp).second->tracK(number);
215  if (cand && !cand->empty())
216  _cache0.push_back(L1MuDTTrackCand(cand->getDataWord(),
217  cand->bx(),
218  cand->spid().wheel(),
219  cand->spid().sector(),
220  number,
221  cand->address(1),
222  cand->address(2),
223  cand->address(3),
224  cand->address(4),
225  cand->tc()));
226  }
227  it_sp++;
228  }
229 
230  // run wedge sorters
231  vector<L1MuDTWedgeSorter*>::iterator it_ws = m_wsvec.begin();
232  while (it_ws != m_wsvec.end()) {
233  if (m_config->Debug(2))
234  cout << "running Wedge Sorter " << (*it_ws)->id() << endl;
235  if (*it_ws)
236  (*it_ws)->run();
237  if (m_config->Debug(2) && *it_ws)
238  (*it_ws)->print();
239  it_ws++;
240  }
241 
242  // run muon sorter
243  if (m_config->Debug(2))
244  cout << "running DT Muon Sorter" << endl;
245  if (m_ms)
246  m_ms->run();
247  if (m_config->Debug(2) && m_ms)
248  m_ms->print();
249 
250  // store found track candidates in container (cache)
251  if (m_ms->numberOfTracks() > 0) {
252  const vector<const L1MuDTTrack*>& mttf_cont = m_ms->tracks();
253  vector<const L1MuDTTrack*>::const_iterator iter;
254  for (iter = mttf_cont.begin(); iter != mttf_cont.end(); iter++) {
255  if (*iter)
256  _cache.push_back(L1MuRegionalCand((*iter)->getDataWord(), (*iter)->bx()));
257  }
258  }
259  }
260 }
261 
262 //
263 // reset MTTF
264 //
266  L1MuDTSecProcMap::SPmap_iter it_sp = m_spmap->begin();
267  while (it_sp != m_spmap->end()) {
268  if ((*it_sp).second)
269  (*it_sp).second->reset();
270  it_sp++;
271  }
272 
273  vector<L1MuDTEtaProcessor*>::iterator it_ep = m_epvec.begin();
274  while (it_ep != m_epvec.end()) {
275  if (*it_ep)
276  (*it_ep)->reset();
277  it_ep++;
278  }
279 
280  vector<L1MuDTWedgeSorter*>::iterator it_ws = m_wsvec.begin();
281  while (it_ws != m_wsvec.end()) {
282  if (*it_ws)
283  (*it_ws)->reset();
284  it_ws++;
285  }
286 
287  if (m_ms)
288  m_ms->reset();
289 }
290 
291 //
292 // return Sector Processor container
293 //
294 const L1MuDTSectorProcessor* L1MuDTTrackFinder::sp(const L1MuDTSecProcId& id) const { return m_spmap->sp(id); }
295 
296 //
297 // return number of muon candidates found by the barrel MTTF
298 //
299 int L1MuDTTrackFinder::numberOfTracks() { return _cache.size(); }
300 
302 
304 
306  _cache.clear();
307  _cache0.clear();
308 }
309 
310 //
311 // return number of muon candidates found by the barrel MTTF at a given bx
312 //
314  int number = 0;
315  for (TFtracks_const_iter it = _cache.begin(); it != _cache.end(); it++) {
316  if ((*it).bx() == bx)
317  number++;
318  }
319 
320  return number;
321 }
322 
323 // static data members
324 
L1MuDTWedgeSorter.h
L1MuDTTrackFinder::end
TFtracks_const_iter end()
Definition: L1MuDTTrackFinder.cc:303
Handle.h
L1MuDTTFConfig.h
L1MuDTSecProcId.h
L1MuDTSecProcMap.h
L1MuDTTFConfig
Definition: L1MuDTTFConfig.h:38
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuDTWedgeSorter
Definition: L1MuDTWedgeSorter.h:45
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1MuDTSectorProcessor.h
gpuVertexFinder::ws
auto &__restrict__ ws
Definition: gpuClusterTracksDBSCAN.h:32
L1MuDTTrackFinder::~L1MuDTTrackFinder
virtual ~L1MuDTTrackFinder()
destructor
Definition: L1MuDTTrackFinder.cc:81
L1MuDTTrackFinder::run
void run(const edm::Event &e, const edm::EventSetup &c)
run the barrel MTTF
Definition: L1MuDTTrackFinder.cc:156
L1MuDTTrackFinder::setup
void setup(edm::ConsumesCollector &&iC)
build the structure of the barrel MTTF
Definition: L1MuDTTrackFinder.cc:112
L1MuDTSecProcMap::SPmap_iter
SPmap::iterator SPmap_iter
Definition: L1MuDTSecProcMap.h:41
L1MuDTTrackFinder::begin
TFtracks_const_iter begin()
Definition: L1MuDTTrackFinder.cc:301
L1MuDTTrackFinder.h
edm::Handle< L1MuDTChambPhContainer >
L1MuDTSecProcMap
Definition: L1MuDTSecProcMap.h:38
L1MuDTChambPhContainer
Definition: L1MuDTChambPhContainer.h:33
L1MuDTChambPhContainer::getContainer
Phi_Container const * getContainer() const
Definition: L1MuDTChambPhContainer.cc:41
L1MuDTTrackCand
Definition: L1MuDTTrackCand.h:33
L1MuDTTrackFinder::L1MuDTTrackFinder
L1MuDTTrackFinder(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
constructor
Definition: L1MuDTTrackFinder.cc:54
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
L1MuDTTrackCand.h
L1MuDTMuonSorter
Definition: L1MuDTMuonSorter.h:45
L1MuRegionalCand
Definition: L1MuRegionalCand.h:26
L1MuDTTrackFinder::reset
void reset()
reset the barrel MTTF
Definition: L1MuDTTrackFinder.cc:265
L1MuDTTrackFinder::sp
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
Definition: L1MuDTTrackFinder.cc:294
L1MuDTTrack.h
edm::ParameterSet
Definition: ParameterSet.h:47
L1MuDTSecProcId
Definition: L1MuDTSecProcId.h:40
Event.h
L1MuDTEtaProcessor
Definition: L1MuDTEtaProcessor.h:55
L1MuDTTrackFinder::numberOfTracks
int numberOfTracks()
get number of muon candidates found by the barrel MTTF
Definition: L1MuDTTrackFinder.cc:299
cand
Definition: decayParser.h:32
L1MuDTTrack
Definition: L1MuDTTrack.h:47
edm::EventSetup
Definition: EventSetup.h:58
L1MuDTChambPhContainer.h
L1MuDTSectorProcessor
Definition: L1MuDTSectorProcessor.h:53
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
L1MuDTEtaProcessor.h
L1MuDTTrackFinder::m_config
static L1MuDTTFConfig * m_config
Track Finder configuration.
Definition: L1MuDTTrackFinder.h:124
L1MuDTTrackFinder::clear
void clear()
Definition: L1MuDTTrackFinder.cc:305
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
L1MuDTTrackFinder::TFtracks_const_iter
std::vector< L1MuRegionalCand >::const_iterator TFtracks_const_iter
container for muon candidates
Definition: L1MuDTTrackFinder.h:59
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
L1MuDTChambPhContainer::bxEmpty
bool bxEmpty(int step) const
Definition: L1MuDTChambPhContainer.cc:43
L1MuDTMuonSorter.h
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37