33{
36
40
41 try {
42
43 JParser<> zap(
"Program to add multi-dimensional histograms of shower light");
44
48
49 zap(argc, argv);
50 }
51 catch(const exception &error) {
52 FATAL(error.what() << endl);
53 }
54
55
57
63
65
66 JMultiHistogram_t h0;
67 JMultiHistogram_t h1;
68
69 h1.transformer.reset(new JFunction4DTransformer_t());
70
71 bool add = false;
72
73 for(vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
74
75 NOTICE(
"loading input from file " << *file_name <<
"... " << flush);
76
77 try {
78
80
81 if (add) {
82
83 JMultiHistogram_t p0;
85
86 p1.transformer.reset(
new JFunction4DTransformer_t());
87
88 for(JMultiHistogram_t* p : { &p0, &
p1 }) {
89 in.load(*p);
90 }
91
92 in.close();
93
95
96
97
98 double integral1 = 0.0;
99 double integral2 = 0.0;
100
101 for(JMultiHistogram_t::super_iterator
102 i0 = h0.super_begin(), i1 = h1.super_begin(),
103 j0 = p0.super_begin(), j1 =
p1.super_begin(); i1 != h1.super_end(); ++i0, ++i1, ++j0, ++j1) {
104
105 integral1 += i0.getValue().getIntegral();
106
107 i0.getValue().add(j0.getValue());
108 i1.getValue().add(j1.getValue());
109
110 integral2 += i0.getValue().getIntegral();
111 }
112 }
113 else {
114
115 for(JMultiHistogram_t* p : { &h0, &h1 }) {
116 in.load(*p);
117 }
118
119 in.close();
120
122
123 add = true;
124 }
125 }
128 }
129 }
130
132
133 NOTICE(
"Storing, " << flush);
134
135 for (const JMultiHistogram_t* p : { &h0, &h1 }) {
136 out.store(*p);
137 }
138
139 out.close();
141}
#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).