@@ -107,6 +107,7 @@ struct LumiStabilityPP {
107107 Configurable<bool > doBCSL{" doBCSL" , false , " Create and fill histograms for super-leading BCs (no preceding FT0/FDD activity) of type B" };
108108 Configurable<int > numEmptyBCsBeforeLeadingBC{" numEmptyBCsBeforeLeadingBC" , 5 , " Number of empty BCs before a leading BC" };
109109 Configurable<bool > requireNoT0ForSLBC{" requireNoT0ForSLBC" , false , " Require no T0 signal for definition of super leading BC (otherwise only no FDD)" };
110+ Configurable<int > bcShiftFDDForData2023{" bcShiftFDDForData2023" , -15 , " Number of bc to shift for FDD to be applied for 2023 data only" };
110111
111112 std::bitset<o2::constants::lhc::LHCMaxBunches> beamPatternA, beamPatternC;
112113 std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternA, bcPatternC, bcPatternB, bcPatternE, bcPatternL;
@@ -128,6 +129,7 @@ struct LumiStabilityPP {
128129 std::map<int , std::shared_ptr<TH1>> histBcHasFDD;
129130 std::map<int , std::shared_ptr<TH1>> histFillingScheme;
130131 std::map<int , std::shared_ptr<TH1>> histFillTime;
132+ std::map<int , std::shared_ptr<TH1>> histInteractionRate;
131133
132134 static constexpr std::string_view NBCsVsTimeHistNames[NTriggerAliases][NBCCategories] =
133135 {{" AllBCs/BC_A/nBCsVsTime" , " AllBCs/BC_B/nBCsVsTime" , " AllBCs/BC_C/nBCsVsTime" , " AllBCs/BC_E/nBCsVsTime" , " AllBCs/BC_L/nBCsVsTime" , " AllBCs/BC_SL/nBCsVsTime" },
@@ -160,6 +162,7 @@ struct LumiStabilityPP {
160162 histTfPerMin[runNumber] = registry.add <TH1>(Form (" %d/TFsPerMinute" , runNumber), " TFs seen in this minute (to account for failed jobs);#bf{t-t_{SOF} (min)};#bf{#it{N}_{TFs}}" , HistType::kTH1D , {timeAxis});
161163 histFillingScheme[runNumber] = registry.add <TH1>(Form (" %d/FillingScheme" , runNumber), " Filling Scheme;Filling Scheme;" , HistType::kTH1D , {{1 , 0 , 1 }});
162164 histFillTime[runNumber] = registry.add <TH1>(Form (" %d/FillTime" , runNumber), " Fill time;Fill time;" , HistType::kTH1D , {{1 , 0 , 1 }});
165+ histInteractionRate[runNumber] = registry.add <TH1>(Form (" %d/InteractionRate" , runNumber), " Interaction rate (kHz);Interaction rate (kHz);" , HistType::kTH1D , {{3000 , 0 ., 3000 .}});
163166
164167 histBcHasFT0[runNumber] = registry.add <TH2>(Form (" %d/FITQA/BCHasFT0" , runNumber), " Does the BC have FT0?;BC has FT0;TVX triggered according to CTP;#bf{#it{N}_{BC}}" , HistType::kTH2D , {{2 , -0.5 , 1.5 }, {2 , -0.5 , 1.5 }});
165168 histBcHasFT0[runNumber]->GetYaxis ()->SetBinLabel (1 , " No CTP trigger" );
@@ -182,10 +185,17 @@ struct LumiStabilityPP {
182185 }
183186 }
184187
185- void setLHCIFData (const auto & bc)
188+ bool setLHCIFData (const auto & bc)
186189 {
190+ bool isData23{false };
191+ const int runStart2023{535069 };
192+ const int runStop2023{539908 };
193+ if (bc.runNumber () >= runStart2023 && bc.runNumber () <= runStop2023) {
194+ isData23 = true ;
195+ }
196+
187197 if (runNumber == bc.runNumber ()) {
188- return ;
198+ return isData23 ;
189199 }
190200
191201 auto & ccdbMgr = o2::ccdb::BasicCCDBManager::instance ();
@@ -241,7 +251,7 @@ struct LumiStabilityPP {
241251 LOG (info) << " BC SOR: " << bcSOR << " (orbit SOR: " << runInfo.orbitSOR << " ) NBCs per orbit: " << nBCsPerOrbit;
242252 nBCsPerTF = runInfo.orbitsPerTF * nBCsPerOrbit; // duration of TF in bcs
243253
244- return ;
254+ return isData23 ;
245255 }
246256
247257 float getTimeSinceSOF (const auto & bc)
@@ -267,24 +277,37 @@ struct LumiStabilityPP {
267277 continue ;
268278 }
269279
270- setLHCIFData (bc);
280+ bool isData23 = setLHCIFData (bc);
281+ BCsWithTimeStamps::iterator bcFDD;
282+ auto idxBc = bc.globalIndex ()
283+ if (isData23) {
284+ if (idxBc < bcShiftFDDForData2023) { // we need to skip the first 15 because of the FDD-FT0 shift
285+ continue ;
286+ }
287+ bcFDD = bcs.rawIteratorAt (idxBc - bcShiftFDDForData2023);
288+ } else {
289+ bcFDD = bc;
290+ }
271291
272292 float timeSinceSOF = getTimeSinceSOF (bc);
273293 bool isTriggerTVX = (bc.has_ft0 () ? TESTBIT (bc.ft0 ().triggerMask (), o2::ft0::Triggers::bitVertex) : false );
274294
275295 if (isTriggerTVX) {
276296 histNBcsVsTime[runNumber]->Fill (timeSinceSOF);
297+ histInteractionRate[runNumber]->Fill (mRateFetcher .fetch (ccdbMgr, bc.timestamp (), bc.runNumber (), std::string (" T0VTX" ), true ));
277298 }
278299
279300 int64_t globalBC = bc.globalBC ();
301+ int64_t globalBCFDD = bcFDD.globalBC ();
280302 int localBC = globalBC % nBCsPerOrbit;
303+ int localBCFDD = globalBCFDD % nBCsPerOrbit;
281304
282305 bool isSuperLeadingBc{true };
283306 if (globalBC - globalBCIdOfLastBCWithActivity < numEmptyBCsBeforeLeadingBC) {
284307 isSuperLeadingBc = false ; // not a super-leading BC
285308 }
286309
287- if (bc .has_fdd () || (requireNoT0ForSLBC && bc.has_ft0 ())) {
310+ if (bcFDD .has_fdd () || (requireNoT0ForSLBC && bc.has_ft0 ())) {
288311 globalBCIdOfLastBCWithActivity = globalBC;
289312 }
290313
@@ -300,9 +323,10 @@ struct LumiStabilityPP {
300323 }
301324
302325 std::bitset<64 > ctpInputMask (bc.inputMask ());
326+ std::bitset<64 > ctpInputMaskFDD (bcFDD.inputMask ());
303327
304328 histBcHasFT0[runNumber]->Fill (bc.has_ft0 (), ctpInputMask.test (2 ));
305- histBcHasFDD[runNumber]->Fill (bc .has_fdd (), ctpInputMask .test (15 ));
329+ histBcHasFDD[runNumber]->Fill (bcFDD .has_fdd (), ctpInputMaskFDD .test (15 ));
306330
307331 for (int iTrigger{0 }; iTrigger < NTriggerAliases; ++iTrigger) {
308332 for (int iBCCategory{0 }; iBCCategory < NBCCategories; ++iBCCategory) {
@@ -349,19 +373,19 @@ struct LumiStabilityPP {
349373 if (iBCCategory == BCSL && isSuperLeadingBc)
350374 fillHistograms<FT0CE, BCSL>(timeSinceSOF, localBC);
351375 }
352- if (iTrigger == FDD && ctpInputMask .test (15 )) {
353- if (iBCCategory == BCA && bcPatternA[localBC ])
354- fillHistograms<FDD, BCA>(timeSinceSOF, localBC );
355- if (iBCCategory == BCB && bcPatternB[localBC ])
356- fillHistograms<FDD, BCB>(timeSinceSOF, localBC );
357- if (iBCCategory == BCC && bcPatternC[localBC ])
358- fillHistograms<FDD, BCC>(timeSinceSOF, localBC );
359- if (iBCCategory == BCE && bcPatternE[localBC ])
360- fillHistograms<FDD, BCE>(timeSinceSOF, localBC );
361- if (iBCCategory == BCL && bcPatternL[localBC ])
362- fillHistograms<FDD, BCL>(timeSinceSOF, localBC );
376+ if (iTrigger == FDD && ctpInputMaskFDD .test (15 )) {
377+ if (iBCCategory == BCA && bcPatternA[localBCFDD ])
378+ fillHistograms<FDD, BCA>(timeSinceSOF, localBCFDD );
379+ if (iBCCategory == BCB && bcPatternB[localBCFDD ])
380+ fillHistograms<FDD, BCB>(timeSinceSOF, localBCFDD );
381+ if (iBCCategory == BCC && bcPatternC[localBCFDD ])
382+ fillHistograms<FDD, BCC>(timeSinceSOF, localBCFDD );
383+ if (iBCCategory == BCE && bcPatternE[localBCFDD ])
384+ fillHistograms<FDD, BCE>(timeSinceSOF, localBCFDD );
385+ if (iBCCategory == BCL && bcPatternL[localBCFDD ])
386+ fillHistograms<FDD, BCL>(timeSinceSOF, localBCFDD );
363387 if (iBCCategory == BCSL && isSuperLeadingBc)
364- fillHistograms<FDD, BCSL>(timeSinceSOF, localBC );
388+ fillHistograms<FDD, BCSL>(timeSinceSOF, localBCFDD );
365389 }
366390 }
367391 }
0 commit comments