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