29{
32
34 int numberOfEvents;
35 int numberOfAxes;
37 double precision;
39
40 try {
41
42 JParser<> zap(
"Test program for position fit.");
43
50
51 zap(argc, argv);
52 }
53 catch(const exception &error) {
54 FATAL(error.what() << endl);
55 }
56
57
58 TH1D hx("hx", NULL, 101, -1.0, +1.0);
59 TH1D hy("hy", NULL, 101, -1.0, +1.0);
60 TH1D hz("hz", NULL, 101, -1.0, +1.0);
61
65
66
67 for (int i = 0; i != numberOfEvents; ++i) {
68
70
71
72
74
75 for (
int j = 0;
j != numberOfAxes; ++
j) {
76
77 const double x = gRandom->Gaus(0.0, sigma);
78 const double y = gRandom->Gaus(0.0, sigma);
79 const double z = gRandom->Gaus(0.0, sigma);
80
81 const double dx = gRandom->Uniform(-1, +1);
82 const double dy = gRandom->Uniform(-1, +1);
83 const double dz = gRandom->Uniform(-1, +1);
84
86 }
87
88
89
91
92 hx.Fill(vertex.getX() -
result.getX());
93 hy.Fill(vertex.getY() -
result.getY());
94 hz.Fill(vertex.getZ() -
result.getZ());
95
96 Qx.put(vertex.getX() -
result.getX());
97 Qy.put(vertex.getY() -
result.getY());
98 Qz.put(vertex.getZ() -
result.getZ());
99 }
100
101 if (
debug >= debug_t) {
102 Qx.print(cout);
103 Qy.print(cout);
104 Qz.print(cout);
105 }
106
108
110
111 out << hx << hy << hz;
112
113 out.Write();
114 out.Close();
115 }
116
117 ASSERT(numberOfEvents > 0);
118
119 ASSERT(fabs(Qx.getMean()) <= precision);
120 ASSERT(fabs(Qy.getMean()) <= precision);
121 ASSERT(fabs(Qz.getMean()) <= precision);
122
123 ASSERT(Qx.getSTDev() <= precision);
124 ASSERT(Qy.getSTDev() <= precision);
125 ASSERT(Qz.getSTDev() <= precision);
126
127 return 0;
128}
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of linear fit.
Data structure for vector in three dimensions.
Data structure for normalised vector in three dimensions.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).