Jpp 19.3.0-rc.2
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 617 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 628 of file JSupernova.hh.

628: vector<double>(nModules) {}

Member Function Documentation

◆ setLiveTime()

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

Definition at line 630 of file JSupernova.hh.

630 {
631 livetime = lt;
632 }
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 638 of file JSupernova.hh.

638 {
639
640 ostringstream os;
641
642 os << "=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
643 os << "=> livetime [s] = " << livetime << endl;
644 os << "Level" << '\t' << "Rate (error)" << endl;
645
646 if (livetime > 0) {
647 for (unsigned i = 0; i < this->size(); i++) {
648
649 double count = (*this)[i];
650 double rate = count / livetime;
651 double error = 100 * (sqrt(count) / count);
652
653 if (rate > 0) {
654 os << i << '\t';
655 os << scientific << setprecision(2) << rate << "Hz ";
656 os << fixed << setprecision(0) << "(" << setw(2) << error << "%)";
657 os << endl;
658 }
659 }
660 }
661
662 return os.str();
663
664 }

◆ toSummaryFile()

string JSUPERNOVA::JTriggerSNStats::toSummaryFile ( )
inline

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

Definition at line 671 of file JSupernova.hh.

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

Member Data Documentation

◆ livetime

double JSUPERNOVA::JTriggerSNStats::livetime
private

Definition at line 620 of file JSupernova.hh.


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