Skip to content

Commit 75f9b04

Browse files
author
Nicolas Strangmann
committed
[PWGMM/LumiStability] Add ZDC QA and leading bunches based on foundFDD
1 parent bc00ec9 commit 75f9b04

File tree

1 file changed

+125
-22
lines changed

1 file changed

+125
-22
lines changed

PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx

Lines changed: 125 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct LumiStabilityLightIons {
4949
Configurable<bool> cfgDoBCC{"cfgDoBCC", false, "Create and fill histograms for the BCs of type C"};
5050
Configurable<bool> cfgDoBCE{"cfgDoBCE", false, "Create and fill histograms for the BCs of type E"};
5151
Configurable<bool> cfgDoBCL{"cfgDoBCL", false, "Create and fill histograms for leading BCs of type B"};
52+
Configurable<bool> cfgDoBCSL{"cfgDoBCSL", false, "Create and fill histograms for super-leading BCs (no preceding FT0/FDD activity) of type B"};
53+
54+
Configurable<bool> cfgRequireNoT0ForSLBC{"cfgRequireNoT0ForSLBC", false, "Require no T0 signal for definition of super leading BC (otherwise only no FDD)"};
5255

5356
Configurable<int> cfgEmptyBCsBeforeLeadingBC{"cfgEmptyBCsBeforeLeadingBC", 5, "Minimum number of empty BCs before a leading BC to identify it as such"};
5457

@@ -72,26 +75,28 @@ struct LumiStabilityLightIons {
7275
kFT0CE = 2,
7376
kFDD = 3,
7477
k1ZNC = 4 };
75-
const int nBCCategories = 5;
76-
enum BCCategories { kBCA = 0,
77-
kBCB = 1,
78-
kBCC = 2,
79-
kBCE = 3,
80-
kBCL = 4 };
81-
82-
static constexpr std::string_view NBCsVsTimeHistNames[5][5] =
83-
{{"AllBCs/BC_A/nBCsVsTime", "AllBCs/BC_B/nBCsVsTime", "AllBCs/BC_C/nBCsVsTime", "AllBCs/BC_E/nBCsVsTime", "AllBCs/BC_L/nBCsVsTime"},
84-
{"FT0VTx/BC_A/nBCsVsTime", "FT0VTx/BC_B/nBCsVsTime", "FT0VTx/BC_C/nBCsVsTime", "FT0VTx/BC_E/nBCsVsTime", "FT0VTx/BC_L/nBCsVsTime"},
85-
{"FT0CE/BC_A/nBCsVsTime", "FT0CE/BC_B/nBCsVsTime", "FT0CE/BC_C/nBCsVsTime", "FT0CE/BC_E/nBCsVsTime", "FT0CE/BC_L/nBCsVsTime"},
86-
{"FDD/BC_A/nBCsVsTime", "FDD/BC_B/nBCsVsTime", "FDD/BC_C/nBCsVsTime", "FDD/BC_E/nBCsVsTime", "FDD/BC_L/nBCsVsTime"},
87-
{"1ZNC/BC_A/nBCsVsTime", "1ZNC/BC_B/nBCsVsTime", "1ZNC/BC_C/nBCsVsTime", "1ZNC/BC_E/nBCsVsTime", "1ZNC/BC_L/nBCsVsTime"}};
88-
89-
static constexpr std::string_view NBCsVsBCIDHistNames[5][5] =
90-
{{"AllBCs/BC_A/nBCsVsBCID", "AllBCs/BC_B/nBCsVsBCID", "AllBCs/BC_C/nBCsVsBCID", "AllBCs/BC_E/nBCsVsBCID", "AllBCs/BC_L/nBCsVsBCID"},
91-
{"FT0VTx/BC_A/nBCsVsBCID", "FT0VTx/BC_B/nBCsVsBCID", "FT0VTx/BC_C/nBCsVsBCID", "FT0VTx/BC_E/nBCsVsBCID", "FT0VTx/BC_L/nBCsVsBCID"},
92-
{"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID"},
93-
{"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID"},
94-
{"1ZNC/BC_A/nBCsVsBCID", "1ZNC/BC_B/nBCsVsBCID", "1ZNC/BC_C/nBCsVsBCID", "1ZNC/BC_E/nBCsVsBCID", "1ZNC/BC_L/nBCsVsBCID"}};
78+
79+
const int nBCCategories = 6;
80+
enum BCCategories { kBCA = 0, // A side BCs (bunch-crossings that had beam only from A side)
81+
kBCB = 1, // B type BCs (bunch-crossings that had beam from both sides)
82+
kBCC = 2, // C side BCs (bunch-crossings that had beam only from C side)
83+
kBCE = 3, // empty BCs (bunch-crossings that did not have beam from either side)
84+
kBCL = 4, // leading BCs (bunch-crossings that did not have interacting bunches for a configurable number of preceding BCs)
85+
kBCSL = 5 }; // super-leading BCs (bunch-crossings that did not have FDD/FT0 activity for a configurable number of preceding BCs)
86+
87+
static constexpr std::string_view NBCsVsTimeHistNames[5][6] =
88+
{{"AllBCs/BC_A/nBCsVsTime", "AllBCs/BC_B/nBCsVsTime", "AllBCs/BC_C/nBCsVsTime", "AllBCs/BC_E/nBCsVsTime", "AllBCs/BC_L/nBCsVsTime", "AllBCs/BC_SL/nBCsVsTime"},
89+
{"FT0VTx/BC_A/nBCsVsTime", "FT0VTx/BC_B/nBCsVsTime", "FT0VTx/BC_C/nBCsVsTime", "FT0VTx/BC_E/nBCsVsTime", "FT0VTx/BC_L/nBCsVsTime", "FT0VTx/BC_SL/nBCsVsTime"},
90+
{"FT0CE/BC_A/nBCsVsTime", "FT0CE/BC_B/nBCsVsTime", "FT0CE/BC_C/nBCsVsTime", "FT0CE/BC_E/nBCsVsTime", "FT0CE/BC_L/nBCsVsTime", "FT0CE/BC_SL/nBCsVsTime"},
91+
{"FDD/BC_A/nBCsVsTime", "FDD/BC_B/nBCsVsTime", "FDD/BC_C/nBCsVsTime", "FDD/BC_E/nBCsVsTime", "FDD/BC_L/nBCsVsTime", "FDD/BC_SL/nBCsVsTime"},
92+
{"1ZNC/BC_A/nBCsVsTime", "1ZNC/BC_B/nBCsVsTime", "1ZNC/BC_C/nBCsVsTime", "1ZNC/BC_E/nBCsVsTime", "1ZNC/BC_L/nBCsVsTime", "1ZNC/BC_SL/nBCsVsTime"}};
93+
94+
static constexpr std::string_view NBCsVsBCIDHistNames[5][6] =
95+
{{"AllBCs/BC_A/nBCsVsBCID", "AllBCs/BC_B/nBCsVsBCID", "AllBCs/BC_C/nBCsVsBCID", "AllBCs/BC_E/nBCsVsBCID", "AllBCs/BC_L/nBCsVsBCID", "AllBCs/BC_SL/nBCsVsBCID"},
96+
{"FT0VTx/BC_A/nBCsVsBCID", "FT0VTx/BC_B/nBCsVsBCID", "FT0VTx/BC_C/nBCsVsBCID", "FT0VTx/BC_E/nBCsVsBCID", "FT0VTx/BC_L/nBCsVsBCID", "FT0VTx/BC_SL/nBCsVsBCID"},
97+
{"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID", "FT0CE/BC_SL/nBCsVsBCID"},
98+
{"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID", "FDD/BC_SL/nBCsVsBCID"},
99+
{"1ZNC/BC_A/nBCsVsBCID", "1ZNC/BC_B/nBCsVsBCID", "1ZNC/BC_C/nBCsVsBCID", "1ZNC/BC_E/nBCsVsBCID", "1ZNC/BC_L/nBCsVsBCID", "1ZNC/BC_SL/nBCsVsBCID"}};
95100

96101
int64_t bcSOR;
97102
int nBCsPerTF;
@@ -103,7 +108,7 @@ struct LumiStabilityLightIons {
103108

104109
LOG(info) << "strLPMProductionTag: " << strLPMProductionTag;
105110

106-
AxisSpec timeAxis{1200, 0., 1200., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{3600, 0., 3600., "#bf{BC ID in orbit}"};
111+
AxisSpec timeAxis{1440, 0., 1440., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{3600, 0., 3600., "#bf{BC ID in orbit}"};
107112

108113
for (int iTrigger = 0; iTrigger < nTriggers; iTrigger++) {
109114
if ((iTrigger == kAllBCs) || (iTrigger == kFT0Vtx && cfgDoFT0Vtx) || (iTrigger == kFT0CE && cfgDoFT0CE) || (iTrigger == kFDD && cfgDoFDD) || (iTrigger == k1ZNC && cfgDo1ZNC)) {
@@ -113,12 +118,42 @@ struct LumiStabilityLightIons {
113118
mHistManager.add(Form("%s", std::string(NBCsVsBCIDHistNames[iTrigger][iBCCategory]).c_str()), "BC ID of triggered BCs;#bf{BC ID in orbit};#bf{#it{N}_{BC}}", HistType::kTH1D, {bcIDAxis});
114119
}
115120
}
121+
if (cfgDoBCSL && (iTrigger == kFT0Vtx || iTrigger == kFDD)) { // only for FT0Vtx and FDD fill super-leading BC histograms
122+
mHistManager.add(Form("%s", std::string(NBCsVsTimeHistNames[iTrigger][5]).c_str()), "Time of triggered BCs since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1D, {timeAxis});
123+
mHistManager.add(Form("%s", std::string(NBCsVsBCIDHistNames[iTrigger][5]).c_str()), "BC ID of triggered BCs;#bf{BC ID in orbit};#bf{#it{N}_{BC}}", HistType::kTH1D, {bcIDAxis});
124+
}
116125
}
117126
}
118127

128+
if (cfgDoBCSL) {
129+
mHistManager.add("FITQA/BCHasFT0", "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}});
130+
mHistManager.get<TH2>(HIST("FITQA/BCHasFT0")).get()->GetYaxis()->SetBinLabel(1, "No CTP trigger");
131+
mHistManager.get<TH2>(HIST("FITQA/BCHasFT0")).get()->GetYaxis()->SetBinLabel(2, "CTP triggered");
132+
mHistManager.get<TH2>(HIST("FITQA/BCHasFT0")).get()->GetXaxis()->SetBinLabel(1, "No found FT0");
133+
mHistManager.get<TH2>(HIST("FITQA/BCHasFT0")).get()->GetXaxis()->SetBinLabel(2, "Found FT0");
134+
mHistManager.add("FITQA/BCHasFDD", "Does the BC have FDD?;BC has FDD;FDD triggered according to CTP;#bf{#it{N}_{BC}}", HistType::kTH2D, {{2, -0.5, 1.5}, {2, -0.5, 1.5}});
135+
mHistManager.get<TH2>(HIST("FITQA/BCHasFDD")).get()->GetYaxis()->SetBinLabel(1, "No CTP trigger");
136+
mHistManager.get<TH2>(HIST("FITQA/BCHasFDD")).get()->GetYaxis()->SetBinLabel(2, "CTP triggered");
137+
mHistManager.get<TH2>(HIST("FITQA/BCHasFDD")).get()->GetXaxis()->SetBinLabel(1, "No found FDD");
138+
mHistManager.get<TH2>(HIST("FITQA/BCHasFDD")).get()->GetXaxis()->SetBinLabel(2, "Found FDD");
139+
}
140+
119141
mHistManager.add("FT0Vtx_EvSel/nBCsVsTime", "Time of TVX triggered BCs since the start of fill;;#bf{#it{N}_{BC}}", HistType::kTH1D, {timeAxis});
120142
mHistManager.add("nBCsVsBCID", "Time of TVX triggered BCs since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1D, {bcIDAxis});
121143
mHistManager.add("TFsPerMinute", "TFs seen in this minute (to account for failed jobs);#bf{t-t_{SOF} (min)};#bf{#it{N}_{TFs}}", HistType::kTH1D, {timeAxis});
144+
145+
if (cfgDo1ZNC) {
146+
AxisSpec zdcTimeAxis{200, -50., 50.};
147+
mHistManager.add("ZDCQA/BCHasZDC", "Does the BC have ZDC?;BC has ZDC;Has ZNC according to CTP;#bf{#it{N}_{BC}}", HistType::kTH2D, {{2, -0.5, 1.5}, {2, -0.5, 1.5}});
148+
mHistManager.get<TH2>(HIST("ZDCQA/BCHasZDC")).get()->GetYaxis()->SetBinLabel(1, "No CTP trigger");
149+
mHistManager.get<TH2>(HIST("ZDCQA/BCHasZDC")).get()->GetYaxis()->SetBinLabel(2, "CTP triggered");
150+
mHistManager.get<TH2>(HIST("ZDCQA/BCHasZDC")).get()->GetXaxis()->SetBinLabel(1, "No found ZDC");
151+
mHistManager.get<TH2>(HIST("ZDCQA/BCHasZDC")).get()->GetXaxis()->SetBinLabel(2, "Good ZDC");
152+
mHistManager.add("ZDCQA/ZNCTimeVsEnergy", "ZDC properties in BCs with found ZDC;Energy;#bf{ZNC arrival time (ns)};#bf{#it{N}_{BC}}", HistType::kTH2D, {{1501, -10, 1.5E4}, zdcTimeAxis});
153+
mHistManager.add("ZDCQA/ZDCTimes", "Correlation between ZNA and ZNC timing;#bf{ZNC arrival time (ns)};#bf{ZNA arrival time (ns)}", HistType::kTH2D, {zdcTimeAxis, zdcTimeAxis});
154+
mHistManager.add("ZDCQA/ZNATime", "Time of the ZNA signal;#bf{ZNA arrival time (ns)};#bf{#it{N}_{BC}}", HistType::kTH1D, {zdcTimeAxis});
155+
mHistManager.add("ZDCQA/ZNCTime", "Time of the ZNC signal;#bf{ZNC arrival time (ns)};#bf{#it{N}_{BC}}", HistType::kTH1D, {zdcTimeAxis});
156+
}
122157
}
123158

124159
void setLHCIFData(const auto& bc)
@@ -188,6 +223,74 @@ struct LumiStabilityLightIons {
188223
mHistManager.fill(HIST(NBCsVsBCIDHistNames[iTrigger][iBCCategory]), localBC);
189224
}
190225

226+
void processZDCQA(MyBCs const& bcs, aod::Zdcs const&)
227+
{
228+
for (const auto& bc : bcs) {
229+
230+
std::bitset<64> ctpInputMask(bc.inputMask());
231+
232+
bool zdcHit = !bc.has_zdc() ? 0 : ((bc.zdc().energyCommonZNC() > -1 && std::abs(bc.zdc().timeZNC()) < 1E5) ? 1 : 0);
233+
mHistManager.fill(HIST("ZDCQA/BCHasZDC"), zdcHit, ctpInputMask.test(25) ? 1 : 0);
234+
if (!bc.has_zdc())
235+
continue;
236+
237+
mHistManager.fill(HIST("ZDCQA/ZNCTimeVsEnergy"), bc.zdc().energyCommonZNC() > -2 ? bc.zdc().energyCommonZNC() : -1, std::abs(bc.zdc().timeZNC()) < 50 ? bc.zdc().timeZNC() : 42.f);
238+
239+
float timeZNA = bc.zdc().timeZNA();
240+
float timeZNC = bc.zdc().timeZNC();
241+
242+
if (std::abs(timeZNA) > 50) {
243+
timeZNA = 42.f; // set dummy value for missing ZDC times to be able to plot them
244+
mHistManager.fill(HIST("ZDCQA/ZNCTime"), timeZNC);
245+
}
246+
if (std::abs(timeZNC) > 50) {
247+
timeZNC = 42.f; // set dummy value for missing ZDC times to be able to plot them
248+
if (timeZNA != 42.f) // If ZNA and ZNC are both missing, do not fill the ZNA histogram with the dummy value
249+
mHistManager.fill(HIST("ZDCQA/ZNATime"), timeZNA);
250+
}
251+
252+
mHistManager.fill(HIST("ZDCQA/ZDCTimes"), timeZNA, timeZNC);
253+
}
254+
}
255+
PROCESS_SWITCH(LumiStabilityLightIons, processZDCQA, "process QA for the ZDC triggers (light ions and PbPb)", false);
256+
257+
void processSLBunches(MyBCs const& bcs, aod::FT0s const&, aod::FDDs const&)
258+
{
259+
int64_t globalBCIdOfLastBCWithActivity = 0;
260+
for (const auto& bc : bcs) {
261+
if (bc.timestamp() == 0)
262+
continue;
263+
264+
setLHCIFData(bc);
265+
266+
std::bitset<64> ctpInputMask(bc.inputMask());
267+
268+
mHistManager.fill(HIST("FITQA/BCHasFT0"), bc.has_ft0(), ctpInputMask.test(2));
269+
mHistManager.fill(HIST("FITQA/BCHasFDD"), bc.has_fdd(), ctpInputMask.test(15));
270+
271+
int64_t globalBC = bc.globalBC();
272+
273+
if (globalBC - globalBCIdOfLastBCWithActivity < cfgEmptyBCsBeforeLeadingBC)
274+
continue; // not a super-leading BC
275+
276+
if (bc.has_fdd() || (cfgRequireNoT0ForSLBC && bc.has_ft0()))
277+
globalBCIdOfLastBCWithActivity = globalBC;
278+
279+
float timeSinceSOF = getTimeSinceSOF(bc);
280+
281+
int localBC = globalBC % nBCsPerOrbit;
282+
283+
if (!bcPatternB[localBC])
284+
continue;
285+
286+
if (ctpInputMask.test(2))
287+
fillHistograms<kFT0Vtx, kBCSL>(timeSinceSOF, localBC);
288+
if (ctpInputMask.test(15))
289+
fillHistograms<kFDD, kBCSL>(timeSinceSOF, localBC);
290+
}
291+
}
292+
PROCESS_SWITCH(LumiStabilityLightIons, processSLBunches, "process trigger counting of TVX and FDD for bunches without preceding single-arm activity", false);
293+
191294
void process(MyBCs const& bcs, aod::FT0s const&)
192295
{
193296
for (const auto& bc : bcs) {
@@ -216,7 +319,7 @@ struct LumiStabilityLightIons {
216319

217320
for (int iTrigger = 0; iTrigger < nTriggers; iTrigger++) {
218321
if ((iTrigger == kAllBCs) || (iTrigger == kFT0Vtx && cfgDoFT0Vtx) || (iTrigger == kFT0CE && cfgDoFT0CE) || (iTrigger == kFDD && cfgDoFDD) || (iTrigger == k1ZNC && cfgDo1ZNC)) {
219-
for (int iBCCategory = 0; iBCCategory < nBCCategories; iBCCategory++) {
322+
for (int iBCCategory = 0; iBCCategory < nBCCategories - 1; iBCCategory++) { // Don't do SL BCs here
220323
if ((iBCCategory == kBCA && cfgDoBCA) || (iBCCategory == kBCB && cfgDoBCB) || (iBCCategory == kBCC && cfgDoBCC) || (iBCCategory == kBCE && cfgDoBCE) || (iBCCategory == kBCL && cfgDoBCL)) {
221324
if (iTrigger == kAllBCs) {
222325
if (iBCCategory == kBCA && bcPatternA[localBC])

0 commit comments

Comments
 (0)