CMS 3D CMS Logo

L1MuDTSEU.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTSEU
4 //
5 // Description: Single Extrapolation Unit
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <algorithm>
26 
27 //-------------------------------
28 // Collaborating Class Headers --
29 //-------------------------------
30 
39 
40 using namespace std;
41 
42 // --------------------------------
43 // class L1MuDTSEU
44 //---------------------------------
45 
46 //----------------
47 // Constructors --
48 //----------------
49 
51  m_sp(sp), m_ext(ext),
52  m_startTS_Id(tsId), m_startTS(nullptr), m_EUXs(), m_ERS() {
53 
54  m_EUXs.reserve(12);
55 
56  for ( int target_ts = 0; target_ts < 12; target_ts++ ) {
57  m_EUXs.push_back( new L1MuDTEUX(m_sp,*this,target_ts) );
58  }
59 
60  m_ERS = new L1MuDTERS(*this);
61 
62 }
63 
64 
65 //--------------
66 // Destructor --
67 //--------------
68 
70 
71  vector<L1MuDTEUX*>::iterator iter_eux;
72  for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
73  delete (*iter_eux);
74  *iter_eux = nullptr;
75  }
76 
77  m_startTS = nullptr;
78  m_EUXs.clear();
79 
80  delete m_ERS;
81 
82 }
83 
84 
85 //--------------
86 // Operations --
87 //--------------
88 
89 //
90 // run SEU
91 //
93 
94  if ( L1MuDTTFConfig::Debug(3) ) cout << "Run SEU " << m_ext << " "
95  << m_startTS_Id << endl;
96 
97  pair<int,int> ext_pair = L1MuDTExtrapolationUnit::which_ext(m_ext);
98  int target = ext_pair.second;
99 
100  // check if it is a nextWheel or ownWheel SEU
101  bool nextWheel = isNextWheelSEU();
102 
103  // relative addresses used
104  // nextWheel
105  // extrapolation extrapolation
106  // address address
107  // +--------+--------+ +--------+--------+
108  // + | | | + | | |
109  // | 4 5 | 6 7 | | | 6 7 |
110  // | | | | | | | |
111  // | +--------+--------+ | +--------+--------+
112  // |........| | |........| |
113  // phi |..0...1.| 2 3 | phi |........| 2 3 |
114  // |........| | |........| |
115  // | +--------+--------+ | +--------+--------+
116  // | | | | | | | |
117  // | 8 9 | 10 11 | | | 10 11 |
118  // - | | | - | | |
119  // +--------+--------+ +--------+--------+
120  //
121  // -- eta -- -- eta --
122 
123  // loop over all 12 target addresses
124  for ( int reladr = 0; reladr < 12; reladr++ ) {
125 
126  // for the nextWheel extrapolations only reladr: 2,3,6,7,10,11
127  if ( nextWheel && (reladr/2)%2 == 0 ) continue;
128 
129  const L1MuDTTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr);
130  if ( target_ts && !target_ts->empty() ) {
131  m_EUXs[reladr]->load(m_startTS, target_ts);
132  m_EUXs[reladr]->run(c);
133  if ( m_EUXs[reladr]->result() ) m_EXtable.set(reladr);
134  }
135 
136  }
137 
138  if ( L1MuDTTFConfig::Debug(3) ) {
139  int n_ext = numberOfExt();
140  if ( n_ext > 0 ) cout << "number of successful EUX : " << n_ext << endl;
141  }
142 
143  if ( m_ERS ) m_ERS->run();
144 
145  // if ( m_ERS->address(0) != 15 ) m_QStable.set(m_ERS->address(0));
146  // if ( m_ERS->address(1) != 15 ) m_QStable.set(m_ERS->address(1));
148 
149 }
150 
151 
152 //
153 // reset SEU
154 //
156 
157  m_startTS = nullptr;
158  vector<L1MuDTEUX*>::iterator iter_eux;
159  for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
160  (*iter_eux)->reset();
161  }
162 
163  m_ERS->reset();
164 
165  m_EXtable.reset();
166  m_QStable.reset();
167 
168 }
169 
170 
171 //
172 // reset a single extrapolation
173 //
174 void L1MuDTSEU::reset(unsigned int relAdr) {
175 
176  m_EXtable.reset(relAdr);
177  m_QStable.reset(relAdr);
178  m_EUXs[relAdr]->reset();
179 // m_ERS->reset();
180 
181 }
182 
183 
184 //
185 // get number of successful extrapolations
186 //
188 
189  int number = 0;
190  vector<L1MuDTEUX*>::const_iterator iter_eux;
191  for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
192  if ( (*iter_eux)->result() ) number++;
193  }
194 
195  return number;
196 
197 }
Extrapolation m_ext
Definition: L1MuDTSEU.h:100
void run() override
run L1MuDTERS
Definition: L1MuDTERS.cc:67
unsigned int m_startTS_Id
Definition: L1MuDTSEU.h:101
std::vector< L1MuDTEUX * > m_EUXs
Definition: L1MuDTSEU.h:104
void reset()
reset phi track segment
#define nullptr
~L1MuDTSEU() override
destructor
Definition: L1MuDTSEU.cc:69
L1MuDTSEU(const L1MuDTSectorProcessor &sp, Extrapolation ext, unsigned int tsId)
constructor
Definition: L1MuDTSEU.cc:50
void reset() override
reset SEU
Definition: L1MuDTSEU.cc:155
const L1MuDTDataBuffer * data() const
return pointer to Data Buffer
std::bitset< 12 > m_EXtable
Definition: L1MuDTSEU.h:107
void reset() override
reset ERS
Definition: L1MuDTERS.cc:107
virtual void run()
run processor logic
std::bitset< 12 > m_QStable
Definition: L1MuDTSEU.h:108
bool empty() const
is it an empty phi track segment?
static bool Debug()
Extrapolation
const L1MuDTSectorProcessor & m_sp
Definition: L1MuDTSEU.h:99
bool isNextWheelSEU() const
is it a next wheel Single Extrapolation Unit
Definition: L1MuDTSEU.h:89
static std::pair< int, int > which_ext(Extrapolation ext)
return station of start and target track segment for a given extrapolation
const TSPhivector & getTSphi() const
get all track segments from the buffer
L1MuDTERS * m_ERS
Definition: L1MuDTSEU.h:105
const L1MuDTTrackSegPhi * m_startTS
Definition: L1MuDTSEU.h:103
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuDTSEU.cc:187
Definition: memstream.h:15