99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111//
12- // code author: Zhiyong Lu (zhiyong.lu@cern.ch)
13- // jira: PWGCF-254
14- // Produce Run-by-Run QA plots and flow analysis for Run3
12+
13+ // / \file flowRunbyRun.cxx
14+ // / \author Zhiyong Lu (zhiyong.lu@cern.ch)
15+ // / \since Oct/30/2024
16+ // / \brief jira: PWGCF-254, produce Run-by-Run QA plots and flow analysis for Run3
1517
1618#include < CCDB/BasicCCDBManager.h>
1719#include < cmath>
@@ -76,8 +78,8 @@ struct FlowRunbyRun {
7678
7779 // Connect to ccdb
7880 Service<ccdb::BasicCCDBManager> ccdb;
79- Configurable<int64_t > nolaterthan{ " ccdb-no-later-than " , std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count (), " latest acceptable timestamp of creation for the object" };
80- Configurable<std::string> url{ " ccdb-url " , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
81+ Configurable<int64_t > ccdbNoLaterThan{ " ccdbNoLaterThan " , std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count (), " latest acceptable timestamp of creation for the object" };
82+ Configurable<std::string> ccdbUrl{ " ccdbUrl " , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
8183
8284 // Define output
8385 OutputObj<FlowContainer> fFC {FlowContainer (" FlowContainer" )};
@@ -91,10 +93,10 @@ struct FlowRunbyRun {
9193 TAxis* fPtAxis ;
9294 TRandom3* fRndm = new TRandom3(0 );
9395 int lastRunNumer = -1 ;
94- std::vector<int > RunNumbers ; // vector of run numbers
95- std::map<int , std::vector<std::shared_ptr<TH1>>> TH1sList ; // map of histograms for all runs
96- 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
96+ std::vector<int > runNumbers ; // vector of run numbers
97+ std::map<int , std::vector<std::shared_ptr<TH1>>> th1sList ; // map of histograms for all runs
98+ std::map<int , std::vector<std::shared_ptr<TProfile>>> profilesList ; // map of profiles for all runs
99+ std::map<int , GFWWeights*> weightsList ; // map of weights for all runs
98100 enum OutputTH1Names {
99101 // here are TProfiles for vn-pt correlations that are not implemented in GFW
100102 hPhi = 0 ,
@@ -110,37 +112,37 @@ struct FlowRunbyRun {
110112 kCount_TProfileNames
111113 };
112114
113- using aodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>>;
114- using aodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA>>;
115+ using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>>;
116+ using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA>>;
115117
116118 void init (InitContext const &)
117119 {
118- ccdb->setURL (url .value );
120+ ccdb->setURL (ccdbUrl .value );
119121 ccdb->setCaching (true );
120- ccdb->setCreatedNotAfter (nolaterthan .value );
122+ ccdb->setCreatedNotAfter (ccdbNoLaterThan .value );
121123
122124 TList* weightlist = new TList ();
123125 weightlist->SetOwner (true );
124126 fWeightList .setObject (weightlist);
125127
126128 // Add output histograms to the registry
127- RunNumbers = cfgRunNumbers;
128- for (auto & runNumber : RunNumbers ) {
129- CreateOutputObjectsForRun (runNumber);
129+ runNumbers = cfgRunNumbers;
130+ for (const auto & runNumber : runNumbers ) {
131+ createOutputObjectsForRun (runNumber);
130132 }
131133
132134 o2::framework::AxisSpec axis = axisPt;
133135 int nPtBins = axis.binEdges .size () - 1 ;
134- double * PtBins = &(axis.binEdges )[0 ];
135- fPtAxis = new TAxis (nPtBins, PtBins );
136+ double * ptBins = &(axis.binEdges )[0 ];
137+ fPtAxis = new TAxis (nPtBins, ptBins );
136138
137139 // Create FlowContainer
138140 TObjArray* oba = new TObjArray ();
139- std::vector<std::string> UserDefineGFWCorr = cfgUserDefineGFWCorr;
140- std::vector<std::string> UserDefineGFWName = cfgUserDefineGFWName;
141- if (!UserDefineGFWCorr .empty () && !UserDefineGFWName .empty ()) {
142- for (uint i = 0 ; i < UserDefineGFWName .size (); i++) {
143- oba->Add (new TNamed (UserDefineGFWName .at (i).c_str (), UserDefineGFWName .at (i).c_str ()));
141+ std::vector<std::string> userDefineGFWCorr = cfgUserDefineGFWCorr;
142+ std::vector<std::string> userDefineGFWName = cfgUserDefineGFWName;
143+ if (!userDefineGFWCorr .empty () && !userDefineGFWName .empty ()) {
144+ for (uint i = 0 ; i < userDefineGFWName .size (); i++) {
145+ oba->Add (new TNamed (userDefineGFWName .at (i).c_str (), userDefineGFWName .at (i).c_str ()));
144146 }
145147 }
146148 fFC ->SetName (" FlowContainer" );
@@ -154,87 +156,87 @@ struct FlowRunbyRun {
154156 corrconfigs.resize (kCount_TProfileNames );
155157 corrconfigs[c22] = fGFW ->GetCorrelatorConfig (" full {2 -2}" , " ChFull22" , kFALSE );
156158 corrconfigs[c22_gap10] = fGFW ->GetCorrelatorConfig (" refN10 {2} refP10 {-2}" , " Ch10Gap22" , kFALSE );
157- if (!UserDefineGFWCorr .empty () && !UserDefineGFWName .empty ()) {
159+ if (!userDefineGFWCorr .empty () && !userDefineGFWName .empty ()) {
158160 LOGF (info, " User adding GFW CorrelatorConfig:" );
159161 // attentaion: here we follow the index of cfgUserDefineGFWCorr
160- for (uint i = 0 ; i < UserDefineGFWCorr .size (); i++) {
161- if (i >= UserDefineGFWName .size ()) {
162- LOGF (fatal, " The names you provided are more than configurations. UserDefineGFWName .size(): %d > UserDefineGFWCorr .size(): %d" , UserDefineGFWName .size (), UserDefineGFWCorr .size ());
162+ for (uint i = 0 ; i < userDefineGFWCorr .size (); i++) {
163+ if (i >= userDefineGFWName .size ()) {
164+ LOGF (fatal, " The names you provided are more than configurations. userDefineGFWName .size(): %d > userDefineGFWCorr .size(): %d" , userDefineGFWName .size (), userDefineGFWCorr .size ());
163165 break ;
164166 }
165- LOGF (info, " %d: %s %s" , i, UserDefineGFWCorr .at (i).c_str (), UserDefineGFWName .at (i).c_str ());
166- corrconfigsFC.push_back (fGFW ->GetCorrelatorConfig (UserDefineGFWCorr .at (i).c_str (), UserDefineGFWName .at (i).c_str (), kFALSE ));
167+ LOGF (info, " %d: %s %s" , i, userDefineGFWCorr .at (i).c_str (), userDefineGFWName .at (i).c_str ());
168+ corrconfigsFC.push_back (fGFW ->GetCorrelatorConfig (userDefineGFWCorr .at (i).c_str (), userDefineGFWName .at (i).c_str (), kFALSE ));
167169 }
168170 }
169171 fGFW ->CreateRegions ();
170172 }
171173
172174 template <char ... chars>
173- void FillProfile (const GFW::CorrConfig& corrconf, std::shared_ptr<TProfile> profile, const double & cent)
175+ void fillProfile (const GFW::CorrConfig& corrconf, std::shared_ptr<TProfile> profile, const double & cent)
174176 {
175177 double dnx, val;
176178 dnx = fGFW ->Calculate (corrconf, 0 , kTRUE ).real ();
177179 if (dnx == 0 )
178180 return ;
179181 if (!corrconf.pTDif ) {
180182 val = fGFW ->Calculate (corrconf, 0 , kFALSE ).real () / dnx;
181- if (TMath::Abs (val) < 1 )
183+ if (std::fabs (val) < 1 )
182184 profile->Fill (cent, val, dnx);
183185 return ;
184186 }
185187 return ;
186188 }
187189
188- void FillFC (const GFW::CorrConfig& corrconf, const double & cent, const double & rndm)
190+ void fillFC (const GFW::CorrConfig& corrconf, const double & cent, const double & rndm)
189191 {
190192 double dnx, val;
191193 dnx = fGFW ->Calculate (corrconf, 0 , kTRUE ).real ();
192194 if (dnx == 0 )
193195 return ;
194196 if (!corrconf.pTDif ) {
195197 val = fGFW ->Calculate (corrconf, 0 , kFALSE ).real () / dnx;
196- if (TMath::Abs (val) < 1 )
198+ if (std::fabs (val) < 1 )
197199 fFC ->FillProfile (corrconf.Head .c_str (), cent, val, dnx, rndm);
198200 return ;
199201 }
200- for (Int_t i = 1 ; i <= fPtAxis ->GetNbins (); i++) {
202+ for (auto i = 1 ; i <= fPtAxis ->GetNbins (); i++) {
201203 dnx = fGFW ->Calculate (corrconf, i - 1 , kTRUE ).real ();
202204 if (dnx == 0 )
203205 continue ;
204206 val = fGFW ->Calculate (corrconf, i - 1 , kFALSE ).real () / dnx;
205- if (TMath::Abs (val) < 1 )
207+ if (std::fabs (val) < 1 )
206208 fFC ->FillProfile (Form (" %s_pt_%i" , corrconf.Head .c_str (), i), cent, val, dnx, rndm);
207209 }
208210 return ;
209211 }
210212
211- void CreateOutputObjectsForRun (int runNumber)
213+ void createOutputObjectsForRun (int runNumber)
212214 {
213215 std::vector<std::shared_ptr<TH1>> histos (kCount_TH1Names );
214216 histos[hPhi] = registry.add <TH1>(Form (" %d/hPhi" , runNumber), " " , {HistType::kTH1D , {axisPhi}});
215217 histos[hEta] = registry.add <TH1>(Form (" %d/hEta" , runNumber), " " , {HistType::kTH1D , {axisEta}});
216218 histos[hVtxZ] = registry.add <TH1>(Form (" %d/hVtxZ" , runNumber), " " , {HistType::kTH1D , {axisVertex}});
217219 histos[hMult] = registry.add <TH1>(Form (" %d/hMult" , runNumber), " " , {HistType::kTH1D , {{3000 , 0.5 , 3000.5 }}});
218220 histos[hCent] = registry.add <TH1>(Form (" %d/hCent" , runNumber), " " , {HistType::kTH1D , {{90 , 0 , 90 }}});
219- TH1sList .insert (std::make_pair (runNumber, histos));
221+ th1sList .insert (std::make_pair (runNumber, histos));
220222
221223 std::vector<std::shared_ptr<TProfile>> profiles (kCount_TProfileNames );
222224 profiles[c22] = registry.add <TProfile>(Form (" %d/c22" , runNumber), " " , {HistType::kTProfile , {axisIndependent}});
223225 profiles[c22_gap10] = registry.add <TProfile>(Form (" %d/c22_gap10" , runNumber), " " , {HistType::kTProfile , {axisIndependent}});
224- ProfilesList .insert (std::make_pair (runNumber, profiles));
226+ profilesList .insert (std::make_pair (runNumber, profiles));
225227
226- // WeightsList
228+ // weightsList
227229 o2::framework::AxisSpec axis = axisPt;
228230 int nPtBins = axis.binEdges .size () - 1 ;
229- double * PtBins = &(axis.binEdges )[0 ];
231+ double * ptBins = &(axis.binEdges )[0 ];
230232 GFWWeights* weight = new GFWWeights (Form (" weight_%d" , runNumber));
231- weight->SetPtBins (nPtBins, PtBins );
233+ weight->SetPtBins (nPtBins, ptBins );
232234 weight->Init (true , false );
233235 fWeightList ->Add (weight);
234- WeightsList .insert (std::make_pair (runNumber, weight));
236+ weightsList .insert (std::make_pair (runNumber, weight));
235237 }
236238
237- void process (aodCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, aodTracks const & tracks)
239+ void process (AodCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, AodTracks const & tracks)
238240 {
239241 if (!collision.sel8 ())
240242 return ;
@@ -243,51 +245,51 @@ struct FlowRunbyRun {
243245 // detect run number
244246 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
245247 int runNumber = bc.runNumber ();
246- float l_Random = fRndm ->Rndm ();
248+ float lRandom = fRndm ->Rndm ();
247249 if (runNumber != lastRunNumer) {
248250 lastRunNumer = runNumber;
249- if (std::find (RunNumbers .begin (), RunNumbers .end (), runNumber) == RunNumbers .end ()) {
251+ if (std::find (runNumbers .begin (), runNumbers .end (), runNumber) == runNumbers .end ()) {
250252 // 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+ createOutputObjectsForRun (runNumber);
254+ runNumbers .push_back (runNumber);
253255 }
254256
255- if (TH1sList .find (runNumber) == TH1sList .end ()) {
256- LOGF (fatal, " RunNumber %d not found in TH1sList " , runNumber);
257+ if (th1sList .find (runNumber) == th1sList .end ()) {
258+ LOGF (fatal, " RunNumber %d not found in th1sList " , runNumber);
257259 return ;
258260 }
259261 }
260262
261- TH1sList [runNumber][hVtxZ]->Fill (collision.posZ ());
262- TH1sList [runNumber][hMult]->Fill (tracks.size ());
263- TH1sList [runNumber][hCent]->Fill (collision.centFT0C ());
263+ th1sList [runNumber][hVtxZ]->Fill (collision.posZ ());
264+ th1sList [runNumber][hMult]->Fill (tracks.size ());
265+ th1sList [runNumber][hCent]->Fill (collision.centFT0C ());
264266
265267 fGFW ->Clear ();
266268 const auto cent = collision.centFT0C ();
267269 float weff = 1 , wacc = 1 ;
268- for (auto & track : tracks) {
269- TH1sList [runNumber][hPhi]->Fill (track.phi ());
270- TH1sList [runNumber][hEta]->Fill (track.eta ());
270+ for (const auto & track : tracks) {
271+ th1sList [runNumber][hPhi]->Fill (track.phi ());
272+ th1sList [runNumber][hEta]->Fill (track.eta ());
271273 // bool WithinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range
272- bool WithinPtRef = (cfgCutPtRefMin < track.pt ()) && (track.pt () < cfgCutPtRefMax); // within RF pT range
273- if (WithinPtRef ) {
274+ bool withinPtRef = (cfgCutPtRefMin < track.pt ()) && (track.pt () < cfgCutPtRefMax); // within RF pT range
275+ if (withinPtRef ) {
274276 fGFW ->Fill (track.eta (), 1 , track.phi (), wacc * weff, 1 );
275277 }
276278 if (cfgOutputNUAWeightsRefPt) {
277- if (WithinPtRef )
278- WeightsList [runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
279+ if (withinPtRef )
280+ weightsList [runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
279281 } else {
280- WeightsList [runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
282+ weightsList [runNumber]->Fill (track.phi (), track.eta (), collision.posZ (), track.pt (), cent, 0 );
281283 }
282284 }
283285
284286 // Filling TProfile
285287 for (uint i = 0 ; i < kCount_TProfileNames ; ++i) {
286- FillProfile (corrconfigs[i], ProfilesList [runNumber][i], cent);
288+ fillProfile (corrconfigs[i], profilesList [runNumber][i], cent);
287289 }
288290 // Filling Flow Container
289291 for (uint l_ind = 0 ; l_ind < corrconfigsFC.size (); l_ind++) {
290- FillFC (corrconfigsFC.at (l_ind), cent, l_Random );
292+ fillFC (corrconfigsFC.at (l_ind), cent, lRandom );
291293 }
292294 }
293295};
0 commit comments