Skip to content

Commit 255ded7

Browse files
MaximVirtaalibuild
andauthored
[PWGCF] NUA corrections with CCDB connection (#9868)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent cf45351 commit 255ded7

File tree

9 files changed

+428
-373
lines changed

9 files changed

+428
-373
lines changed

PWGCF/JCorran/Core/FlowJHistManager.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@
1010
// or submit itself to any jurisdiction.
1111

1212
// Header files.
13+
#include <vector>
1314

1415
// O2 headers.
1516

1617
// O2 Physics headers.
1718
#include "PWGCF/JCorran/Core/FlowJHistManager.h"
19+
#include "CommonConstants/MathConstants.h"
1820

1921
// Namespaces.
2022
using namespace o2;
2123
using namespace o2::framework;
2224

2325
/// \brief Create the histograms in the QA registry.
24-
void FlowJHistManager::CreateHistQA()
26+
void FlowJHistManager::createHistQA()
2527
{
2628
// Security checks for proper use of the method.
2729
if (!mHistRegistryQA) {
@@ -60,7 +62,7 @@ void FlowJHistManager::CreateHistQA()
6062
mHistRegistryQA->add("Centrality_00-01/After/histEta", "Pseudorapidity",
6163
HistType::kTH1F, {axisEta}, true);
6264

63-
const AxisSpec axisPhi = {100, 0., 2. * M_PI, "#varphi"};
65+
const AxisSpec axisPhi = {100, 0., o2::constants::math::TwoPI, "#varphi"};
6466
mHistRegistryQA->add("Centrality_00-01/After/histPhi", "Azimuthal angles (no NUA)",
6567
HistType::kTH1F, {axisPhi}, true);
6668

@@ -145,7 +147,7 @@ void FlowJHistManager::CreateHistQA()
145147

146148
// Clone the first centrality class into the other classes.
147149
for (int iBin = 1; iBin < mNcentBins; iBin++) {
148-
mHistRegistryQA->addClone("Centrality_00-01/", mCentClasses[iBin].data());
150+
mHistRegistryQA->addClone("Centrality_00-01/", MCentClasses[iBin].data());
149151
}
150152

151153
LOGF(info, "QA histograms created.");
@@ -154,7 +156,7 @@ void FlowJHistManager::CreateHistQA()
154156
/// \brief Get the centrality bin value corresponding to the percentile.
155157
/// \param Centrality percentile of the collision.
156158
/// \return Bin for the histograms,...
157-
int FlowJHistManager::GetCentBin(float cValue)
159+
int FlowJHistManager::getCentBin(float cValue)
158160
{
159161
const float centClasses[] = {0., 1., 2., 5., 10., 20., 30., 40., 50., 60., 70.};
160162

PWGCF/JCorran/Core/FlowJHistManager.h

Lines changed: 84 additions & 86 deletions
Large diffs are not rendered by default.

PWGCF/JCorran/Core/FlowJSPCAnalysis.cxx

Lines changed: 173 additions & 133 deletions
Large diffs are not rendered by default.

PWGCF/JCorran/Core/FlowJSPCAnalysis.h

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#define PWGCF_JCORRAN_CORE_FLOWJSPCANALYSIS_H_
1717

1818
/* Header files. */
19-
#include <iostream>
2019
#include <array>
2120
#include <vector>
2221
#include <TComplex.h>
@@ -25,64 +24,54 @@
2524
// O2 headers. //
2625
#include "Framework/HistogramRegistry.h"
2726
#include "PWGCF/JCorran/Core/JQVectors.h"
28-
29-
using namespace o2;
30-
using namespace o2::framework;
31-
using namespace std;
27+
#include "CommonConstants/MathConstants.h"
3228

3329
class FlowJSPCAnalysis
3430
{
3531
public:
3632
FlowJSPCAnalysis() = default;
3733

38-
void SetHistRegistry(HistogramRegistry* histReg) { mHistRegistry = histReg; }
39-
Int_t GetCentBin(float cValue);
34+
void setHistRegistry(o2::framework::HistogramRegistry* histReg) { mHistRegistry = histReg; }
35+
int getCentBin(float cValue);
4036

4137
using JQVectorsT = JQVectors<TComplex, 113, 15, false>;
42-
inline void SetQvectors(const JQVectorsT* _qvecs) { qvecs = _qvecs; }
43-
void Correlation(Int_t c_nPart, Int_t c_nHarmo, Int_t* harmo, Double_t* correlData);
44-
void CalculateCorrelators(const Int_t fCentBin);
45-
void FillHistograms(const Int_t fCentBin, Int_t ind, Double_t cNum, Double_t cDenom, Double_t wNum, Double_t wDenom);
46-
TComplex Recursion(int n, int* harmonic, int mult, int skip);
47-
TComplex Q(const Int_t harmN, const Int_t p);
48-
49-
void CreateHistos()
38+
inline void setQvectors(const JQVectorsT* _qvecs) { qvecs = _qvecs; }
39+
void correlation(int c_nPart, int c_nHarmo, int* harmo, double* correlData);
40+
void calculateCorrelators(const int fCentBin);
41+
void fillHistograms(const int fCentBin, int ind, double cNum, double cDenom, double wNum, double wDenom);
42+
void fillQAHistograms(const int fCentBin, double phi, double phiWeight);
43+
TComplex recursion(int n, int* harmonic, int mult, int skip);
44+
TComplex q(const int harmN, const int p);
45+
46+
void createHistos()
5047
{
5148
if (!mHistRegistry) {
5249
LOGF(error, "QA histogram registry missing. Quitting...");
5350
return;
5451
}
55-
mHistRegistry->add("FullCentrality", "FullCentrality", HistType::kTH1D, {{100, 0., 100.}}, true);
56-
mHistRegistry->add("Centrality_0/fResults", "Numerators and denominators", {HistType::kTProfile, {{24, 0., 24.}}}, true);
57-
mHistRegistry->add("Centrality_0/fCovResults", "Covariance N*D", {HistType::kTProfile, {{48, 0., 48.}}}, true);
52+
mHistRegistry->add("FullCentrality", "FullCentrality", o2::framework::HistType::kTH1D, {{100, 0., 100.}}, true);
53+
mHistRegistry->add("Centrality_0/fResults", "Numerators and denominators", {o2::framework::HistType::kTProfile, {{24, 0., 24.}}}, true);
54+
mHistRegistry->add("Centrality_0/fCovResults", "Covariance N*D", {o2::framework::HistType::kTProfile, {{48, 0., 48.}}}, true);
55+
mHistRegistry->add("Centrality_0/phiBefore", "Phi before", {o2::framework::HistType::kTH1D, {{100, 0., o2::constants::math::TwoPI}}}, true);
56+
mHistRegistry->add("Centrality_0/phiAfter", "Phi after", {o2::framework::HistType::kTH1D, {{100, 0., o2::constants::math::TwoPI}}}, true);
5857

59-
for (UInt_t i = 1; i < 8; i++) {
58+
for (uint i = 1; i < 8; i++) {
6059
mHistRegistry->addClone("Centrality_0/", Form("Centrality_%u/", i));
6160
}
6261
}
6362

64-
void SetCorrSet(Int_t obsInd, Int_t harmo[8])
63+
void setCorrSet(int obsInd, int harmo[8])
6564
{
6665
for (int i = 0; i < 8; i++) {
6766
fHarmosArray[obsInd][i] = harmo[i];
6867
}
6968
}
70-
void SetFullCorrSet(Int_t harmo[12][8])
69+
void setFullCorrSet(int harmo[12][8])
7170
{
72-
memcpy(fHarmosArray, harmo, sizeof(Int_t) * 12 * 8);
71+
memcpy(fHarmosArray, harmo, sizeof(int) * 12 * 8);
7372
}
7473

75-
private:
76-
const Int_t mNqHarmos = 113; ///< Highest harmo for Q(n,p): (v8*14part)+1.
77-
const Int_t mNqPowers = 15; ///< Max power for Q(n,p): 14part+1.
78-
const JQVectorsT* qvecs;
79-
80-
HistogramRegistry* mHistRegistry = nullptr;
81-
82-
Int_t fHarmosArray[12][8];
83-
84-
Double_t fCorrelDenoms[14];
85-
static constexpr std::string_view mCentClasses[] = {
74+
static constexpr std::string_view MCentClasses[] = {
8675
"Centrality_0/",
8776
"Centrality_1/",
8877
"Centrality_2/",
@@ -94,6 +83,17 @@ class FlowJSPCAnalysis
9483
"Centrality_8/",
9584
"Centrality_9/"};
9685

86+
private:
87+
const int mNqHarmos = 113; ///< Highest harmo for Q(n,p): (v8*14part)+1.
88+
const int mNqPowers = 15; ///< Max power for Q(n,p): 14part+1.
89+
const JQVectorsT* qvecs;
90+
91+
o2::framework::HistogramRegistry* mHistRegistry = nullptr;
92+
93+
int fHarmosArray[12][8];
94+
95+
double fCorrelDenoms[14];
96+
9797
ClassDefNV(FlowJSPCAnalysis, 1);
9898
};
9999
#endif // PWGCF_JCORRAN_CORE_FLOWJSPCANALYSIS_H_

PWGCF/JCorran/Core/FlowJSPCObservables.h

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,23 @@
1818
// O2 headers. //
1919
#include "Framework/HistogramRegistry.h"
2020

21-
using namespace o2;
22-
using namespace o2::framework;
23-
using namespace std;
24-
2521
const int maxNrComb = 12;
2622
class FlowJSPCObservables
2723
{
2824
public:
2925
FlowJSPCObservables() = default;
3026

31-
Int_t harmonicArray[maxNrComb][8] = {{0}};
27+
int harmonicArray[maxNrComb][8] = {{0}};
3228

33-
void SetSPCObservables(Int_t index)
29+
void setSPCObservables(int index)
3430
{
35-
// Int_t *harmonicArray = (Int_t*)malloc(sizeof(Int_t)*maxNrComb*8);
31+
// int *harmonicArray = (int*)malloc(sizeof(int)*maxNrComb*8);
3632

3733
// Switch to set up correct symmetry plane combinations
3834
switch (index) {
3935
case 0: {
4036
LOGF(info, "Computing three harmonic SPC");
41-
Int_t harmonicArray01[maxNrComb][8] = {
37+
int harmonicArray01[maxNrComb][8] = {
4238
{3, 6, -3, -3, 0, 0, 0, 0},
4339
{3, 4, -2, -2, 0, 0, 0, 0},
4440
{3, 8, -4, -4, 0, 0, 0, 0},
@@ -52,11 +48,11 @@ class FlowJSPCObservables
5248
{0, 2, -3, -3, 4, 0, 0, 0},
5349
{0, 3, 3, -2, -2, -2, 0, 0}};
5450

55-
memcpy(harmonicArray, harmonicArray01, sizeof(Int_t) * maxNrComb * 8);
51+
memcpy(harmonicArray, harmonicArray01, sizeof(int) * maxNrComb * 8);
5652
} break;
5753
case 1: {
5854
LOGF(info, "Computing four harmonic SPC");
59-
Int_t harmonicArray02[maxNrComb][8] = {
55+
int harmonicArray02[maxNrComb][8] = {
6056
{4, 6, -2, -2, -2, 0, 0, 0},
6157
{4, 2, -3, -4, 5, 0, 0, 0},
6258
{4, 2, -3, -3, 4, 0, 0, 0},
@@ -69,11 +65,11 @@ class FlowJSPCObservables
6965
{0, 0, 0, 0, 0, 0, 0, 0},
7066
{0, 0, 0, 0, 0, 0, 0, 0},
7167
{0, 0, 0, 0, 0, 0, 0, 0}};
72-
memcpy(harmonicArray, harmonicArray02, sizeof(Int_t) * maxNrComb * 8);
68+
memcpy(harmonicArray, harmonicArray02, sizeof(int) * maxNrComb * 8);
7369
} break;
7470
case 3: {
7571
LOGF(info, "Computing five and six harmonic SPC");
76-
Int_t harmonicArray03[maxNrComb][8] = {
72+
int harmonicArray03[maxNrComb][8] = {
7773
{5, 3, 3, -2, -2, -2, 0, 0},
7874
{5, 2, 2, -3, 4, -5, 0, 0},
7975
{5, 2, 3, 3, -4, -4, 0, 0},
@@ -86,11 +82,10 @@ class FlowJSPCObservables
8682
{6, 2, 2, 2, 3, -4, -5, 0},
8783
{6, 2, 2, 3, 3, -4, -6, 0},
8884
{0, 0, 0, 0, 0, 0, 0, 0}};
89-
memcpy(harmonicArray, harmonicArray03, sizeof(Int_t) * maxNrComb * 8);
85+
memcpy(harmonicArray, harmonicArray03, sizeof(int) * maxNrComb * 8);
9086
} break;
9187
default:
92-
std::cout << "ERROR: Invalid configuration index. Skipping this element."
93-
<< std::endl;
88+
LOGF(error, "ERROR: Invalid configuration index. Skipping this element.");
9489
}
9590
}
9691

PWGCF/JCorran/Tasks/flowJNUACreation.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ struct flowJNUACreation {
9393
void init(InitContext const&)
9494
{
9595
// Add histomanager here
96-
histManager.SetHistRegistryQA(&qaHistRegistry);
97-
histManager.SetDebugLog(false);
98-
histManager.SetObtainNUA(true);
99-
histManager.CreateHistQA();
96+
histManager.setHistRegistryQA(&qaHistRegistry);
97+
histManager.setDebugLog(false);
98+
histManager.setObtainNUA(true);
99+
histManager.createHistQA();
100100

101101
// Add CCDB access here
102102
ccdb->setURL(cfgCCDB.cfgURL);
@@ -131,13 +131,13 @@ struct flowJNUACreation {
131131
if (cent < 0. || cent > 70.) {
132132
return;
133133
}
134-
Int_t cBin = histManager.GetCentBin(cent);
134+
Int_t cBin = histManager.getCentBin(cent);
135135
int nTracks = tracks.size();
136136

137137
for (auto& track : tracks) {
138-
histManager.FillTrackQA<1>(track, cBin, 1., 1., coll.posZ());
138+
histManager.fillTrackQA<1>(track, cBin, 1., 1., coll.posZ());
139139
}
140-
histManager.FillEventQA<1>(coll, cBin, cent, nTracks);
140+
histManager.fillEventQA<1>(coll, cBin, cent, nTracks);
141141

142142
LOGF(info, "Collision analysed. Next...");
143143
}

0 commit comments

Comments
 (0)