Jpp
Public Member Functions | Private Attributes | List of all members
JSUPERNOVA::JTriggerSNStats Class Reference

SN trigger statistics, the information is stored in the form of a count as a function of the trigger level. More...

#include <JSupernova.hh>

Inheritance diagram for JSUPERNOVA::JTriggerSNStats:
std::vector< double >

Public Member Functions

 JTriggerSNStats (const int nModules)
 default constructor More...
 
void setLiveTime (const double lt)
 
string toString ()
 put statistics into printable form outputs trigger level - rate - error More...
 
string toSummaryFile ()
 put statistics into printable form outputs trigger level - rate - error More...
 

Private Attributes

double livetime
 

Detailed Description

SN trigger statistics, the information is stored in the form of a count as a function of the trigger level.

the livetime needs to be set manually to compute the rates for the printing.

Definition at line 587 of file JSupernova.hh.

Constructor & Destructor Documentation

◆ JTriggerSNStats()

JSUPERNOVA::JTriggerSNStats::JTriggerSNStats ( const int  nModules)
inline

default constructor

Parameters
nModulesnumber of modules of the detector

Definition at line 598 of file JSupernova.hh.

598 : vector<double>(nModules) {}

Member Function Documentation

◆ setLiveTime()

void JSUPERNOVA::JTriggerSNStats::setLiveTime ( const double  lt)
inline

Definition at line 600 of file JSupernova.hh.

600  {
601  livetime = lt;
602  }

◆ toString()

string JSUPERNOVA::JTriggerSNStats::toString ( )
inline

put statistics into printable form outputs trigger level - rate - error

Definition at line 608 of file JSupernova.hh.

608  {
609 
610  ostringstream os;
611 
612  os << "=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
613  os << "=> livetime [s] = " << livetime << endl;
614  os << "Level" << '\t' << "Rate (error)" << endl;
615 
616  if (livetime > 0) {
617  for (unsigned i = 0; i < this->size(); i++) {
618 
619  double count = (*this)[i];
620  double rate = count / livetime;
621  double error = 100 * (sqrt(count) / count);
622 
623  if (rate > 0) {
624  os << i << '\t';
625  os << scientific << setprecision(2) << rate << "Hz ";
626  os << fixed << setprecision(0) << "(" << setw(2) << error << "%)";
627  os << endl;
628  }
629  }
630  }
631 
632  return os.str();
633 
634  }

◆ toSummaryFile()

string JSUPERNOVA::JTriggerSNStats::toSummaryFile ( )
inline

put statistics into printable form outputs trigger level - rate - error

Definition at line 641 of file JSupernova.hh.

641  {
642 
643  ostringstream os;
644 
645  if (livetime > 0) {
646 
647  os << livetime << endl;
648 
649  for (unsigned i = 0; i < this->size(); i++) {
650 
651  double count = (*this)[i];
652  double rate = count / livetime;
653  double error = (sqrt(count) / count);
654 
655  if (rate > 0) {
656  os << i << ",";
657  os << scientific;
658  os << setprecision(2);
659  os << rate << ",";
660  os << error;
661  os << endl;
662  }
663  }
664  }
665 
666 
667  return os.str();
668 
669  }

Member Data Documentation

◆ livetime

double JSUPERNOVA::JTriggerSNStats::livetime
private

Definition at line 590 of file JSupernova.hh.


The documentation for this class was generated from the following file:
std::vector< double >
JSUPERNOVA::JTriggerSNStats::livetime
double livetime
Definition: JSupernova.hh:590