@@ -83,6 +83,8 @@ struct FlowRunbyRun {
8383 O2_DEFINE_CONFIGURABLE (cfgNbootstrap, int , 30 , " Number of subsamples" )
8484 O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeights, bool , false , " NUA weights are filled in ref pt bins" )
8585 O2_DEFINE_CONFIGURABLE (cfgOutputNUAWeightsRefPt, bool , false , " NUA weights are filled in ref pt bins" )
86+ O2_DEFINE_CONFIGURABLE (cfgEfficiency, std::string, " " , " CCDB path to efficiency object" )
87+ O2_DEFINE_CONFIGURABLE (cfgAcceptanceList, std::string, " " , " CCDB path to acceptance lsit object" )
8688 O2_DEFINE_CONFIGURABLE (cfgDynamicRunNumber, bool , false , " Add runNumber during runtime" )
8789 O2_DEFINE_CONFIGURABLE (cfgGetInteractionRate, bool , false , " Get interaction rate from CCDB" )
8890 O2_DEFINE_CONFIGURABLE (cfgUseInteractionRateCut, bool , false , " Use events with low interaction rate" )
@@ -101,6 +103,12 @@ struct FlowRunbyRun {
101103 Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
102104 Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t ) true )) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
103105
106+ // Corrections
107+ TH1D* mEfficiency = nullptr ;
108+ GFWWeights* mAcceptance = nullptr ;
109+ TObjArray* mAcceptanceList = nullptr ;
110+ bool correctionsLoaded = false ;
111+
104112 // Connect to ccdb
105113 Service<ccdb::BasicCCDBManager> ccdb;
106114 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" };
@@ -124,10 +132,12 @@ struct FlowRunbyRun {
124132 enum OutputTH1Names {
125133 // here are TProfiles for vn-pt correlations that are not implemented in GFW
126134 hPhi = 0 ,
135+ hPhiWeighted,
127136 hEta,
128137 hVtxZ,
129138 hMult,
130139 hCent,
140+ hEventCountSpecific,
131141 kCount_TH1Names
132142 };
133143 enum OutputTH3Names {
@@ -272,14 +282,77 @@ struct FlowRunbyRun {
272282 return ;
273283 }
274284
285+ void loadCorrections (uint64_t timestamp, int runNumber)
286+ {
287+ if (correctionsLoaded)
288+ return ;
289+
290+ if (cfgAcceptanceList.value .empty () == false ) {
291+ mAcceptanceList = ccdb->getForTimeStamp <TObjArray>(cfgAcceptanceList, timestamp);
292+ if (mAcceptanceList == nullptr ) {
293+ LOGF (fatal, " Could not load acceptance weights list from %s" , cfgAcceptanceList.value .c_str ());
294+ }
295+ LOGF (info, " Loaded acceptance weights list from %s (%p)" , cfgAcceptanceList.value .c_str (), (void *)mAcceptanceList );
296+
297+ mAcceptance = static_cast <GFWWeights*>(mAcceptanceList ->FindObject (Form (" %d" , runNumber)));
298+ if (mAcceptance == nullptr ) {
299+ LOGF (fatal, " Could not find acceptance weights for run %d in acceptance list" , runNumber);
300+ }
301+ LOGF (info, " Loaded acceptance weights (%p) for run %d from list (%p)" , (void *)mAcceptance , runNumber, (void *)mAcceptanceList );
302+ }
303+ if (cfgEfficiency.value .empty () == false ) {
304+ mEfficiency = ccdb->getForTimeStamp <TH1D>(cfgEfficiency, timestamp);
305+ if (mEfficiency == nullptr ) {
306+ LOGF (fatal, " Could not load efficiency histogram for trigger particles from %s" , cfgEfficiency.value .c_str ());
307+ }
308+ LOGF (info, " Loaded efficiency histogram from %s (%p)" , cfgEfficiency.value .c_str (), (void *)mEfficiency );
309+ }
310+ correctionsLoaded = true ;
311+ }
312+
313+ bool setCurrentParticleWeights (float & weight_nue, float & weight_nua, float phi, float eta, float pt, float vtxz)
314+ {
315+ float eff = 1 .;
316+ if (mEfficiency )
317+ eff = mEfficiency ->GetBinContent (mEfficiency ->FindBin (pt));
318+ else
319+ eff = 1.0 ;
320+ if (eff == 0 )
321+ return false ;
322+ weight_nue = 1 . / eff;
323+
324+ if (mAcceptance )
325+ weight_nua = mAcceptance ->getNUA (phi, eta, vtxz);
326+ else
327+ weight_nua = 1 ;
328+ return true ;
329+ }
330+
331+ void initEventCount (std::shared_ptr<TH1> hEventCountSpecific)
332+ {
333+ hEventCountSpecific->GetXaxis ()->SetBinLabel (1 , " after sel8" );
334+ hEventCountSpecific->GetXaxis ()->SetBinLabel (2 , " kNoSameBunchPileup" );
335+ hEventCountSpecific->GetXaxis ()->SetBinLabel (3 , " kIsGoodZvtxFT0vsPV" );
336+ hEventCountSpecific->GetXaxis ()->SetBinLabel (4 , " kNoCollInTimeRangeStandard" );
337+ hEventCountSpecific->GetXaxis ()->SetBinLabel (5 , " kIsGoodITSLayersAll" );
338+ hEventCountSpecific->GetXaxis ()->SetBinLabel (6 , " kNoCollInRofStandard" );
339+ hEventCountSpecific->GetXaxis ()->SetBinLabel (7 , " kNoHighMultCollInPrevRof" );
340+ hEventCountSpecific->GetXaxis ()->SetBinLabel (8 , " occupancy" );
341+ hEventCountSpecific->GetXaxis ()->SetBinLabel (9 , " MultCorrelation" );
342+ hEventCountSpecific->GetXaxis ()->SetBinLabel (10 , " cfgEvSelV0AT0ACut" );
343+ }
344+
275345 void createOutputObjectsForRun (int runNumber)
276346 {
277347 std::vector<std::shared_ptr<TH1>> histos (kCount_TH1Names );
278348 histos[hPhi] = registry.add <TH1>(Form (" %d/hPhi" , runNumber), " " , {HistType::kTH1D , {axisPhi}});
349+ histos[hPhiWeighted] = registry.add <TH1>(Form (" %d/hPhiWeighted" , runNumber), " " , {HistType::kTH1D , {axisPhi}});
279350 histos[hEta] = registry.add <TH1>(Form (" %d/hEta" , runNumber), " " , {HistType::kTH1D , {axisEta}});
280351 histos[hVtxZ] = registry.add <TH1>(Form (" %d/hVtxZ" , runNumber), " " , {HistType::kTH1D , {axisVertex}});
281352 histos[hMult] = registry.add <TH1>(Form (" %d/hMult" , runNumber), " " , {HistType::kTH1D , {{3000 , 0.5 , 3000.5 }}});
282353 histos[hCent] = registry.add <TH1>(Form (" %d/hCent" , runNumber), " " , {HistType::kTH1D , {{90 , 0 , 90 }}});
354+ histos[hEventCountSpecific] = registry.add <TH1>(Form (" %d/hEventCountSpecific" , runNumber), " " , {HistType::kTH1D , {{10 , 0 , 10 }}});
355+ initEventCount (histos[hEventCountSpecific]);
283356 th1sList.insert (std::make_pair (runNumber, histos));
284357
285358 std::vector<std::shared_ptr<TProfile>> profiles (kCount_TProfileNames );
@@ -316,45 +389,54 @@ struct FlowRunbyRun {
316389 }
317390
318391 template <typename TCollision>
319- bool eventSelected (TCollision collision, const int multTrk, const float centrality)
392+ bool eventSelected (TCollision collision, const int multTrk, const float centrality, const int runNumber )
320393 {
394+ th1sList[runNumber][hEventCountSpecific]->Fill (0.5 );
321395 if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup )) {
322396 // rejects collisions which are associated with the same "found-by-T0" bunch crossing
323397 // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
324398 return 0 ;
325399 }
326-
400+ if (cfgEvSelkNoSameBunchPileup)
401+ th1sList[runNumber][hEventCountSpecific]->Fill (1.5 );
327402 if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV )) {
328403 // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
329404 // use this cut at low multiplicities with caution
330405 return 0 ;
331406 }
332-
407+ if (cfgEvSelkIsGoodZvtxFT0vsPV)
408+ th1sList[runNumber][hEventCountSpecific]->Fill (2.5 );
333409 if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
334410 // no collisions in specified time range
335411 return 0 ;
336412 }
337-
413+ if (cfgEvSelkNoCollInTimeRangeStandard)
414+ th1sList[runNumber][hEventCountSpecific]->Fill (3.5 );
338415 if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
339416 // from Jan 9 2025 AOT meeting
340417 // cut time intervals with dead ITS staves
341418 return 0 ;
342419 }
343-
420+ if (cfgEvSelkIsGoodITSLayersAll)
421+ th1sList[runNumber][hEventCountSpecific]->Fill (4.5 );
344422 if (cfgEvSelkNoCollInRofStandard && !collision.selection_bit (o2::aod::evsel::kNoCollInRofStandard )) {
345423 // no other collisions in this Readout Frame with per-collision multiplicity above threshold
346424 return 0 ;
347425 }
348-
426+ if (cfgEvSelkNoCollInRofStandard)
427+ th1sList[runNumber][hEventCountSpecific]->Fill (5.5 );
349428 if (cfgEvSelkNoHighMultCollInPrevRof && !collision.selection_bit (o2::aod::evsel::kNoHighMultCollInPrevRof )) {
350429 // veto an event if FT0C amplitude in previous ITS ROF is above threshold
351430 return 0 ;
352431 }
353-
432+ if (cfgEvSelkNoHighMultCollInPrevRof)
433+ th1sList[runNumber][hEventCountSpecific]->Fill (6.5 );
354434 auto multNTracksPV = collision.multNTracksPV ();
355435 auto occupancy = collision.trackOccupancyInTimeRange ();
356436 if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh))
357437 return 0 ;
438+ if (cfgEvSelOccupancy)
439+ th1sList[runNumber][hEventCountSpecific]->Fill (7.5 );
358440
359441 if (cfgEvSelMultCorrelation) {
360442 if (multNTracksPV < fMultPVCutLow ->Eval (centrality))
@@ -366,10 +448,14 @@ struct FlowRunbyRun {
366448 if (multTrk > fMultCutHigh ->Eval (centrality))
367449 return 0 ;
368450 }
451+ if (cfgEvSelMultCorrelation)
452+ th1sList[runNumber][hEventCountSpecific]->Fill (8.5 );
369453
370454 // V0A T0A 5 sigma cut
371455 if (cfgEvSelV0AT0ACut && (std::fabs (collision.multFV0A () - fT0AV0AMean ->Eval (collision.multFT0A ())) > 5 * fT0AV0ASigma ->Eval (collision.multFT0A ())))
372456 return 0 ;
457+ if (cfgEvSelV0AT0ACut)
458+ th1sList[runNumber][hEventCountSpecific]->Fill (9.5 );
373459
374460 return 1 ;
375461 }
@@ -392,7 +478,8 @@ struct FlowRunbyRun {
392478 // detect run number
393479 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
394480 const auto cent = collision.centFT0C ();
395- if (cfgUseAdditionalEventCut && !eventSelected (collision, tracks.size (), cent))
481+ int runNumber = bc.runNumber ();
482+ if (cfgUseAdditionalEventCut && !eventSelected (collision, tracks.size (), cent, runNumber))
396483 return ;
397484 if (cfgGetInteractionRate) {
398485 initHadronicRate (bc);
@@ -402,7 +489,6 @@ struct FlowRunbyRun {
402489 return ;
403490 gCurrentHadronicRate ->Fill (seconds, hadronicRate);
404491 }
405- int runNumber = bc.runNumber ();
406492 float lRandom = fRndm ->Rndm ();
407493 if (runNumber != lastRunNumer) {
408494 lastRunNumer = runNumber;
@@ -422,18 +508,15 @@ struct FlowRunbyRun {
422508 th1sList[runNumber][hMult]->Fill (tracks.size ());
423509 th1sList[runNumber][hCent]->Fill (collision.centFT0C ());
424510
511+ loadCorrections (bc.timestamp (), runNumber);
512+
425513 fGFW ->Clear ();
426514 float weff = 1 , wacc = 1 ;
427515 for (const auto & track : tracks) {
428516 if (!trackSelected (track))
429517 continue ;
430- th1sList[runNumber][hPhi]->Fill (track.phi ());
431- th1sList[runNumber][hEta]->Fill (track.eta ());
432518 // bool WithinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range
433519 bool withinPtRef = (cfgCutPtRefMin < track.pt ()) && (track.pt () < cfgCutPtRefMax); // within RF pT range
434- if (withinPtRef) {
435- fGFW ->Fill (track.eta (), 1 , track.phi (), wacc * weff, 1 );
436- }
437520 if (cfgOutputNUAWeights) {
438521 if (cfgOutputNUAWeightsRefPt) {
439522 if (withinPtRef) {
@@ -443,6 +526,16 @@ struct FlowRunbyRun {
443526 th3sList[runNumber][hPhiEtaVtxz]->Fill (track.phi (), track.eta (), collision.posZ ());
444527 }
445528 }
529+ if (!setCurrentParticleWeights (weff, wacc, track.phi (), track.eta (), track.pt (), collision.posZ ()))
530+ continue ;
531+ if (withinPtRef) {
532+ th1sList[runNumber][hPhi]->Fill (track.phi ());
533+ th1sList[runNumber][hPhiWeighted]->Fill (track.phi (), wacc);
534+ th1sList[runNumber][hEta]->Fill (track.eta ());
535+ }
536+ if (withinPtRef) {
537+ fGFW ->Fill (track.eta (), 1 , track.phi (), wacc * weff, 1 );
538+ }
446539 }
447540
448541 // Filling TProfile
0 commit comments