diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index c83984f3a7c..d7f601729ef 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -42,10 +42,10 @@ using namespace o2::framework::expressions; using std::array; using DauTracks = soa::Join; -using CollEventPlane = soa::Join::iterator; -using CollEventPlaneCentralFW = soa::Join::iterator; -using CollEventAndSpecPlane = soa::Join::iterator; -using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; +using CollEventPlane = soa::Join::iterator; +using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventAndSpecPlane = soa::Join::iterator; +using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; using MCCollisionsStra = soa::Join; using V0Candidates = soa::Join; using CascCandidates = soa::Join; @@ -170,6 +170,11 @@ struct cascadeFlow { ConfigurableAxis axisQVs{"axisQVs", {500, -10.f, 10.f}, "axisQVs"}; ConfigurableAxis axisQVsNorm{"axisQVsNorm", {200, -1.f, 1.f}, "axisQVsNorm"}; + // Configurable for shift correction + Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; + Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + // THN axes ConfigurableAxis thnConfigAxisFT0C{"thnConfigAxisFT0C", {8, 0, 80}, "FT0C centrality (%)"}; ConfigurableAxis thnConfigAxisEta{"thnConfigAxisEta", {8, -0.8, 0.8}, "pseudorapidity"}; @@ -462,6 +467,53 @@ struct cascadeFlow { return phi; } + int currentRunNumber = -999; + int lastRunNumber = -999; + std::vector shiftprofile{}; + std::string fullCCDBShiftCorrPath; + + template + double ApplyShiftCorrection(TCollision coll, double psiT0C) + { + int nmode = 2; + auto deltapsiFT0C = 0.0; + + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + } + return psiT0C + deltapsiFT0C; + } + + template + double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC) + { + int nmode = 2; + auto deltapsiFT0C = 0.0; + auto deltapsiTPCA = 0.0; + auto deltapsiTPCC = 0.0; + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + auto coeffshiftxTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); + auto coeffshiftyTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); + auto coeffshiftxTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); + auto coeffshiftyTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); + deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); + } + // histos.fill(HIST("psi2/QA/EP_FT0C_shifted"), coll.centFT0C(), psiT0C + deltapsiFT0C); + // histos.fill(HIST("psi2/QA/EP_TPCA_shifted"), coll.centFT0C(), psiTPCA + deltapsiTPCA); + // histos.fill(HIST("psi2/QA/EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); + resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA))); + resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC))); + resolution.fill(HIST("QVectorsTPCAC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC))); + return true; + } + // objects to use for acceptance correction TH2F* hAcceptanceXi; TH2F* hAcceptanceOmega; @@ -661,6 +713,9 @@ struct cascadeFlow { resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxis}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxis}); resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxis}); + resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{10, 0.f, 10.f}}}); for (Int_t n = 1; n <= histos.get(HIST("hNEvents"))->GetNbinsX(); n++) { @@ -972,10 +1027,33 @@ struct cascadeFlow { ROOT::Math::XYZVector spectatorplaneVecZDCA{std::cos(coll.psiZDCA()), std::sin(coll.psiZDCA()), 0}; // eta positive = projectile ROOT::Math::XYZVector spectatorplaneVecZDCC{std::cos(coll.psiZDCC()), std::sin(coll.psiZDCC()), 0}; // eta negative = target - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + + histos.fill(HIST("hPsiT0C"), psiT0CCorr); histos.fill(HIST("hPsiZDCA_vs_ZDCC"), coll.psiZDCC(), coll.psiZDCA()); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1051,7 +1129,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; auto v1SP_ZDCA = cascUvec.Dot(spectatorplaneVecZDCA); @@ -1107,11 +1185,11 @@ struct cascadeFlow { int chargeIndex = 0; if (casc.sign() > 0) chargeIndex = 1; - double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; - double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; @@ -1217,7 +1295,7 @@ struct cascadeFlow { if (isSelectedCasc[0] || isSelectedCasc[1]) { if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } } @@ -1253,9 +1331,30 @@ struct cascadeFlow { ROOT::Math::XYZVector eventplaneVecTPCA{coll.qvecBPosRe(), coll.qvecBPosIm(), 0}; ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1330,7 +1429,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; @@ -1380,11 +1479,11 @@ struct cascadeFlow { int chargeIndex = 0; if (casc.sign() > 0) chargeIndex = 1; - double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; - double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; @@ -1488,7 +1587,7 @@ struct cascadeFlow { if (isSelectedCasc[0] || isSelectedCasc[1]) { if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, 0, casc, v2CSP, v2CEP, 0, 0, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, 0, casc, v2CSP, v2CEP, 0, 0, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } } @@ -1523,8 +1622,29 @@ struct cascadeFlow { ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), psiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0C); + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1595,7 +1715,7 @@ struct cascadeFlow { ROOT::Math::XYZVector lambdaQvec{std::cos(2 * v0.phi()), std::sin(2 * v0.phi()), 0}; auto v2CSP = lambdaQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto lambdaminuspsiT0C = GetPhiInRange(v0.phi() - psiT0C); + auto lambdaminuspsiT0C = GetPhiInRange(v0.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * lambdaminuspsiT0C); ROOT::Math::XYZVector lambdaUvec{std::cos(v0.phi()), std::sin(v0.phi()), 0}; @@ -1625,15 +1745,15 @@ struct cascadeFlow { double cos2ThetaLambda = 0; double cosThetaLambda = 0; if (chargeIndex == 0) { - pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } else if (chargeIndex == 1) { - pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[1] * cosThetaStarProton[1]; cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; } else { // I treat these bkg candidates as Lambdas for the purpose of calculating Pz - pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } @@ -1660,7 +1780,7 @@ struct cascadeFlow { } if (fillingConfigs.isFillTree) - fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0C, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); + fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0CCorr, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); } } @@ -1706,9 +1826,30 @@ struct cascadeFlow { float NormQvTPCA = std::sqrt(eventplaneVecTPCA.Dot(eventplaneVecTPCA)); float NormQvTPCC = std::sqrt(eventplaneVecTPCC.Dot(eventplaneVecTPCC)); - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hpsiT0C"), psiT0CCorr); + histos.fill(HIST("hpsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1784,7 +1925,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; auto v1SP_ZDCA = cascUvec.Dot(spectatorplaneVecZDCA); @@ -1816,7 +1957,7 @@ struct cascadeFlow { } if (isSelectedCasc[0] || isSelectedCasc[1]) if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } @@ -1934,7 +2075,7 @@ struct cascadeFlow { histos.fill(HIST("hCascadePhi"), casc.phi()); float BDTresponse[nParticles]{0.f, 0.f}; - const float PsiT0C = 0; // not defined in MC for now + const float psiT0C = 0; // not defined in MC for now auto v2CSP = 0; // not defined in MC for now auto v2CEP = 0; // not defined in MC for now auto v1SP_ZDCA = 0; // not defined in MC for now @@ -1949,7 +2090,7 @@ struct cascadeFlow { continue; } if (isSelectedCasc[0] || isSelectedCasc[1]) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], pdgCode); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0C, BDTresponse[0], BDTresponse[1], pdgCode); } }