Skip to content

Commit 8705c03

Browse files
authored
[PWGCF] flow: limit centrality in filter; add group NUA (#9081)
1 parent dd048ff commit 8705c03

File tree

2 files changed

+71
-5
lines changed

2 files changed

+71
-5
lines changed

PWGCF/Flow/Tasks/flowRunbyRun.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct FlowRunbyRun {
6363
O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z")
6464
O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables")
6565
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins")
66+
O2_DEFINE_CONFIGURABLE(cfgDynamicRunNumber, bool, false, "Add runNumber during runtime")
6667
Configurable<std::vector<int>> cfgRunNumbers{"cfgRunNumbers", std::vector<int>{544095, 544098, 544116, 544121, 544122, 544123, 544124}, "Preconfigured run numbers"};
6768
Configurable<std::vector<std::string>> cfgUserDefineGFWCorr{"cfgUserDefineGFWCorr", std::vector<std::string>{"refN10 {2} refP10 {-2}"}, "User defined GFW CorrelatorConfig"};
6869
Configurable<std::vector<std::string>> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector<std::string>{"Ch10Gap22"}, "User defined GFW Name"};
@@ -83,7 +84,7 @@ struct FlowRunbyRun {
8384

8485
// Define output
8586
OutputObj<FlowContainer> fFC{FlowContainer("FlowContainer")};
86-
OutputObj<TList> fWeightList{"WeightList", OutputObjHandlingPolicy::AnalysisObject};
87+
OutputObj<TList> fWeightList{"WeightList", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource};
8788
HistogramRegistry registry{"registry"};
8889

8990
// define global variables
@@ -248,7 +249,7 @@ struct FlowRunbyRun {
248249
float lRandom = fRndm->Rndm();
249250
if (runNumber != lastRunNumer) {
250251
lastRunNumer = runNumber;
251-
if (std::find(runNumbers.begin(), runNumbers.end(), runNumber) == runNumbers.end()) {
252+
if (cfgDynamicRunNumber && std::find(runNumbers.begin(), runNumbers.end(), runNumber) == runNumbers.end()) {
252253
// if run number is not in the preconfigured list, create new output histograms for this run
253254
createOutputObjectsForRun(runNumber);
254255
runNumbers.push_back(runNumber);

PWGCF/Flow/Tasks/flowTask.cxx

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ using namespace o2::framework::expressions;
5454
struct FlowTask {
5555

5656
O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range")
57+
O2_DEFINE_CONFIGURABLE(cfgCentMin, float, 0.0f, "Minimum centrality")
58+
O2_DEFINE_CONFIGURABLE(cfgCentMax, float, 100.0f, "Maximum centrality")
5759
O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal pT for poi tracks")
5860
O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks")
5961
O2_DEFINE_CONFIGURABLE(cfgCutPtRefMin, float, 0.2f, "Minimal pT for ref tracks")
@@ -84,8 +86,11 @@ struct FlowTask {
8486
O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples")
8587
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights")
8688
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins")
89+
O2_DEFINE_CONFIGURABLE(cfgOutputGroupNUAWeights, bool, false, "Fill and output group NUA weights")
8790
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
8891
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
92+
O2_DEFINE_CONFIGURABLE(cfgAcceptanceGroup, std::string, "", "CCDB path to group acceptance object")
93+
O2_DEFINE_CONFIGURABLE(cfgAcceptanceGroupUse, bool, false, "Apply group acceptance, this option overrides cfgAcceptance")
8994
O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object")
9095
O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut")
9196
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy")
@@ -94,6 +99,7 @@ struct FlowTask {
9499
Configurable<std::vector<std::string>> cfgUserDefineGFWCorr{"cfgUserDefineGFWCorr", std::vector<std::string>{"refN02 {2} refP02 {-2}", "refN12 {2} refP12 {-2}"}, "User defined GFW CorrelatorConfig"};
95100
Configurable<std::vector<std::string>> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector<std::string>{"Ch02Gap22", "Ch12Gap22"}, "User defined GFW Name"};
96101
Configurable<std::vector<int>> cfgRunRemoveList{"cfgRunRemoveList", std::vector<int>{-1}, "excluded run numbers"};
102+
Configurable<std::vector<int>> cfgGroupSplitRunNumber{"cfgGroupSplitRunNumber", std::vector<int>{544510, 544653}, "runnumbers for group splitting (suppose run numbers are increasing monotonically) "};
97103

98104
ConfigurableAxis axisVertex{"axisVertex", {40, -20, 20}, "vertex axis for histograms"};
99105
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
@@ -110,12 +116,13 @@ struct FlowTask {
110116
ConfigurableAxis axisDCAz{"axisDCAz", {200, -2, 2}, "DCA_{z} (cm)"};
111117
ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -1, 1}, "DCA_{xy} (cm)"};
112118

113-
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
119+
Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVertex) && (aod::cent::centFT0C > cfgCentMin) && (aod::cent::centFT0C < cfgCentMax);
114120
Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
115121

116122
// Corrections
117123
TH1D* mEfficiency = nullptr;
118124
GFWWeights* mAcceptance = nullptr;
125+
TList* mGroupAcceptanceList = nullptr;
119126
bool correctionsLoaded = false;
120127

121128
// Connect to ccdb
@@ -127,6 +134,7 @@ struct FlowTask {
127134
OutputObj<FlowContainer> fFC{FlowContainer("FlowContainer")};
128135
OutputObj<GFWWeights> fWeights{GFWWeights("weights")};
129136
HistogramRegistry registry{"registry"};
137+
OutputObj<TList> fGroupNUAList{"GroupNUAList", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource};
130138

131139
// define global variables
132140
GFW* fGFW = new GFW();
@@ -150,6 +158,7 @@ struct FlowTask {
150158
std::unordered_map<int, TH2*> gHadronicRate;
151159
ctpRateFetcher mRateFetcher;
152160
TH2* gCurrentHadronicRate;
161+
std::vector<std::shared_ptr<GFWWeights>> groupNUAWeightPtr;
153162

154163
using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>>;
155164
using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA>>;
@@ -248,6 +257,27 @@ struct FlowTask {
248257
fWeights->Init(true, false);
249258
}
250259

260+
TList* groupNUAWeightlist = new TList();
261+
groupNUAWeightlist->SetOwner(true);
262+
fGroupNUAList.setObject(groupNUAWeightlist);
263+
264+
if (cfgOutputGroupNUAWeights) {
265+
groupNUAWeightPtr.resize(cfgGroupSplitRunNumber.value.size() + 1);
266+
for (uint i = 0; i < cfgGroupSplitRunNumber.value.size() + 1; i++) {
267+
GFWWeights* groupweight = nullptr;
268+
if (i < cfgGroupSplitRunNumber.value.size())
269+
groupweight = new GFWWeights(Form("groupweight_%d", cfgGroupSplitRunNumber.value[i]));
270+
else
271+
groupweight = new GFWWeights(Form("groupweight_last"));
272+
273+
groupweight->SetPtBins(nPtBins, ptBins);
274+
groupweight->Init(true, false);
275+
groupNUAWeightlist->Add(groupweight);
276+
std::shared_ptr<GFWWeights> sharePtrGroupWeight(groupweight);
277+
groupNUAWeightPtr[i] = sharePtrGroupWeight;
278+
}
279+
}
280+
251281
// add in FlowContainer to Get boostrap sample automatically
252282
TObjArray* oba = new TObjArray();
253283
oba->Add(new TNamed("ChGap22", "ChGap22"));
@@ -506,6 +536,13 @@ struct FlowTask {
506536
else
507537
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
508538
}
539+
if (cfgAcceptanceGroup.value.empty() == false) {
540+
mGroupAcceptanceList = ccdb->getForTimeStamp<TList>(cfgAcceptance, timestamp);
541+
if (mGroupAcceptanceList == nullptr) {
542+
LOGF(fatal, "Could not load grouped acceptance weights from %s", cfgAcceptanceGroup.value.c_str());
543+
}
544+
LOGF(info, "Loaded grouped acceptance weights from %s (%p)", cfgAcceptanceGroup.value.c_str(), (void*)mGroupAcceptanceList);
545+
}
509546
if (cfgEfficiency.value.empty() == false) {
510547
mEfficiency = ccdb->getForTimeStamp<TH1D>(cfgEfficiency, timestamp);
511548
if (mEfficiency == nullptr) {
@@ -516,7 +553,7 @@ struct FlowTask {
516553
correctionsLoaded = true;
517554
}
518555

519-
bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz)
556+
bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz, int groupNUAIndex = 0)
520557
{
521558
float eff = 1.;
522559
if (mEfficiency)
@@ -526,6 +563,14 @@ struct FlowTask {
526563
if (eff == 0)
527564
return false;
528565
weight_nue = 1. / eff;
566+
if (cfgAcceptanceGroupUse) {
567+
if (mGroupAcceptanceList && mGroupAcceptanceList->At(groupNUAIndex)) {
568+
weight_nua = reinterpret_cast<GFWWeights*>(mGroupAcceptanceList->At(groupNUAIndex))->GetNUA(phi, eta, vtxz);
569+
} else {
570+
weight_nua = 1;
571+
}
572+
return true;
573+
}
529574
if (mAcceptance)
530575
weight_nua = mAcceptance->GetNUA(phi, eta, vtxz);
531576
else
@@ -717,6 +762,17 @@ struct FlowTask {
717762
if (cfgUseNch)
718763
independent = static_cast<float>(tracks.size());
719764

765+
int groupNUAIndex = 0;
766+
if (cfgOutputGroupNUAWeights || cfgAcceptanceGroupUse) {
767+
for (uint i = 0; i < cfgGroupSplitRunNumber.value.size(); i++) {
768+
if (currentRunNumber < cfgGroupSplitRunNumber.value.at(i)) {
769+
break;
770+
} else {
771+
groupNUAIndex++;
772+
}
773+
}
774+
}
775+
720776
for (const auto& track : tracks) {
721777
if (!trackSelected(track))
722778
continue;
@@ -733,7 +789,16 @@ struct FlowTask {
733789
fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
734790
}
735791
}
736-
if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz))
792+
if (cfgOutputGroupNUAWeights) {
793+
if (cfgOutputNUAWeightsRefPt) {
794+
if (withinPtRef) {
795+
groupNUAWeightPtr[groupNUAIndex]->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
796+
}
797+
} else {
798+
groupNUAWeightPtr[groupNUAIndex]->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
799+
}
800+
}
801+
if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz, groupNUAIndex))
737802
continue;
738803
registry.fill(HIST("hPt"), track.pt());
739804
if (withinPtRef) {

0 commit comments

Comments
 (0)