@@ -60,6 +60,7 @@ struct FlowRunbyRun {
6060 O2_DEFINE_CONFIGURABLE (cfgCutChi2prTPCcls, float , 2.5 , " Chi2 per TPC clusters" )
6161 O2_DEFINE_CONFIGURABLE (cfgCutDCAz, float , 2 .0f , " max DCA to vertex z" )
6262 O2_DEFINE_CONFIGURABLE (cfgUseNch, bool , false , " Use Nch for flow observables" )
63+ O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeightsRefPt, bool , false , " NUA weights are filled in ref pt bins" )
6364 Configurable<std::vector<int >> cfgRunNumbers{" cfgRunNumbers" , std::vector<int >{544095 , 544098 , 544116 , 544121 , 544122 , 544123 , 544124 }, " Preconfigured run numbers" };
6465 Configurable<std::vector<std::string>> cfgUserDefineGFWCorr{" cfgUserDefineGFWCorr" , std::vector<std::string>{" refN10 {2} refP10 {-2}" }, " User defined GFW CorrelatorConfig" };
6566 Configurable<std::vector<std::string>> cfgUserDefineGFWName{" cfgUserDefineGFWName" , std::vector<std::string>{" Ch10Gap22" }, " User defined GFW Name" };
@@ -80,6 +81,7 @@ struct FlowRunbyRun {
8081
8182 // Define output
8283 OutputObj<FlowContainer> fFC {FlowContainer (" FlowContainer" )};
84+ OutputObj<TList> fWeightList {" WeightList" , OutputObjHandlingPolicy::AnalysisObject};
8385 HistogramRegistry registry{" registry" };
8486
8587 // define global variables
@@ -88,9 +90,11 @@ struct FlowRunbyRun {
8890 std::vector<GFW::CorrConfig> corrconfigsFC;
8991 TAxis* fPtAxis ;
9092 TRandom3* fRndm = new TRandom3(0 );
93+ int lastRunNumer = -1 ;
9194 std::vector<int > RunNumbers; // vector of run numbers
9295 std::map<int , std::vector<std::shared_ptr<TH1>>> TH1sList; // map of histograms for all runs
9396 std::map<int , std::vector<std::shared_ptr<TProfile>>> ProfilesList; // map of profiles for all runs
97+ std::map<int , GFWWeights*> WeightsList; // map of weights for all runs
9498 enum OutputTH1Names {
9599 // here are TProfiles for vn-pt correlations that are not implemented in GFW
96100 hPhi = 0 ,
@@ -115,6 +119,10 @@ struct FlowRunbyRun {
115119 ccdb->setCaching (true );
116120 ccdb->setCreatedNotAfter (nolaterthan.value );
117121
122+ TList* weightlist = new TList ();
123+ weightlist->SetOwner (true );
124+ fWeightList .setObject (weightlist);
125+
118126 // Add output histograms to the registry
119127 RunNumbers = cfgRunNumbers;
120128 for (auto & runNumber : RunNumbers) {
@@ -214,6 +222,16 @@ struct FlowRunbyRun {
214222 profiles[c22] = registry.add <TProfile>(Form (" %d/c22" , runNumber), " " , {HistType::kTProfile , {axisIndependent}});
215223 profiles[c22_gap10] = registry.add <TProfile>(Form (" %d/c22_gap10" , runNumber), " " , {HistType::kTProfile , {axisIndependent}});
216224 ProfilesList.insert (std::make_pair (runNumber, profiles));
225+
226+ // WeightsList
227+ o2::framework::AxisSpec axis = axisPt;
228+ int nPtBins = axis.binEdges .size () - 1 ;
229+ double * PtBins = &(axis.binEdges )[0 ];
230+ GFWWeights* weight = new GFWWeights (Form (" weight_%d" , runNumber));
231+ weight->SetPtBins (nPtBins, PtBins);
232+ weight->Init (true , false );
233+ fWeightList ->Add (weight);
234+ WeightsList.insert (std::make_pair (runNumber, weight));
217235 }
218236
219237 void process (aodCollisions::iterator const & collision, aod::BCsWithTimestamps const &, aodTracks const & tracks)
@@ -226,15 +244,18 @@ struct FlowRunbyRun {
226244 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
227245 int runNumber = bc.runNumber ();
228246 float l_Random = fRndm ->Rndm ();
229- if (std::find (RunNumbers.begin (), RunNumbers.end (), runNumber) == RunNumbers.end ()) {
230- // if run number is not in the preconfigured list, create new output histograms for this run
231- CreateOutputObjectsForRun (runNumber);
232- RunNumbers.push_back (runNumber);
233- }
247+ if (runNumber != lastRunNumer) {
248+ lastRunNumer = runNumber;
249+ if (std::find (RunNumbers.begin (), RunNumbers.end (), runNumber) == RunNumbers.end ()) {
250+ // if run number is not in the preconfigured list, create new output histograms for this run
251+ CreateOutputObjectsForRun (runNumber);
252+ RunNumbers.push_back (runNumber);
253+ }
234254
235- if (TH1sList.find (runNumber) == TH1sList.end ()) {
236- LOGF (fatal, " RunNumber %d not found in TH1sList" , runNumber);
237- return ;
255+ if (TH1sList.find (runNumber) == TH1sList.end ()) {
256+ LOGF (fatal, " RunNumber %d not found in TH1sList" , runNumber);
257+ return ;
258+ }
238259 }
239260
240261 TH1sList[runNumber][hVtxZ]->Fill (collision.posZ ());
@@ -247,10 +268,17 @@ struct FlowRunbyRun {
247268 for (auto & track : tracks) {
248269 TH1sList[runNumber][hPhi]->Fill (track.phi ());
249270 TH1sList[runNumber][hEta]->Fill (track.eta ());
271+ bool WithinPtPOI = (cfgCutPtPOIMin < track.pt ()) && (track.pt () < cfgCutPtPOIMax); // within POI pT range
250272 bool WithinPtRef = (cfgCutPtRefMin < track.pt ()) && (track.pt () < cfgCutPtRefMax); // within RF pT range
251273 if (WithinPtRef) {
252274 fGFW ->Fill (track.eta (), 1 , track.phi (), wacc * weff, 1 );
253275 }
276+ if (cfgOutputNUAWeightsRefPt) {
277+ if (WithinPtRef)
278+ WeightsList[runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
279+ } else {
280+ WeightsList[runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
281+ }
254282 }
255283
256284 // Filling TProfile
0 commit comments