diff --git a/Common/DataModel/Qvectors.h b/Common/DataModel/Qvectors.h index d723d659bc5..4a750306cbf 100644 --- a/Common/DataModel/Qvectors.h +++ b/Common/DataModel/Qvectors.h @@ -51,6 +51,24 @@ DECLARE_SOA_COLUMN(QvecTPCnegImVec, qvecTPCnegImVec, std::vector); DECLARE_SOA_COLUMN(QvecTPCallReVec, qvecTPCallReVec, std::vector); DECLARE_SOA_COLUMN(QvecTPCallImVec, qvecTPCallImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedRe, qvecShiftedRe, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedIm, qvecShiftedIm, std::vector); + +DECLARE_SOA_COLUMN(QvecShiftedFT0CReVec, qvecShiftedFT0CReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0CImVec, qvecShiftedFT0CImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0AReVec, qvecShiftedFT0AReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0AImVec, qvecShiftedFT0AImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0MReVec, qvecShiftedFT0MReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0MImVec, qvecShiftedFT0MImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFV0AReVec, qvecShiftedFV0AReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFV0AImVec, qvecShiftedFV0AImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCposReVec, qvecShiftedTPCposReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCposImVec, qvecShiftedTPCposImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCnegReVec, qvecShiftedTPCnegReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCnegImVec, qvecShiftedTPCnegImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCallReVec, qvecShiftedTPCallReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCallImVec, qvecShiftedTPCallImVec, std::vector); + DECLARE_SOA_COLUMN(QvecFT0CRe, qvecFT0CRe, float); DECLARE_SOA_COLUMN(QvecFT0CIm, qvecFT0CIm, float); DECLARE_SOA_COLUMN(QvecFT0ARe, qvecFT0ARe, float); @@ -104,6 +122,9 @@ DECLARE_SOA_COLUMN(LabelsBTot, labelsBTot, std::vector); DECLARE_SOA_TABLE(Qvectors, "AOD", "QVECTORDEVS", //! Table with all Qvectors. qvec::Cent, qvec::IsCalibrated, qvec::QvecRe, qvec::QvecIm, qvec::QvecAmp); using Qvector = Qvectors::iterator; +DECLARE_SOA_TABLE(QvectorsShifteds, "AOD", "QVECTORSCDEVS", //! Table with all shifted Qvectors. + qvec::Cent, qvec::IsCalibrated, qvec::QvecShiftedRe, qvec::QvecShiftedIm, qvec::QvecAmp); +using QvectorShifted = QvectorsShifteds::iterator; DECLARE_SOA_TABLE(QvectorFT0Cs, "AOD", "QVECTORSFT0C", qvec::IsCalibrated, qvec::QvecFT0CRe, qvec::QvecFT0CIm, qvec::SumAmplFT0C); DECLARE_SOA_TABLE(QvectorFT0As, "AOD", "QVECTORSFT0A", qvec::IsCalibrated, qvec::QvecFT0ARe, qvec::QvecFT0AIm, qvec::SumAmplFT0A); @@ -121,6 +142,14 @@ DECLARE_SOA_TABLE(QvectorTPCposVecs, "AOD", "QVECTORSTPCPVEC", qvec::IsCalibrate DECLARE_SOA_TABLE(QvectorTPCnegVecs, "AOD", "QVECTORSTPCNVEC", qvec::IsCalibrated, qvec::QvecTPCnegReVec, qvec::QvecTPCnegImVec, qvec::NTrkTPCneg, qvec::LabelsTPCneg); DECLARE_SOA_TABLE(QvectorTPCallVecs, "AOD", "QVECTORSTPCAVEC", qvec::IsCalibrated, qvec::QvecTPCallReVec, qvec::QvecTPCallImVec, qvec::NTrkTPCall, qvec::LabelsTPCall); +DECLARE_SOA_TABLE(QvectorShiftedFT0CVecs, "AOD", "QVECSHIFTEDFT0C", qvec::IsCalibrated, qvec::QvecShiftedFT0CReVec, qvec::QvecShiftedFT0CImVec, qvec::SumAmplFT0C); +DECLARE_SOA_TABLE(QvectorShiftedFT0AVecs, "AOD", "QVECSHIFTEDFT0A", qvec::IsCalibrated, qvec::QvecShiftedFT0AReVec, qvec::QvecShiftedFT0AImVec, qvec::SumAmplFT0A); +DECLARE_SOA_TABLE(QvectorShiftedFT0MVecs, "AOD", "QVECSHIFTEDFT0M", qvec::IsCalibrated, qvec::QvecShiftedFT0MReVec, qvec::QvecShiftedFT0MImVec, qvec::SumAmplFT0M); +DECLARE_SOA_TABLE(QvectorShiftedFV0AVecs, "AOD", "QVECSHIFTEDFV0A", qvec::IsCalibrated, qvec::QvecShiftedFV0AReVec, qvec::QvecShiftedFV0AImVec, qvec::SumAmplFV0A); +DECLARE_SOA_TABLE(QvectorShiftedTPCposVecs, "AOD", "QVECSHIFTEDTPCP", qvec::IsCalibrated, qvec::QvecShiftedTPCposReVec, qvec::QvecShiftedTPCposImVec, qvec::NTrkTPCpos, qvec::LabelsTPCpos); +DECLARE_SOA_TABLE(QvectorShiftedTPCnegVecs, "AOD", "QVECSHIFTEDTPCN", qvec::IsCalibrated, qvec::QvecShiftedTPCnegReVec, qvec::QvecShiftedTPCnegImVec, qvec::NTrkTPCneg, qvec::LabelsTPCneg); +DECLARE_SOA_TABLE(QvectorShiftedTPCallVecs, "AOD", "QVECSHIFTEDTPCA", qvec::IsCalibrated, qvec::QvecShiftedTPCallReVec, qvec::QvecShiftedTPCallImVec, qvec::NTrkTPCall, qvec::LabelsTPCall); + using QvectorFT0C = QvectorFT0Cs::iterator; using QvectorFT0A = QvectorFT0As::iterator; using QvectorFT0M = QvectorFT0Ms::iterator; @@ -137,6 +166,14 @@ using QvectorTPCposVec = QvectorTPCposVecs::iterator; using QvectorTPCnegVec = QvectorTPCnegVecs::iterator; using QvectorTPCallVec = QvectorTPCallVecs::iterator; +using QvectorShiftedFT0CVec = QvectorShiftedFT0CVecs::iterator; +using QvectorShiftedFT0AVec = QvectorShiftedFT0AVecs::iterator; +using QvectorShiftedFT0MVec = QvectorShiftedFT0MVecs::iterator; +using QvectorShiftedFV0AVec = QvectorShiftedFV0AVecs::iterator; +using QvectorShiftedTPCposVec = QvectorShiftedTPCposVecs::iterator; +using QvectorShiftedTPCnegVec = QvectorShiftedTPCnegVecs::iterator; +using QvectorShiftedTPCallVec = QvectorShiftedTPCallVecs::iterator; + // Deprecated, will be removed in future after transition time // DECLARE_SOA_TABLE(QvectorBPoss, "AOD", "QVECTORSBPOS", qvec::IsCalibrated, qvec::QvecBPosRe, qvec::QvecBPosIm, qvec::NTrkBPos, qvec::LabelsBPos); DECLARE_SOA_TABLE(QvectorBNegs, "AOD", "QVECTORSBNEG", qvec::IsCalibrated, qvec::QvecBNegRe, qvec::QvecBNegIm, qvec::NTrkBNeg, qvec::LabelsBNeg); diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index d1d39acf3d4..58b569fec42 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -98,6 +98,9 @@ struct qVectorsTable { Configurable cfgGainEqPath{"cfgGainEqPath", "Users/j/junlee/Qvector/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgQvecCalibPath{"cfgQvecCalibPath", "Analysis/EventPlane/QVecCorrections", "CCDB pasth for Q-vecteor calibration constants"}; + Configurable cfgShiftCorr{"cfgShiftCorr", false, "configurable flag for shift correction"}; + Configurable cfgShiftPath{"cfgShiftPath", "", "CCDB path for shift correction"}; + ConfigurableAxis cfgaxisFITamp{"cfgaxisFITamp", {1000, 0, 5000}, ""}; Configurable cfgUseFT0C{"cfgUseFT0C", false, "Initial value for using FT0C. By default obtained from DataModel."}; @@ -126,6 +129,15 @@ struct qVectorsTable { Produces qVectorTPCnegVec; Produces qVectorTPCallVec; + Produces qVectorShifted; + Produces qVectorFT0CShiftedVec; + Produces qVectorFT0AShiftedVec; + Produces qVectorFT0MShiftedVec; + Produces qVectorFV0AShiftedVec; + Produces qVectorTPCposShiftedVec; + Produces qVectorTPCnegShiftedVec; + Produces qVectorTPCallShiftedVec; + std::vector FT0RelGainConst{}; std::vector FV0RelGainConst{}; @@ -146,6 +158,7 @@ struct qVectorsTable { float cent; std::vector objQvec{}; + std::vector shiftprofile{}; // Deprecated, will be removed in future after transition time // Configurable cfgUseBPos{"cfgUseBPos", false, "Initial value for using BPos. By default obtained from DataModel."}; @@ -265,6 +278,19 @@ struct qVectorsTable { } objQvec.push_back(objqvec); } + + if (cfgShiftCorr) { + shiftprofile.clear(); + for (std::size_t i = 0; i < cfgnMods->size(); i++) { + int ind = cfgnMods->at(i); + fullPath = cfgShiftPath; + fullPath += "/v"; + fullPath += std::to_string(ind); + auto objshift = getForTsOrRun(fullPath, timestamp, runnumber); + shiftprofile.push_back(objshift); + } + } + fullPath = cfgGainEqPath; fullPath += "/FT0"; const auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); @@ -560,6 +586,25 @@ struct qVectorsTable { std::vector qvecReTPCall{}; std::vector qvecImTPCall{}; + std::vector qvecShiftedRe{}; + std::vector qvecShiftedIm{}; + std::vector qvecShiftedAmp{}; + + std::vector qvecReShiftedFT0C{}; + std::vector qvecImShiftedFT0C{}; + std::vector qvecReShiftedFT0A{}; + std::vector qvecImShiftedFT0A{}; + std::vector qvecReShiftedFT0M{}; + std::vector qvecImShiftedFT0M{}; + std::vector qvecReShiftedFV0A{}; + std::vector qvecImShiftedFV0A{}; + std::vector qvecReShiftedTPCpos{}; + std::vector qvecImShiftedTPCpos{}; + std::vector qvecReShiftedTPCneg{}; + std::vector qvecImShiftedTPCneg{}; + std::vector qvecReShiftedTPCall{}; + std::vector qvecImShiftedTPCall{}; + auto bc = coll.bc_as(); int currentRun = bc.runNumber(); if (runNumber != currentRun) { @@ -577,8 +622,8 @@ struct qVectorsTable { IsCalibrated = false; } for (std::size_t id = 0; id < cfgnMods->size(); id++) { - int ind = cfgnMods->at(id); - CalQvec(ind, coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel); + int nmode = cfgnMods->at(id); + CalQvec(nmode, coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel); if (cent < cfgMaxCentrality) { for (auto i{0u}; i < kTPCall + 1; i++) { helperEP.DoRecenter(qvecRe[(kTPCall + 1) * 4 * id + i * 4 + 1], qvecIm[(kTPCall + 1) * 4 * id + i * 4 + 1], @@ -596,6 +641,79 @@ struct qVectorsTable { helperEP.DoRescale(qvecRe[(kTPCall + 1) * 4 * id + i * 4 + 3], qvecIm[(kTPCall + 1) * 4 * id + i * 4 + 3], objQvec.at(id)->GetBinContent(static_cast(cent) + 1, 5, i + 1), objQvec.at(id)->GetBinContent(static_cast(cent) + 1, 6, i + 1)); } + if (cfgShiftCorr) { + auto deltapsiFT0C = 0.0; + auto deltapsiFT0A = 0.0; + auto deltapsiFT0M = 0.0; + auto deltapsiFV0A = 0.0; + auto deltapsiTPCpos = 0.0; + auto deltapsiTPCneg = 0.0; + auto deltapsiTPCall = 0.0; + + auto psidefFT0C = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3]) / static_cast(nmode); + auto psidefFT0A = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3]) / static_cast(nmode); + auto psidefFT0M = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3]) / static_cast(nmode); + auto psidefFV0A = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3]) / static_cast(nmode); + auto psidefTPCpos = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3]) / static_cast(nmode); + auto psidefTPCneg = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3]) / static_cast(nmode); + auto psidefTPCall = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3]) / static_cast(nmode); + + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0C, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0C + 1, ishift - 0.5)); + auto coeffshiftxFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0A, ishift - 0.5)); + auto coeffshiftyFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0A + 1, ishift - 0.5)); + auto coeffshiftxFT0M = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0M, ishift - 0.5)); + auto coeffshiftyFT0M = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0M + 1, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFV0A, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFV0A + 1, ishift - 0.5)); + auto coeffshiftxTPCpos = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCpos, ishift - 0.5)); + auto coeffshiftyTPCpos = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCpos + 1, ishift - 0.5)); + auto coeffshiftxTPCneg = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCneg, ishift - 0.5)); + auto coeffshiftyTPCneg = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCneg + 1, ishift - 0.5)); + auto coeffshiftxTPCall = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCall, ishift - 0.5)); + auto coeffshiftyTPCall = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCall + 1, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psidefFT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psidefFT0C))); + deltapsiFT0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * TMath::Cos(ishift * static_cast(nmode) * psidefFT0A) + coeffshiftyFT0A * TMath::Sin(ishift * static_cast(nmode) * psidefFT0A))); + deltapsiFT0M += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0M * TMath::Cos(ishift * static_cast(nmode) * psidefFT0M) + coeffshiftyFT0M * TMath::Sin(ishift * static_cast(nmode) * psidefFT0M))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos(ishift * static_cast(nmode) * psidefFV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psidefFV0A))); + deltapsiTPCpos += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCpos * TMath::Cos(ishift * static_cast(nmode) * psidefTPCpos) + coeffshiftyTPCpos * TMath::Sin(ishift * static_cast(nmode) * psidefTPCpos))); + deltapsiTPCneg += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCneg * TMath::Cos(ishift * static_cast(nmode) * psidefTPCneg) + coeffshiftyTPCneg * TMath::Sin(ishift * static_cast(nmode) * psidefTPCneg))); + deltapsiTPCall += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCall * TMath::Cos(ishift * static_cast(nmode) * psidefTPCall) + coeffshiftyTPCall * TMath::Sin(ishift * static_cast(nmode) * psidefTPCall))); + } + + qvecReShiftedFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Cos(deltapsiFT0C) - qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Sin(deltapsiFT0C)); + qvecImShiftedFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Sin(deltapsiFT0C) + qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Cos(deltapsiFT0C)); + qvecReShiftedFT0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Cos(deltapsiFT0A) - qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Sin(deltapsiFT0A)); + qvecImShiftedFT0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Sin(deltapsiFT0A) + qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Cos(deltapsiFT0A)); + qvecReShiftedFT0M.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Cos(deltapsiFT0M) - qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Sin(deltapsiFT0M)); + qvecImShiftedFT0M.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Sin(deltapsiFT0M) + qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Cos(deltapsiFT0M)); + qvecReShiftedFV0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Cos(deltapsiFV0A) - qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Sin(deltapsiFV0A)); + qvecImShiftedFV0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Sin(deltapsiFV0A) + qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Cos(deltapsiFV0A)); + qvecReShiftedTPCpos.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Cos(deltapsiTPCpos) - qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Sin(deltapsiTPCpos)); + qvecImShiftedTPCpos.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Sin(deltapsiTPCpos) + qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Cos(deltapsiTPCpos)); + qvecReShiftedTPCneg.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Cos(deltapsiTPCneg) - qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Sin(deltapsiTPCneg)); + qvecImShiftedTPCneg.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Sin(deltapsiTPCneg) + qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Cos(deltapsiTPCneg)); + qvecReShiftedTPCall.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Cos(deltapsiTPCall) - qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Sin(deltapsiTPCall)); + qvecImShiftedTPCall.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Sin(deltapsiTPCall) + qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Cos(deltapsiTPCall)); + + qvecShiftedRe.push_back(qvecReShiftedFT0C[id]); + qvecShiftedRe.push_back(qvecReShiftedFT0A[id]); + qvecShiftedRe.push_back(qvecReShiftedFT0M[id]); + qvecShiftedRe.push_back(qvecReShiftedFV0A[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCpos[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCneg[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCall[id]); + + qvecShiftedIm.push_back(qvecImShiftedFT0C[id]); + qvecShiftedIm.push_back(qvecImShiftedFT0A[id]); + qvecShiftedIm.push_back(qvecImShiftedFT0M[id]); + qvecShiftedIm.push_back(qvecImShiftedFV0A[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCpos[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCneg[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCall[id]); + } } int CorrLevel = cfgCorrLevel == 0 ? 0 : cfgCorrLevel - 1; qvecReFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + CorrLevel]); @@ -639,6 +757,17 @@ struct qVectorsTable { qVectorTPCnegVec(IsCalibrated, qvecReTPCneg, qvecImTPCneg, qvecAmp[kTPCneg], TrkTPCnegLabel); qVectorTPCallVec(IsCalibrated, qvecReTPCall, qvecImTPCall, qvecAmp[kTPCall], TrkTPCallLabel); + if (cfgShiftCorr) { + qVectorShifted(cent, IsCalibrated, qvecShiftedRe, qvecShiftedIm, qvecAmp); + qVectorFT0CShiftedVec(IsCalibrated, qvecReShiftedFT0C, qvecImShiftedFT0C, qvecAmp[kFT0C]); + qVectorFT0AShiftedVec(IsCalibrated, qvecReShiftedFT0A, qvecImShiftedFT0A, qvecAmp[kFT0A]); + qVectorFT0MShiftedVec(IsCalibrated, qvecReShiftedFT0M, qvecImShiftedFT0M, qvecAmp[kFT0M]); + qVectorFV0AShiftedVec(IsCalibrated, qvecReShiftedFV0A, qvecImShiftedFV0A, qvecAmp[kFV0A]); + qVectorTPCposShiftedVec(IsCalibrated, qvecReShiftedTPCpos, qvecImShiftedTPCpos, qvecAmp[kTPCpos], TrkTPCposLabel); + qVectorTPCnegShiftedVec(IsCalibrated, qvecReShiftedTPCneg, qvecImShiftedTPCneg, qvecAmp[kTPCneg], TrkTPCnegLabel); + qVectorTPCallShiftedVec(IsCalibrated, qvecReShiftedTPCall, qvecImShiftedTPCall, qvecAmp[kTPCall], TrkTPCallLabel); + } + // Deprecated, will be removed in future after transition time // if (useDetector["QvectorBPoss"]) qVectorBPos(IsCalibrated, qvecReTPCpos.at(0), qvecImTPCpos.at(0), qvecAmp[kTPCpos], TrkTPCposLabel); diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index 37636ce369d..e41eceaaefe 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -49,6 +49,7 @@ using namespace o2; using namespace o2::framework; using MyCollisions = soa::Join; +using MyCollisionsWithSC = soa::Join; using MyTracks = soa::Join; struct qVectorsCorrection { @@ -76,6 +77,8 @@ struct qVectorsCorrection { Configurable cfgQAFinal{"cfgQAFinal", false, "draw final q-vector steps"}; Configurable cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"}; Configurable cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"}; + Configurable cfgShiftCor{"cfgShiftCor", false, "configurable for shift correction"}; Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; @@ -251,6 +254,61 @@ struct qVectorsCorrection { } } // End void init(InitContext const&) + template + void fillHistosFlowWithSC(const CollType& coll, const TrackType& track, int nmode) + { + int DetInd = DetId + cfgnTotalSystem * (nmode - 2); + int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); + int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + + for (auto& trk : track) { + if (!SelTrack(trk)) { + continue; + } + + if (std::abs(trk.eta()) > 0.8) { + continue; + } + if (nmode == 2) { + histosQA.fill(HIST("hist_EP_cos_Det_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } else if (nmode == 3) { + histosQA.fill(HIST("hist_EP_cos_Det_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } else if (nmode == 4) { + histosQA.fill(HIST("hist_EP_cos_Det_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } + } + } + template void fillHistosFlow(const CollType& coll, const TrackType& track, int nmode) { @@ -310,6 +368,54 @@ struct qVectorsCorrection { } } + template + void fillHistosQvecWithSC(const T& vec, int nmode) + { + int DetInd = DetId + cfgnTotalSystem * (nmode - 2); + int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); + int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + if (nmode == 2) { + histosQA.fill(HIST("histQvecFinalV2"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV2"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV2"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } else if (nmode == 3) { + histosQA.fill(HIST("histQvecFinalV3"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV3"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV3"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } else if (nmode == 4) { + histosQA.fill(HIST("histQvecFinalV4"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV4"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV4"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } + } + // Definition of all the needed template functions. template void fillHistosQvec(const T& vec, int nmode) @@ -574,7 +680,47 @@ struct qVectorsCorrection { fillHistosFlow(qVec, tracks, cfgnMods->at(i)); } } - } // End void process(...) + } + PROCESS_SWITCH(qVectorsCorrection, process, "default process", true); + + void processWithSC(MyCollisionsWithSC::iterator const& qVec, MyTracks const& tracks) + { + histosQA.fill(HIST("histCentFull"), qVec.cent()); + if (cfgAddEvtSel) { + switch (cfgEvtSel) { + case 0: // Sel8 + if (!qVec.sel8()) + return; + break; + case 1: // PbPb standard + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 2: // PbPb with pileup + if (!qVec.sel8() || !qVec.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || + !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 3: // Small systems (OO, NeNe, pp) + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + default: + LOGF(warning, "Event selection flag was not found, continuing without basic event selections!\n"); + } + // Check occupancy + if (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy) + return; + } + + for (uint i = 0; i < cfgnMods->size(); i++) { + fillHistosQvecWithSC(qVec, cfgnMods->at(i)); + if (cfgQAFlowStudy) { + fillHistosFlowWithSC(qVec, tracks, cfgnMods->at(i)); + } + } + } + PROCESS_SWITCH(qVectorsCorrection, processWithSC, "process with shift correction", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)