@@ -55,7 +55,8 @@ struct LumiStabilityTask {
5555 Configurable<int > nOrbitsPerTF{" nOrbitsPerTF" , 128 , " number of orbits per time frame" };
5656 Configurable<double > minOrbitConf{" minOrbitConf" , 0 , " minimum orbit" };
5757 Configurable<bool > is2022Data{" is2022Data" , true , " To 2022 data" };
58- Configurable<int > minEmpty{" minEmpty" , 5 , " number of BCs empty for leading BC" };
58+ Configurable<int > minEmpty{" minEmpty" , 13 , " number of BCs empty for leading BC" };
59+ Configurable<int > nBCsOffSet{" nBCsOffSet" , 7 , " number of BCs offset for FDD" };
5960
6061 Service<o2::ccdb::BasicCCDBManager> ccdb;
6162 parameters::GRPLHCIFData* grplhcif = nullptr ;
@@ -74,6 +75,7 @@ struct LumiStabilityTask {
7475 std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternA;
7576 std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternC;
7677 std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternB;
78+ std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternL;
7779 std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternE;
7880
7981 void init (InitContext const &)
@@ -287,6 +289,7 @@ struct LumiStabilityTask {
287289 bcPatternC = ~beamPatternA & beamPatternC;
288290 bcPatternB = beamPatternA & beamPatternC;
289291 bcPatternE = ~beamPatternA & ~beamPatternC;
292+ bcPatternL = beamPatternA & beamPatternC;
290293
291294 for (int i = 0 ; i < nBCsPerOrbit; i++) {
292295 if (bcPatternA[i]) {
@@ -297,18 +300,23 @@ struct LumiStabilityTask {
297300 }
298301 if (bcPatternB[i]) {
299302 histos.fill (HIST (" hBcB" ), i);
303+ }
304+ if (bcPatternL[i]) {
300305 bool isLeadBC = true ;
301306 for (int jbit = i - minEmpty; jbit < i; jbit++) {
302307 int kbit = jbit;
303308 if (kbit < 0 )
304309 kbit += nbin;
305- if (bcPatternB[kbit]) {
310+ if (!bcPatternE[kbit]) {
311+ bcPatternL[i] = false ;
306312 isLeadBC = false ;
307313 break ;
308314 }
309315 }
310- if (isLeadBC)
316+ if (isLeadBC) {
317+ // bcPatternL[i] = true;
311318 histos.fill (HIST (" hBcBL" ), i);
319+ }
312320 }
313321 if (bcPatternE[i]) {
314322 histos.fill (HIST (" hBcE" ), i);
@@ -379,8 +387,8 @@ struct LumiStabilityTask {
379387 }
380388
381389 if (trgFDD) {
382- histos.fill (HIST (" FDD/bcVertexTriggerCTP" ), localBC + 7 );
383- if (bcPatternB[localBC]) {
390+ histos.fill (HIST (" FDD/bcVertexTriggerCTP" ), localBC + nBCsOffSet );
391+ if (bcPatternB[localBC + nBCsOffSet ]) {
384392 histos.fill (HIST (" FDD/nBCsVsTime" ), timeSinceSOF);
385393 histos.fill (HIST (" FDD/hTimeForRateCTP" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
386394 }
@@ -398,30 +406,21 @@ struct LumiStabilityTask {
398406 histos.fill (HIST (" FV0/hTimeForRateCTP" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
399407 }
400408 }
401- bool isLeadBC = true ;
402- for (int jbit = localBC - minEmpty; jbit < localBC; jbit++) {
403- int kbit = jbit;
404- if (kbit < 0 )
405- kbit += nbin;
406- if (bcPatternB[kbit]) {
407- isLeadBC = false ;
408- break ;
409- }
410- }
411- if (isLeadBC) {
409+ if (bcPatternL[localBC + nBCsOffSet]) {
412410 if (trgFDD) {
413411 histos.fill (HIST (" FDD/nBCsVsTimeLeadingBC" ), timeSinceSOF);
414412 histos.fill (HIST (" FDD/hTimeForRateLeadingBCCTP" ), (bc.timestamp () - tsSOR) * 1 .e -3 );
415413 }
414+ }
415+ if (bcPatternL[localBC]) {
416416 if (trgFT0) {
417417 histos.fill (HIST (" FT0/nBCsVsTimeLeadingBC" ), timeSinceSOF);
418418 histos.fill (HIST (" FT0/hTimeForRateLeadingBCCTP" ), (bc.timestamp () - tsSOR) * 1 .e -3 );
419419 }
420420 if (trgFV0) {
421421 histos.fill (HIST (" FV0/hTimeForRateLeadingBCCTP" ), (bc.timestamp () - tsSOR) * 1 .e -3 );
422422 }
423- }
424- // }
423+ } // if over leading pattern
425424 } // loop over bcs
426425
427426 for (auto const & fdd : fdds) {
@@ -465,18 +464,9 @@ struct LumiStabilityTask {
465464
466465 if (bcPatternB[localBC]) {
467466 histos.fill (HIST (" FDD/hTimeForRate" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
468- bool isLeadBC = true ;
469- for (int jbit = localBC - minEmpty; jbit < localBC; jbit++) {
470- int kbit = jbit;
471- if (kbit < 0 )
472- kbit += nbin;
473- if (bcPatternB[kbit]) {
474- isLeadBC = false ;
475- break ;
476- }
477- }
478- if (isLeadBC)
479- histos.fill (HIST (" FDD/hTimeForRateLeadingBC" ), (bc.timestamp () - tsSOR) * 1 .e -3 );
467+ }
468+ if (bcPatternL[localBC]) {
469+ histos.fill (HIST (" FDD/hTimeForRateLeadingBC" ), (bc.timestamp () - tsSOR) * 1 .e -3 );
480470 }
481471
482472 int deltaIndex = 0 ; // backward move counts
@@ -514,18 +504,6 @@ struct LumiStabilityTask {
514504 if (bcPatternB[localBC]) {
515505 histos.fill (HIST (" FDD/timeACbcBVertex" ), fdd.timeA (), fdd.timeC ());
516506 histos.fill (HIST (" FDD/hBcBVertex" ), localBC);
517- bool isLeadBC = true ;
518- for (int jbit = localBC - minEmpty; jbit < localBC; jbit++) {
519- int kbit = jbit;
520- if (kbit < 0 )
521- kbit += nbin;
522- if (bcPatternB[kbit]) {
523- isLeadBC = false ;
524- break ;
525- }
526- }
527- if (isLeadBC)
528- histos.fill (HIST (" FDD/hBcBVertexL" ), localBC);
529507 histos.fill (HIST (" FDD/hTimeAVertex" ), fdd.timeA ());
530508 histos.fill (HIST (" FDD/hTimeCVertex" ), fdd.timeC ());
531509 if (is2022Data) {
@@ -555,6 +533,9 @@ struct LumiStabilityTask {
555533 }
556534 }
557535 }
536+ if (bcPatternL[localBC]) {
537+ histos.fill (HIST (" FDD/hBcBVertexL" ), localBC);
538+ }
558539 if (bcPatternE[localBC]) {
559540 histos.fill (HIST (" FDD/timeACbcEVertex" ), fdd.timeA (), fdd.timeC ());
560541 histos.fill (HIST (" FDD/hBcEVertex" ), localBC);
@@ -577,18 +558,6 @@ struct LumiStabilityTask {
577558 if (bcPatternB[localBC]) {
578559 histos.fill (HIST (" FDD/timeACbcB" ), fdd.timeA (), fdd.timeC ());
579560 histos.fill (HIST (" FDD/hBcB" ), localBC);
580- bool isLeadBC = true ;
581- for (int jbit = localBC - minEmpty; jbit < localBC; jbit++) {
582- int kbit = jbit;
583- if (kbit < 0 )
584- kbit += nbin;
585- if (bcPatternB[kbit]) {
586- isLeadBC = false ;
587- break ;
588- }
589- }
590- if (isLeadBC)
591- histos.fill (HIST (" FDD/hBcBL" ), localBC);
592561 histos.fill (HIST (" FDD/hTimeACoinc" ), fdd.timeA ());
593562 histos.fill (HIST (" FDD/hTimeCCoinc" ), fdd.timeC ());
594563 if (!is2022Data) {
@@ -618,6 +587,9 @@ struct LumiStabilityTask {
618587 }
619588 }
620589 }
590+ if (bcPatternL[localBC]) {
591+ histos.fill (HIST (" FDD/hBcBL" ), localBC);
592+ }
621593 if (bcPatternE[localBC]) {
622594 histos.fill (HIST (" FDD/timeACbcE" ), fdd.timeA (), fdd.timeC ());
623595 histos.fill (HIST (" FDD/hBcE" ), localBC);
@@ -738,20 +710,6 @@ struct LumiStabilityTask {
738710 histos.fill (HIST (" FT0/timeACbcB" ), ft0.timeA (), ft0.timeC ());
739711 histos.fill (HIST (" FT0/hBcB" ), localBC);
740712 histos.fill (HIST (" FT0/hTimeForRate" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
741- bool isLeadBC = true ;
742- for (int jbit = localBC - minEmpty; jbit < localBC; jbit++) {
743- int kbit = jbit;
744- if (kbit < 0 )
745- kbit += nbin;
746- if (bcPatternB[kbit]) {
747- isLeadBC = false ;
748- break ;
749- }
750- }
751- if (isLeadBC) {
752- histos.fill (HIST (" FT0/hTimeForRateLeadingBC" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
753- histos.fill (HIST (" FT0/hBcBL" ), localBC);
754- }
755713 histos.fill (HIST (" FT0/hTimeA" ), ft0.timeA ());
756714 histos.fill (HIST (" FT0/hTimeC" ), ft0.timeC ());
757715
@@ -780,6 +738,10 @@ struct LumiStabilityTask {
780738 histos.fill (HIST (" FT0/hValidTimevsBC" ), localBC);
781739 }
782740 }
741+ if (bcPatternL[localBC]) {
742+ histos.fill (HIST (" FT0/hTimeForRateLeadingBC" ), (bc.timestamp () - tsSOR) * 1 .e -3 ); // Converting ms into seconds
743+ histos.fill (HIST (" FT0/hBcBL" ), localBC);
744+ }
783745 if (bcPatternE[localBC]) {
784746 histos.fill (HIST (" FT0/timeACbcE" ), ft0.timeA (), ft0.timeC ());
785747 histos.fill (HIST (" FT0/hBcE" ), localBC);
0 commit comments