33{
36
40
41 try {
42
43 JParser<> zap(
"Program to add multi-dimensional histograms of shower light");
44
48
49 if (zap.read(argc, argv) != 0)
50 return 1;
51 }
52 catch(const exception &error) {
53 FATAL(error.what() << endl);
54 }
55
56
58
65
67
68 JMultiHistogram_t h0;
69 JMultiHistogram_t h1;
70
71 h1.transformer.reset(new JFunction5DTransformer_t());
72
73 bool add = false;
74
75 for(vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
76
77 NOTICE(
"loading input from file " << *file_name <<
"... " << flush);
78
79 try {
80
82
83 if (add) {
84
85 JMultiHistogram_t p0;
87
88 p1.transformer.reset(
new JFunction5DTransformer_t());
89
90 for(JMultiHistogram_t* p : { &p0, &
p1 }) {
91 in.load(*p);
92 }
93
94 in.close();
95
97
98
99
100 double integral1 = 0.0;
101 double integral2 = 0.0;
102
103 for(JMultiHistogram_t::super_iterator
104 i0 = h0.super_begin(), i1 = h1.super_begin(),
105 j0 = p0.super_begin(), j1 =
p1.super_begin(); i1 != h1.super_end(); ++i0, ++i1, ++j0, ++j1) {
106
107 integral1 += i0.getValue().getIntegral();
108
109 i0.getValue().add(j0.getValue());
110 i1.getValue().add(j1.getValue());
111
112 integral2 += i0.getValue().getIntegral();
113 }
114 }
115 else {
116
117 for(JMultiHistogram_t* p : { &h0, &h1 }) {
118 in.load(*p);
119 }
120
121 in.close();
122
124
125 add = true;
126 }
127 }
130 }
131 }
132
134
136
137 for (const JMultiHistogram_t* p : { &h0, &h1 }) {
138 out.store(*p);
139 }
140
141 out.close();
142 NOTICE(
"JAddHDE done." << endl);
143}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Binary buffered file input.
Binary buffered file output.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).