Example program to compare dynamic position calibrations.
42{
45
48 string detectorFile;
50 double Tstep_s;
52
53 try {
54
55 JParser<> zap(
"Example program to compare dynamic position calibrations.");
56
58 zap[
'f'] =
make_field(calibrationFile1,
"output of JKatoomba[.sh]");
59 zap[
'F'] =
make_field(calibrationFile2,
"output of JKatoomba[.sh]");
63
64 zap(argc, argv);
65 }
66 catch(const exception &error) {
67 FATAL(error.what() << endl);
68 }
69
70
72
73 try {
75 }
78 }
79
81
82 STATUS(
"loading input from file " << calibrationFile1 <<
"... " << flush);
83
84 dynamics1.load(calibrationFile1);
85
87
88 Double_t xmin1 = numeric_limits<Double_t>::max();
89 Double_t xmax1 = numeric_limits<Double_t>::lowest();
90
92
93 if (!string->second.empty()) {
94 xmin1 = min(xmin1, string->second.getXmin());
95 xmax1 = max(xmax1, string->second.getXmax());
96 }
97 }
98
100
101 STATUS(
"loading input from file " << calibrationFile1 <<
"... " << flush);
102
103 dynamics2.load(calibrationFile2);
104
106
107 Double_t xmin2 = numeric_limits<Double_t>::max();
108 Double_t xmax2 = numeric_limits<Double_t>::lowest();
109
111
112 if (!string->second.empty()) {
113 xmin2 = min(xmin2, string->second.getXmin());
114 xmax2 = max(xmax2, string->second.getXmax());
115 }
116 }
117
118 Double_t
xmin = numeric_limits<Double_t>::max();
119 Double_t
xmax = numeric_limits<Double_t>::lowest();
120
121
122 xmin = max(xmin1, xmin2);
123 xmax = min(xmax1, xmax2);
124
125 const JFormat_t format(4, 0, std::ios_base::fmtflags(),
'0');
126
131
134
135 if (string1->first == string2->first) {
136
137 TH1D* hc = HC[string1->first];
138 TH1D* hd = HD[string1->first];
139
140 for (Double_t t = xmin; t <=
xmax; t = t + Tstep_s) {
141
142 HO[string1->first].put(t, (string1->second(t).tx - string2->second(t).tx) * 1000);
143 HA[string1->first].put(t, (string1->second(t).ty - string2->second(t).ty) * 1000);
144 hc->Fill((string1->second(t).tx - string2->second(t).tx) * 1000);
145 hd->Fill((string1->second(t).ty - string2->second(t).ty) * 1000);
146 }
147
148 break;
149 }
150 }
151 }
152
154
155 out << HC << HD;
158 }
159
162 }
163}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
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.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
data_type::const_iterator const_iterator
Dynamic detector calibration.
Auxiliary data structure to build TGraph.