59{
63
65 JLimit_t& numberOfEvents = inputFile.getLimit();
68 double Tmax_ns;
69 double roadWidth_m;
70 double ctMin;
72 double sigma_ns;
73 int numberOfOutliers;
76
77 try {
78
79 JParser<> zap(
"Example program to test chi2 calculations of co-variance matrix including direction uncertainty.");
80
93
95 }
96 catch(const exception& error) {
98 }
99
100
102
103
105 const double STANDARD_DEVIATIONS = 3.0;
106 const double HIT_OFF = 1.0e3 * sigma_ns*sigma_ns;
107
108
110
111 try {
113 }
116 }
117
120
122
123
125
126
129
132
134
135 {
137
138 for ( ;
x < 10.0;
x += 1.0) { X.push_back(x); }
139 for ( ;
x < 25.0;
x += 2.0) { X.push_back(x); }
140 for ( ;
x < 100.0;
x += 5.0) { X.push_back(x); }
141 }
142
145
146
151
153
154 while (inputFile.hasNext()) {
155
157
159
161 const Evt*
event = ps;
162
164
166
167 if (muon != event->mc_trks.end()) {
168
170
172
174 tz.rotate(R);
175
176 const double theta =
alpha_deg * PI / 180.0;
177 const double phi =
gRandom->Uniform(0.0, 2*PI);
178
180
181
183
185
187
189
190 } else {
191
193
195
197
202
204 }
205 }
206
208
209 sort(i->second.begin(), i->second.end(),
less<JHit>());
210
211 data.push_back(i->second[0]);
212 }
213 }
214
215
216
217
219
220
221
222
223 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
224 i->rotate(R);
225 }
226
228
229
230
231
233
234
235
236
237 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
238 i->sub(tz.getPosition());
239 }
240
242
243
244
245
246 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
248 }
249
250
252
253 JData_t::iterator __end =
data.end();
254
256
258 JData_t::iterator kill = __end;
259
260 for (JData_t::iterator i =
data.begin(); i != __end; ++i) {
261
262 const double y = fabs(i->getT() - tz.getT(*i)) / sigma_ns;
263
266 kill = i;
267 }
268 }
269
270 if (
ymax >= STANDARD_DEVIATIONS)
272 else
273 break;
274 }
275
276 const double chi2 =
getChi2(tz,
data.begin(), __end, sigma_ns);
278
279 h0.Fill(chi2 / N);
280 p0.Fill(TMath::Prob(chi2, N));
281 n0.Fill((
double)
data.size(), (
double) N / (
double)
data.size());
282 }
283
284
286
289
292
294
295 unsigned int N =
data.size();
296
298
300 int kill = -1;
301
302 for (
unsigned int i = 0; i != V.
size(); ++i) {
303
305
308 kill = i;
309 }
310 }
311
312 if (
ymax >= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS)
314 else
315 break;
316 }
317
318 const double chi2 = V.
getDot(Y);
319
320 h1.Fill(chi2 / N);
321 p1.Fill(TMath::Prob(chi2, N));
322 n1.Fill((
double)
data.size(), (
double) N / (
double)
data.size());
323 }
324 }
325 }
327
328 out.Write();
329 out.Close();
330}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int first
index of module in detector data structure
Router for direct addressing of module data in detector data structure.
Address of PMT in detector data structure.
Router for direct addressing of PMT data in detector data structure.
Data structure for PMT geometry, calibration and status.
Data structure for fit of straight line paralel to z-axis.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JVector3D &pos, T __begin, T __end, const double alpha, const double sigma)
Set co-variance matrix.
static double getDot(const variance &first, const variance &second)
Get dot product.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Data structure for angles in three dimensions.
Data structure for vector in three dimensions.
double getZ() const
Get z position.
Template definition of a multi-dimensional oscillation probability interpolation table.
Data structure for L0 hit.
static void setSlewing(const bool slewing)
Set slewing option.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
JDirection3D getDirection(const Vec &dir)
Get direction.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
bool is_noise(const Hit &hit)
Verify hit origin.
Vec getOffset(const JHead &header)
Get offset.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getChi2(const double P)
Get chi2 corresponding to given probability.
const double getSpeedOfLight()
Get speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
const char * getTime()
Get current local time conform ISO-8601 standard.
JHitIterator_t clusterizeWeight(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match)
Partition data according given binary match operator.
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
General purpose class for multiple pointers.
size_t size() const
Get dimension of matrix.
void update(const size_t k, const double value)
Update inverted matrix at given diagonal element.
void invert()
Invert matrix according LDU decomposition.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Data structure for L2 parameters.
The Vec class is a straightforward 3-d vector, which also works in pyroot.