Skip to content

Commit 32ee0ca

Browse files
committed
Correct timestamp rescaling per run
1 parent 9f5b665 commit 32ee0ca

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

PWGCF/Flow/TableProducer/zdcQVectors.cxx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ std::vector<float> v(3, 0); // vx, vy, vz
9999
bool isSelected = true;
100100
std::vector<float> cents; // centrality estimaters
101101
uint64_t timestamp = 0;
102+
double rsTimestamp = 0;
102103

103104
} // namespace o2::analysis::qvectortask
104105

@@ -529,7 +530,7 @@ struct ZdcQVectors {
529530
}
530531

531532
template <FillType ft>
532-
inline void fillCommonRegistry(double qxa, double qya, double qxc, double qyc, std::vector<float> v, double centrality)
533+
inline void fillCommonRegistry(double qxa, double qya, double qxc, double qyc, std::vector<float> v, double centrality, double rsTimestamp)
533534
{
534535
// loop for filling multiple histograms with different naming patterns
535536
// Always fill the uncentered "raw" Q-vector histos!
@@ -580,15 +581,15 @@ struct ZdcQVectors {
580581
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_QXC_vs_vz"), v[2], qya * qxc);
581582
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_QYC_vs_vz"), v[2], qxa * qyc);
582583

583-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qxa);
584-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qya);
585-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qxc);
586-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qyc);
584+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_vs_timestamp"), rsTimestamp, qxa);
585+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_vs_timestamp"), rsTimestamp, qya);
586+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXC_vs_timestamp"), rsTimestamp, qxc);
587+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYC_vs_timestamp"), rsTimestamp, qyc);
587588

588-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_QXC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qxa * qxc);
589-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_QYC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qya * qyc);
590-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_QXC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qya * qxc);
591-
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_QYC_vs_timestamp"), rescaleTimestamp(timestamp, runnumber), qxa * qyc);
589+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_QXC_vs_timestamp"), rsTimestamp, qxa * qxc);
590+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_QYC_vs_timestamp"), rsTimestamp, qya * qyc);
591+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQYA_QXC_vs_timestamp"), rsTimestamp, qya * qxc);
592+
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hQXA_QYC_vs_timestamp"), rsTimestamp, qxa * qyc);
592593

593594
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/ZNA_Qx_vs_Centrality"), centrality, qxa);
594595
registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/ZNA_Qy_vs_Centrality"), centrality, qya);
@@ -680,7 +681,7 @@ struct ZdcQVectors {
680681
bin = h->GetXaxis()->FindBin(TString::Format("%i", runnumber));
681682
}
682683
if (name.Contains("timestamp")) {
683-
bin = h->GetXaxis()->FindBin(rescaleTimestamp(timestamp, runnumber));
684+
bin = h->GetXaxis()->FindBin(rsTimestamp);
684685
}
685686
calibConstant = h->GetBinContent(bin);
686687
} else if (hist->InheritsFrom("THnSparse")) {
@@ -762,6 +763,7 @@ struct ZdcQVectors {
762763
registry.fill(HIST("hEventCount"), evSel_FilteredEvent);
763764

764765
timestamp = foundBC.timestamp();
766+
rsTimestamp = rescaleTimestamp(timestamp, runnumber);
765767

766768
if (!foundBC.has_zdc()) {
767769
isSelected = false;
@@ -1027,15 +1029,15 @@ struct ZdcQVectors {
10271029

10281030
if (cal.atIteration == 0) {
10291031
if (isSelected && cfgFillHistRegistry)
1030-
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality);
1032+
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality, rsTimestamp);
10311033

10321034
spTableZDC(runnumber, cents, v, foundBC.timestamp(), q[0], q[1], q[2], q[3], isSelected, eventSelectionFlags);
10331035
counter++;
10341036
lastRunNumber = runnumber;
10351037
return;
10361038
} else {
10371039
if (cfgFillHistRegistry)
1038-
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality);
1040+
fillCommonRegistry<kBefore>(q[0], q[1], q[2], q[3], v, centrality, rsTimestamp);
10391041

10401042
// vector of 4
10411043
std::vector<double> corrQxA;
@@ -1091,15 +1093,6 @@ struct ZdcQVectors {
10911093
}
10921094
}
10931095

1094-
if (isSelected && cfgFillHistRegistry && !cfgFillNothing) {
1095-
fillCommonRegistry<kAfter>(qRec[0], qRec[1], qRec[2], qRec[3], v, centrality);
1096-
registry.fill(HIST("QA/centrality_after"), centrality);
1097-
registry.get<TProfile>(HIST("QA/after/ZNA_Qx"))->Fill(Form("%d", runnumber), qRec[0]);
1098-
registry.get<TProfile>(HIST("QA/after/ZNA_Qy"))->Fill(Form("%d", runnumber), qRec[1]);
1099-
registry.get<TProfile>(HIST("QA/after/ZNC_Qx"))->Fill(Form("%d", runnumber), qRec[2]);
1100-
registry.get<TProfile>(HIST("QA/after/ZNC_Qy"))->Fill(Form("%d", runnumber), qRec[3]);
1101-
}
1102-
11031096
// do shift for psi.
11041097
double psiZDCA = 1.0 * std::atan2(qRec[1], qRec[0]);
11051098
double psiZDCC = 1.0 * std::atan2(qRec[3], qRec[2]);
@@ -1182,6 +1175,16 @@ struct ZdcQVectors {
11821175
double qXcShift = std::hypot(qRec[2], qRec[3]) * std::cos(psiZDCCshift);
11831176
double qYcShift = std::hypot(qRec[2], qRec[3]) * std::sin(psiZDCCshift);
11841177

1178+
if (isSelected && cfgFillHistRegistry && !cfgFillNothing) {
1179+
fillCommonRegistry<kAfter>(qRec[0], qRec[1], qRec[2], qRec[3], v, centrality, rsTimestamp);
1180+
registry.fill(HIST("QA/centrality_after"), centrality);
1181+
registry.get<TProfile>(HIST("QA/after/ZNA_Qx"))->Fill(Form("%d", runnumber), qRec[0]);
1182+
registry.get<TProfile>(HIST("QA/after/ZNA_Qy"))->Fill(Form("%d", runnumber), qRec[1]);
1183+
registry.get<TProfile>(HIST("QA/after/ZNC_Qx"))->Fill(Form("%d", runnumber), qRec[2]);
1184+
registry.get<TProfile>(HIST("QA/after/ZNC_Qy"))->Fill(Form("%d", runnumber), qRec[3]);
1185+
}
1186+
1187+
11851188
spTableZDC(runnumber, cents, v, foundBC.timestamp(), qXaShift, qYaShift, qXcShift, qYcShift, isSelected, eventSelectionFlags);
11861189
qRec.clear();
11871190

0 commit comments

Comments
 (0)