1616
1717#include " Framework/Logger.h"
1818#include " Framework/HistogramRegistry.h"
19+ #include " CommonConstants/MathConstants.h"
1920
2021// Functions which cut on particle pairs (decays, conversions, two-track cuts)
2122//
2223// Author: Jan Fiete Grosse-Oetringhaus
2324
2425using namespace o2 ;
2526using namespace o2 ::framework;
27+ using namespace constants ::math;
2628
2729class PairCuts
2830{
@@ -266,41 +268,41 @@ double PairCuts::getInvMassSquaredFast(T const& track1, double m0_1, T const& tr
266268 const float pt1 = track1.pt ();
267269 const float pt2 = track2.pt ();
268270
269- float tantheta1 = 1e10 ;
271+ float tantheta1 = 1e10f ;
270272
271- if (eta1 < -1e-10 || eta1 > 1e-10 ) {
272- float expTmp = 1.0 - eta1 + eta1 * eta1 / 2 - eta1 * eta1 * eta1 / 6 + eta1 * eta1 * eta1 * eta1 / 24 ;
273- tantheta1 = 2.0 * expTmp / (1.0 - expTmp * expTmp);
273+ if (eta1 < -1e-10f || eta1 > 1e-10f ) {
274+ float expTmp = 1 .0f - eta1 + eta1 * eta1 / 2 . 0f - eta1 * eta1 * eta1 / 6 . 0f + eta1 * eta1 * eta1 * eta1 / 24 . 0f ;
275+ tantheta1 = 2 .0f * expTmp / (1 .0f - expTmp * expTmp);
274276 }
275277
276- float tantheta2 = 1e10 ;
277- if (eta2 < -1e-10 || eta2 > 1e-10 ) {
278- float expTmp = 1.0 - eta2 + eta2 * eta2 / 2 - eta2 * eta2 * eta2 / 6 + eta2 * eta2 * eta2 * eta2 / 24 ;
279- tantheta2 = 2.0 * expTmp / (1.0 - expTmp * expTmp);
278+ float tantheta2 = 1e10f ;
279+ if (eta2 < -1e-10f || eta2 > 1e-10f ) {
280+ float expTmp = 1 .0f - eta2 + eta2 * eta2 / 2 . 0f - eta2 * eta2 * eta2 / 6 . 0f + eta2 * eta2 * eta2 * eta2 / 24 . 0f ;
281+ tantheta2 = 2 .0f * expTmp / (1 .0f - expTmp * expTmp);
280282 }
281283
282- float e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
283- float e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
284+ float e1squ = m0_1 * m0_1 + pt1 * pt1 * (1 .0f + 1 .0f / tantheta1 / tantheta1);
285+ float e2squ = m0_2 * m0_2 + pt2 * pt2 * (1 .0f + 1 .0f / tantheta2 / tantheta2);
284286
285287 // fold onto 0...pi
286288 float deltaPhi = std::fabs (phi1 - phi2);
287- while (deltaPhi > M_PI * 2 ) {
288- deltaPhi -= M_PI * 2 ;
289+ while (deltaPhi > TwoPI ) {
290+ deltaPhi -= TwoPI ;
289291 }
290- if (deltaPhi > M_PI ) {
291- deltaPhi = M_PI * 2 - deltaPhi;
292+ if (deltaPhi > PI ) {
293+ deltaPhi = TwoPI - deltaPhi;
292294 }
293295
294296 float cosDeltaPhi = 0 ;
295- if (deltaPhi < M_PI / 3 ) {
297+ if (deltaPhi < PI / 3 . 0f ) {
296298 cosDeltaPhi = 1.0 - deltaPhi * deltaPhi / 2 + deltaPhi * deltaPhi * deltaPhi * deltaPhi / 24 ;
297- } else if (deltaPhi < 2 * M_PI / 3 ) {
298- cosDeltaPhi = -(deltaPhi - M_PI / 2 ) + 1.0 / 6 * std::pow ((deltaPhi - M_PI / 2 ), 3 );
299+ } else if (deltaPhi < 2 . 0f * PI / 3 . 0f ) {
300+ cosDeltaPhi = -(deltaPhi - PI / 2 ) + 1.0 / 6 * std::pow ((deltaPhi - PI / 2 ), 3 );
299301 } else {
300- cosDeltaPhi = -1.0 + 1.0 / 2.0 * (deltaPhi - M_PI ) * (deltaPhi - M_PI ) - 1.0 / 24.0 * std::pow (deltaPhi - M_PI , 4 );
302+ cosDeltaPhi = -1 .0f + 1 .0f / 2 .0f * (deltaPhi - PI ) * (deltaPhi - PI ) - 1 .0f / 24 .0f * std::pow (deltaPhi - PI , 4 . 0f );
301303 }
302304
303- double mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * (std::sqrt (e1squ * e2squ) - (pt1 * pt2 * (cosDeltaPhi + 1.0 / tantheta1 / tantheta2)));
305+ double mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 . 0f * (std::sqrt (e1squ * e2squ) - (pt1 * pt2 * (cosDeltaPhi + 1 .0f / tantheta1 / tantheta2)));
304306
305307 // LOGF(debug, "%f %f %f %f %f %f %f %f %f", pt1, eta1, phi1, pt2, eta2, phi2, m0_1, m0_2, mass2);
306308
@@ -324,14 +326,14 @@ float PairCuts::getDPhiStar(T const& track1, T const& track2, float radius, int
324326
325327 float dphistar = phi1 - phi2 - charge1 * std::asin (0.015 * magField * radius / pt1) + charge2 * std::asin (0.015 * magField * radius / pt2);
326328
327- if (dphistar > M_PI ) {
328- dphistar = M_PI * 2 - dphistar;
329+ if (dphistar > PI ) {
330+ dphistar = TwoPI - dphistar;
329331 }
330- if (dphistar < -M_PI ) {
331- dphistar = -M_PI * 2 - dphistar;
332+ if (dphistar < -PI ) {
333+ dphistar = -TwoPI - dphistar;
332334 }
333- if (dphistar > M_PI ) { // might look funny but is needed
334- dphistar = M_PI * 2 - dphistar;
335+ if (dphistar > PI ) { // might look funny but is needed
336+ dphistar = TwoPI - dphistar;
335337 }
336338
337339 return dphistar;
0 commit comments