1 #ifndef __JRUNANALYZER__ 
    2 #define __JRUNANALYZER__ 
   16 using namespace KM3NETDAQ ;
 
   59     numberOfTimeslices       (nTimeslices),
 
   60     numberOfSummaryslices (nSummaryslices),
 
   61     numberOfEvents               (nEvents),
 
   62     pmt_analysis             (pmtanalysis)
 
   68       cerr << 
"FATAL ERROR. Could not open detector file '" << detectorFile << 
"'." << endl;
 
   90     while (scanner.hasNext()) {
 
   94       histograms.h_trigger.h_Snapshot_hits      -> Fill((Double_t) event.size<
JDAQSnapshotHit > ());
 
   95       histograms.h_trigger.h_Triggered_hits     -> Fill((Double_t) event.size<
JDAQTriggeredHit> ());
 
   97       histograms.h_trigger.h_Number_of_overlays -> Fill(event.getOverlays());
 
  101         if (event.hasTriggerBit(i)) {
 
  103           histograms.h_trigger.h_Trigger_bit_event -> Fill((Double_t) i);
 
  107       int counter_3dmuon = 0;
 
  113         if(trigger_mask.hasTriggerBit(getTriggerBit<JTrigger3DMuon>())) counter_3dmuon++; 
 
  115         if (router->hasModule(hit->getModuleID())) {
 
  117           const JModule& module = router->getModule (hit->getModuleID());
 
  119           histograms.h_trigger.h_pmt_distribution_triggered_hits->Fill(hit->getPMT());
 
  120           histograms.h_trigger.h_tot_distribution_triggered_hits->Fill(hit->getToT());
 
  125           histograms.h_trigger.h_Triggered_hits_per_module        -> Fill(String , Floor);
 
  127           if(trigger_mask.hasTriggerBit(getTriggerBit<JTrigger3DMuon>())){
 
  128             histograms.h_trigger.h_Triggered_hits_3dmuon_per_module -> Fill(String , Floor);
 
  133             if (hit -> hasTriggerBit(i)) {
 
  135               histograms.h_trigger.h_Trigger_bit_hit->Fill((Double_t) i);
 
  139           FATAL(
"JModuleRouter trying to access non existing identifier: "<< hit->getModuleID());
 
  143       if(counter_3dmuon != 0) histograms.h_trigger.h_Triggered_hits_3dmuon->Fill(counter_3dmuon);
 
  147         if (router->hasModule(hit->getModuleID())) {
 
  149           const JModule& module = router->getModule (hit->getModuleID());
 
  153           int pmt    = hit->  getPMT();
 
  155           if(pmt_analysis == 
true){
 
  157             (*histograms.h_trigger.m_Snapshot_hits_per_pmt)[
MAKE_STRING(
"Detector/DU" + 
to_string(String))] -> Fill(pmt, Floor);
 
  161           histograms.h_trigger.h_pmt_distribution_snapshot_hits                                           -> Fill(hit->getPMT());       
 
  162           histograms.h_trigger.h_tot_distribution_snapshot_hits                                           -> Fill(hit->getToT());
 
  163           histograms.h_trigger.h_Snapshot_hits_per_module                                                 -> Fill(String, Floor);
 
  167             FATAL(
"JModuleRouter trying to access non existing identifier: "<< hit->getModuleID());
 
  184     while (scanner.hasNext()){
 
  188       for (JDAQSummaryslice::const_iterator frame = slice.begin() ; frame != slice.end() ; ++ frame) {
 
  190         if (router->hasModule(frame->getModuleID())) {
 
  192           const JModule& module = router->getModule (frame->getModuleID());
 
  204             histograms.h_summary.h_hrv_per_dom->Fill(
string , floor, nHRVcount);
 
  208             histograms.h_summary.h_daq_status_per_dom->Fill(
string , floor);      
 
  211           histograms.h_summary.h_fifo_per_dom->Fill(
string , floor , nFIFOcount); 
 
  213           if(pmt_analysis == 
true){
 
  218             const double factor = 1.0e-3;   
 
  222               rate += frame->getRate(i, factor);
 
  224               h2->Fill(i , frame->getRate(i));
 
  226               PMT_rate_quantiles[string][floor-1][i].put(frame->getRate(i, factor)); 
 
  228               histograms.h_summary.h_pmt_rate_distribution->Fill(frame->getRate(i, factor), frame->getWeight(i, factor));
 
  232             histograms.h_summary.h_dom_rate_distribution->Fill(rate);
 
  234             DOM_rate_quantiles[string].resize(modulesPerString);
 
  236             DOM_rate_quantiles[string][floor-1].put(rate * 1e-3);
 
  241             const double factor = 1.0e-3;   
 
  245               rate += frame->getRate(i, factor);
 
  247               histograms.h_summary.h_pmt_rate_distribution->Fill(frame->getRate(i, factor), frame->getWeight(i, factor));
 
  250             histograms.h_summary.h_dom_rate_distribution->Fill(rate);
 
  252             DOM_rate_quantiles[string].resize(modulesPerString);
 
  254             DOM_rate_quantiles[string][floor-1].put(rate);
 
  259           FATAL(
"JModuleRouter trying to access non existing identifier: "<< frame->getModuleID());
 
  265     for (
std::map<
int , 
vector<JQuantile> >::const_iterator i = DOM_rate_quantiles.begin() ; i!= DOM_rate_quantiles.end() ; ++i) {
 
  267       for (
int j=1 ; 
j < modulesPerString + 1 ; 
j++) {
 
  269         if (i->second[
j-1].getCount() > 0) histograms.h_summary.h_rate_summary->Fill(i->first, 
j, i->second[
j-1].getMean());
 
  274     if(pmt_analysis == 
true){
 
  278         for (
int j=0 ; 
j < modulesPerString ; 
j++){
 
  284               (*histograms.h_summary.m_mean_summary_rate)             [
MAKE_STRING(
"Detector/DU" + 
to_string(i->first))]->Fill(
k, 
j+1, i->second[
j][
k].getMean());
 
  285               (*histograms.h_summary.m_mean_summary_rate_distribution)[
MAKE_STRING(
"Detector/DU" + 
to_string(i->first))]->Fill(        i->second[
j][
k].getMean());
 
  306     double inverseFrameTimeSec = 1. / (1.0e-9 * 
getFrameTime());
 
  308     while (scanner.hasNext()){
 
  310       T slice = *(scanner.next());
 
  312       for(
auto & frame : slice) {
 
  313         if (router->hasModule(frame.getModuleID())) {
 
  315           const JModule& module = router->getModule (frame.getModuleID());
 
  316           double  rate   = frame.numberOfHits * inverseFrameTimeSec;
 
  320           DOM_rate_quantiles[string][floor].put(rate);
 
  324           if(pmt_analysis == 
true){
 
  330             h2 -> Fill(hit->getPMT() , hit->getToT()) ;
 
  332             pmt_hit_count[hit->getPMT()]++;
 
  338               (*histograms.h_timeslice.m_pmt_rate_distributions[ts_type])[
MAKE_STRING(
"Detector/DU" + 
to_string(
string) + 
"/F" + 
to_string(floor))] -> Fill(pmt , 1e-3 * pmt_hit_count[pmt] * inverseFrameTimeSec);
 
  345             FATAL(
"JModuleRouter trying to access non existing identifier: "<< frame.getModuleID());
 
  355         if (
j->second.getCount() > 0) histograms.h_timeslice.h_dom_mean_rates[ts_type] -> Fill (i->first , 
j->first , 
j->second.getMean() ) ;
 
  369     if (scanner.hasNext()) {
 
  370       histograms.initialize_summary_histograms();
 
  372       iterateSummarysliceTree(scanner);
 
  386     if(scanner.hasNext()) {
 
  388       histograms.initialize_timeslice_histograms <
T>();
 
  390       iterateTimesliceTree(scanner);
 
  404     if(scanner.hasNext()) {
 
  406       histograms.initialize_trigger_histograms();
 
  408       iterateEventTree(scanner);
 
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
 
void iterateTimesliceTree(JTreeScanner< T > &scanner)
 
ROOT TTree parameter settings of various packages. 
 
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits. 
 
int countFIFOStatus() const 
Count FIFO status. 
 
JRunAnalyzer(string file, string detectorFile, JLimit_t nTimeslices, JLimit_t nSummaryslices, JLimit_t nEvents, bool pmtanalysis)
Constructor. 
 
int getFloor() const 
Get floor number. 
 
Data structure for a composite optical module. 
 
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi set_variable RUNBYRUN file
 
Auxiliary class for trigger mask. 
 
JRA_Histograms histograms
 
Router for direct addressing of module data in detector data structure. 
 
then set_variable singlesRate set_variable doublesRate set_variable numberOfSlices echo Generating random background echo Singles rate
 
JLimit_t numberOfTimeslices
 
Dynamic ROOT object management. 
 
void iterateSummarysliceTree(JTreeScanner< JDAQSummaryslice > &scanner)
 
Class dedicated to the analysis of KM3NeT runs. 
 
Template definition for direct access of elements in ROOT TChain. 
 
#define MAKE_STRING(A)
Make string. 
 
Auxiliary class for defining the range of iterations of objects. 
 
JRunAnalyzer()
Default constructor. 
 
~JRunAnalyzer()
Destructor. 
 
double getFrameTime()
Get frame time duration. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
void iterateEventTree(JTreeScanner< JDAQEvent > &scanner)
 
static const JStringCounter getNumberOfStrings
Function object to count unique strings. 
 
Scanning of objects from multiple files according a format that follows from the extension of each fi...
 
Direct access to module in detector data structure. 
 
int getString() const 
Get string number. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
int countHighRateVeto() const 
Count high-rate veto status. 
 
General purpose string class. 
 
std::string to_string(const T &value)
Convert value to string. 
 
int getCount(const T &hit)
Get hit count. 
 
JLimit_t numberOfSummaryslices
 
Indexing of data type in type list. 
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
bool testDAQStatus() const 
Test DAQ status of packets. 
 
JRA_Histograms getHistograms()
 
int getNumberOfModules(const JDetector &detector)
Get number of modules.