Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPrintSirene.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5#include <map>
6
7#include "TROOT.h"
8#include "TFile.h"
9#include "TH1D.h"
10#include "TError.h"
11
12#include "JPhysics/JPDFTypes.hh"
13
14#include "Jeep/JPrint.hh"
15#include "Jeep/JParser.hh"
16#include "Jeep/JMessage.hh"
17
18
19/**
20 * \file
21 *
22 * Auxiliary program to print JSirene.cc job statistics.
23 * \author mdejong
24 */
25int main(int argc, char **argv)
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
65 SCATTERED_LIGHT_FROM_MUON, //
66 DIRECT_LIGHT_FROM_DELTARAYS, //
67 SCATTERED_LIGHT_FROM_DELTARAYS, //
68 DIRECT_LIGHT_FROM_EMSHOWER, //
69 SCATTERED_LIGHT_FROM_EMSHOWER, //
70
71 DIRECT_LIGHT_FROM_MUON + 20, // tau
72 SCATTERED_LIGHT_FROM_MUON + 20, //
73 DIRECT_LIGHT_FROM_DELTARAYS + 20, //
74 SCATTERED_LIGHT_FROM_DELTARAYS + 20, //
75
76 DIRECT_LIGHT_FROM_EMSHOWER + 40, // electrons/hadrons
77 SCATTERED_LIGHT_FROM_EMSHOWER + 40, //
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}
General purpose messaging.
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Numbering scheme for PDF types.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
I/O formatting auxiliaries.
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for sequence of same character.
Definition JManip.hh:330
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Auxiliary data structure for alignment of data.
Definition JManip.hh:266
Auxiliary data structure for alignment of data.
Definition JManip.hh:298