1616#ifndef ALIALGAUX_H
1717#define ALIALGAUX_H
1818
19- #include < TMath.h >
20- #include < TString.h >
19+ #include " CommonConstants/MathConstants.h "
20+ #include " MathUtils/Utils.h "
2121#include " ReconstructionDataFormats/Track.h"
22- // class AliCDBId;
23- class TMap ;
24- class TList ;
25-
26- using namespace TMath ;
2722
2823namespace o2
2924{
@@ -49,42 +44,42 @@ enum { kColl,
4944 kCosm ,
5045 kNTrackTypes };
5146//
52- inline Double_t Sector2Alpha (int sect);
53- inline Int_t Phi2Sector (double alpha);
54- inline Double_t SectorDAlpha () { return Pi () / 9 ; }
47+ inline double Sector2Alpha (int sect);
48+ inline int Phi2Sector (double alpha);
49+ inline double SectorDAlpha () { return constants::math::PI / 9 ; }
5550//
5651template <typename F>
5752void BringTo02Pi (F& phi);
5853template <typename F>
5954void BringToPiPM (F& phi);
6055template <typename F>
61- Bool_t OKforPhiMin (F phiMin, F phi);
56+ bool OKforPhiMin (F phiMin, F phi);
6257template <typename F>
63- Bool_t OKforPhiMax (F phiMax, F phi);
58+ bool OKforPhiMax (F phiMax, F phi);
6459template <typename F>
6560F MeanPhiSmall (F phi0, F phi1);
6661template <typename F>
6762F DeltaPhiSmall (F phi0, F phi1);
6863template <typename F>
69- Bool_t SmallerAbs (F d, F tolD)
64+ bool SmallerAbs (F d, F tolD)
7065{
71- return Abs (d) < tolD;
66+ return std::abs (d) < tolD;
7267}
7368template <typename F>
74- Bool_t Smaller (F d, F tolD)
69+ bool Smaller (F d, F tolD)
7570{
7671 return d < tolD;
7772}
7873//
79- inline Int_t NumberOfBitsSet (UInt_t x);
80- inline Bool_t IsZeroAbs (double d) { return SmallerAbs (d, kAlmostZeroD ); }
81- inline Bool_t IsZeroAbs (float f) { return SmallerAbs (f, kAlmostZeroF ); }
82- inline Bool_t IsZeroPos (double d) { return Smaller (d, kAlmostZeroD ); }
83- inline Bool_t IsZeroPos (float f) { return Smaller (f, kAlmostZeroF ); }
74+ inline int NumberOfBitsSet (uint32_t x);
75+ inline bool IsZeroAbs (double d) { return SmallerAbs (d, kAlmostZeroD ); }
76+ inline bool IsZeroAbs (float f) { return SmallerAbs (f, kAlmostZeroF ); }
77+ inline bool IsZeroPos (double d) { return Smaller (d, kAlmostZeroD ); }
78+ inline bool IsZeroPos (float f) { return Smaller (f, kAlmostZeroF ); }
8479//
8580int FindKeyIndex (int key, const int * arr, int n);
8681//
87- void PrintBits (ULong64_t patt, Int_t maxBits);
82+ void PrintBits (size_t patt, int maxBits);
8883
8984} // namespace AliAlgAux
9085
@@ -94,35 +89,35 @@ inline void AliAlgAux::BringTo02Pi(F& phi)
9489{
9590 // bring phi to 0-2pi range
9691 if (phi < 0 )
97- phi += TwoPi () ;
98- else if (phi > TwoPi () )
99- phi -= TwoPi () ;
92+ phi += constants::math::TwoPI ;
93+ else if (phi > constants::math::TwoPI )
94+ phi -= constants::math::TwoPI ;
10095}
10196
10297// _________________________________________________________________________________
10398template <typename F>
10499inline void AliAlgAux::BringToPiPM (F& phi)
105100{
106101 // bring phi to -pi:pi range
107- if (phi > Pi () )
108- phi -= TwoPi () ;
102+ if (phi > constants::math::PI )
103+ phi -= constants::math::TwoPI ;
109104}
110105// _________________________________________________________________________________
111106template <typename F>
112- inline Bool_t AliAlgAux::OKforPhiMin (F phiMin, F phi)
107+ inline bool AliAlgAux::OKforPhiMin (F phiMin, F phi)
113108{
114109 // check if phi is above the phiMin, phi's must be in 0-2pi range
115110 F dphi = phi - phiMin;
116- return ((dphi > 0 && dphi < Pi ()) || dphi < -Pi ()) ? kTRUE : kFALSE ;
111+ return ((dphi > 0 && dphi < constants::math::PI) || dphi < -constants::math::PI) ? true : false ;
117112}
118113
119114// _________________________________________________________________________________
120115template <typename F>
121- inline Bool_t AliAlgAux::OKforPhiMax (F phiMax, F phi)
116+ inline bool AliAlgAux::OKforPhiMax (F phiMax, F phi)
122117{
123118 // check if phi is below the phiMax, phi's must be in 0-2pi range
124119 F dphi = phi - phiMax;
125- return ((dphi < 0 && dphi > -Pi ()) || dphi > Pi ()) ? kTRUE : kFALSE ;
120+ return ((dphi < 0 && dphi > -constants::math::PI) || dphi > constants::math::PI) ? true : false ;
126121}
127122
128123// _________________________________________________________________________________
@@ -137,7 +132,7 @@ inline F AliAlgAux::MeanPhiSmall(F phi0, F phi1)
137132 phi1 = phi;
138133 }
139134 if (phi0 > phi1)
140- phi = (phi1 - (TwoPi () - phi0)) / 2 ; // wrap
135+ phi = (phi1 - (constants::math::TwoPI - phi0)) / 2 ; // wrap
141136 else
142137 phi = (phi0 + phi1) / 2 ;
143138 BringTo02Pi (phi);
@@ -157,12 +152,12 @@ inline F AliAlgAux::DeltaPhiSmall(F phi0, F phi1)
157152 }
158153 del = phi1 - phi0;
159154 if (del < 0 )
160- del += TwoPi () ;
155+ del += constants::math::TwoPI ;
161156 return del;
162157}
163158
164159// _________________________________________________________________________________
165- inline Int_t AliAlgAux::NumberOfBitsSet (UInt_t x)
160+ inline int AliAlgAux::NumberOfBitsSet (uint32_t x)
166161{
167162 // count number of non-0 bits in 32bit word
168163 x = x - ((x >> 1 ) & 0x55555555 );
@@ -171,7 +166,7 @@ inline Int_t AliAlgAux::NumberOfBitsSet(UInt_t x)
171166}
172167
173168// _________________________________________________________________________________
174- inline Double_t AliAlgAux::Sector2Alpha (int sect)
169+ inline double AliAlgAux::Sector2Alpha (int sect)
175170{
176171 // get barrel sector alpha in -pi:pi format
177172 if (sect > 8 )
@@ -180,10 +175,10 @@ inline Double_t AliAlgAux::Sector2Alpha(int sect)
180175}
181176
182177// _________________________________________________________________________________
183- inline Int_t AliAlgAux::Phi2Sector (double phi)
178+ inline int AliAlgAux::Phi2Sector (double phi)
184179{
185180 // get barrel sector from phi in -pi:pi format
186- int sect = Nint ((phi * RadToDeg () - 10 ) / 20 .);
181+ int sect = math_utils::nintd ((phi * constants::math::Rad2Deg - 10 ) / 20 .);
187182 if (sect < 0 )
188183 sect += 18 ;
189184 return sect;
0 commit comments