Skip to content

Commit 9606ecf

Browse files
committed
new def od leading BC and addition of configurable for bc offset
1 parent 36d532b commit 9606ecf

File tree

1 file changed

+31
-68
lines changed

1 file changed

+31
-68
lines changed

PWGMM/Lumi/Tasks/lumiStability.cxx

Lines changed: 31 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -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,22 @@ 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]) {
410+
std::cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << "I am in the leading BC pattern" << std::endl;
412411
if (trgFDD) {
413412
histos.fill(HIST("FDD/nBCsVsTimeLeadingBC"), timeSinceSOF);
414413
histos.fill(HIST("FDD/hTimeForRateLeadingBCCTP"), (bc.timestamp() - tsSOR) * 1.e-3);
415414
}
415+
}
416+
if (bcPatternL[localBC]) {
416417
if (trgFT0) {
417418
histos.fill(HIST("FT0/nBCsVsTimeLeadingBC"), timeSinceSOF);
418419
histos.fill(HIST("FT0/hTimeForRateLeadingBCCTP"), (bc.timestamp() - tsSOR) * 1.e-3);
419420
}
420421
if (trgFV0) {
421422
histos.fill(HIST("FV0/hTimeForRateLeadingBCCTP"), (bc.timestamp() - tsSOR) * 1.e-3);
422423
}
423-
}
424-
// }
424+
} // if over leading pattern
425425
} // loop over bcs
426426

427427
for (auto const& fdd : fdds) {
@@ -465,18 +465,9 @@ struct LumiStabilityTask {
465465

466466
if (bcPatternB[localBC]) {
467467
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);
468+
}
469+
if (bcPatternL[localBC]) {
470+
histos.fill(HIST("FDD/hTimeForRateLeadingBC"), (bc.timestamp() - tsSOR) * 1.e-3);
480471
}
481472

482473
int deltaIndex = 0; // backward move counts
@@ -514,18 +505,6 @@ struct LumiStabilityTask {
514505
if (bcPatternB[localBC]) {
515506
histos.fill(HIST("FDD/timeACbcBVertex"), fdd.timeA(), fdd.timeC());
516507
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);
529508
histos.fill(HIST("FDD/hTimeAVertex"), fdd.timeA());
530509
histos.fill(HIST("FDD/hTimeCVertex"), fdd.timeC());
531510
if (is2022Data) {
@@ -555,6 +534,9 @@ struct LumiStabilityTask {
555534
}
556535
}
557536
}
537+
if (bcPatternL[localBC]) {
538+
histos.fill(HIST("FDD/hBcBVertexL"), localBC);
539+
}
558540
if (bcPatternE[localBC]) {
559541
histos.fill(HIST("FDD/timeACbcEVertex"), fdd.timeA(), fdd.timeC());
560542
histos.fill(HIST("FDD/hBcEVertex"), localBC);
@@ -577,18 +559,6 @@ struct LumiStabilityTask {
577559
if (bcPatternB[localBC]) {
578560
histos.fill(HIST("FDD/timeACbcB"), fdd.timeA(), fdd.timeC());
579561
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);
592562
histos.fill(HIST("FDD/hTimeACoinc"), fdd.timeA());
593563
histos.fill(HIST("FDD/hTimeCCoinc"), fdd.timeC());
594564
if (!is2022Data) {
@@ -618,6 +588,9 @@ struct LumiStabilityTask {
618588
}
619589
}
620590
}
591+
if (bcPatternL[localBC]) {
592+
histos.fill(HIST("FDD/hBcBL"), localBC);
593+
}
621594
if (bcPatternE[localBC]) {
622595
histos.fill(HIST("FDD/timeACbcE"), fdd.timeA(), fdd.timeC());
623596
histos.fill(HIST("FDD/hBcE"), localBC);
@@ -738,20 +711,6 @@ struct LumiStabilityTask {
738711
histos.fill(HIST("FT0/timeACbcB"), ft0.timeA(), ft0.timeC());
739712
histos.fill(HIST("FT0/hBcB"), localBC);
740713
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-
}
755714
histos.fill(HIST("FT0/hTimeA"), ft0.timeA());
756715
histos.fill(HIST("FT0/hTimeC"), ft0.timeC());
757716

@@ -780,6 +739,10 @@ struct LumiStabilityTask {
780739
histos.fill(HIST("FT0/hValidTimevsBC"), localBC);
781740
}
782741
}
742+
if (bcPatternL[localBC]) {
743+
histos.fill(HIST("FT0/hTimeForRateLeadingBC"), (bc.timestamp() - tsSOR) * 1.e-3); // Converting ms into seconds
744+
histos.fill(HIST("FT0/hBcBL"), localBC);
745+
}
783746
if (bcPatternE[localBC]) {
784747
histos.fill(HIST("FT0/timeACbcE"), ft0.timeA(), ft0.timeC());
785748
histos.fill(HIST("FT0/hBcE"), localBC);

0 commit comments

Comments
 (0)