Skip to content

Commit c3f387f

Browse files
MichaelLettrichshahor02
authored andcommitted
[ALIGN] adapt C++ elementary types
Use elementary C++ data types instead of ROOT ones. * Double_t -> double * Float_t -> float * UInt_t -> uint32_t * Int_t -> int * Bool_t -> bool * UChar_t -> uint8_t * Char_r -> char * UShort_t -> uint16_t * Short_t -> int16_t * ULong_t -> uint64_t * ULong64_t -> uint64_t * Long_t -> int64_t * Long64_t -> int64_t
1 parent aea153b commit c3f387f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1251
-1257
lines changed

Detectors/Align/include/Align/AliAlgAux.h

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,9 @@
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

2823
namespace 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
//
5651
template <typename F>
5752
void BringTo02Pi(F& phi);
5853
template <typename F>
5954
void BringToPiPM(F& phi);
6055
template <typename F>
61-
Bool_t OKforPhiMin(F phiMin, F phi);
56+
bool OKforPhiMin(F phiMin, F phi);
6257
template <typename F>
63-
Bool_t OKforPhiMax(F phiMax, F phi);
58+
bool OKforPhiMax(F phiMax, F phi);
6459
template <typename F>
6560
F MeanPhiSmall(F phi0, F phi1);
6661
template <typename F>
6762
F DeltaPhiSmall(F phi0, F phi1);
6863
template <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
}
7368
template <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
//
8580
int 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
//_________________________________________________________________________________
10398
template <typename F>
10499
inline 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
//_________________________________________________________________________________
111106
template <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
//_________________________________________________________________________________
120115
template <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;

Detectors/Align/include/Align/AliAlgConstraint.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,25 @@ class AliAlgConstraint : public TNamed
4848
void SetParent(const AliAlgVol* par);
4949
const AliAlgVol* GetParent() const { return fParent; }
5050
//
51-
Int_t GetNChildren() const { return fChildren.GetEntriesFast(); }
51+
int GetNChildren() const { return fChildren.GetEntriesFast(); }
5252
AliAlgVol* GetChild(int i) const { return (AliAlgVol*)fChildren[i]; }
5353
void AddChild(const AliAlgVol* v)
5454
{
5555
if (v)
5656
fChildren.AddLast((AliAlgVol*)v);
5757
}
5858
//
59-
Bool_t IsDOFConstrained(Int_t dof) const { return fConstraint & 0x1 << dof; }
60-
UChar_t GetConstraintPattern() const { return fConstraint; }
61-
void ConstrainDOF(Int_t dof) { fConstraint |= 0x1 << dof; }
62-
void UnConstrainDOF(Int_t dof) { fConstraint &= ~(0x1 << dof); }
63-
void SetConstrainPattern(UInt_t pat) { fConstraint = pat; }
64-
Bool_t HasConstraint() const { return fConstraint; }
65-
Double_t GetSigma(int i) const { return fSigma[i]; }
59+
bool IsDOFConstrained(int dof) const { return fConstraint & 0x1 << dof; }
60+
uint8_t GetConstraintPattern() const { return fConstraint; }
61+
void ConstrainDOF(int dof) { fConstraint |= 0x1 << dof; }
62+
void UnConstrainDOF(int dof) { fConstraint &= ~(0x1 << dof); }
63+
void SetConstrainPattern(uint32_t pat) { fConstraint = pat; }
64+
bool HasConstraint() const { return fConstraint; }
65+
double GetSigma(int i) const { return fSigma[i]; }
6666
void SetSigma(int i, double s = 0) { fSigma[i] = s; }
6767
//
68-
void SetNoJacobian(Bool_t v = kTRUE) { SetBit(kNoJacobianBit, v); }
69-
Bool_t GetNoJacobian() const { return TestBit(kNoJacobianBit); }
68+
void SetNoJacobian(bool v = true) { SetBit(kNoJacobianBit, v); }
69+
bool GetNoJacobian() const { return TestBit(kNoJacobianBit); }
7070
//
7171
void ConstrCoefGeom(const TGeoHMatrix& matRD, float* jac /*[kNDOFGeom][kNDOFGeom]*/) const;
7272
//
@@ -81,10 +81,10 @@ class AliAlgConstraint : public TNamed
8181
AliAlgConstraint& operator=(const AliAlgConstraint&);
8282
//
8383
protected:
84-
UInt_t fConstraint; // bit pattern of constraint
85-
Double_t fSigma[kNDOFGeom]; // optional sigma if constraint is gaussian
86-
const AliAlgVol* fParent; // parent volume for contraint, lab if 0
87-
TObjArray fChildren; // volumes subjected to constraints
84+
uint32_t fConstraint; // bit pattern of constraint
85+
double fSigma[kNDOFGeom]; // optional sigma if constraint is gaussian
86+
const AliAlgVol* fParent; // parent volume for contraint, lab if 0
87+
TObjArray fChildren; // volumes subjected to constraints
8888
//
8989
ClassDef(AliAlgConstraint, 2);
9090
};

Detectors/Align/include/Align/AliAlgDOFStat.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@ class AliAlgSteer;
3030
class AliAlgDOFStat : public TNamed
3131
{
3232
public:
33-
AliAlgDOFStat(Int_t n = 0);
33+
AliAlgDOFStat(int n = 0);
3434
virtual ~AliAlgDOFStat();
3535
//
36-
Int_t GetNDOFs() const { return fNDOFs; }
37-
Int_t GetStat(int idf) const { return idf < fNDOFs ? fStat[idf] : 0; }
38-
Int_t* GetStat() const { return (Int_t*)fStat; };
36+
int GetNDOFs() const { return fNDOFs; }
37+
int GetStat(int idf) const { return idf < fNDOFs ? fStat[idf] : 0; }
38+
int* GetStat() const { return (int*)fStat; };
3939
void SetStat(int idf, int v) { fStat[idf] = v; }
4040
void AddStat(int idf, int v) { fStat[idf] += v; }
41-
Int_t GetNMerges() const { return fNMerges; }
41+
int GetNMerges() const { return fNMerges; }
4242
TH1F* CreateHisto(AliAlgSteer* st) const;
4343
virtual void Print(Option_t* opt) const;
44-
virtual Long64_t Merge(TCollection* list);
44+
virtual int64_t Merge(TCollection* list);
4545
//
4646
protected:
4747
//
4848
AliAlgDOFStat(const AliAlgDOFStat&);
4949
AliAlgDOFStat& operator=(const AliAlgDOFStat&);
5050
//
5151
protected:
52-
Int_t fNDOFs; // number of dofs defined
53-
Int_t fNMerges; // number of merges
54-
Int_t* fStat; //[fNDOFs] statistics per DOF
52+
int fNDOFs; // number of dofs defined
53+
int fNMerges; // number of merges
54+
int* fStat; //[fNDOFs] statistics per DOF
5555
//
5656
ClassDef(AliAlgDOFStat, 1);
5757
};

0 commit comments

Comments
 (0)