Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 586 of file JSupernova.hh.

Constructor & Destructor Documentation

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

default constructor

Parameters
nModulesnumber of modules of the detector

Definition at line 597 of file JSupernova.hh.

Member Function Documentation

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

Definition at line 599 of file JSupernova.hh.

599  {
600  livetime = lt;
601  }
string JSUPERNOVA::JTriggerSNStats::toString ( )
inline

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

Definition at line 607 of file JSupernova.hh.

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

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

Definition at line 640 of file JSupernova.hh.

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

Member Data Documentation

double JSUPERNOVA::JTriggerSNStats::livetime
private

Definition at line 589 of file JSupernova.hh.


The documentation for this class was generated from the following file: