Skip to content

Commit f712ed3

Browse files
cnkosteralibuild
andauthored
[PWGCF] Fixed indices of corrections (AliceO2Group#10965)
Co-authored-by: ALICE Action Bot <[email protected]>
1 parent a87fcd3 commit f712ed3

File tree

2 files changed

+180
-110
lines changed

2 files changed

+180
-110
lines changed

PWGCF/Flow/TableProducer/zdcQVectors.cxx

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ double alphaZDC = 0.395;
8181

8282
// q-vectors before (q) and after (qRec) recentering.
8383
std::vector<double> q(4); // start values of [QxA, QyA, QxC, QyC]
84+
std::vector<double> qNoEq(4); // start values of [QxA, QyA, QxC, QyC]
8485

8586
// for energy calibration
8687
std::vector<double> eZN(8); // uncalibrated energy for the 2x4 towers (a1, a2, a3, a4, c1, c2, c3, c4)
@@ -129,7 +130,7 @@ struct ZdcQVectors {
129130
O2_DEFINE_CONFIGURABLE(cfgEnergyCal, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/Energy", "ccdb path for energy calibration histos")
130131
O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/vmean", "ccdb path for mean v histos")
131132
O2_DEFINE_CONFIGURABLE(cfgMinEntriesSparseBin, int, 100, "Minimal number of entries allowed in 4D recentering histogram to use for recentering.")
132-
O2_DEFINE_CONFIGURABLE(cfgRec, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass4/", "ccdb path for recentering histos");
133+
O2_DEFINE_CONFIGURABLE(cfgRec, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass4", "ccdb path for recentering histos");
133134
O2_DEFINE_CONFIGURABLE(cfgFillCommonRegistry, bool, true, "Fill common registry with histograms");
134135

135136
// Additional event selections
@@ -249,6 +250,16 @@ struct ZdcQVectors {
249250
registry.add<TProfile>("QA/before/ZNC_pm3", "ZNC_pm3", kTProfile, {{1, 0, 1.}});
250251
registry.add<TProfile>("QA/before/ZNC_pm4", "ZNC_pm4", kTProfile, {{1, 0, 1.}});
251252

253+
registry.add<TProfile>("QA/before/ZNA_Qx", "ZNA_Qx", kTProfile, {{1, 0, 1.}});
254+
registry.add<TProfile>("QA/before/ZNA_Qy", "ZNA_Qy", kTProfile, {{1, 0, 1.}});
255+
registry.add<TProfile>("QA/before/ZNC_Qx", "ZNC_Qx", kTProfile, {{1, 0, 1.}});
256+
registry.add<TProfile>("QA/before/ZNC_Qy", "ZNC_Qy", kTProfile, {{1, 0, 1.}});
257+
258+
registry.add<TProfile>("QA/before/ZNA_Qx_noEq", "ZNA_Qx_noEq", kTProfile, {{1, 0, 1.}});
259+
registry.add<TProfile>("QA/before/ZNA_Qy_noEq", "ZNA_Qy_noEq", kTProfile, {{1, 0, 1.}});
260+
registry.add<TProfile>("QA/before/ZNC_Qx_noEq", "ZNC_Qx_noEq", kTProfile, {{1, 0, 1.}});
261+
registry.add<TProfile>("QA/before/ZNC_Qy_noEq", "ZNC_Qy_noEq", kTProfile, {{1, 0, 1.}});
262+
252263
registry.addClone("QA/before/", "QA/after/");
253264
}
254265

@@ -418,6 +429,10 @@ struct ZdcQVectors {
418429
cal.calibList[cm] = ccdb->getForTimeStamp<TList>(ccdb_dir, timestamp);
419430
cal.calibfilesLoaded[cm] = true;
420431
LOGF(info, "Loaded calibration histos from %s", ccdb_dir.c_str());
432+
if (cm == kRec) {
433+
cal.atStep = 5;
434+
cal.atIteration = 5;
435+
}
421436
} else {
422437
LOGF(info, "No ccdb path given for calibration histos. Do not recenter.");
423438
}
@@ -437,7 +452,13 @@ struct ZdcQVectors {
437452
hist = reinterpret_cast<T*>(list->FindObject(Form("%s", objName)));
438453
} else if (cm == kRec) {
439454
TList* list = reinterpret_cast<TList*>(cal.calibList[cm]->FindObject(Form("it%i_step%i", iteration, step)));
455+
if (!list) {
456+
LOGF(fatal, "No calibration list for iteration %i and step %i", iteration, step);
457+
}
440458
hist = reinterpret_cast<T*>(list->FindObject(Form("%s", objName)));
459+
if (!hist) {
460+
LOGF(fatal, "No calibration histo for iteration %i and step %i -> %s", iteration, step, objName);
461+
}
441462
cal.atStep = step;
442463
cal.atIteration = iteration;
443464
}
@@ -501,9 +522,9 @@ struct ZdcQVectors {
501522
{
502523
// for Q-vector calculation
503524
// A[0] & C[1]
504-
std::vector<double> sumZN(2, 0.);
505-
std::vector<double> xEnZN(2, 0.);
506-
std::vector<double> yEnZN(2, 0.);
525+
std::vector<double> sumZN(2, 0.), sumZN_noEq(2, 0.);
526+
std::vector<double> xEnZN(2, 0.), xEnZN_noEq(2, 0.);
527+
std::vector<double> yEnZN(2, 0.), yEnZN_noEq(2, 0.);
507528

508529
isSelected = true;
509530

@@ -678,6 +699,12 @@ struct ZdcQVectors {
678699
sumZN[side] += energy;
679700
xEnZN[side] += (side == 0) ? -1.0 * pxZDC[sector] * energy : pxZDC[sector] * energy;
680701
yEnZN[side] += pyZDC[sector] * energy;
702+
703+
// Also calculate the Q-vector for the non-equalized energy
704+
double energyNoEq = std::pow(eZN[tower], alphaZDC);
705+
sumZN_noEq[side] += energyNoEq;
706+
xEnZN_noEq[side] += (side == 0) ? -1.0 * pxZDC[sector] * energyNoEq : pxZDC[sector] * energyNoEq;
707+
yEnZN_noEq[side] += pyZDC[sector] * energyNoEq;
681708
}
682709

683710
// "QXA", "QYA", "QXC", "QYC"
@@ -687,6 +714,10 @@ struct ZdcQVectors {
687714
q[i * 2] = xEnZN[i] / sumZN[i]; // for QXA[0] and QXC[2]
688715
q[i * 2 + 1] = yEnZN[i] / sumZN[i]; // for QYA[1] and QYC[3]
689716
}
717+
if (sumZN_noEq[i] > 0) {
718+
qNoEq[i * 2] = xEnZN_noEq[i] / sumZN_noEq[i]; // for QXA[0] and QXC[2]
719+
qNoEq[i * 2 + 1] = yEnZN_noEq[i] / sumZN_noEq[i]; // for QYA[1] and QYC[3]
720+
}
690721
}
691722

692723
if (cal.calibfilesLoaded[1]) {
@@ -701,10 +732,20 @@ struct ZdcQVectors {
701732

702733
std::vector<double> qRec(q);
703734

735+
registry.get<TProfile>(HIST("QA/before/ZNA_Qx"))->Fill(Form("%d", runnumber), q[0]);
736+
registry.get<TProfile>(HIST("QA/before/ZNA_Qy"))->Fill(Form("%d", runnumber), q[1]);
737+
registry.get<TProfile>(HIST("QA/before/ZNC_Qx"))->Fill(Form("%d", runnumber), q[2]);
738+
registry.get<TProfile>(HIST("QA/before/ZNC_Qy"))->Fill(Form("%d", runnumber), q[3]);
739+
740+
registry.get<TProfile>(HIST("QA/before/ZNA_Qx_noEq"))->Fill(Form("%d", runnumber), qNoEq[0]);
741+
registry.get<TProfile>(HIST("QA/before/ZNA_Qy_noEq"))->Fill(Form("%d", runnumber), qNoEq[1]);
742+
registry.get<TProfile>(HIST("QA/before/ZNC_Qx_noEq"))->Fill(Form("%d", runnumber), qNoEq[2]);
743+
registry.get<TProfile>(HIST("QA/before/ZNC_Qy_noEq"))->Fill(Form("%d", runnumber), qNoEq[3]);
744+
704745
if (cal.atIteration == 0) {
705-
if (isSelected)
706-
if (cfgFillCommonRegistry)
707-
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality);
746+
if (isSelected && cfgFillCommonRegistry)
747+
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality);
748+
708749
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0], q[1], q[2], q[3], isSelected, 0, 0);
709750
counter++;
710751
return;
@@ -720,21 +761,21 @@ struct ZdcQVectors {
720761

721762
int pb = 0;
722763

723-
int nIterations = 6;
764+
int nIterations = 5;
724765
int nSteps = 5;
725766

726-
for (int it = 1; it < nIterations; it++) {
727-
corrQxA.push_back(getCorrection<THnSparse, kRec>(names[0][0].Data(), it, 0));
728-
corrQyA.push_back(getCorrection<THnSparse, kRec>(names[0][1].Data(), it, 0));
729-
corrQxC.push_back(getCorrection<THnSparse, kRec>(names[0][2].Data(), it, 0));
730-
corrQyC.push_back(getCorrection<THnSparse, kRec>(names[0][3].Data(), it, 0));
767+
for (int it = 1; it <= nIterations; it++) {
768+
corrQxA.push_back(getCorrection<THnSparse, kRec>(names[0][0].Data(), it, 1));
769+
corrQyA.push_back(getCorrection<THnSparse, kRec>(names[0][1].Data(), it, 1));
770+
corrQxC.push_back(getCorrection<THnSparse, kRec>(names[0][2].Data(), it, 1));
771+
corrQyC.push_back(getCorrection<THnSparse, kRec>(names[0][3].Data(), it, 1));
731772
pb++;
732773

733-
for (int step = 1; step < nSteps; step++) {
734-
corrQxA.push_back(getCorrection<TProfile, kRec>(names[step][0].Data(), it, step));
735-
corrQyA.push_back(getCorrection<TProfile, kRec>(names[step][1].Data(), it, step));
736-
corrQxC.push_back(getCorrection<TProfile, kRec>(names[step][2].Data(), it, step));
737-
corrQyC.push_back(getCorrection<TProfile, kRec>(names[step][3].Data(), it, step));
774+
for (int step = 2; step <= nSteps; step++) {
775+
corrQxA.push_back(getCorrection<TProfile, kRec>(names[step - 1][0].Data(), it, step));
776+
corrQyA.push_back(getCorrection<TProfile, kRec>(names[step - 1][1].Data(), it, step));
777+
corrQxC.push_back(getCorrection<TProfile, kRec>(names[step - 1][2].Data(), it, step));
778+
corrQyC.push_back(getCorrection<TProfile, kRec>(names[step - 1][3].Data(), it, step));
738779
pb++;
739780
}
740781
}
@@ -746,10 +787,13 @@ struct ZdcQVectors {
746787
qRec[3] -= corrQyC[cor];
747788
}
748789

749-
if (isSelected) {
750-
if (cfgFillCommonRegistry)
751-
fillCommonRegistry<kAfter>(qRec[0], qRec[1], qRec[2], qRec[3], v, centrality);
790+
if (isSelected && cfgFillCommonRegistry) {
791+
fillCommonRegistry<kAfter>(qRec[0], qRec[1], qRec[2], qRec[3], v, centrality);
752792
registry.fill(HIST("QA/centrality_after"), centrality);
793+
registry.get<TProfile>(HIST("QA/after/ZNA_Qx"))->Fill(Form("%d", runnumber), qRec[0]);
794+
registry.get<TProfile>(HIST("QA/after/ZNA_Qy"))->Fill(Form("%d", runnumber), qRec[1]);
795+
registry.get<TProfile>(HIST("QA/after/ZNC_Qx"))->Fill(Form("%d", runnumber), qRec[2]);
796+
registry.get<TProfile>(HIST("QA/after/ZNC_Qy"))->Fill(Form("%d", runnumber), qRec[3]);
753797
}
754798

755799
spTableZDC(runnumber, centrality, v[0], v[1], v[2], qRec[0], qRec[1], qRec[2], qRec[3], isSelected, cal.atIteration, cal.atStep);

0 commit comments

Comments
 (0)