@@ -100,6 +100,7 @@ struct FlowTask {
100100 O2_DEFINE_CONFIGURABLE (cfgNbootstrap, int , 30 , " Number of subsamples" )
101101 O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeights, bool , false , " Fill and output NUA weights" )
102102 O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeightsRefPt, bool , false , " NUA weights are filled in ref pt bins" )
103+ O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeightsRunbyRun, bool , false , " NUA weights are filled run-by-run" )
103104 O2_DEFINE_CONFIGURABLE (cfgEfficiency, std::string, " " , " CCDB path to efficiency object" )
104105 O2_DEFINE_CONFIGURABLE (cfgAcceptance, std::string, " " , " CCDB path to acceptance object" )
105106 O2_DEFINE_CONFIGURABLE (cfgUseSmallMemory, bool , false , " Use small memory mode" )
@@ -198,6 +199,9 @@ struct FlowTask {
198199 std::vector<GFW::CorrConfig> corrconfigsPtVn;
199200 TAxis* fPtAxis ;
200201 TRandom3* fRndm = new TRandom3(0 );
202+ int lastRunNumber = -1 ;
203+ std::vector<int > runNumbers;
204+ std::map<int , std::shared_ptr<TH3>> th3sPerRun; // map of TH3 histograms for all runs
201205 enum CentEstimators {
202206 kCentFT0C = 0 ,
203207 kCentFT0CVariant1 ,
@@ -478,7 +482,7 @@ struct FlowTask {
478482 gfwConfigs.SetCorrs (cfgUserPtVnCorrConfig->GetCorrs ());
479483 gfwConfigs.SetHeads (cfgUserPtVnCorrConfig->GetHeads ());
480484 gfwConfigs.SetpTDifs (cfgUserPtVnCorrConfig->GetpTDifs ());
481- // Mask 1: vn-[pT], 2 : vn-[pT^2], 4 : vn-[pT^3]
485+ // Mask 1: vn-[pT], 3 : vn-[pT^2], 7 : vn-[pT^3], 15: vn-[pT^4 ]
482486 gfwConfigs.SetpTCorrMasks (cfgUserPtVnCorrConfig->GetpTCorrMasks ());
483487 gfwConfigs.Print ();
484488 fFCpt ->setUseCentralMoments (cfgUseCentralMoments);
@@ -545,6 +549,13 @@ struct FlowTask {
545549 }
546550 }
547551
552+ void createOutputObjectsForRun (int runNumber)
553+ {
554+ const AxisSpec axisPhi{60 , 0.0 , constants::math::TwoPI, " #varphi" };
555+ 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 }}});
556+ th3sPerRun.insert (std::make_pair (runNumber, histPhiEtaVtxz));
557+ }
558+
548559 template <char ... chars>
549560 void fillProfile (const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double & cent)
550561 {
@@ -874,6 +885,20 @@ struct FlowTask {
874885 return ;
875886 }
876887 }
888+ if (cfgOutputNUAWeightsRunbyRun && currentRunNumber != lastRunNumber) {
889+ lastRunNumber = currentRunNumber;
890+ if (std::find (runNumbers.begin (), runNumbers.end (), currentRunNumber) == runNumbers.end ()) {
891+ // if run number is not in the preconfigured list, create new output histograms for this run
892+ createOutputObjectsForRun (currentRunNumber);
893+ runNumbers.push_back (currentRunNumber);
894+ }
895+
896+ if (th3sPerRun.find (currentRunNumber) == th3sPerRun.end ()) {
897+ LOGF (fatal, " RunNumber %d not found in th3sPerRun" , currentRunNumber);
898+ return ;
899+ }
900+ }
901+
877902 registry.fill (HIST (" hEventCount" ), 2.5 );
878903 if (!cfgUseSmallMemory) {
879904 registry.fill (HIST (" BeforeCut_globalTracks_centT0C" ), collision.centFT0C (), tracks.size ());
@@ -975,10 +1000,15 @@ struct FlowTask {
9751000 bool withinEtaGap08 = (std::abs (track.eta ()) < cfgEtaPtPt);
9761001 if (cfgOutputNUAWeights) {
9771002 if (cfgOutputNUAWeightsRefPt) {
978- if (withinPtRef)
1003+ if (withinPtRef) {
9791004 fWeights ->fill (track.phi (), track.eta (), vtxz, track.pt (), cent, 0 );
1005+ if (cfgOutputNUAWeightsRunbyRun)
1006+ th3sPerRun[currentRunNumber]->Fill (track.phi (), track.eta (), collision.posZ ());
1007+ }
9801008 } else {
9811009 fWeights ->fill (track.phi (), track.eta (), vtxz, track.pt (), cent, 0 );
1010+ if (cfgOutputNUAWeightsRunbyRun)
1011+ th3sPerRun[currentRunNumber]->Fill (track.phi (), track.eta (), collision.posZ ());
9821012 }
9831013 }
9841014 if (!setCurrentParticleWeights (weff, wacc, track.phi (), track.eta (), track.pt (), vtxz))
0 commit comments