Skip to content

Commit 9013419

Browse files
ChiaraDeMartin95Chiara De Martinalibuild
authored
[PWGLF] Fix shift correction vectors (#12986)
Co-authored-by: Chiara De Martin <chdemart@alicecerno2.cern.ch> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 771ca9d commit 9013419

File tree

1 file changed

+44
-65
lines changed

1 file changed

+44
-65
lines changed

PWGLF/TableProducer/Strangeness/cascadeflow.cxx

Lines changed: 44 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@ struct cascadeFlow {
177177
// Configurable for shift correction
178178
struct : ConfigurableGroup {
179179
Configurable<bool> cfgShiftCorr{"cfgShiftCorr", 0, ""};
180-
Configurable<std::string> cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
181-
Configurable<std::string> cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
182-
Configurable<std::string> cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
183-
Configurable<std::string> cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
184-
Configurable<int> cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"};
180+
Configurable<std::string> cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/c/chdemart/OOpass2Shift/ShiftFT0C", "Path for Shift"};
181+
Configurable<std::string> cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/c/chdemart/OOpass2Shift/ShiftTPCL", "Path for Shift"};
182+
Configurable<std::string> cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/c/chdemart/OOpass2Shift/ShiftTPCR", "Path for Shift"};
185183
} ShiftConfigs;
186184
// Configurable<float> cfgHarmonic{"cfgHarmonic", 2, "Harmonic for event plane calculation"};
187185

@@ -483,44 +481,44 @@ struct cascadeFlow {
483481

484482
int currentRunNumber = -999;
485483
int lastRunNumber = -999;
486-
std::vector<TProfile3D*> shiftprofile{};
487-
std::vector<TProfile3D*> shiftprofileFT0C{};
488-
std::vector<TProfile3D*> shiftprofileTPCL{};
489-
std::vector<TProfile3D*> shiftprofileTPCR{};
484+
TProfile3D* shiftprofile;
485+
TProfile3D* shiftprofileFT0C;
486+
TProfile3D* shiftprofileTPCL;
487+
TProfile3D* shiftprofileTPCR;
490488
std::string fullCCDBShiftCorrPath;
491489
std::string fullCCDBShiftCorrPathFT0C;
492490
std::string fullCCDBShiftCorrPathTPCL;
493491
std::string fullCCDBShiftCorrPathTPCR;
494492

495493
template <typename TCollision>
496-
double ApplyShiftCorrection(TCollision coll, double psiT0C)
494+
double ApplyShiftCorrection(TCollision coll, double psiT0C, TProfile3D* shiftprofile)
497495
{
498-
int nmode = 2;
499496
auto deltapsiFT0C = 0.0;
497+
int nmode = 2;
500498

501499
for (int ishift = 1; ishift <= 10; ishift++) {
502-
auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
503-
auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
500+
auto coeffshiftxFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
501+
auto coeffshiftyFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
504502

505503
deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast<float>(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast<float>(nmode) * psiT0C)));
506504
}
507505
return psiT0C + deltapsiFT0C;
508506
}
509507

510508
template <typename TCollision>
511-
double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC)
509+
double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC, TProfile3D* shiftprofileA, TProfile3D* shiftprofileB, TProfile3D* shiftprofileC)
512510
{
513511
int nmode = 2;
514512
auto deltapsiFT0C = 0.0;
515513
auto deltapsiTPCA = 0.0;
516514
auto deltapsiTPCC = 0.0;
517515
for (int ishift = 1; ishift <= 10; ishift++) {
518-
auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
519-
auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
520-
auto coeffshiftxTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 2.5, ishift - 0.5));
521-
auto coeffshiftyTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 3.5, ishift - 0.5));
522-
auto coeffshiftxTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 4.5, ishift - 0.5));
523-
auto coeffshiftyTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 5.5, ishift - 0.5));
516+
auto coeffshiftxFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
517+
auto coeffshiftyFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
518+
auto coeffshiftxTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 2.5, ishift - 0.5));
519+
auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 3.5, ishift - 0.5));
520+
auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 4.5, ishift - 0.5));
521+
auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 5.5, ishift - 0.5));
524522
deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast<float>(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast<float>(nmode) * psiT0C)));
525523
deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast<float>(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast<float>(nmode) * psiTPCA)));
526524
deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast<float>(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast<float>(nmode) * psiTPCC)));
@@ -1079,25 +1077,19 @@ struct cascadeFlow {
10791077
if (ShiftConfigs.cfgShiftCorr) {
10801078
currentRunNumber = coll.runNumber();
10811079
if (currentRunNumber != lastRunNumber) {
1082-
shiftprofileFT0C.clear();
1083-
shiftprofileTPCL.clear();
1084-
shiftprofileTPCR.clear();
10851080
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
10861081
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
10871082
fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR;
1088-
auto objshiftFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1089-
shiftprofileFT0C.push_back(objshiftFT0C);
1090-
auto objshiftTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1091-
shiftprofileTPCL.push_back(objshiftTPCL);
1092-
auto objshiftTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
1093-
shiftprofileTPCR.push_back(objshiftTPCR);
1083+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1084+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1085+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
10941086
lastRunNumber = currentRunNumber;
10951087
}
10961088
}
10971089

10981090
if (ShiftConfigs.cfgShiftCorr) {
1099-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1100-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1091+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1092+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
11011093
}
11021094

11031095
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
@@ -1398,25 +1390,21 @@ struct cascadeFlow {
13981390
if (ShiftConfigs.cfgShiftCorr) {
13991391
currentRunNumber = coll.runNumber();
14001392
if (currentRunNumber != lastRunNumber) {
1401-
shiftprofileFT0C.clear();
1402-
shiftprofileTPCL.clear();
1403-
shiftprofileTPCR.clear();
14041393
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
14051394
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
14061395
fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR;
1407-
auto objshiftFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1408-
shiftprofileFT0C.push_back(objshiftFT0C);
1409-
auto objshiftTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1410-
shiftprofileTPCL.push_back(objshiftTPCL);
1411-
auto objshiftTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
1412-
shiftprofileTPCR.push_back(objshiftTPCR);
1396+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1397+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1398+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
14131399
lastRunNumber = currentRunNumber;
14141400
}
14151401
}
1402+
14161403
if (ShiftConfigs.cfgShiftCorr) {
1417-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1418-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1404+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1405+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
14191406
}
1407+
14201408
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
14211409
histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
14221410

@@ -1703,25 +1691,21 @@ struct cascadeFlow {
17031691
if (ShiftConfigs.cfgShiftCorr) {
17041692
currentRunNumber = coll.runNumber();
17051693
if (currentRunNumber != lastRunNumber) {
1706-
shiftprofileFT0C.clear();
1707-
shiftprofileTPCL.clear();
1708-
shiftprofileTPCR.clear();
17091694
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
17101695
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
17111696
fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR;
1712-
auto objshiftFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1713-
shiftprofileFT0C.push_back(objshiftFT0C);
1714-
auto objshiftTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1715-
shiftprofileTPCL.push_back(objshiftTPCL);
1716-
auto objshiftTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
1717-
shiftprofileTPCR.push_back(objshiftTPCR);
1697+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1698+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1699+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
17181700
lastRunNumber = currentRunNumber;
17191701
}
17201702
}
1703+
17211704
if (ShiftConfigs.cfgShiftCorr) {
1722-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1723-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1705+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1706+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
17241707
}
1708+
17251709
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
17261710
histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
17271711

@@ -1931,29 +1915,24 @@ struct cascadeFlow {
19311915
histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC));
19321916
histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC));
19331917
}
1934-
19351918
if (ShiftConfigs.cfgShiftCorr) {
19361919
currentRunNumber = coll.runNumber();
19371920
if (currentRunNumber != lastRunNumber) {
1938-
shiftprofileFT0C.clear();
1939-
shiftprofileTPCL.clear();
1940-
shiftprofileTPCR.clear();
19411921
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
19421922
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
19431923
fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR;
1944-
auto objshiftFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1945-
shiftprofileFT0C.push_back(objshiftFT0C);
1946-
auto objshiftTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1947-
shiftprofileTPCL.push_back(objshiftTPCL);
1948-
auto objshiftTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
1949-
shiftprofileTPCR.push_back(objshiftTPCR);
1924+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1925+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1926+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
19501927
lastRunNumber = currentRunNumber;
19511928
}
19521929
}
1930+
19531931
if (ShiftConfigs.cfgShiftCorr) {
1954-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1955-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1932+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1933+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
19561934
}
1935+
19571936
histos.fill(HIST("hpsiT0C"), psiT0CCorr);
19581937
histos.fill(HIST("hpsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
19591938

0 commit comments

Comments
 (0)