3838#include " GFW.h"
3939#include " GFWCumulant.h"
4040#include " GFWWeights.h"
41+ #include " GFWWeightsList.h"
4142#include " FlowContainer.h"
4243#include " TList.h"
4344#include < TProfile.h>
@@ -62,6 +63,7 @@ struct FlowRunbyRun {
6263 O2_DEFINE_CONFIGURABLE (cfgCutChi2prTPCcls, float , 2.5 , " Chi2 per TPC clusters" )
6364 O2_DEFINE_CONFIGURABLE (cfgCutDCAz, float , 2 .0f , " max DCA to vertex z" )
6465 O2_DEFINE_CONFIGURABLE (cfgUseNch, bool , false , " Use Nch for flow observables" )
66+ O2_DEFINE_CONFIGURABLE (cfgNbootstrap, int , 30 , " Number of subsamples" )
6567 O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeightsRefPt, bool , false , " NUA weights are filled in ref pt bins" )
6668 O2_DEFINE_CONFIGURABLE (cfgDynamicRunNumber, bool , false , " Add runNumber during runtime" )
6769 Configurable<std::vector<int >> cfgRunNumbers{" cfgRunNumbers" , std::vector<int >{544095 , 544098 , 544116 , 544121 , 544122 , 544123 , 544124 }, " Preconfigured run numbers" };
@@ -84,7 +86,7 @@ struct FlowRunbyRun {
8486
8587 // Define output
8688 OutputObj<FlowContainer> fFC {FlowContainer (" FlowContainer" )};
87- OutputObj<TList> fWeightList { " WeightList " , OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource };
89+ OutputObj<GFWWeightsList> fGFWWeightsList { GFWWeightsList ( " GFWWeightsList " ) };
8890 HistogramRegistry registry{" registry" };
8991
9092 // define global variables
@@ -97,7 +99,6 @@ struct FlowRunbyRun {
9799 std::vector<int > runNumbers; // vector of run numbers
98100 std::map<int , std::vector<std::shared_ptr<TH1>>> th1sList; // map of histograms for all runs
99101 std::map<int , std::vector<std::shared_ptr<TProfile>>> profilesList; // map of profiles for all runs
100- std::map<int , GFWWeights*> weightsList; // map of weights for all runs
101102 enum OutputTH1Names {
102103 // here are TProfiles for vn-pt correlations that are not implemented in GFW
103104 hPhi = 0 ,
@@ -122,9 +123,7 @@ struct FlowRunbyRun {
122123 ccdb->setCaching (true );
123124 ccdb->setCreatedNotAfter (ccdbNoLaterThan.value );
124125
125- TList* weightlist = new TList ();
126- weightlist->SetOwner (true );
127- fWeightList .setObject (weightlist);
126+ fGFWWeightsList ->init (" weightList" );
128127
129128 // Add output histograms to the registry
130129 runNumbers = cfgRunNumbers;
@@ -148,7 +147,7 @@ struct FlowRunbyRun {
148147 }
149148 fFC ->SetName (" FlowContainer" );
150149 fFC ->SetXAxis (fPtAxis );
151- fFC ->Initialize (oba, axisIndependent, 1 );
150+ fFC ->Initialize (oba, axisIndependent, cfgNbootstrap );
152151 delete oba;
153152
154153 fGFW ->AddRegion (" full" , -0.8 , 0.8 , 1 , 1 );
@@ -230,11 +229,7 @@ struct FlowRunbyRun {
230229 o2::framework::AxisSpec axis = axisPt;
231230 int nPtBins = axis.binEdges .size () - 1 ;
232231 double * ptBins = &(axis.binEdges )[0 ];
233- GFWWeights* weight = new GFWWeights (Form (" weight_%d" , runNumber));
234- weight->SetPtBins (nPtBins, ptBins);
235- weight->Init (true , false );
236- fWeightList ->Add (weight);
237- weightsList.insert (std::make_pair (runNumber, weight));
232+ fGFWWeightsList ->addGFWWeightsByRun (runNumber, nPtBins, ptBins, true , false );
238233 }
239234
240235 void process (AodCollisions::iterator const & collision, aod::BCsWithTimestamps const &, AodTracks const & tracks)
@@ -277,10 +272,21 @@ struct FlowRunbyRun {
277272 fGFW ->Fill (track.eta (), 1 , track.phi (), wacc * weff, 1 );
278273 }
279274 if (cfgOutputNUAWeightsRefPt) {
280- if (withinPtRef)
281- weightsList[runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
275+ if (withinPtRef) {
276+ GFWWeights* weight = fGFWWeightsList ->getGFWWeightsByRun (runNumber);
277+ if (!weight) {
278+ LOGF (fatal, " Could not find the weight for run %d" , runNumber);
279+ return ;
280+ }
281+ weight->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
282+ }
282283 } else {
283- weightsList[runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
284+ GFWWeights* weight = fGFWWeightsList ->getGFWWeightsByRun (runNumber);
285+ if (!weight) {
286+ LOGF (fatal, " Could not find the weight for run %d" , runNumber);
287+ return ;
288+ }
289+ weight->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
284290 }
285291 }
286292
0 commit comments