Skip to content

Commit 369184d

Browse files
cnkosteralibuild
andauthored
[PWGCF] zdcQVectors: Change procedure for getting shift correction from CCDB … (#13123)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent c749b9e commit 369184d

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

PWGCF/Flow/TableProducer/zdcQVectors.cxx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ struct ZdcQVectors {
191191

192192
TProfile3D* shiftprofileC = nullptr;
193193
TProfile3D* shiftprofileA = nullptr;
194-
195194
bool isShiftProfileFound = false;
196195

197196
} cal;
@@ -640,6 +639,10 @@ struct ZdcQVectors {
640639

641640
cal.calibfilesLoaded[2] = false;
642641
cal.calibList[2] = nullptr;
642+
643+
cal.isShiftProfileFound = false;
644+
cal.shiftprofileC = nullptr;
645+
cal.shiftprofileA = nullptr;
643646
}
644647

645648
const auto& zdcCol = foundBC.zdc();
@@ -922,19 +925,17 @@ struct ZdcQVectors {
922925
double deltaPsiZDCA = 0;
923926
double deltaPsiZDCC = 0;
924927

925-
if (!cfgCCDBdir_Shift.value.empty()) {
926-
if (lastRunNumber != runnumber) {
928+
if (!cfgCCDBdir_Shift.value.empty() && cal.isShiftProfileFound == false) {
929+
LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber);
930+
TList* hcorrList = ccdb->getForTimeStamp<TList>(cfgCCDBdir_Shift.value, foundBC.timestamp());
931+
cal.shiftprofileC = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
932+
cal.shiftprofileA = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
933+
if (!cal.shiftprofileC || !cal.shiftprofileA) {
934+
LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber);
927935
cal.isShiftProfileFound = false;
928-
LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber);
929-
TList* hcorrList = ccdb->getForTimeStamp<TList>(cfgCCDBdir_Shift.value, foundBC.timestamp());
930-
cal.shiftprofileC = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
931-
cal.shiftprofileA = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
932-
if (!cal.shiftprofileC || !cal.shiftprofileA) {
933-
LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber);
934-
} else {
935-
LOGF(error, "Shift profile found in CCDB for runnumber: %d", runnumber);
936-
cal.isShiftProfileFound = true;
937-
}
936+
} else {
937+
LOGF(info, "Shift profile found in CCDB for runnumber: %d", runnumber);
938+
cal.isShiftProfileFound = true;
938939
}
939940
}
940941

@@ -950,8 +951,8 @@ struct ZdcQVectors {
950951
float coeffshiftxZDCA = 0.0;
951952
float coeffshiftyZDCA = 0.0;
952953

953-
for (int ishift = 1; ishift <= nshift; ishift++) {
954-
if (cal.isShiftProfileFound) {
954+
if (cal.isShiftProfileFound) {
955+
for (int ishift = 1; ishift <= nshift; ishift++) {
955956
int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); // bin 0.5
956957
int binshiftyZDCC = cal.shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5);
957958
int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5);
@@ -965,9 +966,10 @@ struct ZdcQVectors {
965966
coeffshiftxZDCA = cal.shiftprofileA->GetBinContent(binshiftxZDCA);
966967
if (binshiftyZDCA > 0)
967968
coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA);
969+
970+
deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC)));
971+
deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA)));
968972
}
969-
deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC)));
970-
deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA)));
971973
}
972974

973975
psiZDCCshift += deltaPsiZDCC;

0 commit comments

Comments
 (0)