Skip to content

Commit 921cb24

Browse files
authored
[PWGCF] add run-by-run NUA output (#13570)
1 parent 75bd9cd commit 921cb24

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

PWGCF/Flow/Tasks/flowTask.cxx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@
4545
#include <TRandom3.h>
4646

4747
#include <cmath>
48+
#include <map>
4849
#include <memory>
4950
#include <string>
5051
#include <unordered_map>
52+
#include <utility>
5153
#include <vector>
5254

5355
using namespace o2;
@@ -100,6 +102,7 @@ struct FlowTask {
100102
O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 30, "Number of subsamples")
101103
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights")
102104
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins")
105+
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRunbyRun, bool, false, "NUA weights are filled run-by-run")
103106
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
104107
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
105108
O2_DEFINE_CONFIGURABLE(cfgUseSmallMemory, bool, false, "Use small memory mode")
@@ -198,6 +201,9 @@ struct FlowTask {
198201
std::vector<GFW::CorrConfig> corrconfigsPtVn;
199202
TAxis* fPtAxis;
200203
TRandom3* fRndm = new TRandom3(0);
204+
int lastRunNumber = -1;
205+
std::vector<int> runNumbers;
206+
std::map<int, std::shared_ptr<TH3>> th3sPerRun; // map of TH3 histograms for all runs
201207
enum CentEstimators {
202208
kCentFT0C = 0,
203209
kCentFT0CVariant1,
@@ -478,7 +484,7 @@ struct FlowTask {
478484
gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs());
479485
gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads());
480486
gfwConfigs.SetpTDifs(cfgUserPtVnCorrConfig->GetpTDifs());
481-
// Mask 1: vn-[pT], 2: vn-[pT^2], 4: vn-[pT^3]
487+
// Mask 1: vn-[pT], 3: vn-[pT^2], 7: vn-[pT^3], 15: vn-[pT^4]
482488
gfwConfigs.SetpTCorrMasks(cfgUserPtVnCorrConfig->GetpTCorrMasks());
483489
gfwConfigs.Print();
484490
fFCpt->setUseCentralMoments(cfgUseCentralMoments);
@@ -545,6 +551,13 @@ struct FlowTask {
545551
}
546552
}
547553

554+
void createOutputObjectsForRun(int runNumber)
555+
{
556+
const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"};
557+
std::shared_ptr<TH3> histPhiEtaVtxz = registry.add<TH3>(Form("%d/hPhiEtaVtxz", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, {64, -1.6, 1.6}, {40, -10, 10}}});
558+
th3sPerRun.insert(std::make_pair(runNumber, histPhiEtaVtxz));
559+
}
560+
548561
template <char... chars>
549562
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
550563
{
@@ -874,6 +887,20 @@ struct FlowTask {
874887
return;
875888
}
876889
}
890+
if (cfgOutputNUAWeightsRunbyRun && currentRunNumber != lastRunNumber) {
891+
lastRunNumber = currentRunNumber;
892+
if (std::find(runNumbers.begin(), runNumbers.end(), currentRunNumber) == runNumbers.end()) {
893+
// if run number is not in the preconfigured list, create new output histograms for this run
894+
createOutputObjectsForRun(currentRunNumber);
895+
runNumbers.push_back(currentRunNumber);
896+
}
897+
898+
if (th3sPerRun.find(currentRunNumber) == th3sPerRun.end()) {
899+
LOGF(fatal, "RunNumber %d not found in th3sPerRun", currentRunNumber);
900+
return;
901+
}
902+
}
903+
877904
registry.fill(HIST("hEventCount"), 2.5);
878905
if (!cfgUseSmallMemory) {
879906
registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size());
@@ -975,10 +1002,15 @@ struct FlowTask {
9751002
bool withinEtaGap08 = (std::abs(track.eta()) < cfgEtaPtPt);
9761003
if (cfgOutputNUAWeights) {
9771004
if (cfgOutputNUAWeightsRefPt) {
978-
if (withinPtRef)
1005+
if (withinPtRef) {
9791006
fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
1007+
if (cfgOutputNUAWeightsRunbyRun)
1008+
th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ());
1009+
}
9801010
} else {
9811011
fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0);
1012+
if (cfgOutputNUAWeightsRunbyRun)
1013+
th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ());
9821014
}
9831015
}
9841016
if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz))

0 commit comments

Comments
 (0)