Skip to content

Commit faca8d0

Browse files
authored
[PWGCF] flow: add FlowContainer in FlowRunbyRun; add d2{4} in FlowTask (#8546)
1 parent dabead6 commit faca8d0

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed

PWGCF/Flow/Tasks/FlowRunbyRun.cxx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "GFW.h"
3737
#include "GFWCumulant.h"
3838
#include "GFWWeights.h"
39+
#include "FlowContainer.h"
3940
#include "TList.h"
4041
#include <TProfile.h>
4142
#include <TRandom3.h>
@@ -60,6 +61,8 @@ struct FlowRunbyRun {
6061
O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z")
6162
O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables")
6263
Configurable<std::vector<int>> cfgRunNumbers{"cfgRunNumbers", std::vector<int>{544095, 544098, 544116, 544121, 544122, 544123, 544124}, "Preconfigured run numbers"};
64+
Configurable<std::vector<std::string>> cfgUserDefineGFWCorr{"cfgUserDefineGFWCorr", std::vector<std::string>{"refN10 {2} refP10 {-2}"}, "User defined GFW CorrelatorConfig"};
65+
Configurable<std::vector<std::string>> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector<std::string>{"Ch10Gap22"}, "User defined GFW Name"};
6366

6467
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
6568
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
@@ -76,11 +79,15 @@ struct FlowRunbyRun {
7679
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
7780

7881
// Define output
82+
OutputObj<FlowContainer> fFC{FlowContainer("FlowContainer")};
7983
HistogramRegistry registry{"registry"};
8084

8185
// define global variables
8286
GFW* fGFW = new GFW();
8387
std::vector<GFW::CorrConfig> corrconfigs;
88+
std::vector<GFW::CorrConfig> corrconfigsFC;
89+
TAxis* fPtAxis;
90+
TRandom3* fRndm = new TRandom3(0);
8491
std::vector<int> RunNumbers; // vector of run numbers
8592
std::map<int, std::vector<std::shared_ptr<TH1>>> TH1sList; // map of histograms for all runs
8693
std::map<int, std::vector<std::shared_ptr<TProfile>>> ProfilesList; // map of profiles for all runs
@@ -114,12 +121,43 @@ struct FlowRunbyRun {
114121
CreateOutputObjectsForRun(runNumber);
115122
}
116123

124+
o2::framework::AxisSpec axis = axisPt;
125+
int nPtBins = axis.binEdges.size() - 1;
126+
double* PtBins = &(axis.binEdges)[0];
127+
fPtAxis = new TAxis(nPtBins, PtBins);
128+
129+
// Create FlowContainer
130+
TObjArray* oba = new TObjArray();
131+
std::vector<std::string> UserDefineGFWCorr = cfgUserDefineGFWCorr;
132+
std::vector<std::string> UserDefineGFWName = cfgUserDefineGFWName;
133+
if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) {
134+
for (uint i = 0; i < UserDefineGFWName.size(); i++) {
135+
oba->Add(new TNamed(UserDefineGFWName.at(i).c_str(), UserDefineGFWName.at(i).c_str()));
136+
}
137+
}
138+
fFC->SetName("FlowContainer");
139+
fFC->SetXAxis(fPtAxis);
140+
fFC->Initialize(oba, axisIndependent, 1);
141+
delete oba;
142+
117143
fGFW->AddRegion("full", -0.8, 0.8, 1, 1);
118144
fGFW->AddRegion("refN10", -0.8, -0.5, 1, 1);
119145
fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1);
120146
corrconfigs.resize(kCount_TProfileNames);
121147
corrconfigs[c22] = fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE);
122148
corrconfigs[c22_gap10] = fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE);
149+
if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) {
150+
LOGF(info, "User adding GFW CorrelatorConfig:");
151+
// attentaion: here we follow the index of cfgUserDefineGFWCorr
152+
for (uint i = 0; i < UserDefineGFWCorr.size(); i++) {
153+
if (i >= UserDefineGFWName.size()) {
154+
LOGF(fatal, "The names you provided are more than configurations. UserDefineGFWName.size(): %d > UserDefineGFWCorr.size(): %d", UserDefineGFWName.size(), UserDefineGFWCorr.size());
155+
break;
156+
}
157+
LOGF(info, "%d: %s %s", i, UserDefineGFWCorr.at(i).c_str(), UserDefineGFWName.at(i).c_str());
158+
corrconfigsFC.push_back(fGFW->GetCorrelatorConfig(UserDefineGFWCorr.at(i).c_str(), UserDefineGFWName.at(i).c_str(), kFALSE));
159+
}
160+
}
123161
fGFW->CreateRegions();
124162
}
125163

@@ -139,6 +177,29 @@ struct FlowRunbyRun {
139177
return;
140178
}
141179

180+
void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm)
181+
{
182+
double dnx, val;
183+
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();
184+
if (dnx == 0)
185+
return;
186+
if (!corrconf.pTDif) {
187+
val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx;
188+
if (TMath::Abs(val) < 1)
189+
fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm);
190+
return;
191+
}
192+
for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) {
193+
dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real();
194+
if (dnx == 0)
195+
continue;
196+
val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx;
197+
if (TMath::Abs(val) < 1)
198+
fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm);
199+
}
200+
return;
201+
}
202+
142203
void CreateOutputObjectsForRun(int runNumber)
143204
{
144205
std::vector<std::shared_ptr<TH1>> histos(kCount_TH1Names);
@@ -164,6 +225,7 @@ struct FlowRunbyRun {
164225
// detect run number
165226
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
166227
int runNumber = bc.runNumber();
228+
float l_Random = fRndm->Rndm();
167229
if (std::find(RunNumbers.begin(), RunNumbers.end(), runNumber) == RunNumbers.end()) {
168230
// if run number is not in the preconfigured list, create new output histograms for this run
169231
CreateOutputObjectsForRun(runNumber);
@@ -195,6 +257,10 @@ struct FlowRunbyRun {
195257
for (uint i = 0; i < kCount_TProfileNames; ++i) {
196258
FillProfile(corrconfigs[i], ProfilesList[runNumber][i], cent);
197259
}
260+
// Filling Flow Container
261+
for (uint l_ind = 0; l_ind < corrconfigsFC.size(); l_ind++) {
262+
FillFC(corrconfigsFC.at(l_ind), cent, l_Random);
263+
}
198264
}
199265
};
200266

PWGCF/Flow/Tasks/FlowTask.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,15 @@ struct FlowTask {
248248
// add in FlowContainer to Get boostrap sample automatically
249249
TObjArray* oba = new TObjArray();
250250
oba->Add(new TNamed("ChGap22", "ChGap22"));
251-
for (Int_t i = 0; i < fPtAxis->GetNbins(); i++)
252-
oba->Add(new TNamed(Form("ChGap22_pt_%i", i + 1), "ChGap22_pTDiff"));
253251
oba->Add(new TNamed("ChFull22", "ChFull22"));
254252
oba->Add(new TNamed("ChFull32", "ChFull32"));
255253
oba->Add(new TNamed("ChFull42", "ChFull42"));
256254
oba->Add(new TNamed("ChFull24", "ChFull24"));
257255
oba->Add(new TNamed("ChFull26", "ChFull26"));
256+
for (Int_t i = 0; i < fPtAxis->GetNbins(); i++)
257+
oba->Add(new TNamed(Form("ChFull22_pt_%i", i + 1), "ChFull22_pTDiff"));
258+
for (Int_t i = 0; i < fPtAxis->GetNbins(); i++)
259+
oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff"));
258260
oba->Add(new TNamed("Ch04Gap22", "Ch04Gap22"));
259261
oba->Add(new TNamed("Ch06Gap22", "Ch06Gap22"));
260262
oba->Add(new TNamed("Ch08Gap22", "Ch08Gap22"));
@@ -324,8 +326,10 @@ struct FlowTask {
324326
fGFW->AddRegion("refM", -0.4, 0.4, 1, 1);
325327
fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 2);
326328
fGFW->AddRegion("poiN10", -0.8, -0.5, 1 + fPtAxis->GetNbins(), 2);
329+
fGFW->AddRegion("poifull", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 2);
327330
fGFW->AddRegion("olN", -0.8, -0.4, 1, 4);
328331
fGFW->AddRegion("olN10", -0.8, -0.5, 1, 4);
332+
fGFW->AddRegion("olfull", -0.8, 0.8, 1, 4);
329333

330334
corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE));
331335
corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {3 -3}", "ChFull32", kFALSE));
@@ -348,7 +352,8 @@ struct FlowTask {
348352
corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {4} refP10 {-4}", "Ch10Gap42", kFALSE));
349353
corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN12 {4} refP12 {-4}", "Ch12Gap42", kFALSE));
350354
corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN {2} refP {-2}", "ChGap22", kFALSE));
351-
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN refN | olN {2} refP {-2}", "ChGap22", kTRUE));
355+
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifull full | olfull {2 -2}", "ChFull22", kTRUE));
356+
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifull full | olfull {2 2 -2 -2}", "ChFull24", kTRUE));
352357
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {2} refP10 {-2}", "Ch10Gap22", kTRUE));
353358
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {3} refP10 {-3}", "Ch10Gap32", kTRUE));
354359
corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {4} refP10 {-4}", "Ch10Gap42", kTRUE));

0 commit comments

Comments
 (0)