31 inline bool check_boundaries(
const TAxis* axis,
double value )
33 const auto bin = axis->FindBin( value );
34 return( bin >= 2 && bin < axis->GetNbins() );
39 inline bool check_boundaries(
const TH3*
h,
double r,
double phi,
double z )
41 return check_boundaries( h->GetXaxis(),
r )
42 && check_boundaries( h->GetYaxis(),
phi )
43 && check_boundaries( h->GetZaxis(),
z );
57 std::cout <<
"Static distortion file could not be opened!" << std::endl;
78 std::cout <<
"TimeOrdered distortion file could not be opened!" << std::endl;
109 int nentries =
TimeTree->GetEntries();
110 if (event_num > nentries) event_num = event_num % nentries;
111 if (event_num % nentries == 0 && event_num != 0)
113 std::cout <<
"Distortion map sequence repeating as of event number " << event_num << std::endl;
124 double r = sqrt(x * x + y * y);
125 double phi = std::atan2(y, x);
132 double cosphi = cos(phi);
133 double sinphi = sin(phi);
134 double dx = dr * cosphi - dphi * sinphi;
141 double r = sqrt(x * x + y * y);
142 double phi = std::atan2(y, x);
149 double cosphi = cos(phi);
150 double sinphi = sin(phi);
151 double dy = dphi * cosphi + dr * sinphi;
158 double r = sqrt(x * x + y * y);
159 double phi = std::atan2(y, x);
190 if (r<1)
printf(
"Unusual R: %f. This line is to keep the compiler from complaining about unused parameters like %f and %f.\n",r,phi,z);
197 if (phi < 0) phi += 2 * M_PI;
198 const int zpart = (z > 0 ? 1 : 0);
200 TH3* hdistortion =
nullptr;
202 if (axis !=
'r' && axis !=
'p' && axis !=
'z'&& axis !=
'R')
204 std::cout <<
"Distortion Requested along axis " << axis <<
" which is invalid. Exiting.\n"
209 double _distortion = 0.;
216 hdistortion =
hDRint[zpart];
218 else if (axis ==
'p')
220 hdistortion =
hDPint[zpart];
222 else if (axis ==
'z')
224 hdistortion =
hDZint[zpart];
226 else if (axis ==
'R')
228 hdistortion =
hReach[zpart];
232 if( check_boundaries( hdistortion, phi, r, z ) )
233 { _distortion += hdistortion->Interpolate(phi, r, z); }
237 std::cout <<
"Static Distortion Requested along axis " << axis <<
", but distortion map does not exist. Exiting.\n"
249 else if (axis ==
'p')
253 else if (axis ==
'z')
257 else if (axis ==
'R')
263 if( check_boundaries( hdistortion, phi, r, z ) )
264 { _distortion += hdistortion->Interpolate(phi, r, z); }
268 std::cout <<
"Time Series Distortion Requested along axis " << axis <<
", but distortion map does not exist. Exiting.\n"