6666
6767using namespace o2 ;
6868using namespace o2 ::framework;
69+ using namespace o2 ::constants::math;
6970
7071struct OnTheFlyRichPid {
7172 Produces<aod::UpgradeRich> upgradeRich;
@@ -225,19 +226,19 @@ struct OnTheFlyRichPid {
225226 l_aerogel_z[i_central_mirror] = std::sqrt (1.0 + m_val * m_val) * R_min * square_size_barrel_cylinder / (std::sqrt (1.0 + m_val * m_val) * R_max - m_val * square_size_barrel_cylinder);
226227 T_r_plus_g[i_central_mirror] = R_max - R_min;
227228 float t = std::tan (std::atan (m_val) + std::atan (square_size_barrel_cylinder / (2.0 * R_max * std::sqrt (1.0 + m_val * m_val) - square_size_barrel_cylinder * m_val)));
228- theta_max[i_central_mirror] = M_PI / 2.0 - std::atan (t);
229- theta_min[i_central_mirror] = M_PI / 2.0 + std::atan (t);
229+ theta_max[i_central_mirror] = PI / 2.0 - std::atan (t);
230+ theta_min[i_central_mirror] = PI / 2.0 + std::atan (t);
230231 mProjectiveLengthInner = R_min * t;
231232 aerogel_rindex[i_central_mirror] = bRichRefractiveIndexSector[0 ];
232233 for (int i = i_central_mirror + 1 ; i < number_of_sectors_in_z; i++) {
233234 float par_a = t;
234235 float par_b = 2.0 * R_max / square_size_z;
235236 m_val = (std::sqrt (par_a * par_a * par_b * par_b + par_b * par_b - 1.0 ) + par_a * par_b * par_b) / (par_b * par_b - 1.0 );
236- theta_min[i] = M_PI / 2.0 - std::atan (t);
237- theta_max[2 * i_central_mirror - i] = M_PI / 2.0 + std::atan (t);
237+ theta_min[i] = PI / 2.0 - std::atan (t);
238+ theta_max[2 * i_central_mirror - i] = PI / 2.0 + std::atan (t);
238239 t = std::tan (std::atan (m_val) + std::atan (square_size_z / (2.0 * R_max * std::sqrt (1.0 + m_val * m_val) - square_size_z * m_val)));
239- theta_max[i] = M_PI / 2.0 - std::atan (t);
240- theta_min[2 * i_central_mirror - i] = M_PI / 2.0 + std::atan (t);
240+ theta_max[i] = PI / 2.0 - std::atan (t);
241+ theta_min[2 * i_central_mirror - i] = PI / 2.0 + std::atan (t);
241242 // Forward sectors
242243 theta_bi[i] = std::atan (m_val);
243244 R0_tilt[i] = R_max - square_size_z / 2.0 * std::sin (std::atan (m_val));
@@ -268,11 +269,11 @@ struct OnTheFlyRichPid {
268269 float par_a = t;
269270 float par_b = 2.0 * R_max / square_size_z;
270271 m_val = (std::sqrt (par_a * par_a * par_b * par_b + par_b * par_b - 1.0 ) + par_a * par_b * par_b) / (par_b * par_b - 1.0 );
271- theta_min[i] = M_PI / 2.0 - std::atan (t);
272- theta_max[2 * i_central_mirror - i - 1 ] = M_PI / 2.0 + std::atan (t);
272+ theta_min[i] = PI / 2.0 - std::atan (t);
273+ theta_max[2 * i_central_mirror - i - 1 ] = PI / 2.0 + std::atan (t);
273274 t = std::tan (std::atan (m_val) + std::atan (square_size_z / (2.0 * R_max * std::sqrt (1.0 + m_val * m_val) - square_size_z * m_val)));
274- theta_max[i] = M_PI / 2.0 - std::atan (t);
275- theta_min[2 * i_central_mirror - i - 1 ] = M_PI / 2.0 + std::atan (t);
275+ theta_max[i] = PI / 2.0 - std::atan (t);
276+ theta_min[2 * i_central_mirror - i - 1 ] = PI / 2.0 + std::atan (t);
276277 // Forward sectors
277278 theta_bi[i] = std::atan (m_val);
278279 R0_tilt[i] = R_max - square_size_z / 2.0 * std::sin (std::atan (m_val));
@@ -307,13 +308,11 @@ struct OnTheFlyRichPid {
307308 gap_thickness[i] = (det_centers[i] - rad_centers[i]).Mag () - bRichRadiatorThickness / 2.0 ;
308309 }
309310 // DEBUG
310- std::cout << std::endl
311- << std::endl;
312- for (int i = 0 ; i < number_of_sectors_in_z; i++) {
313- std::cout << " Sector " << i << " : Gap = " << gap_thickness[i] << " cm, Index aerogel = " << aerogel_rindex[i] << " , Gap thickness = " << gap_thickness[i] << " cm" << std::endl;
314- }
315- std::cout << std::endl
316- << std::endl;
311+ // std::cout << std::endl << std::endl;
312+ // for (int i = 0; i < number_of_sectors_in_z; i++) {
313+ // std::cout << "Sector " << i << ": Gap = " << gap_thickness[i] << " cm, Index aerogel = " << aerogel_rindex[i] << ", Gap thickness = " << gap_thickness[i] << " cm" << std::endl;
314+ // }
315+ // std::cout << std::endl << std::endl;
317316 }
318317
319318 void init (o2::framework::InitContext& initContext)
@@ -581,7 +580,7 @@ struct OnTheFlyRichPid {
581580 // / \param radius the nominal radius of the Cherenkov ring
582581 float fractionPhotonsProjectiveRICH (float eta, float tile_z_length, float radius)
583582 {
584- float polar = 2.0 * atan (exp (-eta));
583+ float polar = 2.0 * std:: atan (std:: exp (-eta));
585584 int i_sector = 0 ;
586585 bool flag_sector = false ;
587586 for (int j_sec = 0 ; j_sec < mNumberSectors ; j_sec++) {
@@ -597,14 +596,14 @@ struct OnTheFlyRichPid {
597596 float z_sec_rich = rad_centers[i_sector].Z ();
598597 float R_sec_tof = det_centers[i_sector].X ();
599598 float z_sec_tof = det_centers[i_sector].Z ();
600- float radius_ripple = (pow (R_sec_rich, 2 ) + pow (z_sec_rich, 2 )) / (R_sec_rich + z_sec_rich / tan (polar));
601- float z_ripple = radius_ripple / tan (polar);
602- float absZ = hypot (radius_ripple - R_sec_rich, z_ripple - z_sec_rich);
599+ float radius_ripple = (std:: pow (R_sec_rich, 2 ) + std:: pow (z_sec_rich, 2 )) / (R_sec_rich + z_sec_rich / std:: tan (polar));
600+ float z_ripple = radius_ripple / std:: tan (polar);
601+ float absZ = std:: hypot (radius_ripple - R_sec_rich, z_ripple - z_sec_rich);
603602 float fraction = 1 .;
604603 if (tile_z_length / 2 . - absZ < radius) {
605- fraction = fraction - (1 . / M_PI ) * acos ((tile_z_length / 2 . - absZ) / radius);
604+ fraction = fraction - (1 . / PI ) * std:: acos ((tile_z_length / 2 . - absZ) / radius);
606605 if (tile_z_length / 2 . + absZ < radius) {
607- fraction = fraction - (1 . / M_PI ) * acos ((tile_z_length / 2 . + absZ) / radius);
606+ fraction = fraction - (1 . / PI ) * std:: acos ((tile_z_length / 2 . + absZ) / radius);
608607 }
609608 }
610609 return fraction;
@@ -685,7 +684,7 @@ struct OnTheFlyRichPid {
685684 float N0 = 24 . * T_r / 2 .; // photons for N = 1.03 at saturation ( 24/2 factor per radiator cm )
686685 float multiplicity_spectrum_factor = std::pow (std::sin (theta_c), 2 .) / std::pow (std::sin (std::acos (1 . / 1.03 )), 2 .); // scale multiplicity w.r.t. N = 1.03 at saturation
687686 // Considering average resolution (integrated over the sector)
688- // float n_photons = (tile_z_length / 2.0 > radius) ? N0 * multiplicity_spectrum_factor * (1.-(2.0*radius)/(M_PI *tile_z_length)) : N0 * multiplicity_spectrum_factor * (1.-(2.0*radius)/(M_PI *tile_z_length) - (2.0/(tile_z_length*M_PI ))*(-(tile_z_length/(2.0))*std::acos(tile_z_length/(2.0*radius)) + radius*std::sqrt(1.-std::pow(tile_z_length/(2.0*radius),2.0))));
687+ // float n_photons = (tile_z_length / 2.0 > radius) ? N0 * multiplicity_spectrum_factor * (1.-(2.0*radius)/(PI *tile_z_length)) : N0 * multiplicity_spectrum_factor * (1.-(2.0*radius)/(PI *tile_z_length) - (2.0/(tile_z_length*PI ))*(-(tile_z_length/(2.0))*std::acos(tile_z_length/(2.0*radius)) + radius*std::sqrt(1.-std::pow(tile_z_length/(2.0*radius),2.0))));
689688 // Considering "exact" resolution (eta by eta)
690689 float n_photons = N0 * multiplicity_spectrum_factor * fractionPhotonsProjectiveRICH (eta, tile_z_length, radius);
691690 if (n_photons <= error_value + 1 )
0 commit comments