Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Functions
JPrintSirene.cc File Reference

Auxiliary program to print JSirene.cc job statistics. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TError.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 25 of file JPrintSirene.cc.

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