CMS 3D CMS Logo

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