Jpp test-rotations-old-57-g407471f53
the software that should make you happy
Loading...
Searching...
No Matches
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
 
void setLiveTime (const double lt)
 
string toString ()
 put statistics into printable form outputs trigger level - rate - error
 
string toSummaryFile ()
 put statistics into printable form outputs trigger level - rate - error
 

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 619 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 630 of file JSupernova.hh.

630: vector<double>(nModules) {}

Member Function Documentation

◆ setLiveTime()

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

Definition at line 632 of file JSupernova.hh.

632 {
633 livetime = lt;
634 }
Normalisation of MUPAGE events.
Definition JHead.hh:835

◆ toString()

string JSUPERNOVA::JTriggerSNStats::toString ( )
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 os << "=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
645 os << "=> livetime [s] = " << livetime << endl;
646 os << "Level" << '\t' << "Rate (error)" << endl;
647
648 if (livetime > 0) {
649 for (unsigned i = 0; i < this->size(); i++) {
650
651 double count = (*this)[i];
652 double rate = count / livetime;
653 double error = 100 * (sqrt(count) / count);
654
655 if (rate > 0) {
656 os << i << '\t';
657 os << scientific << setprecision(2) << rate << "Hz ";
658 os << fixed << setprecision(0) << "(" << setw(2) << error << "%)";
659 os << endl;
660 }
661 }
662 }
663
664 return os.str();
665
666 }

◆ toSummaryFile()

string JSUPERNOVA::JTriggerSNStats::toSummaryFile ( )
inline

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

Definition at line 673 of file JSupernova.hh.

673 {
674
675 ostringstream os;
676
677 if (livetime > 0) {
678
679 os << livetime << endl;
680
681 for (unsigned i = 0; i < this->size(); i++) {
682
683 double count = (*this)[i];
684 double rate = count / livetime;
685 double error = (sqrt(count) / count);
686
687 if (rate > 0) {
688 os << i << ",";
689 os << scientific;
690 os << setprecision(2);
691 os << rate << ",";
692 os << error;
693 os << endl;
694 }
695 }
696 }
697
698
699 return os.str();
700
701 }

Member Data Documentation

◆ livetime

double JSUPERNOVA::JTriggerSNStats::livetime
private

Definition at line 622 of file JSupernova.hh.


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