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

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

Pretty-print operator for Level1TriggerScalers.

Definition at line 220 of file Level1TriggerScalers.cc.

References Level1TriggerScalers::bunchCrossingErrors(), Level1TriggerScalers::bunchNumber(), Level1TriggerScalers::collectionTime(), Level1TriggerScalers::collectionTimeLumiSeg(), constexpr, Level1TriggerScalers::deadtime(), Level1TriggerScalers::deadtimeBeamActive(), Level1TriggerScalers::deadtimeBeamActiveCalibration(), Level1TriggerScalers::deadtimeBeamActivePartitionController(), Level1TriggerScalers::deadtimeBeamActivePrivateOrbit(), Level1TriggerScalers::deadtimeBeamActiveTimeSlot(), Level1TriggerScalers::deadtimeBeamActiveTriggerRules(), Level1TriggerScalers::eventID(), Level1TriggerScalers::gtAlgoCounts(), Level1TriggerScalers::gtEvents(), Level1TriggerScalers::gtEventsRate(), Level1TriggerScalers::gtResets(), Level1TriggerScalers::gtTechCounts(), Level1TriggerScalers::gtTriggers(), Level1TriggerScalers::gtTriggersRate(), mps_fire::i, Level1TriggerScalers::l1AsCalibration(), Level1TriggerScalers::l1AsPhysics(), Level1TriggerScalers::l1AsRandom(), Level1TriggerScalers::l1AsTest(), Level1TriggerScalers::lastEventCounter0(), Level1TriggerScalers::lastHardReset(), Level1TriggerScalers::lastOrbitCounter0(), Level1TriggerScalers::lastResync(), Level1TriggerScalers::lastStart(), Level1TriggerScalers::lastTestEnable(), geometryCSVtoXML::line, Level1TriggerScalers::lumiSegmentNr(), Level1TriggerScalers::lumiSegmentNrLumiSeg(), Level1TriggerScalers::lumiSegmentOrbits(), Level1TriggerScalers::orbitNr(), Level1TriggerScalers::percentLS(), Level1TriggerScalers::percentLSActive(), Level1TriggerScalers::prescaleIndexAlgo(), Level1TriggerScalers::prescaleIndexTech(), Level1TriggerScalers::rateLS(), alignCSCRings::s, Level1TriggerScalers::sourceID(), Level1TriggerScalers::triggersPhysicsGeneratedFDL(), Level1TriggerScalers::triggersPhysicsLost(), Level1TriggerScalers::triggersPhysicsLostBeamActive(), Level1TriggerScalers::triggersPhysicsLostBeamInactive(), Level1TriggerScalers::trigType(), and Level1TriggerScalers::version().

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