CMS 3D CMS Logo

L1MuDTSectorProcessor.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTSectorProcessor
4 //
5 // Description: Sector Processor
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 #include <cmath>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
42 
43 using namespace std;
44 
45 // --------------------------------
46 // class L1MuDTSectorProcessor
47 //---------------------------------
48 
49 //----------------
50 // Constructors --
51 //----------------
52 
54  const L1MuDTSecProcId& id,
56  m_tf(tf), m_spid(id),
57  m_SectorReceiver(new L1MuDTSectorReceiver(*this, std::move(iC))),
58  m_DataBuffer(new L1MuDTDataBuffer(*this)),
59  m_EU(new L1MuDTExtrapolationUnit(*this)),
60  m_TA(new L1MuDTTrackAssembler(*this)),
61  m_AUs(), m_TrackCands(), m_TracKCands() {
62 
63  // 2 assignment units
64  m_AUs.reserve(2);
65  m_AUs.push_back(new L1MuDTAssignmentUnit(*this,0));
66  m_AUs.push_back(new L1MuDTAssignmentUnit(*this,1));
67 
68  // now the 2 track candidates
69  m_TrackCands.reserve(2);
70  m_TrackCands.push_back(new L1MuDTTrack(m_spid) );
71  m_TrackCands.push_back(new L1MuDTTrack(m_spid) );
72 
73  m_TracKCands.reserve(2);
74  m_TracKCands.push_back(new L1MuDTTrack(m_spid) );
75  m_TracKCands.push_back(new L1MuDTTrack(m_spid) );
76 
77 }
78 
79 
80 //--------------
81 // Destructor --
82 //--------------
83 
85 
86  delete m_SectorReceiver;
87  delete m_DataBuffer;
88  delete m_EU;
89  delete m_TA;
90  delete m_AUs[0];
91  delete m_AUs[1];
92  delete m_TrackCands[0];
93  delete m_TrackCands[1];
94  delete m_TracKCands[0];
95  delete m_TracKCands[1];
96 
97 }
98 
99 //--------------
100 // Operations --
101 //--------------
102 
103 //
104 // run Sector Processor
105 //
107 
108  // receive data and store them into the data buffer
109  if ( m_SectorReceiver ) m_SectorReceiver->run(bx, e, c);
110 
111  // check content of data buffer
112  if ( m_DataBuffer ) {
113  if ( m_tf.config()->Debug(4) && m_DataBuffer->numberTSphi() > 0 ) {
114  cout << "Phi track segments received by " << m_spid << " : " << endl;
116  }
117  }
118 
119  // perform all extrapolations
120  int n_ext = 0; // number of successful extrapolations
121  if ( m_EU && m_DataBuffer && m_DataBuffer->numberTSphi() > 1 ) {
122  m_EU->run(c);
123  n_ext = m_EU->numberOfExt();
124  if ( m_tf.config()->Debug(3) && n_ext > 0 ) {
125  cout << "Number of successful extrapolations : " << n_ext << endl;
126  m_EU->print();
127  }
128  }
129 
130  // hardware debug (output from Extrapolator and Quality Sorter)
131  // m_EU->print(1);
132 
133  // perform track assembling
134  if ( m_TA && n_ext > 0 ) {
135  m_TA->run();
136  if ( m_tf.config()->Debug(3) ) m_TA->print();
137  }
138 
139  // assign pt, eta, phi and quality
140  if ( m_AUs[0] && !m_TA->isEmpty(0) ) m_AUs[0]->run(c);
141  if ( m_AUs[1] && !m_TA->isEmpty(1) ) m_AUs[1]->run(c);
142 
143  if ( m_spid.wheel() == -1 ) {
144  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2)>3 && m_TrackCands[0]->address(2)<6 ) m_TrackCands[0]->reset();
145  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3)>3 && m_TrackCands[0]->address(3)<6 ) m_TrackCands[0]->reset();
146  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4)>3 && m_TrackCands[0]->address(4)<6 ) m_TrackCands[0]->reset();
147 
148  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2)>3 && m_TracKCands[0]->address(2)<6 ) m_TracKCands[0]->reset();
149  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3)>3 && m_TracKCands[0]->address(3)<6 ) m_TracKCands[0]->reset();
150  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4)>3 && m_TracKCands[0]->address(4)<6 ) m_TracKCands[0]->reset();
151 
152  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2)>3 && m_TrackCands[1]->address(2)<6 ) m_TrackCands[1]->reset();
153  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3)>3 && m_TrackCands[1]->address(3)<6 ) m_TrackCands[1]->reset();
154  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4)>3 && m_TrackCands[1]->address(4)<6 ) m_TrackCands[1]->reset();
155 
156  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2)>3 && m_TracKCands[1]->address(2)<6 ) m_TracKCands[1]->reset();
157  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3)>3 && m_TracKCands[1]->address(3)<6 ) m_TracKCands[1]->reset();
158  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4)>3 && m_TracKCands[1]->address(4)<6 ) m_TracKCands[1]->reset();
159 
160  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2)>7 && m_TrackCands[0]->address(2)<10 ) m_TrackCands[0]->reset();
161  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3)>7 && m_TrackCands[0]->address(3)<10 ) m_TrackCands[0]->reset();
162  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4)>7 && m_TrackCands[0]->address(4)<10 ) m_TrackCands[0]->reset();
163 
164  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2)>7 && m_TracKCands[0]->address(2)<10 ) m_TracKCands[0]->reset();
165  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3)>7 && m_TracKCands[0]->address(3)<10 ) m_TracKCands[0]->reset();
166  if ( m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4)>7 && m_TracKCands[0]->address(4)<10 ) m_TracKCands[0]->reset();
167 
168  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2)>7 && m_TrackCands[1]->address(2)<10 ) m_TrackCands[1]->reset();
169  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3)>7 && m_TrackCands[1]->address(3)<10 ) m_TrackCands[1]->reset();
170  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4)>7 && m_TrackCands[1]->address(4)<10 ) m_TrackCands[1]->reset();
171 
172  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2)>7 && m_TracKCands[1]->address(2)<10 ) m_TracKCands[1]->reset();
173  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3)>7 && m_TracKCands[1]->address(3)<10 ) m_TracKCands[1]->reset();
174  if ( m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4)>7 && m_TracKCands[1]->address(4)<10 ) m_TracKCands[1]->reset();
175  }
176 
177 }
178 
179 
180 //
181 // reset Sector Processor
182 //
184 
186  if ( m_DataBuffer ) m_DataBuffer->reset();
187  if ( m_EU ) m_EU->reset();
188  if ( m_TA ) m_TA->reset();
189  if ( m_AUs[0] ) m_AUs[0]->reset();
190  if ( m_AUs[1] ) m_AUs[1]->reset();
191  if ( m_TrackCands[0] ) m_TrackCands[0]->reset();
192  if ( m_TrackCands[1] ) m_TrackCands[1]->reset();
193  if ( m_TracKCands[0] ) m_TracKCands[0]->reset();
194  if ( m_TracKCands[1] ) m_TracKCands[1]->reset();
195 
196 }
197 
198 
199 //
200 // print candidates found in Sector Processor
201 //
203 
204  if ( anyTrack() ) {
205  cout << "Muon candidates found in " << m_spid << " : " << endl;
206  vector<L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
207  while ( iter != m_TrackCands.end() ) {
208  if ( *iter) (*iter)->print();
209  iter++;
210  }
211  }
212 
213 }
214 
215 
216 //
217 // return pointer to nextWheel neighbour
218 //
220 
221  int sector = m_spid.sector();
222  int wheel = m_spid.wheel();
223 
224  // the neighbour is in the same wedge with the following definition:
225  // current SP -3 -2 -1 +1 +2 +3
226  // neighbour -2 -1 +1 0 +1 +2
227 
228  if ( wheel == 1) return nullptr;
229  wheel = (wheel == -1) ? 1 : (wheel/abs(wheel)) * (abs(wheel)-1);
230 
231  const L1MuDTSecProcId id(wheel,sector);
232 
233  return m_tf.sp(id);
234 
235 }
236 
237 
238 //
239 // are there any muon candidates?
240 //
242 
243  if ( m_TrackCands[0] && !m_TrackCands[0]->empty() ) return true;
244  if ( m_TrackCands[1] && !m_TrackCands[1]->empty() ) return true;
245 
246  return false;
247 
248 }
void reset() override
reset Extrapolation Unit
void printTSphi() const
print all phi track segments which are in the buffer
void reset()
clear Sector Receiver
L1MuDTSectorReceiver * m_SectorReceiver
const L1MuDTSectorProcessor * neighbour() const
return pointer to the next wheel neighbour
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
std::vector< L1MuDTAssignmentUnit * > m_AUs
void print() const
print result of Track Assembler
bool anyTrack() const
are there any non-empty muon candidates?
void print(int level=0) const
print all successful extrapolations
virtual void reset()
reset the Sector Processor
void run(const edm::EventSetup &c) override
run Extrapolation Unit
int sector() const
return sector number
void reset()
clear Data Buffer
std::vector< L1MuDTTrack * > m_TracKCands
L1MuDTExtrapolationUnit * m_EU
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool Debug()
L1MuDTSectorProcessor(const L1MuDTTrackFinder &, const L1MuDTSecProcId &, edm::ConsumesCollector &&)
constructor
const L1MuDTSecProcId & id() const
return Sector Processor identifier
void print() const
print muon candidates found by the Sector Processor
void run() override
run Track Assembler
static L1MuDTTFConfig * config()
return configuration
virtual void run(int bx, const edm::Event &e, const edm::EventSetup &c)
run the Sector Processor
int numberTSphi() const
return number of non-empty phi track segments
bool isEmpty(int id) const
is it a valid Track Class?
int numberOfExt() const
return number of successful extrapolations
L1MuDTDataBuffer * m_DataBuffer
void run(int bx, const edm::Event &e, const edm::EventSetup &c)
receive track segment data from the DTBX and CSC chamber triggers
int wheel() const
return wheel number
L1MuDTTrackAssembler * m_TA
const L1MuDTTrackFinder & m_tf
void reset() override
reset Track Assembler
def move(src, dest)
Definition: eostools.py:510
virtual ~L1MuDTSectorProcessor()
destructor
std::vector< L1MuDTTrack * > m_TrackCands