test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuBMSEU.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMSEU
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 L1MuBMSEU
44 //---------------------------------
45 
46 //----------------
47 // Constructors --
48 //----------------
49 
51  m_sp(sp), m_ext(ext),
52  m_startTS_Id(tsId), m_startTS(0), 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 L1MuBMEUX(m_sp,*this,target_ts) );
58  }
59 
60  m_ERS = new L1MuBMERS(*this);
61 
62 }
63 
64 
65 //--------------
66 // Destructor --
67 //--------------
68 
70 
71  vector<L1MuBMEUX*>::iterator iter_eux;
72  for ( iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++ ) {
73  delete (*iter_eux);
74  *iter_eux = 0;
75  }
76 
77  m_startTS = 0;
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 ( L1MuBMTFConfig::Debug(3) ) cout << "Run SEU " << m_ext << " "
95  << m_startTS_Id << endl;
96 
97  pair<int,int> ext_pair = L1MuBMExtrapolationUnit::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 L1MuBMTrackSegPhi* 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 ( L1MuBMTFConfig::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 = 0;
158  vector<L1MuBMEUX*>::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 L1MuBMSEU::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<L1MuBMEUX*>::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 }
static std::pair< int, int > which_ext(Extrapolation ext)
return station of start and target track segment for a given extrapolation
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuBMSEU.cc:187
const L1MuBMSectorProcessor & m_sp
Definition: L1MuBMSEU.h:99
unsigned int m_startTS_Id
Definition: L1MuBMSEU.h:101
tuple result
Definition: mps_fire.py:84
virtual void run()
run L1MuBMERS
Definition: L1MuBMERS.cc:67
std::vector< L1MuBMEUX * > m_EUXs
Definition: L1MuBMSEU.h:104
std::bitset< 12 > m_QStable
Definition: L1MuBMSEU.h:108
virtual void run()
run processor logic
virtual void reset()
reset SEU
Definition: L1MuBMSEU.cc:155
L1MuBMSEU(const L1MuBMSectorProcessor &sp, Extrapolation ext, unsigned int tsId)
constructor
Definition: L1MuBMSEU.cc:50
void reset()
reset phi track segment
Extrapolation
virtual void reset()
reset ERS
Definition: L1MuBMERS.cc:107
virtual ~L1MuBMSEU()
destructor
Definition: L1MuBMSEU.cc:69
static bool Debug()
const TSPhivector & getTSphi() const
get all track segments from the buffer
bool isNextWheelSEU() const
is it a next wheel Single Extrapolation Unit
Definition: L1MuBMSEU.h:89
const L1MuBMDataBuffer * data() const
return pointer to Data Buffer
std::bitset< 12 > m_EXtable
Definition: L1MuBMSEU.h:107
tuple cout
Definition: gather_cfg.py:145
L1MuBMERS * m_ERS
Definition: L1MuBMSEU.h:105
const L1MuBMTrackSegPhi * m_startTS
Definition: L1MuBMSEU.h:103
Definition: sp.h:21
Extrapolation m_ext
Definition: L1MuBMSEU.h:100
bool empty() const
is it an empty phi track segment?