From c1e886b8386a7a9a38088a430e6ce9f12f486e21 Mon Sep 17 00:00:00 2001 From: fchinu Date: Mon, 16 Feb 2026 10:55:41 +0100 Subject: [PATCH 1/4] Small fixes to mu and interaction rate evaluation --- PWGMM/Lumi/Tasks/lumiStabilityPP.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx index ee01dab084b..7be27b32be0 100644 --- a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx +++ b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx @@ -13,6 +13,7 @@ /// \brief Analysis over BCs to study the luminosity stability along time for pp collisions /// /// \author Fabrizio Grosa (fabrizio.grosa@cern.ch), CERN +/// \author Fabrizio Chinu (fabrizio.chinu@cern.ch), INFN and University of Turin #include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/MetadataHelper.h" @@ -299,6 +300,7 @@ struct LumiStabilityPP { int nBCs[2] = {0, 0}; float timeStartSinceSOF{-1.f}, timeStopSinceSOF{-1.f}; int nTriggersPerDf[NTriggerAliases][NBCCategories]; + std::fill(&nTriggersPerDf[0][0], &nTriggersPerDf[0][0] + (NTriggerAliases * NBCCategories), 0); // Initialize to 0 for (const auto& bc : bcs) { if (bc.timestamp() == 0) { @@ -309,7 +311,7 @@ struct LumiStabilityPP { BCsWithTimeStamps::iterator bcFDD; auto idxBc = bc.globalIndex(); if (isData23) { - if (idxBc < bcShiftFDDForData2023) { // we need to skip the first 15 because of the FDD-FT0 shift + if ((bcShiftFDDForData2023 < 0 && idxBc < -bcShiftFDDForData2023) || (bcShiftFDDForData2023 > 0 && idxBc > bcs.size() - bcShiftFDDForData2023)) { // we need to skip the first/last bcs because of the FDD-FT0 shift continue; } bcFDD = bcs.rawIteratorAt(idxBc + bcShiftFDDForData2023); @@ -332,7 +334,7 @@ struct LumiStabilityPP { double rate{-1.}; int runVdM23Start{542757}; int runVdM23Stop{542768}; - if (runNumber < runVdM23Start && runNumber > runVdM23Stop) { + if (runNumber < runVdM23Start || runNumber > runVdM23Stop) { rate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), std::string("T0VTX"), true) * 1.e-3; // kHz } histInteractionRate[runNumber]->Fill(rate); @@ -443,7 +445,7 @@ struct LumiStabilityPP { continue; } float mu{0.}; - if (iBCCategory != BCSL) { + if (iBCCategory != BCL) { mu = getMu(nTriggersPerDf[iTrigger][iBCCategory] / deltaTime, nBCs[0]); } else { mu = getMu(nTriggersPerDf[iTrigger][iBCCategory] / deltaTime, nBCs[1]); From 4272024b1512f55fd9e0e1dc18815770ab80b7e5 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Mon, 16 Feb 2026 18:43:38 +0100 Subject: [PATCH 2/4] Change SL BC definition splitting FDD and FT0 and fix on-the-fly mu calculation --- PWGMM/Lumi/Tasks/lumiStabilityPP.cxx | 176 ++++++++++++++++----------- 1 file changed, 108 insertions(+), 68 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx index 7be27b32be0..6787f152f10 100644 --- a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx +++ b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx @@ -28,6 +28,8 @@ #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include +#include #include "Framework/runDataProcessing.h" #include @@ -52,7 +54,8 @@ enum BCCategories { BCA = 0, // A side BCs (bunch-crossings that had beam only BCC = 2, // C side BCs (bunch-crossings that had beam only from C side) BCE = 3, // empty BCs (bunch-crossings that did not have beam from either side) BCL = 4, // leading BCs (bunch-crossings that did not have interacting bunches for a configurable number of preceding BCs) - BCSL = 5, // super-leading BCs (bunch-crossings that did not have FDD/FT0 activity for a configurable number of preceding BCs) + BCSLFDD = 5, // super-leading BCs for FDD (bunch-crossings that had beam from both sides but did not have FDD activity for a configurable number of preceding BCs) + BCSLFT0 = 6, // super-leading BCs for FT0 (bunch-crossings that had beam from both sides but did not have FT0 activity for a configurable number of preceding BCs) NBCCategories }; } // namespace lumi namespace aod @@ -100,14 +103,10 @@ struct BuildBcFlagTable { struct LumiStabilityPP { - Configurable doBCA{"doBCA", false, "Create and fill histograms for the BCs of type A"}; - Configurable doBCB{"doBCB", true, "Create and fill histograms for the BCs of type B"}; - Configurable doBCC{"doBCC", false, "Create and fill histograms for the BCs of type C"}; - Configurable doBCE{"doBCE", false, "Create and fill histograms for the BCs of type E"}; - Configurable doBCL{"doBCL", false, "Create and fill histograms for leading BCs of type B"}; - Configurable doBCSL{"doBCSL", false, "Create and fill histograms for super-leading BCs (no preceding FT0/FDD activity) of type B"}; + static constexpr int defaulFlags[1][NBCCategories] = {{1, 1, 1, 1, 1, 1, 1}}; + Configurable> doTypeBC{"doTypeBC", {defaulFlags[0], NBCCategories, {"BCA", "BCB", "BCC", "BCE", "BCL", "BCSLFDD", "BCSLFT0"}}, "Create and fill histograms for different BC types"}; + Configurable numEmptyBCsBeforeLeadingBC{"numEmptyBCsBeforeLeadingBC", 5, "Number of empty BCs before a leading BC"}; - Configurable requireNoT0ForSLBC{"requireNoT0ForSLBC", false, "Require no T0 signal for definition of super leading BC (otherwise only no FDD)"}; Configurable bcShiftFDDForData2023{"bcShiftFDDForData2023", -15, "Number of bc to shift for FDD to be applied for 2023 data only"}; std::bitset beamPatternA, beamPatternC; @@ -119,7 +118,7 @@ struct LumiStabilityPP { int runNumber{-1}; bool isData23{false}; ctpRateFetcher mRateFetcher; - std::string injectionScheme; + int nBunchesFillingScheme; HistogramRegistry registry{"registry"}; @@ -136,22 +135,22 @@ struct LumiStabilityPP { std::map> histInteractionRate; static constexpr std::string_view NBCsVsTimeHistNames[NTriggerAliases][NBCCategories] = - {{"AllBCs/BC_A/nBCsVsTime", "AllBCs/BC_B/nBCsVsTime", "AllBCs/BC_C/nBCsVsTime", "AllBCs/BC_E/nBCsVsTime", "AllBCs/BC_L/nBCsVsTime", "AllBCs/BC_SL/nBCsVsTime"}, - {"FT0VTx/BC_A/nBCsVsTime", "FT0VTx/BC_B/nBCsVsTime", "FT0VTx/BC_C/nBCsVsTime", "FT0VTx/BC_E/nBCsVsTime", "FT0VTx/BC_L/nBCsVsTime", "FT0VTx/BC_SL/nBCsVsTime"}, - {"FT0CE/BC_A/nBCsVsTime", "FT0CE/BC_B/nBCsVsTime", "FT0CE/BC_C/nBCsVsTime", "FT0CE/BC_E/nBCsVsTime", "FT0CE/BC_L/nBCsVsTime", "FT0CE/BC_SL/nBCsVsTime"}, - {"FDD/BC_A/nBCsVsTime", "FDD/BC_B/nBCsVsTime", "FDD/BC_C/nBCsVsTime", "FDD/BC_E/nBCsVsTime", "FDD/BC_L/nBCsVsTime", "FDD/BC_SL/nBCsVsTime"}}; + {{"AllBCs/BC_A/nBCsVsTime", "AllBCs/BC_B/nBCsVsTime", "AllBCs/BC_C/nBCsVsTime", "AllBCs/BC_E/nBCsVsTime", "AllBCs/BC_L/nBCsVsTime", "AllBCs/BC_SL_FDD/nBCsVsTime", "AllBCs/BC_SL_FT0/nBCsVsTime"}, + {"FT0VTx/BC_A/nBCsVsTime", "FT0VTx/BC_B/nBCsVsTime", "FT0VTx/BC_C/nBCsVsTime", "FT0VTx/BC_E/nBCsVsTime", "FT0VTx/BC_L/nBCsVsTime", "FT0VTx/BC_SL_FDD/nBCsVsTime", "FT0VTx/BC_SL_FT0/nBCsVsTime"}, + {"FT0CE/BC_A/nBCsVsTime", "FT0CE/BC_B/nBCsVsTime", "FT0CE/BC_C/nBCsVsTime", "FT0CE/BC_E/nBCsVsTime", "FT0CE/BC_L/nBCsVsTime", "FT0CE/BC_SL_FDD/nBCsVsTime", "FT0CE/BC_SL_FT0/nBCsVsTime"}, + {"FDD/BC_A/nBCsVsTime", "FDD/BC_B/nBCsVsTime", "FDD/BC_C/nBCsVsTime", "FDD/BC_E/nBCsVsTime", "FDD/BC_L/nBCsVsTime", "FDD/BC_SL_FDD/nBCsVsTime", "FDD/BC_SL_FT0/nBCsVsTime"}}; static constexpr std::string_view NBCsVsBCIDHistNames[NTriggerAliases][NBCCategories] = - {{"AllBCs/BC_A/nBCsVsBCID", "AllBCs/BC_B/nBCsVsBCID", "AllBCs/BC_C/nBCsVsBCID", "AllBCs/BC_E/nBCsVsBCID", "AllBCs/BC_L/nBCsVsBCID", "AllBCs/BC_SL/nBCsVsBCID"}, - {"FT0VTx/BC_A/nBCsVsBCID", "FT0VTx/BC_B/nBCsVsBCID", "FT0VTx/BC_C/nBCsVsBCID", "FT0VTx/BC_E/nBCsVsBCID", "FT0VTx/BC_L/nBCsVsBCID", "FT0VTx/BC_SL/nBCsVsBCID"}, - {"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID", "FT0CE/BC_SL/nBCsVsBCID"}, - {"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID", "FDD/BC_SL/nBCsVsBCID"}}; + {{"AllBCs/BC_A/nBCsVsBCID", "AllBCs/BC_B/nBCsVsBCID", "AllBCs/BC_C/nBCsVsBCID", "AllBCs/BC_E/nBCsVsBCID", "AllBCs/BC_L/nBCsVsBCID", "AllBCs/BC_SL_FDD/nBCsVsBCID", "AllBCs/BC_SL_FT0/nBCsVsBCID"}, + {"FT0VTx/BC_A/nBCsVsBCID", "FT0VTx/BC_B/nBCsVsBCID", "FT0VTx/BC_C/nBCsVsBCID", "FT0VTx/BC_E/nBCsVsBCID", "FT0VTx/BC_L/nBCsVsBCID", "FT0VTx/BC_SL_FDD/nBCsVsBCID", "FT0VTx/BC_SL_FT0/nBCsVsBCID"}, + {"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID", "FT0CE/BC_SL_FDD/nBCsVsBCID", "FT0CE/BC_SL_FT0/nBCsVsBCID"}, + {"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID", "FDD/BC_SL_FDD/nBCsVsBCID", "FDD/BC_SL_FT0/nBCsVsBCID"}}; - static constexpr std::string_view MuHistNames[NTriggerAliases][NBCCategories - 1] = - {{"AllBCs/BC_A/Mu", "AllBCs/BC_B/Mu", "AllBCs/BC_C/Mu", "AllBCs/BC_E/Mu", "AllBCs/BC_L/Mu"}, - {"FT0VTx/BC_A/Mu", "FT0VTx/BC_B/Mu", "FT0VTx/BC_C/Mu", "FT0VTx/BC_E/Mu", "FT0VTx/BC_L/Mu"}, - {"FT0CE/BC_A/Mu", "FT0CE/BC_B/Mu", "FT0CE/BC_C/Mu", "FT0CE/BC_E/Mu", "FT0CE/BC_L/Mu"}, - {"FDD/BC_A/Mu", "FDD/BC_B/Mu", "FDD/BC_C/Mu", "FDD/BC_E/Mu", "FDD/BC_L/Mu"}}; + static constexpr std::string_view MuHistNames[NTriggerAliases][NBCCategories] = + {{"AllBCs/BC_A/Mu", "AllBCs/BC_B/Mu", "AllBCs/BC_C/Mu", "AllBCs/BC_E/Mu", "AllBCs/BC_L/Mu", "AllBCs/BC_SL_FDD/Mu", "AllBCs/BC_SL_FT0/Mu"}, + {"FT0VTx/BC_A/Mu", "FT0VTx/BC_B/Mu", "FT0VTx/BC_C/Mu", "FT0VTx/BC_E/Mu", "FT0VTx/BC_L/Mu", "FT0VTx/BC_SL_FDD/Mu", "FT0VTx/BC_SL_FT0/Mu"}, + {"FT0CE/BC_A/Mu", "FT0CE/BC_B/Mu", "FT0CE/BC_C/Mu", "FT0CE/BC_E/Mu", "FT0CE/BC_L/Mu", "FT0CE/BC_SL_FDD/Mu", "FT0CE/BC_SL_FT0/Mu"}, + {"FDD/BC_A/Mu", "FDD/BC_B/Mu", "FDD/BC_C/Mu", "FDD/BC_E/Mu", "FDD/BC_L/Mu", "FDD/BC_SL_FDD/Mu", "FDD/BC_SL_FT0/Mu"}}; const AxisSpec timeAxis{2880, 0., 2880., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{nBCsPerOrbit, -0.5, static_cast(nBCsPerOrbit) - 0.5, "#bf{BC ID in orbit}"}; @@ -186,13 +185,11 @@ struct LumiStabilityPP { histBcHasFDD[runNumber]->GetXaxis()->SetBinLabel(2, "Found FDD"); for (int iTrigger{0}; iTrigger < NTriggerAliases; ++iTrigger) { - for (int iBCCategory{0}; iBCCategory < NBCCategories; ++iBCCategory) { // Don't do SL BCs here - if ((iBCCategory == BCA && doBCA) || (iBCCategory == BCB && doBCB) || (iBCCategory == BCC && doBCC) || (iBCCategory == BCE && doBCE) || (iBCCategory == BCL && doBCL) || (iBCCategory == BCSL && doBCSL)) { + for (int iBCCategory{0}; iBCCategory < NBCCategories; ++iBCCategory) { + if (doTypeBC->get(0u, iBCCategory)) { histBcVsTime[iTrigger][iBCCategory][runNumber] = registry.add(Form("%d/%s", runNumber, std::string(NBCsVsTimeHistNames[iTrigger][iBCCategory]).c_str()), "Time of triggered BCs since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1D, {timeAxis}); histBcVsBcId[iTrigger][iBCCategory][runNumber] = registry.add(Form("%d/%s", runNumber, std::string(NBCsVsBCIDHistNames[iTrigger][iBCCategory]).c_str()), "BC ID of triggered BCs;#bf{BC ID in orbit};#bf{#it{N}_{BC}}", HistType::kTH1D, {bcIDAxis}); - if (iBCCategory != BCSL) { // we do not do it for superleading because it is not easy to define the number of inspected BCs - histMu[iTrigger][iBCCategory][runNumber] = registry.add(Form("%d/%s", runNumber, std::string(MuHistNames[iTrigger][iBCCategory]).c_str()), "pile-up #mu of different triggers;#mu;counts", HistType::kTH1D, {{1000, 0., 0.2}}); - } + histMu[iTrigger][iBCCategory][runNumber] = registry.add(Form("%d/%s", runNumber, std::string(MuHistNames[iTrigger][iBCCategory]).c_str()), "pile-up #mu of different triggers;#mu;counts", HistType::kTH1D, {{1000, 0., 0.2}}); } } } @@ -223,7 +220,14 @@ struct LumiStabilityPP { LOG(info) << "LHCIF data fetched for run " << runNumber << " and timestamp " << timeStamp; createHistograms(); - histFillingScheme[runNumber]->Fill(mLHCIFdata->getInjectionScheme().c_str(), 0); + std::string_view injectionScheme = mLHCIFdata->getInjectionScheme(); + size_t underScorePos = injectionScheme.find('_'); + size_t bPos = injectionScheme.find('b', underScorePos); + if (underScorePos != std::string_view::npos && bPos != std::string_view::npos && bPos > underScorePos) { + std::string_view nBunchesFillingSchemeStr = injectionScheme.substr(underScorePos + 1, bPos - (underScorePos + 1)); + nBunchesFillingScheme = std::stoi(std::string(nBunchesFillingSchemeStr)); + } + histFillingScheme[runNumber]->Fill(std::string(injectionScheme).c_str(), 0); histFillTime[runNumber]->Fill(0.5, mLHCIFdata->getFillNumberTime()); beamPatternA = mLHCIFdata->getBunchFilling().getBeamPattern(0); @@ -271,12 +275,12 @@ struct LumiStabilityPP { return (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 / 60; // Convert to minutes } - float getMu(double triggerRate, int nbc) + float getMu(double ntriggers, int nbc) { if (nbc == 0) { return 0.; } - return -std::log(1.f - triggerRate / nbc / constants::lhc::LHCRevFreq); + return -std::log(1.f - ntriggers / nbc); } template @@ -287,20 +291,17 @@ struct LumiStabilityPP { histBcVsBcId[iTrigger][iBCCategory][runNumber]->Fill(localBC); } - void fillMuHistograms(int iTrigger, int iBCCategory, float mu) - { - histMu[iTrigger][iBCCategory][runNumber]->Fill(mu); - } - void process(BCsWithTimeStamps const& bcs, aod::FT0s const&, aod::FDDs const&) { - int64_t globalBCIdOfLastBCWithActivity = 0; - int nBCs[2] = {0, 0}; + int64_t globalBCIdOfLastBCWithActivityFDD{0}, globalBCIdOfLastBCWithActivityFT0{0}, globalBCLastInspectedBC{-1}; + int nBCs[NBCCategories]; + std::fill(&nBCs[0], &nBCs[0] + static_cast(NBCCategories), 0); // Initialize to 0 float timeStartSinceSOF{-1.f}, timeStopSinceSOF{-1.f}; int nTriggersPerDf[NTriggerAliases][NBCCategories]; - std::fill(&nTriggersPerDf[0][0], &nTriggersPerDf[0][0] + (NTriggerAliases * NBCCategories), 0); // Initialize to 0 + std::fill(&nTriggersPerDf[0][0], &nTriggersPerDf[0][0] + (static_cast(NTriggerAliases) * static_cast(NBCCategories)), 0); // Initialize to 0 + double rate{-1.}; for (const auto& bc : bcs) { if (bc.timestamp() == 0) { @@ -331,7 +332,6 @@ struct LumiStabilityPP { if (isTriggerTVX) { histNBcsVsTime[runNumber]->Fill(timeSinceSOF); - double rate{-1.}; int runVdM23Start{542757}; int runVdM23Stop{542768}; if (runNumber < runVdM23Start || runNumber > runVdM23Stop) { @@ -342,22 +342,55 @@ struct LumiStabilityPP { int64_t globalBC = bc.globalBC(); int localBC = globalBC % nBCsPerOrbit; - nBCs[0]++; - if (bcPatternL[localBC]) { - nBCs[1]++; - } - bool isSuperLeadingBc{true}; - if (globalBC - globalBCIdOfLastBCWithActivity < numEmptyBCsBeforeLeadingBC) { - isSuperLeadingBc = false; // not a super-leading BC + bool isSuperLeadingBcFDD{true}, isSuperLeadingBcFT0{true}; + if (globalBC - globalBCIdOfLastBCWithActivityFDD < numEmptyBCsBeforeLeadingBC) { + isSuperLeadingBcFDD = false; // not a super-leading BC for FDD + } + if (globalBC - globalBCIdOfLastBCWithActivityFT0 < numEmptyBCsBeforeLeadingBC) { + isSuperLeadingBcFT0 = false; // not a super-leading BC for FT0 } - if (bcFDD.has_fdd() || (requireNoT0ForSLBC && bc.has_ft0())) { - globalBCIdOfLastBCWithActivity = globalBC; + if (bcFDD.has_fdd()) { + globalBCIdOfLastBCWithActivityFDD = globalBC; + } + if (bc.has_ft0()) { + globalBCIdOfLastBCWithActivityFT0 = globalBC; } if (!bcPatternB[localBC]) { - isSuperLeadingBc = false; // not a super-leading BC + isSuperLeadingBcFDD = false; // not a super-leading BC + isSuperLeadingBcFT0 = false; // not a super-leading BC + } + + int64_t globalBCStart = (globalBCLastInspectedBC >= 0 && globalBCLastInspectedBC < globalBC) ? globalBCLastInspectedBC + 1 : globalBC; + int64_t maxBcDiff = (rate > 0) ? 10 * static_cast(nBunchesFillingScheme * constants::lhc::LHCRevFreq / rate) : 500; + if (globalBC - globalBCStart > maxBcDiff) { // we changed fill, we should not count all BCs between the current and the previous one + globalBCStart = globalBC; + } + for (int64_t iGlobalBC{globalBCStart}; iGlobalBC<=globalBC; ++iGlobalBC) { // we count all BCs in between one and another stored in the AO2Ds + int iLocalBC = iGlobalBC % nBCsPerOrbit; + if (bcPatternA[iLocalBC]) { + nBCs[BCA]++; + } + if (bcPatternB[iLocalBC]) { + nBCs[BCB]++; + if (iGlobalBC - globalBCIdOfLastBCWithActivityFDD < numEmptyBCsBeforeLeadingBC) { + nBCs[BCSLFDD]++; + } + if (iGlobalBC - globalBCIdOfLastBCWithActivityFT0 < numEmptyBCsBeforeLeadingBC) { + nBCs[BCSLFT0]++; + } + } + if (bcPatternC[iLocalBC]) { + nBCs[BCC]++; + } + if (bcPatternE[iLocalBC]) { + nBCs[BCE]++; + } + if (bcPatternL[iLocalBC]) { + nBCs[BCL]++; + } } int64_t thisTFid = (globalBC - bcSOR) / nBCsPerTF; @@ -375,7 +408,7 @@ struct LumiStabilityPP { for (int iTrigger{0}; iTrigger < NTriggerAliases; ++iTrigger) { for (int iBCCategory{0}; iBCCategory < NBCCategories; ++iBCCategory) { - if ((iBCCategory == BCA && doBCA) || (iBCCategory == BCB && doBCB) || (iBCCategory == BCC && doBCC) || (iBCCategory == BCE && doBCE) || (iBCCategory == BCL && doBCL) || (iBCCategory == BCSL && doBCSL)) { + if (doTypeBC->get(0u, iBCCategory)) { if (iTrigger == AllBCs) { if (iBCCategory == BCA && bcPatternA[localBC]) fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); @@ -387,8 +420,10 @@ struct LumiStabilityPP { fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); if (iBCCategory == BCL && bcPatternL[localBC]) fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); - if (iBCCategory == BCSL && isSuperLeadingBc) - fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFDD && isSuperLeadingBcFDD) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFT0 && isSuperLeadingBcFT0) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); } if (iTrigger == FT0Vtx && ctpInputMask.test(2)) { if (iBCCategory == BCA && bcPatternA[localBC]) @@ -401,8 +436,10 @@ struct LumiStabilityPP { fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); if (iBCCategory == BCL && bcPatternL[localBC]) fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); - if (iBCCategory == BCSL && isSuperLeadingBc) - fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFDD && isSuperLeadingBcFDD) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFT0 && isSuperLeadingBcFT0) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); } if (iTrigger == FT0CE && ctpInputMask.test(4)) { if (iBCCategory == BCA && bcPatternA[localBC]) @@ -415,8 +452,10 @@ struct LumiStabilityPP { fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); if (iBCCategory == BCL && bcPatternL[localBC]) fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); - if (iBCCategory == BCSL && isSuperLeadingBc) - fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFDD && isSuperLeadingBcFDD) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFT0 && isSuperLeadingBcFT0) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); } if (iTrigger == FDD && ctpInputMaskFDD.test(15)) { if (iBCCategory == BCA && bcPatternA[localBC]) @@ -429,28 +468,29 @@ struct LumiStabilityPP { fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); if (iBCCategory == BCL && bcPatternL[localBC]) fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); - if (iBCCategory == BCSL && isSuperLeadingBc) - fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFDD && isSuperLeadingBcFDD) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); + if (iBCCategory == BCSLFT0 && isSuperLeadingBcFT0) + fillHistograms(timeSinceSOF, localBC, nTriggersPerDf[iTrigger][iBCCategory]); } } } } histNBcsVsBcId[runNumber]->Fill(localBC); + if (globalBCLastInspectedBC < globalBC) { + globalBCLastInspectedBC = globalBC; + } else { + globalBCLastInspectedBC = -1; + } } // fill histogram for mu - float deltaTime = (timeStopSinceSOF - timeStartSinceSOF) * 60.; // convert back to seconds + // float deltaTime = (timeStopSinceSOF - timeStartSinceSOF) * 60.; // convert back to seconds for (int iTrigger{0}; iTrigger < NTriggerAliases; ++iTrigger) { for (int iBCCategory{0}; iBCCategory < NBCCategories; ++iBCCategory) { - if (iBCCategory == BCSL) { // we do not do it for superleading because it is not easy to define the number of inspected BCs - continue; - } - float mu{0.}; - if (iBCCategory != BCL) { - mu = getMu(nTriggersPerDf[iTrigger][iBCCategory] / deltaTime, nBCs[0]); - } else { - mu = getMu(nTriggersPerDf[iTrigger][iBCCategory] / deltaTime, nBCs[1]); + if (doTypeBC->get(0u, iBCCategory)) { + float mu = getMu(nTriggersPerDf[iTrigger][iBCCategory], nBCs[iBCCategory]); + histMu[iTrigger][iBCCategory][runNumber]->Fill(mu); } - fillMuHistograms(iTrigger, iBCCategory, mu); } } } From 1ea968bc471e6da0ed1e7a5c78c99771da8f3338 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Mon, 16 Feb 2026 18:46:51 +0100 Subject: [PATCH 3/4] Remove unused delta time --- PWGMM/Lumi/Tasks/lumiStabilityPP.cxx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx index 6787f152f10..df03ca8fce1 100644 --- a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx +++ b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx @@ -298,7 +298,6 @@ struct LumiStabilityPP { int64_t globalBCIdOfLastBCWithActivityFDD{0}, globalBCIdOfLastBCWithActivityFT0{0}, globalBCLastInspectedBC{-1}; int nBCs[NBCCategories]; std::fill(&nBCs[0], &nBCs[0] + static_cast(NBCCategories), 0); // Initialize to 0 - float timeStartSinceSOF{-1.f}, timeStopSinceSOF{-1.f}; int nTriggersPerDf[NTriggerAliases][NBCCategories]; std::fill(&nTriggersPerDf[0][0], &nTriggersPerDf[0][0] + (static_cast(NTriggerAliases) * static_cast(NBCCategories)), 0); // Initialize to 0 double rate{-1.}; @@ -321,15 +320,8 @@ struct LumiStabilityPP { } float timeSinceSOF = getTimeSinceSOF(bc); - if (timeStartSinceSOF < 0.) { - timeStartSinceSOF = timeSinceSOF; - } - if (timeStopSinceSOF < timeSinceSOF) { - timeStopSinceSOF = timeSinceSOF; - } bool isTriggerTVX = (bc.has_ft0() ? TESTBIT(bc.ft0().triggerMask(), o2::ft0::Triggers::bitVertex) : false); - if (isTriggerTVX) { histNBcsVsTime[runNumber]->Fill(timeSinceSOF); int runVdM23Start{542757}; @@ -484,7 +476,6 @@ struct LumiStabilityPP { } } // fill histogram for mu - // float deltaTime = (timeStopSinceSOF - timeStartSinceSOF) * 60.; // convert back to seconds for (int iTrigger{0}; iTrigger < NTriggerAliases; ++iTrigger) { for (int iBCCategory{0}; iBCCategory < NBCCategories; ++iBCCategory) { if (doTypeBC->get(0u, iBCCategory)) { From 3743a5f3f23d41b1d9929b7ba6d74d42e27be546 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 16 Feb 2026 17:49:11 +0000 Subject: [PATCH 4/4] Please consider the following formatting changes --- PWGMM/Lumi/Tasks/lumiStabilityPP.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx index df03ca8fce1..e396704d338 100644 --- a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx +++ b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx @@ -28,9 +28,9 @@ #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" #include #include -#include "Framework/runDataProcessing.h" #include #include @@ -49,11 +49,11 @@ enum TriggerAliases { AllBCs = 0, FT0CE = 2, FDD = 3, NTriggerAliases }; -enum BCCategories { BCA = 0, // A side BCs (bunch-crossings that had beam only from A side) - BCB = 1, // B type BCs (bunch-crossings that had beam from both sides) - BCC = 2, // C side BCs (bunch-crossings that had beam only from C side) - BCE = 3, // empty BCs (bunch-crossings that did not have beam from either side) - BCL = 4, // leading BCs (bunch-crossings that did not have interacting bunches for a configurable number of preceding BCs) +enum BCCategories { BCA = 0, // A side BCs (bunch-crossings that had beam only from A side) + BCB = 1, // B type BCs (bunch-crossings that had beam from both sides) + BCC = 2, // C side BCs (bunch-crossings that had beam only from C side) + BCE = 3, // empty BCs (bunch-crossings that did not have beam from either side) + BCL = 4, // leading BCs (bunch-crossings that did not have interacting bunches for a configurable number of preceding BCs) BCSLFDD = 5, // super-leading BCs for FDD (bunch-crossings that had beam from both sides but did not have FDD activity for a configurable number of preceding BCs) BCSLFT0 = 6, // super-leading BCs for FT0 (bunch-crossings that had beam from both sides but did not have FT0 activity for a configurable number of preceding BCs) NBCCategories }; @@ -222,7 +222,7 @@ struct LumiStabilityPP { std::string_view injectionScheme = mLHCIFdata->getInjectionScheme(); size_t underScorePos = injectionScheme.find('_'); - size_t bPos = injectionScheme.find('b', underScorePos); + size_t bPos = injectionScheme.find('b', underScorePos); if (underScorePos != std::string_view::npos && bPos != std::string_view::npos && bPos > underScorePos) { std::string_view nBunchesFillingSchemeStr = injectionScheme.substr(underScorePos + 1, bPos - (underScorePos + 1)); nBunchesFillingScheme = std::stoi(std::string(nBunchesFillingSchemeStr)); @@ -360,7 +360,7 @@ struct LumiStabilityPP { if (globalBC - globalBCStart > maxBcDiff) { // we changed fill, we should not count all BCs between the current and the previous one globalBCStart = globalBC; } - for (int64_t iGlobalBC{globalBCStart}; iGlobalBC<=globalBC; ++iGlobalBC) { // we count all BCs in between one and another stored in the AO2Ds + for (int64_t iGlobalBC{globalBCStart}; iGlobalBC <= globalBC; ++iGlobalBC) { // we count all BCs in between one and another stored in the AO2Ds int iLocalBC = iGlobalBC % nBCsPerOrbit; if (bcPatternA[iLocalBC]) { nBCs[BCA]++;