39{
42
44
46 JLimit_t& numberOfEvents = inputFile.getLimit();
48 double Z;
50
51 try {
52
53 JParser<> zap(
"Example program to plot acoustic fit results.");
54
55 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh]/JFremantle[.sh])");
58 zap[
'Z'] =
make_field(Z,
"detector height (for 2nd order tilt correction)") = 0.0;
60
61 zap(argc, argv);
62 }
63 catch(const exception &error) {
64 FATAL(error.what() << endl);
65 }
66
67 Z *= 0.5;
68
69 const JFormat_t format(4, 0, std::ios_base::fmtflags(),
'0');
70
71 TH1D h1("chi2/NDF", NULL, 500, 0.0, 10.0);
72 TH1D h2("amplitude", NULL, 500, 0.0, 100.0);
73
74 JGraph_t g0;
76 JGraph_t g2;
77
81
83 JManager<int, TH2D> H2(
new TH2D(
"[%].tiltdeviation", NULL, 300, -4.0, +4.0, 300, -4.0, +4.0),
'%', format);
84
86
87 for (
counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
88
89 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
90
91 const JEvt* evt = in.next();
92
94
96
100
101 double Tx = 0.0;
102 double Ty = 0.0;
103 double Ts = 0.0;
104 double Vs = 0.0;
105
106 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
107
108 const int id = i->id;
109 const double tx = (i->tx + i->tx2 * Z) * 1.0e3;
110 const double ty = (i->ty + i->ty2 * Z) * 1.0e3;
111 const double vs = i->vs * 1.0e2;
112 const double ts = sqrt(tx*tx + ty*ty);
113
114 h2.Fill(ts);
115
116 Tx += tx;
117 Ty += ty;
118 Vs += vs;
119 Ts += ts;
120
121 H1 ->Fill(ts, vs);
122 H1[id]->Fill(ts, vs);
123
124 GO[id].put(t1, atan2(ty, tx));
125 GA[id].put(t1, ts);
126 GS[id].put(t1, vs);
127 }
128
129 Tx /= evt->size();
130 Ty /= evt->size();
131 Vs /= evt->size();
132 Ts /= evt->size();
133
134 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
135
136 const double tx = (i->tx + i->tx2 * Z) * 1.0e3;
137 const double ty = (i->ty + i->ty2 * Z) * 1.0e3;
138
139 H2 ->Fill(tx - Tx, ty - Ty);
140 H2[i->id]->Fill(tx - Tx, ty - Ty);
141
142 GO[-1].put(t1, atan2(Ty, Tx));
143 GA[-1].put(t1, Ts);
144 GS[-1].put(t1, Vs);
145 }
146 }
148
149 TH1D hx("hx", NULL, H2.size(), -0.5, H2.size() + 0.5);
150 TH1D hy("hy", NULL, H2.size(), -0.5, H2.size() + 0.5);
151
153
155
156 const int ix =
distance(H2.cbegin(), i) + 1;
157
160
161 hx.SetBinContent(ix, i->second->GetMean(1));
162 hy.SetBinContent(ix, i->second->GetMean(2));
163 hx.SetBinError (ix, i->second->GetStdDev(1));
164 hy.SetBinError (ix, i->second->GetStdDev(2));
165
166 Qx.
put(i->second->GetMean(1));
167 Qy.
put(i->second->GetMean(2));
168 }
169
172 }
173
175
176 out << h1 << h2 << hx << hy
180
181 out << H1 << *H1 << H2 << *H2;
182
185 }
186
189 }
190
193 }
194
195 out.Write();
196 out.Close();
197}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Double_t g1(const Double_t x)
Function.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Auxiliary class for multiplexing object iterators.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
General purpose class for object reading from a list of file names.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
double UNIXTimeStop
stop time
double ndf
weighed number of degrees of freedom
int npar
number of fit parameters
double UNIXTimeStart
start time
int numberOfIterations
number of iterations
Auxiliary data structure to build TGraph.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.