Skip to content

Commit 6fb372c

Browse files
vkucerachengtt0406
authored andcommitted
Fix namespace pollution from std and o2::constants (AliceO2Group#3423)
1 parent 535214d commit 6fb372c

28 files changed

+132
-116
lines changed

Common/Tools/handleParamTPCResponse.cxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ int main(int argc, char* argv[])
251251
// Request interactive confirmation to upload
252252
LOG(info) << "Continue with object upload anyway? (Y/n)";
253253
std::string confirm;
254-
cin >> confirm;
254+
std::cin >> confirm;
255255
if (boost::iequals(confirm.substr(0, 1), "y")) {
256256
LOG(info) << "Continuing with object upload";
257257
} else {

DPG/Tasks/AOTTrack/qaMatchEff.cxx

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
//
3232
// base namespaces
3333
using namespace o2;
34+
using namespace o2::constants::math;
3435
using namespace o2::framework;
3536
using namespace o2::framework::expressions;
3637
using std::array;

EventFiltering/PWGHF/HFFilterHelpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static const o2::framework::AxisSpec nSigmaAxis{100, -10.f, 10.f};
156156
static const o2::framework::AxisSpec alphaAxis{100, -1.f, 1.f};
157157
static const o2::framework::AxisSpec qtAxis{100, 0.f, 0.25f};
158158
static const o2::framework::AxisSpec bdtAxis{100, 0.f, 1.f};
159-
static const o2::framework::AxisSpec phiAxis{36, 0., TwoPI};
159+
static const o2::framework::AxisSpec phiAxis{36, 0., o2::constants::math::TwoPI};
160160
static const std::array<o2::framework::AxisSpec, kNCharmParticles + 8> massAxisC = {o2::framework::AxisSpec{100, 1.65f, 2.05f}, o2::framework::AxisSpec{100, 1.65f, 2.05f}, o2::framework::AxisSpec{100, 1.75f, 2.15f}, o2::framework::AxisSpec{100, 2.05f, 2.45f}, o2::framework::AxisSpec{100, 2.25f, 2.65f}, o2::framework::AxisSpec{100, 0.139f, 0.159f}, o2::framework::AxisSpec{100, 0.f, 0.25f}, o2::framework::AxisSpec{100, 0.f, 0.25f}, o2::framework::AxisSpec{100, 0.48f, 0.88f}, o2::framework::AxisSpec{100, 0.48f, 0.88f}, o2::framework::AxisSpec{100, 1.1f, 1.4f}, o2::framework::AxisSpec{100, 2.3f, 2.9f}, o2::framework::AxisSpec{100, 2.3f, 2.9f}};
161161
static const std::array<o2::framework::AxisSpec, kNBeautyParticles> massAxisB = {o2::framework::AxisSpec{240, 4.8f, 6.0f}, o2::framework::AxisSpec{240, 4.8f, 6.0f}, o2::framework::AxisSpec{240, 4.8f, 6.0f}, o2::framework::AxisSpec{240, 4.8f, 6.0f}, o2::framework::AxisSpec{240, 5.0f, 6.2f}, o2::framework::AxisSpec{240, 5.0f, 6.2f}};
162162

PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class FemtoUniverseAngularContainer
120120
framework::AxisSpec mTAxis3D = {mTBins3D, "#it{m}_{T} (GeV/#it{c})"};
121121

122122
// angular correlations
123-
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
124-
mPhiHigh = 2 * PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
123+
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
124+
mPhiHigh = 2 * o2::constants::math::PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
125125
framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh};
126126
framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0};
127127

@@ -159,10 +159,10 @@ class FemtoUniverseAngularContainer
159159
delta_phi = part1.phi() - part2.phi();
160160

161161
while (delta_phi < mPhiLow) {
162-
delta_phi += TwoPI;
162+
delta_phi += o2::constants::math::TwoPI;
163163
}
164164
while (delta_phi > mPhiHigh) {
165-
delta_phi -= TwoPI;
165+
delta_phi -= o2::constants::math::TwoPI;
166166
}
167167

168168
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtouniverseMCparticle::MCTypeName[mc]) + HIST("/DeltaEtaDeltaPhi"), delta_phi, delta_eta);

PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ class FemtoUniverseContainer
135135
framework::AxisSpec mTAxis3D = {mTBins3D, "#it{m}_{T} (GeV/#it{c})"};
136136

137137
// angular correlations
138-
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
139-
mPhiHigh = 2 * PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
138+
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
139+
mPhiHigh = 2 * o2::constants::math::PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
140140
framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh};
141141
framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0};
142142

@@ -175,10 +175,10 @@ class FemtoUniverseContainer
175175
delta_phi = part1.phi() - part2.phi();
176176

177177
while (delta_phi < mPhiLow) {
178-
delta_phi += TwoPI;
178+
delta_phi += o2::constants::math::TwoPI;
179179
}
180180
while (delta_phi > mPhiHigh) {
181-
delta_phi -= TwoPI;
181+
delta_phi -= o2::constants::math::TwoPI;
182182
}
183183

184184
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtouniverseMCparticle::MCTypeName[mc]) + HIST("/relPairDist"), femtoObs);

PWGCF/FemtoWorld/Core/FemtoWorldContainer.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "TRandom.h"
3333

3434
using namespace o2::framework;
35-
using namespace o2::constants::math;
3635

3736
namespace o2::analysis::femtoWorld
3837
{
@@ -87,8 +86,8 @@ class FemtoWorldContainer
8786
framework::AxisSpec kTAxis = {kTBins, "#it{k}_{T} (GeV/#it{c})"};
8887
framework::AxisSpec mTAxis = {mTBins, "#it{m}_{T} (GeV/#it{c}^{2})"};
8988

90-
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
91-
mPhiHigh = 2 * PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
89+
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
90+
mPhiHigh = 2 * o2::constants::math::PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
9291

9392
framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh};
9493
framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0};
@@ -154,10 +153,10 @@ class FemtoWorldContainer
154153
double delta_phi = part1.phi() - part2.phi();
155154

156155
while (delta_phi < mPhiLow) {
157-
delta_phi += TwoPI;
156+
delta_phi += o2::constants::math::TwoPI;
158157
}
159158
while (delta_phi > mPhiHigh) {
160-
delta_phi -= TwoPI;
159+
delta_phi -= o2::constants::math::TwoPI;
161160
}
162161
TLorentzVector part1Vec;
163162
part1Vec.SetPtEtaPhiM(part1.pt(), part1.eta(), part1.phi(), mMassOne);

PWGCF/FemtoWorld/Core/FemtoWorldPionContainer.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "TRandom.h"
3333

3434
using namespace o2::framework;
35-
using namespace o2::constants::math;
3635

3736
namespace o2::analysis::femtoWorld
3837
{
@@ -91,8 +90,8 @@ class FemtoWorldPionContainer
9190
framework::AxisSpec kTAxis = {kTBins, "#it{k}_{T} (GeV/#it{c})"};
9291
framework::AxisSpec mTAxis = {mTBins, "#it{m}_{T} (GeV/#it{c}^{2})"};
9392

94-
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
95-
mPhiHigh = 2 * PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * PI / phiBins;
93+
mPhiLow = (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
94+
mPhiHigh = 2 * o2::constants::math::PI + (-static_cast<int>(phiBins / 4) + 0.5) * 2. * o2::constants::math::PI / phiBins;
9695

9796
framework::AxisSpec phiAxis = {phiBins, mPhiLow, mPhiHigh};
9897
framework::AxisSpec etaAxis = {etaBins, -2.0, 2.0};
@@ -141,10 +140,10 @@ class FemtoWorldPionContainer
141140
double delta_phi = part1.phi() - part2.phi();
142141

143142
while (delta_phi < mPhiLow) {
144-
delta_phi += TwoPI;
143+
delta_phi += o2::constants::math::TwoPI;
145144
}
146145
while (delta_phi > mPhiHigh) {
147-
delta_phi -= TwoPI;
146+
delta_phi -= o2::constants::math::TwoPI;
148147
}
149148
TLorentzVector part1Vec;
150149
part1Vec.SetPtEtaPhiM(part1.pt(), part1.eta(), part1.phi(), mMassOne);

PWGCF/GenericFramework/GFW.cxx

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ If used, modified, or distributed, please aknowledge the author of this code.
1818
*/
1919

2020
#include "GFW.h"
21+
22+
using std::complex;
23+
using std::pair;
24+
using std::string;
25+
using std::vector;
26+
2127
GFW::GFW() : fInitialized(false) {}
2228

2329
GFW::~GFW()

PWGCF/GenericFramework/GFW.h

+30-31
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ If used, modified, or distributed, please aknowledge the author of this code.
1818
*/
1919
#ifndef PWGCF_GENERICFRAMEWORK_GFW_H_
2020
#define PWGCF_GENERICFRAMEWORK_GFW_H_
21+
2122
#include "GFWCumulant.h"
2223
#include "GFWPowerArray.h"
2324
#include <vector>
2425
#include <string>
2526
#include <utility>
2627
#include <algorithm>
2728
#include <complex>
28-
using std::complex;
29-
using std::string;
30-
using std::vector;
29+
3130
class GFW
3231
{
3332
public:
3433
struct Region {
3534
int Nhar, NpT;
36-
vector<int> NparVec{};
35+
std::vector<int> NparVec{};
3736
double EtaMin = -999;
3837
double EtaMax = -999;
3938
int BitMask = 1;
40-
string rName = "";
39+
std::string rName = "";
4140
bool powsDefined = false;
4241
bool operator<(const Region& a) const
4342
{
@@ -46,47 +45,47 @@ class GFW
4645
void PrintStructure() { printf("%s: eta [%f.. %f].", rName.c_str(), EtaMin, EtaMax); }
4746
};
4847
struct CorrConfig {
49-
vector<vector<int>> Regs{};
50-
vector<vector<int>> Hars{};
51-
vector<int> Overlap;
52-
vector<int> ptInd;
48+
std::vector<std::vector<int>> Regs{};
49+
std::vector<std::vector<int>> Hars{};
50+
std::vector<int> Overlap;
51+
std::vector<int> ptInd;
5352
bool pTDif = false;
54-
string Head = "";
53+
std::string Head = "";
5554
};
5655
GFW();
5756
~GFW();
58-
vector<Region> fRegions;
59-
vector<GFWCumulant> fCumulants;
60-
void AddRegion(string refName, double lEtaMin, double lEtaMax, int lNpT, int BitMask);
61-
void AddRegion(string refName, vector<int> lNparVec, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy
62-
void AddRegion(string refName, int lNhar, int lNpar, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy support, all powers are the same
63-
void AddRegion(string refName, int lNhar, int* lNparVec, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy support, array instead of a vector
57+
std::vector<Region> fRegions;
58+
std::vector<GFWCumulant> fCumulants;
59+
void AddRegion(std::string refName, double lEtaMin, double lEtaMax, int lNpT, int BitMask);
60+
void AddRegion(std::string refName, std::vector<int> lNparVec, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy
61+
void AddRegion(std::string refName, int lNhar, int lNpar, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy support, all powers are the same
62+
void AddRegion(std::string refName, int lNhar, int* lNparVec, double lEtaMin, double lEtaMax, int lNpT, int BitMask); // Legacy support, array instead of a vector
6463
int CreateRegions();
6564
void Fill(double eta, int ptin, double phi, double weight, int mask, double secondWeight = -1);
6665
void Clear();
6766
GFWCumulant GetCumulant(int index) { return fCumulants.at(index); }
68-
CorrConfig GetCorrelatorConfig(string config, string head = "", bool ptdif = false);
69-
complex<double> Calculate(CorrConfig corconf, int ptbin, bool SetHarmsToZero);
67+
CorrConfig GetCorrelatorConfig(std::string config, std::string head = "", bool ptdif = false);
68+
std::complex<double> Calculate(CorrConfig corconf, int ptbin, bool SetHarmsToZero);
7069
void InitializePowerArrays();
7170

7271
protected:
7372
bool fInitialized;
74-
vector<CorrConfig> fListOfCFGs;
75-
complex<double> TwoRec(int n1, int n2, int p1, int p2, int ptbin, GFWCumulant*, GFWCumulant*, GFWCumulant*);
76-
complex<double> RecursiveCorr(GFWCumulant* qpoi, GFWCumulant* qref, GFWCumulant* qol, int ptbin, vector<int>& hars, vector<int>& pows); // POI, Ref. flow, overlapping region
77-
complex<double> RecursiveCorr(GFWCumulant* qpoi, GFWCumulant* qref, GFWCumulant* qol, int ptbin, vector<int>& hars); // POI, Ref. flow, overlapping region
73+
std::vector<CorrConfig> fListOfCFGs;
74+
std::complex<double> TwoRec(int n1, int n2, int p1, int p2, int ptbin, GFWCumulant*, GFWCumulant*, GFWCumulant*);
75+
std::complex<double> RecursiveCorr(GFWCumulant* qpoi, GFWCumulant* qref, GFWCumulant* qol, int ptbin, std::vector<int>& hars, std::vector<int>& pows); // POI, Ref. flow, overlapping region
76+
std::complex<double> RecursiveCorr(GFWCumulant* qpoi, GFWCumulant* qref, GFWCumulant* qol, int ptbin, std::vector<int>& hars); // POI, Ref. flow, overlapping region
7877
void AddRegion(Region inreg) { fRegions.push_back(inreg); }
7978
Region GetRegion(int index) { return fRegions.at(index); }
80-
int FindRegionByName(string refName);
81-
vector<pair<int, vector<int>>> GetHarmonicsSingleConfig(const CorrConfig&);
79+
int FindRegionByName(std::string refName);
80+
std::vector<std::pair<int, std::vector<int>>> GetHarmonicsSingleConfig(const CorrConfig&);
8281
// Calculating functions:
83-
complex<double> Calculate(int poi, int ref, vector<int> hars, int ptbin = 0); // For differential, need POI and reference
84-
complex<double> Calculate(int poi, vector<int> hars); // For integrated case
82+
std::complex<double> Calculate(int poi, int ref, std::vector<int> hars, int ptbin = 0); // For differential, need POI and reference
83+
std::complex<double> Calculate(int poi, std::vector<int> hars); // For integrated case
8584
// Operations on strings. Equivalent to TString operations, but one to rid of root dependence
86-
int s_index(string& instr, const string& pattern, const int& spos = 0);
87-
bool s_contains(string& instr, const string& pattern);
88-
void s_replace(string& instr, const string& pattern1, const string& pattern2, const int& spos = 0);
89-
void s_replace_all(string& instr, const string& pattern1, const string& pattern2);
90-
bool s_tokenize(string& instr, string& substr, int& spos, const string& delim);
85+
int s_index(std::string& instr, const std::string& pattern, const int& spos = 0);
86+
bool s_contains(std::string& instr, const std::string& pattern);
87+
void s_replace(std::string& instr, const std::string& pattern1, const std::string& pattern2, const int& spos = 0);
88+
void s_replace_all(std::string& instr, const std::string& pattern1, const std::string& pattern2);
89+
bool s_tokenize(std::string& instr, std::string& substr, int& spos, const std::string& delim);
9190
};
9291
#endif // PWGCF_GENERICFRAMEWORK_GFW_H_

PWGCF/GenericFramework/GFWCumulant.cxx

+5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ A part of <GFW.cxx/h>
1616
A container to store Q vectors for one subevent with an extra layer to recursively calculate particle correlations.
1717
If used, modified, or distributed, please aknowledge the author of this code.
1818
*/
19+
1920
#include "GFWCumulant.h"
21+
22+
using std::complex;
23+
using std::vector;
24+
2025
GFWCumulant::GFWCumulant() : fQvector(0),
2126
fUsed(kBlank),
2227
fNEntries(-1),

PWGCF/GenericFramework/GFWCumulant.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ If used, modified, or distributed, please aknowledge the author of this code.
1818
*/
1919
#ifndef PWGCF_GENERICFRAMEWORK_GFWCUMULANT_H_
2020
#define PWGCF_GENERICFRAMEWORK_GFWCUMULANT_H_
21+
2122
#include <cmath>
2223
#include <complex>
2324
#include <vector>
24-
using std::complex;
25-
using std::vector;
25+
2626
class GFWCumulant
2727
{
2828
public:
@@ -42,22 +42,22 @@ class GFWCumulant
4242
int GetN() { return fNEntries; }
4343
bool IsPtBinFilled(int ptb);
4444
void CreateComplexVectorArray(int N = 1, int P = 1, int Pt = 1);
45-
void CreateComplexVectorArrayVarPower(int N = 1, vector<int> Pvec = {1}, int Pt = 1);
45+
void CreateComplexVectorArrayVarPower(int N = 1, std::vector<int> Pvec = {1}, int Pt = 1);
4646
int PW(int ind) { return fPowVec.at(ind); }; // No checks to speed up, be carefull!!!
4747
void DestroyComplexVectorArray();
48-
complex<double> Vec(int, int, int ptbin = 0); // envelope class to summarize pt-dif. Q-vec getter
48+
std::complex<double> Vec(int, int, int ptbin = 0); // envelope class to summarize pt-dif. Q-vec getter
4949
protected:
50-
complex<double>*** fQvector;
50+
std::complex<double>*** fQvector;
5151
uint fUsed;
5252
int fNEntries;
5353
// Q-vectors. Could be done recursively, but maybe defining each one of them explicitly is easier to read
5454
int fN; //! Harmonics
5555
int fPow; //! Power
56-
vector<int> fPowVec; //! Powers array
56+
std::vector<int> fPowVec; //! Powers array
5757
int fPt; //! fPt bins
5858
bool* fFilledPts;
5959
bool fInitialized; // Arrays are initialized
60-
complex<double> fNullQ = 0;
60+
std::complex<double> fNullQ = 0;
6161
};
6262

6363
#endif // PWGCF_GENERICFRAMEWORK_GFWCUMULANT_H_

PWGCF/GenericFramework/GFWPowerArray.cxx

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "GFWPowerArray.h"
13+
14+
using std::string;
15+
using std::vector;
16+
1317
int GFWPowerArray::getHighestHarmonic(const HarSet& inhar)
1418
{
1519
// Highest possible harmonic: sum of same-sign harmonics

PWGCF/GenericFramework/GFWPowerArray.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@
1111

1212
#ifndef PWGCF_GENERICFRAMEWORK_GFWPOWERARRAY_H_
1313
#define PWGCF_GENERICFRAMEWORK_GFWPOWERARRAY_H_
14+
1415
#include <vector>
1516
#include <cmath>
1617
#include <string>
17-
using namespace std;
18-
using std::string;
19-
using std::vector;
20-
typedef vector<int> HarSet;
18+
19+
typedef std::vector<int> HarSet;
2120
class GFWPowerArray
2221
{
2322
public:
24-
static HarSet GetPowerArray(vector<HarSet> inHarmonics);
23+
static HarSet GetPowerArray(std::vector<HarSet> inHarmonics);
2524
static void PowerArrayTest();
2625

2726
private:

PWGDQ/Core/MCSignal.cxx

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
#include "PWGDQ/Core/MCSignal.h"
1313

14+
using std::cout;
15+
using std::endl;
16+
1417
ClassImp(MCSignal);
1518

1619
//________________________________________________________________________________________________

PWGDQ/Core/MCSignal.h

-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ process(aod::McParticles const& mcTracks) {
6161

6262
#include <vector>
6363
#include <iostream>
64-
using std::cout;
65-
using std::endl;
6664

6765
class MCSignal : public TNamed
6866
{

PWGDQ/Core/VarManager.cxx

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include <cmath>
1616

17+
using std::cout;
18+
using std::endl;
19+
using namespace o2::constants::physics;
20+
1721
ClassImp(VarManager);
1822

1923
TString VarManager::fgVariableNames[VarManager::kNVars] = {""};

0 commit comments

Comments
 (0)