diff --git a/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx b/PWGMM/Lumi/Tasks/lumiStabilityPP.cxx index ee01dab084b..e396704d338 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" @@ -28,6 +29,8 @@ #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" +#include +#include #include #include @@ -46,12 +49,13 @@ 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) - BCSL = 5, // super-leading BCs (bunch-crossings that did not have FDD/FT0 activity 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 }; } // namespace lumi namespace aod @@ -99,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; @@ -118,7 +118,7 @@ struct LumiStabilityPP { int runNumber{-1}; bool isData23{false}; ctpRateFetcher mRateFetcher; - std::string injectionScheme; + int nBunchesFillingScheme; HistogramRegistry registry{"registry"}; @@ -135,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}"}; @@ -185,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}}); } } } @@ -222,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); @@ -270,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 @@ -286,19 +291,16 @@ 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}; - float timeStartSinceSOF{-1.f}, timeStopSinceSOF{-1.f}; + int64_t globalBCIdOfLastBCWithActivityFDD{0}, globalBCIdOfLastBCWithActivityFT0{0}, globalBCLastInspectedBC{-1}; + int nBCs[NBCCategories]; + std::fill(&nBCs[0], &nBCs[0] + static_cast(NBCCategories), 0); // Initialize to 0 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.}; 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); @@ -318,21 +320,13 @@ 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); - 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); @@ -340,22 +334,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; @@ -373,7 +400,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]); @@ -385,8 +412,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]) @@ -399,8 +428,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]) @@ -413,8 +444,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]) @@ -427,28 +460,28 @@ 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 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 != BCSL) { - 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); } } }