Skip to content

Commit 9579326

Browse files
cnkosteralibuild
andauthored
[PWGCF] Fill registry only when events are selected (#8940)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent bfd1b0b commit 9579326

File tree

2 files changed

+181
-131
lines changed

2 files changed

+181
-131
lines changed

PWGCF/Flow/TableProducer/zdcQVectors.cxx

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ struct ZdcQVectors {
176176
for (int step = 0; step < 6; step++) {
177177
registry.add<TH2>(Form("step%i/QA/hSPplaneA", step), "hSPplaneA", kTH2D, {{100, -4, 4}, axisCent10});
178178
registry.add<TH2>(Form("step%i/QA/hSPplaneC", step), "hSPplaneC", kTH2D, {{100, -4, 4}, axisCent10});
179+
registry.add<TH2>(Form("step%i/QA/hSPplaneFull", step), "hSPplaneFull", kTH2D, {{100, -4, 4}, axisCent10});
179180
for (const auto& side : sides) {
180181
hQxvsQy[step] = registry.add<TH2>(Form("step%i/hZN%s_Qx_vs_Qy", step, side), Form("hZN%s_Qx_vs_Qy", side), kTH2F, {axisQ, axisQ});
181182
}
@@ -328,6 +329,14 @@ struct ZdcQVectors {
328329
registry.fill(HIST("step0/QA/hQXC_vs_vz"), v[2], q[0][0][2]);
329330
registry.fill(HIST("step0/QA/hQYC_vs_vz"), v[2], q[0][0][3]);
330331

332+
// add psi!!
333+
double psiA = 1.0 * std::atan2(q[0][0][2], q[0][0][0]);
334+
registry.fill(HIST("step0/QA/hSPplaneA"), psiA, centrality, 1);
335+
double psiC = 1.0 * std::atan2(q[0][0][3], q[0][0][1]);
336+
registry.fill(HIST("step0/QA/hSPplaneC"), psiC, centrality, 1);
337+
double psiFull = 1.0 * std::atan2(q[0][0][2] + q[0][0][3], q[0][0][0] + q[0][0][1]);
338+
registry.fill(HIST("step0/QA/hSPplaneFull"), psiFull, centrality, 1);
339+
331340
static constexpr std::string_view SubDir[] = {"step1/", "step2/", "step3/", "step4/", "step5/"};
332341
static_for<0, 4>([&](auto Ind) {
333342
constexpr int Index = Ind.value;
@@ -361,11 +370,12 @@ struct ZdcQVectors {
361370
registry.fill(HIST(SubDir[Index]) + HIST("QA/hQXC_vs_vz"), v[2], q[iteration][indexRt][2]);
362371
registry.fill(HIST(SubDir[Index]) + HIST("QA/hQYC_vs_vz"), v[2], q[iteration][indexRt][3]);
363372

364-
// add psi!!
365-
double psiA = 1.0 * std::atan2(q[iteration][indexRt][2], q[iteration][indexRt][0]);
373+
psiA = 1.0 * std::atan2(q[iteration][indexRt][2], q[iteration][indexRt][0]);
366374
registry.fill(HIST(SubDir[Index]) + HIST("QA/hSPplaneA"), psiA, centrality, 1);
367-
double psiC = 1.0 * std::atan2(q[iteration][indexRt][3], q[iteration][indexRt][1]);
375+
psiC = 1.0 * std::atan2(q[iteration][indexRt][3], q[iteration][indexRt][1]);
368376
registry.fill(HIST(SubDir[Index]) + HIST("QA/hSPplaneC"), psiC, centrality, 1);
377+
psiFull = 1.0 * std::atan2(q[iteration][indexRt][2] + q[iteration][indexRt][3], q[iteration][indexRt][0] + q[iteration][indexRt][1]);
378+
registry.fill(HIST(SubDir[Index]) + HIST("QA/hSPplaneFull"), psiFull, centrality, 1);
369379
});
370380
}
371381

@@ -456,7 +466,7 @@ struct ZdcQVectors {
456466
} else if (hist->InheritsFrom("TProfile")) {
457467
TProfile* h = reinterpret_cast<TProfile*>(hist);
458468
TString name = h->GetName();
459-
int bin{};
469+
int bin;
460470
if (name.Contains("mean_vx"))
461471
bin = h->GetXaxis()->FindBin(v[0]);
462472
if (name.Contains("mean_vy"))
@@ -471,20 +481,17 @@ struct ZdcQVectors {
471481
} else if (hist->InheritsFrom("THnSparse")) {
472482
std::vector<int> sparsePars;
473483
THnSparseD* h = reinterpret_cast<THnSparseD*>(hist);
474-
if (step == 0 && iteration > 0) {
475-
// Axis(0) is runnuber, but we don't need this
476-
sparsePars.push_back(h->GetAxis(1)->FindBin(centrality));
477-
sparsePars.push_back(h->GetAxis(2)->FindBin(v[0]));
478-
sparsePars.push_back(h->GetAxis(3)->FindBin(v[1]));
479-
sparsePars.push_back(h->GetAxis(4)->FindBin(v[2]));
480-
}
484+
sparsePars.push_back(h->GetAxis(0)->FindBin(centrality));
485+
sparsePars.push_back(h->GetAxis(1)->FindBin(v[0]));
486+
sparsePars.push_back(h->GetAxis(2)->FindBin(v[1]));
487+
sparsePars.push_back(h->GetAxis(3)->FindBin(v[2]));
481488

482-
for (std::size_t i = 0; i < sparsePars.size() + 1; i++) {
483-
h->GetAxis(i + 1)->SetRange(sparsePars[i], sparsePars[i]);
489+
for (std::size_t i = 0; i < sparsePars.size(); i++) {
490+
h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]);
484491
}
485-
calibConstant = h->Projection(5)->GetMean();
492+
calibConstant = h->Projection(4)->GetMean();
486493

487-
if (h->Projection(sparsePars.size())->GetEntries() < cfgMinEntriesSparseBin) {
494+
if (h->Projection(4)->GetEntries() < cfgMinEntriesSparseBin) {
488495
LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)");
489496
calibConstant = 0;
490497
isSelected = false;
@@ -694,7 +701,8 @@ struct ZdcQVectors {
694701
if (cal.atIteration == 0) {
695702
if (counter < 1)
696703
LOGF(warning, "Calibation files missing!!! Output created with q-vectors right after energy gain eq. !!");
697-
fillAllRegistries(0, 0);
704+
if (isSelected)
705+
fillAllRegistries(0, 0);
698706
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0][0][0], q[0][0][1], q[0][0][2], q[0][0][3], isSelected, 0, 0);
699707
counter++;
700708
return;
@@ -722,8 +730,10 @@ struct ZdcQVectors {
722730

723731
if (counter < 1)
724732
LOGF(info, "Output created with q-vectors at iteration %i and step %i!!!!", cal.atIteration, cal.atStep + 1);
725-
fillAllRegistries(cal.atIteration, cal.atStep + 1);
726-
registry.fill(HIST("QA/centrality_after"), centrality);
733+
if (isSelected) {
734+
fillAllRegistries(cal.atIteration, cal.atStep + 1);
735+
registry.fill(HIST("QA/centrality_after"), centrality);
736+
}
727737
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[cal.atIteration][cal.atStep][0], q[cal.atIteration][cal.atStep][1], q[cal.atIteration][cal.atStep][2], q[cal.atIteration][cal.atStep][3], isSelected, cal.atIteration, cal.atStep);
728738
counter++;
729739
return;

0 commit comments

Comments
 (0)