CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
78 void L1MuDTSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSetup& c) {
79  // receive data and store them into the data buffer
80  m_SectorReceiver.run(bx, e, c);
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 //
193 void L1MuDTSectorProcessor::print() const {
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 //
227 bool L1MuDTSectorProcessor::anyTrack() const {
228  if (!m_TrackCands[0].empty())
229  return true;
230  if (!m_TrackCands[1].empty())
231  return true;
232 
233  return false;
234 }
const edm::EventSetup & c
L1MuDTTrackAssembler m_TA
void printTSphi() const
print all phi track segments which are in the buffer
void reset()
clear Sector Receiver
void reset()
reset Extrapolation Unit
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
std::array< L1MuDTTrack, 2 > m_TrackCands
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
std::array< L1MuDTAssignmentUnit, 2 > m_AUs
int sector() const
return sector number
void reset()
clear Data Buffer
void run()
run Track Assembler
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool Debug()
void reset()
reset Track Assembler
L1MuDTExtrapolationUnit m_EU
const L1MuDTSecProcId & id() const
return Sector Processor identifier
std::array< L1MuDTTrack, 2 > m_TracKCands
const L1MuDTSectorProcessor * neighbour() const
return pointer to the next wheel neighbour
L1MuDTSectorProcessor(const L1MuDTTrackFinder &, const L1MuDTSecProcId &, edm::ConsumesCollector)
constructor
void print() const
print muon candidates found by the Sector Processor
virtual ~L1MuDTSectorProcessor()
destructor
static L1MuDTTFConfig * config()
return configuration
int numberTSphi() const
return number of non-empty phi track segments
L1MuDTSectorReceiver m_SectorReceiver
bool isEmpty(int id) const
is it a valid Track Class?
int numberOfExt() const
return number of successful extrapolations
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
tuple cout
Definition: gather_cfg.py:144
virtual void run(int bx, const edm::Event &e, const edm::EventSetup &c)
run the Sector Processor
const L1MuDTTrackFinder & m_tf
virtual void reset()
reset the Sector Processor
void run(const edm::EventSetup &c)
run Extrapolation Unit