Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions PWGCF/Flow/TableProducer/zdcQVectors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ struct ZdcQVectors {

TProfile3D* shiftprofileC = nullptr;
TProfile3D* shiftprofileA = nullptr;

bool isShiftProfileFound = false;

} cal;
Expand Down Expand Up @@ -640,6 +639,10 @@ struct ZdcQVectors {

cal.calibfilesLoaded[2] = false;
cal.calibList[2] = nullptr;

cal.isShiftProfileFound = false;
cal.shiftprofileC = nullptr;
cal.shiftprofileA = nullptr;
}

const auto& zdcCol = foundBC.zdc();
Expand Down Expand Up @@ -922,19 +925,17 @@ struct ZdcQVectors {
double deltaPsiZDCA = 0;
double deltaPsiZDCC = 0;

if (!cfgCCDBdir_Shift.value.empty()) {
if (lastRunNumber != runnumber) {
if (!cfgCCDBdir_Shift.value.empty() && cal.isShiftProfileFound == false) {
LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber);
TList* hcorrList = ccdb->getForTimeStamp<TList>(cfgCCDBdir_Shift.value, foundBC.timestamp());
cal.shiftprofileC = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
cal.shiftprofileA = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
if (!cal.shiftprofileC || !cal.shiftprofileA) {
LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber);
cal.isShiftProfileFound = false;
LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber);
TList* hcorrList = ccdb->getForTimeStamp<TList>(cfgCCDBdir_Shift.value, foundBC.timestamp());
cal.shiftprofileC = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
cal.shiftprofileA = reinterpret_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
if (!cal.shiftprofileC || !cal.shiftprofileA) {
LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber);
} else {
LOGF(error, "Shift profile found in CCDB for runnumber: %d", runnumber);
cal.isShiftProfileFound = true;
}
} else {
LOGF(info, "Shift profile found in CCDB for runnumber: %d", runnumber);
cal.isShiftProfileFound = true;
}
}

Expand All @@ -950,8 +951,8 @@ struct ZdcQVectors {
float coeffshiftxZDCA = 0.0;
float coeffshiftyZDCA = 0.0;

for (int ishift = 1; ishift <= nshift; ishift++) {
if (cal.isShiftProfileFound) {
if (cal.isShiftProfileFound) {
for (int ishift = 1; ishift <= nshift; ishift++) {
int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); // bin 0.5
int binshiftyZDCC = cal.shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5);
int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5);
Expand All @@ -965,9 +966,10 @@ struct ZdcQVectors {
coeffshiftxZDCA = cal.shiftprofileA->GetBinContent(binshiftxZDCA);
if (binshiftyZDCA > 0)
coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA);

deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC)));
deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA)));
}
deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC)));
deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA)));
}

psiZDCCshift += deltaPsiZDCC;
Expand Down
Loading