Skip to content

Commit 61e4f83

Browse files
author
smonira
committed
fixed cpp issues
1 parent 3ea497c commit 61e4f83

3 files changed

Lines changed: 83 additions & 76 deletions

File tree

‎PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h‎

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
#include <string_view>
4747
#include <vector>
4848

49-
namespace o2::analysis
50-
{
51-
namespace femto_universe
49+
namespace o2::analysis::femto_universe
5250
{
5351

5452
/// \namespace cpr_track_cascade_cuts
@@ -61,9 +59,11 @@ static constexpr int NDaughters = 3;
6159
static constexpr int NCutVars = 4;
6260

6361
// default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
64-
constexpr double Cuts[NDaughters][NCutVars] = {{0.0, 0.0, 0.0, 0.0}, /* posChild */
65-
{0.0, 0.0, 0.0, 0.0}, /* negChild */
66-
{0.0, 0.0, 0.0, 0.0}}; /* bachelor */
62+
constexpr std::array<std::array<double, NCutVars>, NDaughters> Cuts = {{
63+
{0.0, 0.0, 0.0, 0.0}, /* posChild */
64+
{0.0, 0.0, 0.0, 0.0}, /* negChild */
65+
{0.0, 0.0, 0.0, 0.0} /* bachelor */
66+
}};
6767

6868
// row labels
6969
static const std::vector<std::string> labelsDaughter = {"posChild", "negChild", "bachelor"};
@@ -84,16 +84,18 @@ static constexpr int NCutVars = 4;
8484

8585
// daughter pair table: row i = {offset of daughter of cascade 1, offset of daughter of cascade 2}
8686
// ordered from pos to bach (both indices sorted pos < neg < bach)
87-
constexpr int CascChildTable[NPairs][2] = {{-3, -3}, {-3, -1}, {-2, -2}, {-2, -1}, {-1, -1}, {-1, -2}, {-1, -3}};
87+
constexpr std::array<std::array<int, 2>, NPairs> CascChildTable = {{{-3, -3}, {-3, -1}, {-2, -2}, {-2, -1}, {-1, -1}, {-1, -2}, {-1, -3}}};
8888

8989
// default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
90-
constexpr double Cuts[NPairs][NCutVars] = {{0.0, 0.0, 0.0, 0.0}, /* pos-pos */
91-
{0.0, 0.0, 0.0, 0.0}, /* pos-bach */
92-
{0.0, 0.0, 0.0, 0.0}, /* neg-neg */
93-
{0.0, 0.0, 0.0, 0.0}, /* neg-bach */
94-
{0.0, 0.0, 0.0, 0.0}, /* bach-bach */
95-
{0.0, 0.0, 0.0, 0.0}, /* bach-neg */
96-
{0.0, 0.0, 0.0, 0.0}}; /* bach-pos */
90+
constexpr std::array<std::array<double, NCutVars>, NPairs> Cuts = {{
91+
{0.0, 0.0, 0.0, 0.0}, /* pos-pos */
92+
{0.0, 0.0, 0.0, 0.0}, /* pos-bach */
93+
{0.0, 0.0, 0.0, 0.0}, /* neg-neg */
94+
{0.0, 0.0, 0.0, 0.0}, /* neg-bach */
95+
{0.0, 0.0, 0.0, 0.0}, /* bach-bach */
96+
{0.0, 0.0, 0.0, 0.0}, /* bach-neg */
97+
{0.0, 0.0, 0.0, 0.0} /* bach-pos */
98+
}};
9799

98100
// row labels
99101
static const std::vector<std::string> labelsPair = {"pos-pos", "pos-bach", "neg-neg", "neg-bach", "bach-bach", "bach-neg", "bach-pos"};
@@ -113,8 +115,10 @@ static constexpr int NDaughters = 2;
113115
static constexpr int NCutVars = 4;
114116

115117
// default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
116-
constexpr double Cuts[NDaughters][NCutVars] = {{0.0, 0.0, 0.0, 0.0}, /* posChild */
117-
{0.0, 0.0, 0.0, 0.0}}; /* negChild */
118+
constexpr std::array<std::array<double, NCutVars>, NDaughters> Cuts = {{
119+
{0.0, 0.0, 0.0, 0.0}, /* posChild */
120+
{0.0, 0.0, 0.0, 0.0} /* negChild */
121+
}};
118122

119123
// row labels
120124
static const std::vector<std::string> labelsDaughter = {"posChild", "negChild"};
@@ -133,8 +137,10 @@ static constexpr int NPairs = 2;
133137
static constexpr int NCutVars = 4;
134138

135139
// default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
136-
constexpr double Cuts[NPairs][NCutVars] = {{0.0, 0.0, 0.0, 0.0}, /* pos-pos */
137-
{0.0, 0.0, 0.0, 0.0}}; /* neg-neg */
140+
constexpr std::array<std::array<double, NCutVars>, NPairs> Cuts = {{
141+
{0.0, 0.0, 0.0, 0.0}, /* pos-pos */
142+
{0.0, 0.0, 0.0, 0.0} /* neg-neg */
143+
}};
138144

139145
// row labels
140146
static const std::vector<std::string> labelsPair = {"pos-pos", "neg-neg"};
@@ -327,7 +333,11 @@ class FemtoUniverseDetaDphiStar
327333
for (int j = 1; j < static_cast<int>(ktBins.size() - 1); j++) {
328334
std::string histSuffixkT1 = std::to_string(static_cast<int>(ktBins[j] * 100.0));
329335
std::string histSuffixkT2 = std::to_string(static_cast<int>(ktBins[j + 1] * 100.0));
330-
std::string histFolderkT = "kT_" + histSuffixkT1 + "_" + histSuffixkT2 + "/";
336+
std::string histFolderkT = "kT_";
337+
histFolderkT += histSuffixkT1;
338+
histFolderkT += "_";
339+
histFolderkT += histSuffixkT2;
340+
histFolderkT += "/";
331341
histdetadphisamebeforekT[j] = mHistogramRegistry->add<TH2>((dirName + histFolderkT + "detadphidetadphiBeforeSame").c_str(), "; #Delta #eta; #Delta #phi", o2::framework::HistType::kTH2F, {{fDeltaEtaAxis}, {fDeltaPhiStarAxis}});
332342
histdetadphimixedbeforekT[j] = mHistogramRegistry->add<TH2>((dirName + histFolderkT + "detadphidetadphiBeforeMixed").c_str(), "; #Delta #eta; #Delta #phi", o2::framework::HistType::kTH2F, {{fDeltaEtaAxis}, {fDeltaPhiStarAxis}});
333343
histdetadphisameafterkT[j] = mHistogramRegistry->add<TH2>((dirName + histFolderkT + "detadphidetadphiAfterSame").c_str(), "; #Delta #eta; #Delta #phi", o2::framework::HistType::kTH2F, {{fDeltaEtaAxis}, {fDeltaPhiStarAxis}});
@@ -367,16 +377,15 @@ class FemtoUniverseDetaDphiStar
367377

368378
if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) {
369379
return true;
380+
}
381+
if (ChosenEventType == femto_universe_container::EventType::same) {
382+
histdetadpisame[0][1]->Fill(deta, dphiAvg);
383+
} else if (ChosenEventType == femto_universe_container::EventType::mixed) {
384+
histdetadpimixed[0][1]->Fill(deta, dphiAvg);
370385
} else {
371-
if (ChosenEventType == femto_universe_container::EventType::same) {
372-
histdetadpisame[0][1]->Fill(deta, dphiAvg);
373-
} else if (ChosenEventType == femto_universe_container::EventType::mixed) {
374-
histdetadpimixed[0][1]->Fill(deta, dphiAvg);
375-
} else {
376-
LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed.";
377-
}
378-
return false;
386+
LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed.";
379387
}
388+
return false;
380389

381390
} else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kV0) {
382391
/// Track-V0 combination
@@ -464,9 +473,9 @@ class FemtoUniverseDetaDphiStar
464473
}
465474
}
466475

467-
if (V0V0rect && (dphiAvg > dPhiStarMin) && (dphiAvg < dPhiStarMax) && (deta > dEtaMin) && (deta < dEtaMax)) {
468-
pass = true;
469-
} else if (!V0V0rect && std::pow(dphiAvg, 2) / std::pow(dPhiStarMax, 2) + std::pow(deta, 2) / std::pow(dEtaMax, 2) < 1.) {
476+
const bool isClose = V0V0rect ? ((dphiAvg > dPhiStarMin) && (dphiAvg < dPhiStarMax) && (deta > dEtaMin) && (deta < dEtaMax))
477+
: (std::pow(dphiAvg, 2) / std::pow(dPhiStarMax, 2) + std::pow(deta, 2) / std::pow(dEtaMax, 2) < 1.);
478+
if (isClose) {
470479
pass = true;
471480
} else {
472481
if (ChosenEventType == femto_universe_container::EventType::same) {
@@ -752,16 +761,15 @@ class FemtoUniverseDetaDphiStar
752761

753762
if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) {
754763
return true;
764+
}
765+
if (ChosenEventType == femto_universe_container::EventType::same) {
766+
histdetadpisame[0][1]->Fill(deta, dphiAvg);
767+
} else if (ChosenEventType == femto_universe_container::EventType::mixed) {
768+
histdetadpimixed[0][1]->Fill(deta, dphiAvg);
755769
} else {
756-
if (ChosenEventType == femto_universe_container::EventType::same) {
757-
histdetadpisame[0][1]->Fill(deta, dphiAvg);
758-
} else if (ChosenEventType == femto_universe_container::EventType::mixed) {
759-
histdetadpimixed[0][1]->Fill(deta, dphiAvg);
760-
} else {
761-
LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed.";
762-
}
763-
return false;
770+
LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed.";
764771
}
772+
return false;
765773
} else {
766774
LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!";
767775
return false;
@@ -1047,11 +1055,11 @@ class FemtoUniverseDetaDphiStar
10471055
static constexpr uint32_t kSignPlusMask = 1 << 1;
10481056
static constexpr uint32_t kValue0 = 0;
10491057

1050-
float chosenRadii;
1051-
float cutDeltaPhiStarMax;
1052-
float cutDeltaPhiStarMin;
1053-
float cutDeltaEtaMax;
1054-
float cutDeltaEtaMin;
1058+
float chosenRadii = 0.f;
1059+
float cutDeltaPhiStarMax = 0.f;
1060+
float cutDeltaPhiStarMin = 0.f;
1061+
float cutDeltaEtaMax = 0.f;
1062+
float cutDeltaEtaMin = 0.f;
10551063
o2::framework::LabeledArray<double> mCPRCuts{}; ///< Per-daughter/pair CPR cuts for this combination (rows: daughters or daughter pairs, cols: dPhiStarMin/dPhiStarMax/dEtaMin/dEtaMax)
10561064

10571065
std::vector<float> cutDeltaPhiStarMaxVector;
@@ -1064,10 +1072,10 @@ class FemtoUniverseDetaDphiStar
10641072
std::vector<float> cutDeltaEtaFractionMaxVector;
10651073
std::vector<float> cutDeltaEtaFractionMinVector;
10661074

1067-
float magfield;
1075+
float magfield = 0.f;
10681076
bool plotForEveryRadii = false;
1069-
float cutPhiInvMassLow;
1070-
float cutPhiInvMassHigh;
1077+
float cutPhiInvMassLow = 0.f;
1078+
float cutPhiInvMassHigh = 0.f;
10711079
bool isSameSignCPR = false;
10721080
std::vector<double> ktBins;
10731081

@@ -1213,7 +1221,6 @@ class FemtoUniverseDetaDphiStar
12131221
}
12141222
};
12151223

1216-
} /* namespace femto_universe */
1217-
} /* namespace o2::analysis */
1224+
} // namespace o2::analysis::femto_universe
12181225

12191226
#endif // PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_

0 commit comments

Comments
 (0)