Jpp
Functions
JPrintSirene.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JPhysics/JPDFTypes.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print JSirene.cc job statistics.

Author
mdejong

Definition in file JPrintSirene.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JPrintSirene.cc.

25 {
26  using namespace std;
27 
28  string inputFile;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Auxiliary program to print JSirene job statistics.");
34 
35  zap['f'] = make_field(inputFile);
36  zap['d'] = make_field(debug) = 2;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
44 
45  TFile* in = TFile::Open(inputFile.c_str(), "exist");
46 
47  if (in == NULL || !in->IsOpen()) {
48  FATAL("File: " << inputFile << " not opened." << endl);
49  }
50 
51 
52  TH1D* job = dynamic_cast<TH1D*>(in->Get("job"));
53 
54  if (job == NULL) {
55  FATAL("No job statistics.");
56  }
57 
58  using namespace JPP;
59 
60  const int hit_types[] = {
61  DIRECT_LIGHT_FROM_MUON, // muon
67 
68  DIRECT_LIGHT_FROM_MUON + 20, // tau
72 
73  DIRECT_LIGHT_FROM_EMSHOWER + 40, // electrons/hadrons
75 
76  -1 // end marker
77  };
78 
79 
80  typedef map<int, string> map_type;
81 
82  map_type zmap;
83 
84  zmap[100] = "Number of photons";
85  zmap[200] = "Number of errors";
86  zmap[300] = "Number of misses";
87 
88 
89  NOTICE("Job summary" << endl);
90 
91  NOTICE(LEFT(40) << "Number of events input " << RIGHT(10) << (int) job->GetBinContent( 1) << endl);
92  NOTICE(LEFT(40) << "Number of muons " << RIGHT(10) << (int) job->GetBinContent( 2) << endl);
93  NOTICE(LEFT(40) << "Number of muons in can " << RIGHT(10) << (int) job->GetBinContent( 3) << endl);
94  NOTICE(LEFT(40) << "Number of muons within road " << RIGHT(10) << (int) job->GetBinContent( 4) << endl);
95  NOTICE(LEFT(40) << "Number of taus " << RIGHT(10) << (int) job->GetBinContent( 6) << endl);
96  NOTICE(LEFT(40) << "Number of detectable taus " << RIGHT(10) << (int) job->GetBinContent( 7) << endl);
97  NOTICE(LEFT(40) << "Number of electrons/hadrons " << RIGHT(10) << (int) job->GetBinContent( 8) << endl);
98  NOTICE(LEFT(40) << "Number of detectable electrons/hadrons " << RIGHT(10) << (int) job->GetBinContent( 9) << endl);
99  NOTICE(LEFT(40) << "Number of events output " << RIGHT(10) << (int) job->GetBinContent( 10) << endl);
100  NOTICE(LEFT(40) << "Number of unknown particles " << RIGHT(10) << (int) job->GetBinContent( 21) << endl);
101 
102  for (map_type::const_iterator entry = zmap.begin(); entry != zmap.end(); ++entry) {
103  NOTICE(endl);
104  for (const int* i = hit_types; *i != -1; ++i) {
105  NOTICE(""
106  << LEFT (19) << entry->second << FILL(1)
107  << RIGHT( 2) << *i << FILL(8)
108  << FILL (10)
109  << RIGHT(10) << (int) job->GetBinContent(entry->first + *i) << endl);
110  }
111  }
112 
113  in->Close();
114 }
JPHYSICS::DIRECT_LIGHT_FROM_DELTARAYS
direct light from delta-rays
Definition: JPDFTypes.hh:35
JPHYSICS::DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
Definition: JPDFTypes.hh:40
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
NOTICE
#define NOTICE(A)
Definition: JMessage.hh:64
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
FILL
Auxiliary data structure for sequence of same character.
Definition: JPrint.hh:361
JPHYSICS::SCATTERED_LIGHT_FROM_EMSHOWER
scattered light from EM shower
Definition: JPDFTypes.hh:41
std::map
Definition: JSTDTypes.hh:16
JLANG::RIGHT
Definition: JTwosome.hh:18
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
JPHYSICS::DIRECT_LIGHT_FROM_MUON
direct light from muon
Definition: JPDFTypes.hh:29
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JPHYSICS::SCATTERED_LIGHT_FROM_DELTARAYS
scattered light from delta-rays
Definition: JPDFTypes.hh:36
JLANG::LEFT
Definition: JTwosome.hh:18
JPHYSICS::SCATTERED_LIGHT_FROM_MUON
scattered light from muon
Definition: JPDFTypes.hh:30