17 template<
class T>
inline constexpr
T square(
const T&
x ) {
return x*
x; }
21 inline bool check_boundaries(
const TAxis* axis,
double value )
23 const auto bin = axis->FindBin( value );
24 return( bin >= 2 && bin < axis->GetNbins() );
29 inline bool check_boundaries(
const TH1*
h,
double r,
double phi,
double z )
31 return check_boundaries( h->GetXaxis(),
r )
32 && check_boundaries( h->GetYaxis(),
phi )
33 && check_boundaries( h->GetZaxis(),
z );
38 inline bool check_boundaries(
const TH1* h,
double r,
double phi )
39 {
return check_boundaries( h->GetXaxis(),
r ) && check_boundaries( h->GetYaxis(),
phi ); }
47 const auto r = std::sqrt(
square( source.x() ) +
square( source.y() ) );
48 auto phi = std::atan2( source.y(), source.x() );
49 if( phi < 0 ) phi += 2*M_PI;
51 const auto z = source.z();
52 const int index = z > 0 ? 1:0;
73 const double zterm = (1.- std::abs(z)/105.5);
74 if (dcc->
m_hDPint[index] && (mask&
COORD_PHI) && check_boundaries( dcc->
m_hDPint[index],phi,r)) phi_new = phi - dcc->
m_hDPint[index]->Interpolate(phi,r)*zterm/divisor;
80 const auto x_new = r_new*std::cos( phi_new );
81 const auto y_new = r_new*std::sin( phi_new );
83 return {x_new, y_new, z_new};