CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GlobalTriggerRecord.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iomanip>
22 
23 
24 // user include files
26 
27 // constructors
29 {
30 
31  // empty
32 
33 }
34 
35 L1GlobalTriggerRecord::L1GlobalTriggerRecord(const unsigned int numberPhysTriggers,
36  const unsigned int numberTechnicalTriggers) {
37 
38  m_gtDecisionWord.reserve(numberPhysTriggers);
39  m_gtTechnicalTriggerWord.reserve(numberTechnicalTriggers);
40 
41  m_gtDecisionWordBeforeMask.reserve(numberPhysTriggers);
42  m_gtTechnicalTriggerWordBeforeMask.reserve(numberTechnicalTriggers);
43 
44 }
45 
46 // copy constructor
49 {
50 
52 
55 
58 
61 
62 }
63 
64 // destructor
66 {
67 
68  // empty now
69 
70 }
71 
72 // assignment operator
75 {
76 
77  if ( this != &result ) {
78 
80 
83 
86 
89  }
90 
91  return *this;
92 
93 }
94 
95 // equal operator
97  const L1GlobalTriggerRecord& result) const
98 {
99 
100  if (m_gtGlobalDecision != result.m_gtGlobalDecision) {
101  return false;
102  }
103 
104  if (m_gtDecisionWord != result.m_gtDecisionWord) {
105  return false;
106  }
107 
109  return false;
110  }
111 
113  return false;
114  }
115 
117  return false;
118  }
119 
121  return false;
122  }
123 
125  return false;
126  }
127 
128  // all members identical
129  return true;
130 
131 }
132 
133 // unequal operator
135  const L1GlobalTriggerRecord& result) const
136 {
137 
138  return !( result == *this);
139 
140 }
141 // methods
142 
143 
144 // set global decision
145 void L1GlobalTriggerRecord::setDecision(const bool& dValue)
146 {
147 
148  m_gtGlobalDecision = dValue;
149 
150 }
151 
152 // set decision word
154  const DecisionWord& dWordValue)
155 {
156 
157  m_gtDecisionWord = dWordValue;
158 
159 }
160 
162  const TechnicalTriggerWord& ttWordValue)
163 {
164 
165  m_gtTechnicalTriggerWord = ttWordValue;
166 
167 }
168 
169 // set decision word before applying the masks
171  const DecisionWord& dWordValue)
172 {
173 
174  m_gtDecisionWordBeforeMask = dWordValue;
175 
176 }
177 
179  const TechnicalTriggerWord& ttWordValue)
180 {
181 
183 
184 }
185 
186 
187 // print global decision and algorithm decision word
188 void L1GlobalTriggerRecord::printGtDecision(std::ostream& myCout) const
189 {
190 
191  myCout << std::endl;
192  myCout << "\n Global decision (FinalOR): " << m_gtGlobalDecision << std::endl;
193 
194  // decision word (in 64bits words)
195  int sizeW64 = 64; // 64 bits words
196 
197  int iBit = 0;
198  int jBit = m_gtDecisionWord.size();
199  int nrDecWord = m_gtDecisionWord.size()/sizeW64;
200 
201  std::ostringstream stream64;
202 
203  std::vector<std::string> decWord;
204  decWord.reserve(nrDecWord);
205 
206  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtDecisionWord.rbegin();
207  ritBit != m_gtDecisionWord.rend(); ++ritBit) {
208 
209  stream64 << (*ritBit ? '1' : '0');
210 
211  if ( (((iBit + 1)%16) == (sizeW64%16)) ) {
212  stream64 << " ";
213  }
214 
215  if ( ((iBit + 1)%sizeW64) == 0) {
216  std::string iW = stream64.str();
217  stream64.str("");
218 
219  decWord.push_back(iW);
220  }
221 
222 
223  iBit++;
224  jBit--;
225  }
226 
227  int iWord = 0;
228 
229  myCout << "\n DecisionWord after trigger mask (bitset style)";
230  for (std::vector<std::string>::reverse_iterator ritWord = decWord.rbegin();
231  ritWord != decWord.rend(); ++ritWord) {
232 
233  myCout << "\n Bits "
234  << iWord*sizeW64 + sizeW64 - 1 << " : " << iWord*sizeW64 << "\n ";
235  myCout << *ritWord;
236 
237  iWord++;
238 
239  }
240 
241 }
242 
243 // print technical trigger word (reverse order for vector<bool>)
244 void L1GlobalTriggerRecord::printTechnicalTrigger(std::ostream& myCout) const
245 {
246 
247  myCout << "\n Technical triggers after trigger mask (bitset style): \n " ;
248 
249  int sizeW64 = 64; // 64 bits words
250  int iBit = 0;
251 
252  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtTechnicalTriggerWord.rbegin();
253  ritBit != m_gtTechnicalTriggerWord.rend(); ++ritBit) {
254 
255  myCout << (*ritBit ? '1' : '0');
256 
257  if ( (((iBit + 1)%16) == (sizeW64%16)) && (iBit != 63) ) {
258  myCout << " ";
259  }
260 
261  iBit++;
262  }
263 
264 
265 }
266 
267 // clear the record
269 {
270 
271  m_gtGlobalDecision = false;
272 
273  for (std::vector<bool>::iterator itBit = m_gtDecisionWord.begin();
274  itBit != m_gtDecisionWord.end(); ++itBit) {
275 
276  *itBit = false;
277 
278  }
279  for (std::vector<bool>::iterator itBit = m_gtTechnicalTriggerWord.begin();
280  itBit != m_gtTechnicalTriggerWord.end(); ++itBit) {
281 
282  *itBit = false;
283 
284  }
285  for (std::vector<bool>::iterator itBit = m_gtDecisionWordBeforeMask.begin();
286  itBit != m_gtDecisionWordBeforeMask.end(); ++itBit) {
287 
288  *itBit = false;
289 
290  }
291 
292  for (std::vector<bool>::iterator itBit = m_gtTechnicalTriggerWordBeforeMask.begin();
293  itBit != m_gtTechnicalTriggerWordBeforeMask.end(); ++itBit) {
294 
295  *itBit = false;
296 
297  }
298 
301 
302 }
303 
304 
305 // pretty print the content of a L1GlobalTriggerRecord
306 void L1GlobalTriggerRecord::print(std::ostream& myCout) const
307 {
308 
309  printGtDecision(myCout);
310 
311  myCout << std::endl;
312 
313  printTechnicalTrigger(myCout);
314 
315  myCout << std::endl;
316  myCout << "\n Index of prescale factor set for technical triggers: "
317  << m_gtPrescaleFactorIndexTech << std::endl;
318  myCout << " Index of prescale factor set for algorithm triggers: "
319  << m_gtPrescaleFactorIndexTech << std::endl;
320  myCout << std::endl;
321 
322 
323 }
324 
325 // output stream operator
326 std::ostream& operator<<(std::ostream& streamRec, const L1GlobalTriggerRecord& result)
327 {
328  result.print(streamRec);
329  return streamRec;
330 
331 }
TechnicalTriggerWord m_gtTechnicalTriggerWord
technical trigger word for L1A bunch cross
void setDecisionWordBeforeMask(const DecisionWord &dWordValue)
L1GlobalTriggerRecord & operator=(const L1GlobalTriggerRecord &)
assignment operator
void setDecision(const bool &dValue)
void setTechnicalTriggerWord(const TechnicalTriggerWord &ttWordValue)
void setDecisionWord(const DecisionWord &dWordValue)
bool m_gtGlobalDecision
global decision for L1A bunch cross
unsigned int m_gtPrescaleFactorIndexAlgo
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
DecisionWord m_gtDecisionWordBeforeMask
algorithm decision word for L1A bunch cross before applying the masks
bool operator!=(const L1GlobalTriggerRecord &) const
unequal operator
TechnicalTriggerWord m_gtTechnicalTriggerWordBeforeMask
technical trigger word for L1A bunch cross before applying the masks
std::vector< bool > DecisionWord
typedefs
void print(std::ostream &myCout) const
pretty print the content of a L1GlobalTriggerRecord
tuple result
Definition: query.py:137
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
void reset()
clear the record
DecisionWord m_gtDecisionWord
algorithm decision word for L1A bunch cross
void setTechnicalTriggerWordBeforeMask(const TechnicalTriggerWord &ttWordValue)
unsigned int m_gtPrescaleFactorIndexTech
virtual ~L1GlobalTriggerRecord()
destructor
void printTechnicalTrigger(std::ostream &myCout) const
print technical triggers
void printGtDecision(std::ostream &myCout) const
print global decision and algorithm decision word
bool operator==(const L1GlobalTriggerRecord &) const
equal operator
L1GlobalTriggerRecord()
constructors