CMS 3D CMS Logo

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), m_startTS_Id(tsId), m_startTS(nullptr), m_EUXs(), m_ERS() {
52  m_EUXs.reserve(12);
53 
54  for (int target_ts = 0; target_ts < 12; target_ts++) {
55  m_EUXs.push_back(new L1MuBMEUX(m_sp, *this, target_ts));
56  }
57 
58  m_ERS = new L1MuBMERS(*this);
59 }
60 
61 //--------------
62 // Destructor --
63 //--------------
64 
66  vector<L1MuBMEUX*>::iterator iter_eux;
67  for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
68  delete (*iter_eux);
69  *iter_eux = nullptr;
70  }
71 
72  m_startTS = nullptr;
73  m_EUXs.clear();
74 
75  delete m_ERS;
76 }
77 
78 //--------------
79 // Operations --
80 //--------------
81 
82 //
83 // run SEU
84 //
86  if (L1MuBMTFConfig::Debug(3))
87  cout << "Run SEU " << m_ext << " " << m_startTS_Id << endl;
88 
89  pair<int, int> ext_pair = L1MuBMExtrapolationUnit::which_ext(m_ext);
90  int target = ext_pair.second;
91 
92  // check if it is a nextWheel or ownWheel SEU
93  bool nextWheel = isNextWheelSEU();
94 
95  // relative addresses used
96  // nextWheel
97  // extrapolation extrapolation
98  // address address
99  // +--------+--------+ +--------+--------+
100  // + | | | + | | |
101  // | 4 5 | 6 7 | | | 6 7 |
102  // | | | | | | | |
103  // | +--------+--------+ | +--------+--------+
104  // |........| | |........| |
105  // phi |..0...1.| 2 3 | phi |........| 2 3 |
106  // |........| | |........| |
107  // | +--------+--------+ | +--------+--------+
108  // | | | | | | | |
109  // | 8 9 | 10 11 | | | 10 11 |
110  // - | | | - | | |
111  // +--------+--------+ +--------+--------+
112  //
113  // -- eta -- -- eta --
114 
115  // loop over all 12 target addresses
116  for (int reladr = 0; reladr < 12; reladr++) {
117  // for the nextWheel extrapolations only reladr: 2,3,6,7,10,11
118  if (nextWheel && (reladr / 2) % 2 == 0)
119  continue;
120 
121  const L1MuBMTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr);
122  if (target_ts && !target_ts->empty()) {
123  m_EUXs[reladr]->load(m_startTS, target_ts);
124  m_EUXs[reladr]->run(c);
125  if (m_EUXs[reladr]->result())
126  m_EXtable.set(reladr);
127  }
128  }
129 
130  if (L1MuBMTFConfig::Debug(3)) {
131  int n_ext = numberOfExt();
132  if (n_ext > 0)
133  cout << "number of successful EUX : " << n_ext << endl;
134  }
135 
136  if (m_ERS)
137  m_ERS->run();
138 
139  // if ( m_ERS->address(0) != 15 ) m_QStable.set(m_ERS->address(0));
140  // if ( m_ERS->address(1) != 15 ) m_QStable.set(m_ERS->address(1));
142 }
143 
144 //
145 // reset SEU
146 //
148  m_startTS = nullptr;
149  vector<L1MuBMEUX*>::iterator iter_eux;
150  for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
151  (*iter_eux)->reset();
152  }
153 
154  m_ERS->reset();
155 
156  m_EXtable.reset();
157  m_QStable.reset();
158 }
159 
160 //
161 // reset a single extrapolation
162 //
163 void L1MuBMSEU::reset(unsigned int relAdr) {
164  m_EXtable.reset(relAdr);
165  m_QStable.reset(relAdr);
166  m_EUXs[relAdr]->reset();
167  // m_ERS->reset();
168 }
169 
170 //
171 // get number of successful extrapolations
172 //
174  int number = 0;
175  vector<L1MuBMEUX*>::const_iterator iter_eux;
176  for (iter_eux = m_EUXs.begin(); iter_eux != m_EUXs.end(); iter_eux++) {
177  if ((*iter_eux)->result())
178  number++;
179  }
180 
181  return number;
182 }
L1MuBMSEU::L1MuBMSEU
L1MuBMSEU(const L1MuBMSectorProcessor &sp, Extrapolation ext, unsigned int tsId)
constructor
Definition: L1MuBMSEU.cc:50
L1MuBMERS.h
ext
Definition: memstream.h:15
L1MuBMExtrapolationUnit.h
L1MuBMDataBuffer::getTSphi
const TSPhivector & getTSphi() const
get all track segments from the buffer
Definition: L1MuBMDataBuffer.h:56
L1MuBMTrackSegPhi
Definition: L1MuBMTrackSegPhi.h:41
L1MuBMSEU::m_startTS_Id
unsigned int m_startTS_Id
Definition: L1MuBMSEU.h:98
L1MuBMERS::run
void run() override
run L1MuBMERS
Definition: L1MuBMERS.cc:61
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuBMSEU::m_ERS
L1MuBMERS * m_ERS
Definition: L1MuBMSEU.h:102
L1MuBMEUX
Definition: L1MuBMEUX.h:52
L1MuBMTrackSegPhi.h
L1MuBMSEU::~L1MuBMSEU
~L1MuBMSEU() override
destructor
Definition: L1MuBMSEU.cc:65
L1MuBMSEU::isNextWheelSEU
bool isNextWheelSEU() const
is it a next wheel Single Extrapolation Unit
Definition: L1MuBMSEU.h:87
L1MuBMSectorProcessor
Definition: L1MuBMSectorProcessor.h:54
L1MuBMSEU::m_EXtable
std::bitset< 12 > m_EXtable
Definition: L1MuBMSEU.h:104
L1MuBMEUX.h
L1MuBMTrackSegLoc.h
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
L1MuBMSEU.h
L1MuBMSEU::reset
void reset() override
reset SEU
Definition: L1MuBMSEU.cc:147
Extrapolation
Extrapolation
Definition: L1MuDTExtParam.h:22
L1MuBMTFConfig::Debug
static bool Debug()
Definition: L1MuBMTFConfig.h:54
L1MuBMSEU::m_EUXs
std::vector< L1MuBMEUX * > m_EUXs
Definition: L1MuBMSEU.h:101
L1MuBMSEU::m_QStable
std::bitset< 12 > m_QStable
Definition: L1MuBMSEU.h:105
L1MuBMTFConfig.h
L1AbstractProcessor::run
virtual void run()
run processor logic
Definition: L1AbstractProcessor.h:40
L1MuBMTrackSegPhi::empty
bool empty() const
is it an empty phi track segment?
Definition: L1MuBMTrackSegPhi.h:115
L1MuBMTrackSegPhi::reset
void reset()
reset phi track segment
Definition: L1MuBMTrackSegPhi.cc:103
edm::EventSetup
Definition: EventSetup.h:58
L1MuBMERS::reset
void reset() override
reset ERS
Definition: L1MuBMERS.cc:96
L1MuBMSectorProcessor::data
const L1MuBMDataBuffer * data() const
return pointer to Data Buffer
Definition: L1MuBMSectorProcessor.h:87
std
Definition: JetResolutionObject.h:76
L1MuBMSEU::m_startTS
const L1MuBMTrackSegPhi * m_startTS
Definition: L1MuBMSEU.h:100
L1MuBMDataBuffer.h
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
L1MuBMSEU::m_sp
const L1MuBMSectorProcessor & m_sp
Definition: L1MuBMSEU.h:96
mps_fire.result
result
Definition: mps_fire.py:311
L1MuBMERS
Definition: L1MuBMERS.h:43
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
L1MuBMSectorProcessor.h
L1MuBMExtrapolationUnit::which_ext
static std::pair< int, int > which_ext(Extrapolation ext)
return station of start and target track segment for a given extrapolation
Definition: L1MuBMExtrapolationUnit.cc:296
L1MuBMSEU::m_ext
Extrapolation m_ext
Definition: L1MuBMSEU.h:97
L1MuBMSEU::numberOfExt
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuBMSEU.cc:173