Skip to content

Commit 6a3d7b2

Browse files
mpuccioMohammadAlTurany
authored andcommitted
Unscoped using:: are allowed only in implementation files
According to our coding guidelines.
1 parent bc633ab commit 6a3d7b2

7 files changed

Lines changed: 99 additions & 102 deletions

File tree

Detectors/Base/include/DetectorsBase/Track.h

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
55
#ifndef ALICEO2_BASE_TRACK
66
#define ALICEO2_BASE_TRACK
77

8-
#include <iostream>
98
#include <algorithm>
9+
#include <array>
10+
#include <iostream>
1011
#include <string.h>
12+
1113
#include "DetectorsBase/Constants.h"
1214
#include "DetectorsBase/Utils.h"
1315

1416
namespace AliceO2 {
1517
namespace Base {
1618
namespace Track {
1719

18-
using namespace AliceO2::Base::Constants;
19-
using namespace AliceO2::Base::Utils;
20-
using namespace std;
21-
2220
// aliases for track elements
2321
enum ParLabels : int {
2422
kY,kZ,kSnp,kTgl,kQ2Pt
@@ -47,7 +45,7 @@ namespace AliceO2 {
4745
// helper function
4846
float BetheBlochSolid(float bg, float rho=2.33f,float kp1=0.20f,float kp2=3.00f,
4947
float meanI=173e-9f,float meanZA=0.49848f);
50-
void g3helx3(float qfield, float step,array<float,7> &vect);
48+
void g3helx3(float qfield, float step,std::array<float,7> &vect);
5149

5250

5351
class TrackParBase { // track parameterization, kinematics only. This base class cannot be instantiated
@@ -63,30 +61,30 @@ namespace AliceO2 {
6361
float GetQ2Pt() const { return mP[kQ2Pt]; }
6462

6563
// derived getters
66-
float GetCurvature(float b) const { return mP[kQ2Pt]*b*kB2C;}
64+
float GetCurvature(float b) const { return mP[kQ2Pt]*b*Constants::kB2C;}
6765
float GetSign() const { return mP[kQ2Pt]>0 ? 1.f:-1.f;}
6866
float GetPhi() const { return asinf(GetSnp()) + GetAlpha();}
6967
float GetPhiPos() const;
7068

7169
float GetP() const;
7270
float GetPt() const;
73-
void GetXYZ(array<float,3> &xyz) const;
74-
bool GetPxPyPz(array<float,3> &pxyz) const;
75-
bool GetPosDir(array<float,9> &posdirp) const;
71+
void GetXYZ(std::array<float,3> &xyz) const;
72+
bool GetPxPyPz(std::array<float,3> &pxyz) const;
73+
bool GetPosDir(std::array<float,9> &posdirp) const;
7674

7775
// parameters manipulation
7876
bool RotateParam(float alpha);
7977
bool PropagateParamTo(float xk, float b);
80-
bool PropagateParamTo(float xk, const array<float,3> &b);
78+
bool PropagateParamTo(float xk, const std::array<float,3> &b);
8179
void InvertParam();
8280

8381
void PrintParam() const;
8482

8583
protected:
8684
// to keep this class non-virtual but derivable the c-tors and d-tor are protected
8785
TrackParBase() : mX{0.},mAlpha{0.} {}
88-
TrackParBase(float x,float alpha, const array<float,kNParams> &par);
89-
TrackParBase(const array<float,3> &xyz,const array<float,3> &pxpypz, int sign, bool sectorAlpha=true);
86+
TrackParBase(float x,float alpha, const std::array<float,kNParams> &par);
87+
TrackParBase(const std::array<float,3> &xyz,const std::array<float,3> &pxpypz, int sign, bool sectorAlpha=true);
9088
TrackParBase(const TrackParBase&) = default;
9189
TrackParBase(TrackParBase&&) = default;
9290
TrackParBase& operator=(const TrackParBase& src) = default;
@@ -101,8 +99,8 @@ namespace AliceO2 {
10199
class TrackParCov final : public TrackParBase { // track+error parameterization
102100
public:
103101
TrackParCov() : TrackParBase{} { }
104-
TrackParCov(float x, float alpha, const array<float,kNParams> &par, const array<float,kCovMatSize> &cov);
105-
TrackParCov(const array<float,3> &xyz,const array<float,3> &pxpypz,const array<float,kLabCovMatSize> &cv, int sign, bool sectorAlpha=true);
102+
TrackParCov(float x, float alpha, const std::array<float,kNParams> &par, const std::array<float,kCovMatSize> &cov);
103+
TrackParCov(const std::array<float,3> &xyz,const std::array<float,3> &pxpypz,const std::array<float,kLabCovMatSize> &cv, int sign, bool sectorAlpha=true);
106104

107105
///const float* GetCov() const { return mC; }
108106
float GetSigmaY2() const { return mC[kSigY2]; }
@@ -126,11 +124,11 @@ namespace AliceO2 {
126124
// parameters + covmat manipulation
127125
bool Rotate(float alpha);
128126
bool PropagateTo(float xk, float b);
129-
bool PropagateTo(float xk, const array<float,3> &b);
127+
bool PropagateTo(float xk, const std::array<float,3> &b);
130128
void Invert();
131129

132-
float GetPredictedChi2(const array<float,2> &p, const array<float,3> &cov) const;
133-
bool Update(const array<float,2> &p, const array<float,3> &cov);
130+
float GetPredictedChi2(const std::array<float,2> &p, const std::array<float,3> &cov) const;
131+
bool Update(const std::array<float,2> &p, const std::array<float,3> &cov);
134132

135133
bool CorrectForMaterial(float x2x0,float xrho,float mass,bool anglecorr=false,float dedx=kCalcdEdxAuto);
136134

@@ -145,25 +143,25 @@ namespace AliceO2 {
145143
class TrackPar final : public TrackParBase { // track parameterization only
146144
public:
147145
TrackPar() {}
148-
TrackPar(float x,float alpha, const array<float,kNParams> &par) : TrackParBase{x,alpha,par} {}
149-
TrackPar(const array<float,3> &xyz, const array<float,3> &pxpypz,int sign, bool sectorAlpha=true);
146+
TrackPar(float x,float alpha, const std::array<float,kNParams> &par) : TrackParBase{x,alpha,par} {}
147+
TrackPar(const std::array<float,3> &xyz, const std::array<float,3> &pxpypz,int sign, bool sectorAlpha=true);
150148
//
151149
void Print() const {PrintParam();}
152150
};
153151

154152
//____________________________________________________________
155-
inline TrackParBase::TrackParBase(float x, float alpha, const array<float, kNParams> &par) : mX{x}, mAlpha{alpha} {
153+
inline TrackParBase::TrackParBase(float x, float alpha, const std::array<float, kNParams> &par) : mX{x}, mAlpha{alpha} {
156154
// explicit constructor
157155
std::copy(par.begin(), par.end(), mP);
158156
}
159157

160158
//_______________________________________________________
161-
inline void TrackParBase::GetXYZ(array<float,3> &xyz) const {
159+
inline void TrackParBase::GetXYZ(std::array<float,3> &xyz) const {
162160
// track coordinates in lab frame
163161
xyz[0] = GetX();
164162
xyz[1] = GetY();
165163
xyz[2] = GetZ();
166-
RotateZ(xyz,GetAlpha());
164+
Utils::RotateZ(xyz,GetAlpha());
167165
}
168166

169167
//_______________________________________________________
@@ -177,20 +175,20 @@ namespace AliceO2 {
177175
inline float TrackParBase::GetP() const {
178176
// return the track momentum
179177
float ptI = fabs(GetQ2Pt());
180-
return (ptI>kAlmost0) ? sqrtf(1.f+ GetTgl()*GetTgl())/ptI : kVeryBig;
178+
return (ptI>Constants::kAlmost0) ? sqrtf(1.f+ GetTgl()*GetTgl())/ptI : Constants::kVeryBig;
181179
}
182180

183181
//____________________________________________________________
184182
inline float TrackParBase::GetPt() const {
185183
// return the track transverse momentum
186184
float ptI = fabs(GetQ2Pt());
187-
return (ptI>kAlmost0) ? 1.f/ptI : kVeryBig;
185+
return (ptI>Constants::kAlmost0) ? 1.f/ptI : Constants::kVeryBig;
188186
}
189187

190188
//============================================================
191189

192190
//____________________________________________________________
193-
inline TrackParCov::TrackParCov(float x, float alpha, const array<float,kNParams> &par, const array<float,kCovMatSize> &cov)
191+
inline TrackParCov::TrackParCov(float x, float alpha, const std::array<float,kNParams> &par, const std::array<float,kCovMatSize> &cov)
194192
: TrackParBase{x,alpha,par} {
195193
// explicit constructor
196194
std::copy(cov.begin(), cov.end(), mC);
@@ -199,7 +197,7 @@ namespace AliceO2 {
199197
//============================================================
200198

201199
//____________________________________________________________
202-
inline TrackPar::TrackPar(const array<float,3> &xyz, const array<float,3> &pxpypz,int sign, bool sectorAlpha)
200+
inline TrackPar::TrackPar(const std::array<float,3> &xyz, const std::array<float,3> &pxpypz,int sign, bool sectorAlpha)
203201
: TrackParBase{xyz,pxpypz,sign,sectorAlpha} {
204202
// explicit constructor
205203
}

Detectors/Base/include/DetectorsBase/Utils.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,40 @@
88
#include "DetectorsBase/Constants.h"
99
#include <math.h>
1010
#include <array>
11-
using std::array;
1211

1312
namespace AliceO2 {
1413
namespace Base {
1514
namespace Utils {
1615

17-
using namespace AliceO2::Base::Constants;
18-
1916
inline void BringTo02Pi(float &phi) {
2017
// ensure angle in [0:2pi] for the input in [-pi:pi] or [0:pi]
21-
if (phi < 0) phi += k2PI;
18+
if (phi < 0) phi += Constants::k2PI;
2219
}
2320

2421
inline void BringTo02PiGen(float &phi) {
2522
// ensure angle in [0:2pi] for the any input angle
26-
while(phi<0) {phi += k2PI;}
27-
while(phi>k2PI) {phi -= k2PI;}
23+
while(phi<0) {phi += Constants::k2PI;}
24+
while(phi>Constants::k2PI) {phi -= Constants::k2PI;}
2825
}
2926

3027
inline void BringToPMPi(float &phi) {
3128
// ensure angle in [-pi:pi] for the input in [-pi:pi] or [0:pi]
32-
if (phi > kPI) phi -= k2PI;
29+
if (phi > Constants::kPI) phi -= Constants::k2PI;
3330
}
3431

3532
inline void BringToPMPiGen(float &phi) {
3633
// ensure angle in [-pi:pi] for any input angle
37-
while(phi<-kPI) {phi += k2PI;}
38-
while(phi> kPI) {phi -= k2PI;}
34+
while(phi<-Constants::kPI) {phi += Constants::k2PI;}
35+
while(phi> Constants::kPI) {phi -= Constants::k2PI;}
3936
}
4037

4138
inline void sincosf(float ang, float& s, float &c) {
4239
// consider speedup for simultaneus calculation
43-
s = sin(ang);
44-
c = cos(ang);
40+
s = sinf(ang);
41+
c = cosf(ang);
4542
}
4643

47-
inline void RotateZ(array<float,3> &xy, float alpha) {
44+
inline void RotateZ(std::array<float,3> &xy, float alpha) {
4845
// transforms vector in tracking frame alpha to global frame
4946
float sn,cs, x=xy[0];
5047
sincosf(alpha,sn,cs);
@@ -54,14 +51,14 @@ namespace AliceO2 {
5451

5552
inline int Angle2Sector(float phi) {
5653
// convert angle to sector ID
57-
int sect = (phi*kRad2Deg)/kSectorSpan;
58-
sect %= kNSectors;
59-
return (sect<0) ? sect+kNSectors-1 : sect;
54+
int sect = (phi*Constants::kRad2Deg)/Constants::kSectorSpan;
55+
sect %= Constants::kNSectors;
56+
return (sect<0) ? sect+Constants::kNSectors-1 : sect;
6057
}
6158

6259
inline float Sector2Angle(int sect) {
6360
// convert sector to its angle center
64-
return kSectorSpan/2.f + (sect%kNSectors)*kSectorSpan;
61+
return Constants::kSectorSpan/2.f + (sect%Constants::kNSectors)*Constants::kSectorSpan;
6562
}
6663

6764
inline float Angle2Alpha(float phi) {

0 commit comments

Comments
 (0)