40{
43
46
48
50 JLimit_t& numberOfEvents = inputFile.getLimit();
54 double Z;
57 string option;
60
61 try {
62
63 JParser<> zap(
"Auxiliary application to determine tilt angles of seabed based on measured tilt angles.");
64
65 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh]/JFremantle[.sh])");
72 zap[
'Z'] =
make_field(Z,
"detector height (for 2nd order tilt correction)") = 0.0;
73 zap[
'O'] =
make_field(option,
"ROOT fit option, see TH1::Fit.") =
"L";
76
78 }
79 catch(const exception &error) {
81 }
82
83 Z *= 0.5;
84
85 if (option.find('O') == string::npos) { option += "O"; }
86 if (option.find("R") == string::npos) { option += "R"; }
87 if (option.find("S") == string::npos) { option += "S"; }
88
89 if (
debug == 0 && option.find(
'Q') == string::npos) { option +=
"Q"; }
90
92 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
93 Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit());
94
96
97 for (
counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
98
100
101 const JEvt* evt = in.next();
102
103 if (!evt->empty()) {
104
107
108 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
109
110 const double tx = (i->tx + i->tx2 * Z) * 1.0e3;
111 const double ty = (i->ty + i->ty2 * Z) * 1.0e3;
112
115 }
116
119
121 }
122 }
124
125
126 double x0 = 0.0;
127 double y0 = 0.0;
128 double z0 = 0.0;
129
132 if (
H2.GetBinContent(
ix,
iy) > z0) {
133 x0 =
H2.GetXaxis()->GetBinCenter(
ix);
134 y0 =
H2.GetYaxis()->GetBinCenter(
iy);
135 z0 =
H2.GetBinContent(
ix,
iy);
136 }
137 }
138 }
139
141
142
143 TF2 f2("f2", "[0] * exp(-0.5 * (x-[1])*(x-[1]) / ([2]*[2])) * exp(-0.5 * (y-[3])*(y-[3]) / ([4]*[4])) + [5] + [6]*x + [7]*y");
144
145 f2.SetParameter(0, z0 * 0.7);
146 f2.SetParameter(1, x0);
147 f2.SetParameter(2, 0.5);
148 f2.SetParameter(3, y0);
149 f2.SetParameter(4, 0.5);
150 f2.SetParameter(5, 0.0);
151 f2.SetParameter(6, 0.0);
152 f2.SetParameter(7, 0.0);
153
154 f2.SetParError(0, 0.1);
155 f2.SetParError(1, 0.02);
156 f2.SetParError(2, 0.02);
157 f2.SetParError(3, 0.02);
158 f2.SetParError(4, 0.02);
159 f2.SetParError(5, 0.001);
160 f2.SetParError(6, 0.001);
161 f2.SetParError(7, 0.001);
162
163 f2.SetRange(x0 +
x.getLowerLimit(), y0 +
y.getLowerLimit(), x0 +
x.getUpperLimit(), y0 +
y.getUpperLimit());
164
165 H2.GetXaxis()->SetRangeUser(x0 +
x.getLowerLimit(), x0 +
x.getUpperLimit());
166 H2.GetYaxis()->SetRangeUser(y0 +
y.getLowerLimit(), y0 +
y.getUpperLimit());
167
169
170 H2.GetXaxis()->SetRangeUser(
H2.GetXaxis()->GetXmin(),
H2.GetXaxis()->GetXmax());
171 H2.GetYaxis()->SetRangeUser(
H2.GetYaxis()->GetXmin(),
H2.GetYaxis()->GetXmax());
172
174 FATAL(
"Invalid TFitResultPtr " <<
H2.GetName() <<
endl);
175 }
176
179 }
180
181 cout <<
"tilt: " <<
FIXED(9,6) << f2.GetParameter(1)*1.0e-3 <<
' ' <<
FIXED(9,6) << f2.GetParameter(3)*1.0e-3 <<
endl;
182
183
185
187
189
191
192 h2->Reset();
193
194 for (
Int_t ix = 1;
ix <= h2->GetXaxis()->GetNbins(); ++
ix) {
195 for (
Int_t iy = 1;
iy <= h2->GetYaxis()->GetNbins(); ++
iy) {
196
197 const Double_t x = h2->GetXaxis()->GetBinCenter(
ix);
198 const Double_t y = h2->GetYaxis()->GetBinCenter(
iy);
199
200 h2->SetBinContent(
ix,
iy, f2.Eval(x,y));
201 h2->SetBinError (
ix,
iy, 0.0);
202 }
203 }
204 }
205
206 out.Write();
207 out.Close();
208}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Template definition of a multi-dimensional oscillation probability interpolation table.
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Type definition of range.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.