CMS 3D CMS Logo

Functions
Level1TriggerScalers.cc File Reference
#include "DataFormats/Scalers/interface/Level1TriggerScalers.h"
#include "DataFormats/Scalers/interface/ScalersRaw.h"
#include <iostream>
#include <ctime>
#include <cstdio>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &s, Level1TriggerScalers const &c)
 Pretty-print operator for Level1TriggerScalers. More...
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  s,
Level1TriggerScalers const &  c 
)

Pretty-print operator for Level1TriggerScalers.

Definition at line 193 of file Level1TriggerScalers.cc.

References c, mps_fire::i, mps_splice::line, Level1TriggerScalers::percentLS(), Level1TriggerScalers::percentLSActive(), Level1TriggerScalers::rateLS(), and alignCSCRings::s.

193  {
194  s << "Level1TriggerScalers Version:" << c.version() << " SourceID: " << c.sourceID() << std::endl;
195  constexpr size_t kLineBufferSize = 164;
196  char line[kLineBufferSize];
197  char zeitHeaven[128];
198  struct tm* horaHeaven;
199 
200  snprintf(line,
201  kLineBufferSize,
202  " TrigType: %d EventID: %d BunchNumber: %d",
203  c.trigType(),
204  c.eventID(),
205  c.bunchNumber());
206  s << line << std::endl;
207 
208  struct timespec secondsToHeaven = c.collectionTime();
209  horaHeaven = gmtime(&secondsToHeaven.tv_sec);
210  strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven);
211  snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec);
212  s << line << std::endl;
213 
214  snprintf(line,
215  kLineBufferSize,
216  " LumiSegmentNr: %10u LumiSegmentOrbits: %10u",
217  c.lumiSegmentNr(),
218  c.lumiSegmentOrbits());
219  s << line << std::endl;
220 
221  snprintf(line,
222  kLineBufferSize,
223  " LumiSegmentNrLumiSeg: %10u OrbitNr: %10u ",
224  c.lumiSegmentNrLumiSeg(),
225  c.orbitNr());
226  s << line << std::endl;
227 
228  snprintf(line,
229  kLineBufferSize,
230  " GtResets: %10u BunchCrossingErrors: %10u",
231  c.gtResets(),
232  c.bunchCrossingErrors());
233  s << line << std::endl;
234 
235  snprintf(line,
236  kLineBufferSize,
237  " PrescaleIndexAlgo: %10d PrescaleIndexTech: %10d",
238  c.prescaleIndexAlgo(),
239  c.prescaleIndexTech());
240  s << line << std::endl;
241 
242  snprintf(
243  line, kLineBufferSize, " GtTriggers: %20llu %22.3f Hz", c.gtTriggers(), c.gtTriggersRate());
244  s << line << std::endl;
245 
246  snprintf(line, kLineBufferSize, " GtEvents: %20llu %22.3f Hz", c.gtEvents(), c.gtEventsRate());
247  s << line << std::endl;
248 
249  secondsToHeaven = c.collectionTimeLumiSeg();
250  horaHeaven = gmtime(&secondsToHeaven.tv_sec);
251  strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven);
252  snprintf(line, kLineBufferSize, " CollectionTimeLumiSeg: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec);
253  s << line << std::endl;
254 
255  snprintf(line,
256  kLineBufferSize,
257  " TriggersPhysicsGeneratedFDL: %20llu %22.3f Hz",
258  c.triggersPhysicsGeneratedFDL(),
259  Level1TriggerScalers::rateLS(c.triggersPhysicsGeneratedFDL()));
260  s << line << std::endl;
261 
262  snprintf(line,
263  kLineBufferSize,
264  " TriggersPhysicsLost: %20llu %22.3f Hz",
265  c.triggersPhysicsLost(),
266  Level1TriggerScalers::rateLS(c.triggersPhysicsLost()));
267  s << line << std::endl;
268 
269  snprintf(line,
270  kLineBufferSize,
271  " TriggersPhysicsLostBeamActive: %20llu %22.3f Hz",
272  c.triggersPhysicsLostBeamActive(),
273  Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamActive()));
274  s << line << std::endl;
275 
276  snprintf(line,
277  kLineBufferSize,
278  " TriggersPhysicsLostBeamInactive: %20llu %22.3f Hz",
279  c.triggersPhysicsLostBeamInactive(),
280  Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamInactive()));
281  s << line << std::endl;
282 
283  snprintf(line,
284  kLineBufferSize,
285  " L1AsPhysics: %20llu %22.3f Hz",
286  c.l1AsPhysics(),
287  Level1TriggerScalers::rateLS(c.l1AsPhysics()));
288  s << line << std::endl;
289 
290  snprintf(line,
291  kLineBufferSize,
292  " L1AsRandom: %20llu %22.3f Hz",
293  c.l1AsRandom(),
294  Level1TriggerScalers::rateLS(c.l1AsRandom()));
295  s << line << std::endl;
296 
297  snprintf(line,
298  kLineBufferSize,
299  " L1AsTest: %20llu %22.3f Hz",
300  c.l1AsTest(),
301  Level1TriggerScalers::rateLS(c.l1AsTest()));
302  s << line << std::endl;
303 
304  snprintf(line,
305  kLineBufferSize,
306  " L1AsCalibration: %20llu %22.3f Hz",
307  c.l1AsCalibration(),
308  Level1TriggerScalers::rateLS(c.l1AsCalibration()));
309  s << line << std::endl;
310 
311  snprintf(line,
312  kLineBufferSize,
313  " Deadtime: %20llu %17.3f%%",
314  c.deadtime(),
315  Level1TriggerScalers::percentLS(c.deadtime()));
316  s << line << std::endl;
317 
318  snprintf(line,
319  kLineBufferSize,
320  " DeadtimeBeamActive: %20llu %17.3f%%",
321  c.deadtimeBeamActive(),
322  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActive()));
323  s << line << std::endl;
324 
325  snprintf(line,
326  kLineBufferSize,
327  " DeadtimeBeamActiveTriggerRules: %20llu %17.3f%%",
328  c.deadtimeBeamActiveTriggerRules(),
329  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTriggerRules()));
330  s << line << std::endl;
331 
332  snprintf(line,
333  kLineBufferSize,
334  " DeadtimeBeamActiveCalibration: %20llu %17.3f%%",
335  c.deadtimeBeamActiveCalibration(),
336  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveCalibration()));
337  s << line << std::endl;
338 
339  snprintf(line,
340  kLineBufferSize,
341  " DeadtimeBeamActivePrivateOrbit: %20llu %17.3f%%",
342  c.deadtimeBeamActivePrivateOrbit(),
343  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePrivateOrbit()));
344  s << line << std::endl;
345 
346  snprintf(line,
347  kLineBufferSize,
348  " DeadtimeBeamActivePartitionController:%20llu %17.3f%%",
349  c.deadtimeBeamActivePartitionController(),
350  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePartitionController()));
351  s << line << std::endl;
352 
353  snprintf(line,
354  kLineBufferSize,
355  " DeadtimeBeamActiveTimeSlot: %20llu %17.3f%%",
356  c.deadtimeBeamActiveTimeSlot(),
357  Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTimeSlot()));
358  s << line << std::endl;
359 
360  s << "Physics GtAlgoCounts" << std::endl;
361  const std::vector<unsigned int> gtAlgoCounts = c.gtAlgoCounts();
362  int length = gtAlgoCounts.size() / 4;
363  for (int i = 0; i < length; i++) {
364  snprintf(line,
365  kLineBufferSize,
366  " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u",
367  i,
368  gtAlgoCounts[i],
369  (i + length),
370  gtAlgoCounts[i + length],
371  (i + (length * 2)),
372  gtAlgoCounts[i + (length * 2)],
373  (i + (length * 3)),
374  gtAlgoCounts[i + (length * 3)]);
375  s << line << std::endl;
376  }
377 
378  s << "Test GtTechCounts" << std::endl;
379  const std::vector<unsigned int> gtTechCounts = c.gtTechCounts();
380  length = gtTechCounts.size() / 4;
381  for (int i = 0; i < length; i++) {
382  snprintf(line,
383  kLineBufferSize,
384  " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u",
385  i,
386  gtTechCounts[i],
387  (i + length),
388  gtTechCounts[i + length],
389  (i + (length * 2)),
390  gtTechCounts[i + (length * 2)],
391  (i + (length * 3)),
392  gtTechCounts[i + (length * 3)]);
393  s << line << std::endl;
394  }
395 
396  if (c.version() >= 5) {
397  snprintf(line, kLineBufferSize, " LastOrbitCounter0: %10u 0x%8.8X", c.lastOrbitCounter0(), c.lastOrbitCounter0());
398  s << line << std::endl;
399 
400  snprintf(line, kLineBufferSize, " LastTestEnable: %10u 0x%8.8X", c.lastTestEnable(), c.lastTestEnable());
401  s << line << std::endl;
402 
403  snprintf(line, kLineBufferSize, " LastResync: %10u 0x%8.8X", c.lastResync(), c.lastResync());
404  s << line << std::endl;
405 
406  snprintf(line, kLineBufferSize, " LastStart: %10u 0x%8.8X", c.lastStart(), c.lastStart());
407  s << line << std::endl;
408 
409  snprintf(line, kLineBufferSize, " LastEventCounter0: %10u 0x%8.8X", c.lastEventCounter0(), c.lastEventCounter0());
410  s << line << std::endl;
411 
412  snprintf(line, kLineBufferSize, " LastHardReset: %10u 0x%8.8X", c.lastHardReset(), c.lastHardReset());
413  s << line << std::endl;
414  }
415 
416  return s;
417 }
static double rateLS(unsigned long long counts)
static double percentLSActive(unsigned long long counts)
static double percentLS(unsigned long long counts)