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
80
82 JManager<int, TH2D> H2(
new TH2D(
"[%].tiltdeviation", NULL, 300, -4.0, +4.0, 300, -4.0, +4.0),
'%', format);
83
85
86 for (
counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
87
88 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
89
90 const JEvt* evt = in.next();
91
93
95
98
99 double Tx = 0.0;
100 double Ty = 0.0;
101 double Ts = 0.0;
102 double Vs = 0.0;
103
104 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
105
106 const int id = i->id;
107 const double tx = (i->tx + i->tx2 * Z) * 1.0e3;
108 const double ty = (i->ty + i->ty2 * Z) * 1.0e3;
109 const double vs = i->vs * 1.0e2;
110 const double ts = sqrt(tx*tx + ty*ty);
111
112 h2.Fill(ts);
113
114 Tx += tx;
115 Ty += ty;
117 Ts += ts;
118
120 H1[id]->Fill(ts,
vs);
121
122 GO[id].put(t1, atan2(ty, tx));
123 GA[id].put(t1, ts);
125 }
126
127 Tx /= evt->size();
128 Ty /= evt->size();
129 Vs /= evt->size();
130 Ts /= evt->size();
131
132 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
133
134 const double tx = (i->tx + i->tx2 * Z) * 1.0e3;
135 const double ty = (i->ty + i->ty2 * Z) * 1.0e3;
136
137 H2 ->Fill(tx - Tx, ty - Ty);
138 H2[i->id]->Fill(tx - Tx, ty - Ty);
139
140 GO[-1].put(t1, atan2(Ty, Tx));
141 GA[-1].put(t1, Ts);
142 GS[-1].put(t1, Vs);
143 }
144 }
146
147 TH1D hx("hx", NULL, H2.size(), -0.5, H2.size() + 0.5);
148 TH1D hy("hy", NULL, H2.size(), -0.5, H2.size() + 0.5);
149
151
153
154 const int ix =
distance(H2.cbegin(), i) + 1;
155
158
159 hx.SetBinContent(ix, i->second->GetMean(1));
160 hy.SetBinContent(ix, i->second->GetMean(2));
161 hx.SetBinError (ix, i->second->GetStdDev(1));
162 hy.SetBinError (ix, i->second->GetStdDev(2));
163
164 Qx.
put(i->second->GetMean(1));
165 Qy.
put(i->second->GetMean(2));
166 }
167
170 }
171
173
174 out << h1 << h2 << hx << hy
177
178 out << H1 << *H1 << H2 << *H2;
179
182 }
183
186 }
187
190 }
191
192 out.Write();
193 out.Close();
194}
#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
Auxiliary data structure to build TGraph.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.