@@ -98,6 +98,9 @@ struct qVectorsTable {
9898 Configurable<std::string> cfgGainEqPath{" cfgGainEqPath" , " Users/j/junlee/Qvector/GainEq" , " CCDB path for gain equalization constants" };
9999 Configurable<std::string> cfgQvecCalibPath{" cfgQvecCalibPath" , " Analysis/EventPlane/QVecCorrections" , " CCDB pasth for Q-vecteor calibration constants" };
100100
101+ Configurable<bool > cfgShiftCorr{" cfgShiftCorr" , false , " configurable flag for shift correction" };
102+ Configurable<std::string> cfgShiftPath{" cfgShiftPath" , " " , " CCDB path for shift correction" };
103+
101104 ConfigurableAxis cfgaxisFITamp{" cfgaxisFITamp" , {1000 , 0 , 5000 }, " " };
102105
103106 Configurable<bool > cfgUseFT0C{" cfgUseFT0C" , false , " Initial value for using FT0C. By default obtained from DataModel." };
@@ -126,6 +129,15 @@ struct qVectorsTable {
126129 Produces<aod::QvectorTPCnegVecs> qVectorTPCnegVec;
127130 Produces<aod::QvectorTPCallVecs> qVectorTPCallVec;
128131
132+ Produces<aod::QvectorsShifteds> qVectorShifted;
133+ Produces<aod::QvectorShiftedFT0CVecs> qVectorFT0CShiftedVec;
134+ Produces<aod::QvectorShiftedFT0AVecs> qVectorFT0AShiftedVec;
135+ Produces<aod::QvectorShiftedFT0MVecs> qVectorFT0MShiftedVec;
136+ Produces<aod::QvectorShiftedFV0AVecs> qVectorFV0AShiftedVec;
137+ Produces<aod::QvectorShiftedTPCposVecs> qVectorTPCposShiftedVec;
138+ Produces<aod::QvectorShiftedTPCnegVecs> qVectorTPCnegShiftedVec;
139+ Produces<aod::QvectorShiftedTPCallVecs> qVectorTPCallShiftedVec;
140+
129141 std::vector<float > FT0RelGainConst{};
130142 std::vector<float > FV0RelGainConst{};
131143
@@ -146,6 +158,7 @@ struct qVectorsTable {
146158 float cent;
147159
148160 std::vector<TH3F*> objQvec{};
161+ std::vector<TProfile3D*> shiftprofile{};
149162
150163 // Deprecated, will be removed in future after transition time //
151164 Configurable<bool > cfgUseBPos{" cfgUseBPos" , false , " Initial value for using BPos. By default obtained from DataModel." };
@@ -265,6 +278,19 @@ struct qVectorsTable {
265278 }
266279 objQvec.push_back (objqvec);
267280 }
281+
282+ if (cfgShiftCorr) {
283+ shiftprofile.clear ();
284+ for (std::size_t i = 0 ; i < cfgnMods->size (); i++) {
285+ int ind = cfgnMods->at (i);
286+ fullPath = cfgShiftPath;
287+ fullPath += " /v" ;
288+ fullPath += std::to_string (ind);
289+ auto objshift = getForTsOrRun<TProfile3D>(fullPath, timestamp, runnumber);
290+ shiftprofile.push_back (objshift);
291+ }
292+ }
293+
268294 fullPath = cfgGainEqPath;
269295 fullPath += " /FT0" ;
270296 const auto objft0Gain = getForTsOrRun<std::vector<float >>(fullPath, timestamp, runnumber);
@@ -560,6 +586,25 @@ struct qVectorsTable {
560586 std::vector<float > qvecReTPCall{};
561587 std::vector<float > qvecImTPCall{};
562588
589+ std::vector<float > qvecShiftedRe{};
590+ std::vector<float > qvecShiftedIm{};
591+ std::vector<float > qvecShiftedAmp{};
592+
593+ std::vector<float > qvecReShiftedFT0C{};
594+ std::vector<float > qvecImShiftedFT0C{};
595+ std::vector<float > qvecReShiftedFT0A{};
596+ std::vector<float > qvecImShiftedFT0A{};
597+ std::vector<float > qvecReShiftedFT0M{};
598+ std::vector<float > qvecImShiftedFT0M{};
599+ std::vector<float > qvecReShiftedFV0A{};
600+ std::vector<float > qvecImShiftedFV0A{};
601+ std::vector<float > qvecReShiftedTPCpos{};
602+ std::vector<float > qvecImShiftedTPCpos{};
603+ std::vector<float > qvecReShiftedTPCneg{};
604+ std::vector<float > qvecImShiftedTPCneg{};
605+ std::vector<float > qvecReShiftedTPCall{};
606+ std::vector<float > qvecImShiftedTPCall{};
607+
563608 auto bc = coll.bc_as <aod::BCsWithTimestamps>();
564609 int currentRun = bc.runNumber ();
565610 if (runNumber != currentRun) {
@@ -577,8 +622,8 @@ struct qVectorsTable {
577622 IsCalibrated = false ;
578623 }
579624 for (std::size_t id = 0 ; id < cfgnMods->size (); id++) {
580- int ind = cfgnMods->at (id);
581- CalQvec (ind , coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel);
625+ int nmode = cfgnMods->at (id);
626+ CalQvec (nmode , coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel);
582627 if (cent < cfgMaxCentrality) {
583628 for (auto i{0u }; i < kTPCall + 1 ; i++) {
584629 helperEP.DoRecenter (qvecRe[(kTPCall + 1 ) * 4 * id + i * 4 + 1 ], qvecIm[(kTPCall + 1 ) * 4 * id + i * 4 + 1 ],
@@ -596,6 +641,79 @@ struct qVectorsTable {
596641 helperEP.DoRescale (qvecRe[(kTPCall + 1 ) * 4 * id + i * 4 + 3 ], qvecIm[(kTPCall + 1 ) * 4 * id + i * 4 + 3 ],
597642 objQvec.at (id)->GetBinContent (static_cast <int >(cent) + 1 , 5 , i + 1 ), objQvec.at (id)->GetBinContent (static_cast <int >(cent) + 1 , 6 , i + 1 ));
598643 }
644+ if (cfgShiftCorr) {
645+ auto deltapsiFT0C = 0.0 ;
646+ auto deltapsiFT0A = 0.0 ;
647+ auto deltapsiFT0M = 0.0 ;
648+ auto deltapsiFV0A = 0.0 ;
649+ auto deltapsiTPCpos = 0.0 ;
650+ auto deltapsiTPCneg = 0.0 ;
651+ auto deltapsiTPCall = 0.0 ;
652+
653+ auto psidefFT0C = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kFT0C * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kFT0C * 4 + 3 ]) / static_cast <float >(nmode);
654+ auto psidefFT0A = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kFT0A * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kFT0A * 4 + 3 ]) / static_cast <float >(nmode);
655+ auto psidefFT0M = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kFT0M * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kFT0M * 4 + 3 ]) / static_cast <float >(nmode);
656+ auto psidefFV0A = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kFV0A * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kFV0A * 4 + 3 ]) / static_cast <float >(nmode);
657+ auto psidefTPCpos = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kTPCpos * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kTPCpos * 4 + 3 ]) / static_cast <float >(nmode);
658+ auto psidefTPCneg = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kTPCneg * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kTPCneg * 4 + 3 ]) / static_cast <float >(nmode);
659+ auto psidefTPCall = TMath::ATan2 (qvecIm[(kTPCall + 1 ) * 4 * id + kTPCall * 4 + 3 ], qvecRe[(kTPCall + 1 ) * 4 * id + kTPCall * 4 + 3 ]) / static_cast <float >(nmode);
660+
661+ for (int ishift = 1 ; ishift <= 10 ; ishift++) {
662+ auto coeffshiftxFT0C = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0C , ishift - 0.5 ));
663+ auto coeffshiftyFT0C = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0C + 1 , ishift - 0.5 ));
664+ auto coeffshiftxFT0A = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0A , ishift - 0.5 ));
665+ auto coeffshiftyFT0A = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0A + 1 , ishift - 0.5 ));
666+ auto coeffshiftxFT0M = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0M , ishift - 0.5 ));
667+ auto coeffshiftyFT0M = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFT0M + 1 , ishift - 0.5 ));
668+ auto coeffshiftxFV0A = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFV0A , ishift - 0.5 ));
669+ auto coeffshiftyFV0A = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kFV0A + 1 , ishift - 0.5 ));
670+ auto coeffshiftxTPCpos = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCpos , ishift - 0.5 ));
671+ auto coeffshiftyTPCpos = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCpos + 1 , ishift - 0.5 ));
672+ auto coeffshiftxTPCneg = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCneg , ishift - 0.5 ));
673+ auto coeffshiftyTPCneg = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCneg + 1 , ishift - 0.5 ));
674+ auto coeffshiftxTPCall = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCall , ishift - 0.5 ));
675+ auto coeffshiftyTPCall = shiftprofile.at (nmode - 2 )->GetBinContent (shiftprofile.at (nmode - 2 )->FindBin (cent, 2 * kTPCall + 1 , ishift - 0.5 ));
676+
677+ deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos (ishift * static_cast <float >(nmode) * psidefFT0C) + coeffshiftyFT0C * TMath::Sin (ishift * static_cast <float >(nmode) * psidefFT0C)));
678+ deltapsiFT0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * TMath::Cos (ishift * static_cast <float >(nmode) * psidefFT0A) + coeffshiftyFT0A * TMath::Sin (ishift * static_cast <float >(nmode) * psidefFT0A)));
679+ deltapsiFT0M += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0M * TMath::Cos (ishift * static_cast <float >(nmode) * psidefFT0M) + coeffshiftyFT0M * TMath::Sin (ishift * static_cast <float >(nmode) * psidefFT0M)));
680+ deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos (ishift * static_cast <float >(nmode) * psidefFV0A) + coeffshiftyFV0A * TMath::Sin (ishift * static_cast <float >(nmode) * psidefFV0A)));
681+ deltapsiTPCpos += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCpos * TMath::Cos (ishift * static_cast <float >(nmode) * psidefTPCpos) + coeffshiftyTPCpos * TMath::Sin (ishift * static_cast <float >(nmode) * psidefTPCpos)));
682+ deltapsiTPCneg += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCneg * TMath::Cos (ishift * static_cast <float >(nmode) * psidefTPCneg) + coeffshiftyTPCneg * TMath::Sin (ishift * static_cast <float >(nmode) * psidefTPCneg)));
683+ deltapsiTPCall += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCall * TMath::Cos (ishift * static_cast <float >(nmode) * psidefTPCall) + coeffshiftyTPCall * TMath::Sin (ishift * static_cast <float >(nmode) * psidefTPCall)));
684+ }
685+
686+ 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));
687+ 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));
688+ 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));
689+ 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));
690+ 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));
691+ 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));
692+ 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));
693+ 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));
694+ 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));
695+ 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));
696+ 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));
697+ 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));
698+ 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));
699+ 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));
700+
701+ qvecShiftedRe.push_back (qvecReShiftedFT0C[id]);
702+ qvecShiftedRe.push_back (qvecReShiftedFT0A[id]);
703+ qvecShiftedRe.push_back (qvecReShiftedFT0M[id]);
704+ qvecShiftedRe.push_back (qvecReShiftedFV0A[id]);
705+ qvecShiftedRe.push_back (qvecReShiftedTPCpos[id]);
706+ qvecShiftedRe.push_back (qvecReShiftedTPCneg[id]);
707+ qvecShiftedRe.push_back (qvecReShiftedTPCall[id]);
708+
709+ qvecShiftedIm.push_back (qvecImShiftedFT0C[id]);
710+ qvecShiftedIm.push_back (qvecImShiftedFT0A[id]);
711+ qvecShiftedIm.push_back (qvecImShiftedFT0M[id]);
712+ qvecShiftedIm.push_back (qvecImShiftedFV0A[id]);
713+ qvecShiftedIm.push_back (qvecImShiftedTPCpos[id]);
714+ qvecShiftedIm.push_back (qvecImShiftedTPCneg[id]);
715+ qvecShiftedIm.push_back (qvecImShiftedTPCall[id]);
716+ }
599717 }
600718 int CorrLevel = cfgCorrLevel == 0 ? 0 : cfgCorrLevel - 1 ;
601719 qvecReFT0C.push_back (qvecRe[(kTPCall + 1 ) * 4 * id + kFT0C * 4 + CorrLevel]);
@@ -639,6 +757,17 @@ struct qVectorsTable {
639757 qVectorTPCnegVec (IsCalibrated, qvecReTPCneg, qvecImTPCneg, qvecAmp[kTPCneg ], TrkTPCnegLabel);
640758 qVectorTPCallVec (IsCalibrated, qvecReTPCall, qvecImTPCall, qvecAmp[kTPCall ], TrkTPCallLabel);
641759
760+ if (cfgShiftCorr) {
761+ qVectorShifted (cent, IsCalibrated, qvecShiftedRe, qvecShiftedIm, qvecAmp);
762+ qVectorFT0CShiftedVec (IsCalibrated, qvecReShiftedFT0C, qvecImShiftedFT0C, qvecAmp[kFT0C ]);
763+ qVectorFT0AShiftedVec (IsCalibrated, qvecReShiftedFT0A, qvecImShiftedFT0A, qvecAmp[kFT0A ]);
764+ qVectorFT0MShiftedVec (IsCalibrated, qvecReShiftedFT0M, qvecImShiftedFT0M, qvecAmp[kFT0M ]);
765+ qVectorFV0AShiftedVec (IsCalibrated, qvecReShiftedFV0A, qvecImShiftedFV0A, qvecAmp[kFV0A ]);
766+ qVectorTPCposShiftedVec (IsCalibrated, qvecReShiftedTPCpos, qvecImShiftedTPCpos, qvecAmp[kTPCpos ], TrkTPCposLabel);
767+ qVectorTPCnegShiftedVec (IsCalibrated, qvecReShiftedTPCneg, qvecImShiftedTPCneg, qvecAmp[kTPCneg ], TrkTPCnegLabel);
768+ qVectorTPCallShiftedVec (IsCalibrated, qvecReShiftedTPCall, qvecImShiftedTPCall, qvecAmp[kTPCall ], TrkTPCallLabel);
769+ }
770+
642771 // Deprecated, will be removed in future after transition time //
643772 if (useDetector[" QvectorBPoss" ])
644773 qVectorBPos (IsCalibrated, qvecReTPCpos.at (0 ), qvecImTPCpos.at (0 ), qvecAmp[kTPCpos ], TrkTPCposLabel);
0 commit comments