Skip to content

Commit cbe5398

Browse files
author
Chiara De Martin
committed
fix shift correction vectors
1 parent 4004c68 commit cbe5398

File tree

1 file changed

+43
-62
lines changed

1 file changed

+43
-62
lines changed

PWGLF/TableProducer/Strangeness/cascadeflow.cxx

Lines changed: 43 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ struct cascadeFlow {
181181
Configurable<std::string> cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
182182
Configurable<std::string> cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"};
183183
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"};
185184
} ShiftConfigs;
186185
// Configurable<float> cfgHarmonic{"cfgHarmonic", 2, "Harmonic for event plane calculation"};
187186

@@ -483,44 +482,45 @@ struct cascadeFlow {
483482

484483
int currentRunNumber = -999;
485484
int lastRunNumber = -999;
486-
std::vector<TProfile3D*> shiftprofile{};
487-
std::vector<TProfile3D*> shiftprofileFT0C{};
488-
std::vector<TProfile3D*> shiftprofileTPCL{};
489-
std::vector<TProfile3D*> shiftprofileTPCR{};
485+
TProfile3D* shiftprofile;
486+
TProfile3D* shiftprofileFT0C;
487+
TProfile3D* shiftprofileTPCL;
488+
TProfile3D* shiftprofileTPCR;
490489
std::string fullCCDBShiftCorrPath;
491490
std::string fullCCDBShiftCorrPathFT0C;
492491
std::string fullCCDBShiftCorrPathTPCL;
493492
std::string fullCCDBShiftCorrPathTPCR;
494493

494+
495495
template <typename TCollision>
496-
double ApplyShiftCorrection(TCollision coll, double psiT0C)
496+
double ApplyShiftCorrection(TCollision coll, double psiT0C, TProfile3D* shiftprofile)
497497
{
498-
int nmode = 2;
499498
auto deltapsiFT0C = 0.0;
500-
499+
int nmode = 2;
500+
501501
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));
502+
auto coeffshiftxFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
503+
auto coeffshiftyFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
504504

505505
deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast<float>(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast<float>(nmode) * psiT0C)));
506506
}
507507
return psiT0C + deltapsiFT0C;
508508
}
509509

510510
template <typename TCollision>
511-
double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC)
511+
double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC, TProfile3D* shiftprofileA, TProfile3D* shiftprofileB, TProfile3D* shiftprofileC)
512512
{
513513
int nmode = 2;
514514
auto deltapsiFT0C = 0.0;
515515
auto deltapsiTPCA = 0.0;
516516
auto deltapsiTPCC = 0.0;
517517
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));
518+
auto coeffshiftxFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 0.5, ishift - 0.5));
519+
auto coeffshiftyFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 1.5, ishift - 0.5));
520+
auto coeffshiftxTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 2.5, ishift - 0.5));
521+
auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 3.5, ishift - 0.5));
522+
auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 4.5, ishift - 0.5));
523+
auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 5.5, ishift - 0.5));
524524
deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast<float>(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast<float>(nmode) * psiT0C)));
525525
deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast<float>(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast<float>(nmode) * psiTPCA)));
526526
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 +1079,19 @@ struct cascadeFlow {
10791079
if (ShiftConfigs.cfgShiftCorr) {
10801080
currentRunNumber = coll.runNumber();
10811081
if (currentRunNumber != lastRunNumber) {
1082-
shiftprofileFT0C.clear();
1083-
shiftprofileTPCL.clear();
1084-
shiftprofileTPCR.clear();
10851082
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
10861083
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
10871084
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);
1085+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1086+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1087+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
10941088
lastRunNumber = currentRunNumber;
10951089
}
10961090
}
10971091

10981092
if (ShiftConfigs.cfgShiftCorr) {
1099-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1100-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1093+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1094+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
11011095
}
11021096

11031097
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
@@ -1398,25 +1392,21 @@ struct cascadeFlow {
13981392
if (ShiftConfigs.cfgShiftCorr) {
13991393
currentRunNumber = coll.runNumber();
14001394
if (currentRunNumber != lastRunNumber) {
1401-
shiftprofileFT0C.clear();
1402-
shiftprofileTPCL.clear();
1403-
shiftprofileTPCR.clear();
14041395
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
14051396
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
14061397
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);
1398+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1399+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1400+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
14131401
lastRunNumber = currentRunNumber;
14141402
}
14151403
}
1404+
14161405
if (ShiftConfigs.cfgShiftCorr) {
1417-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1418-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1406+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1407+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
14191408
}
1409+
14201410
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
14211411
histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
14221412

@@ -1703,25 +1693,21 @@ struct cascadeFlow {
17031693
if (ShiftConfigs.cfgShiftCorr) {
17041694
currentRunNumber = coll.runNumber();
17051695
if (currentRunNumber != lastRunNumber) {
1706-
shiftprofileFT0C.clear();
1707-
shiftprofileTPCL.clear();
1708-
shiftprofileTPCR.clear();
17091696
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
17101697
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
17111698
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);
1699+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1700+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1701+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
17181702
lastRunNumber = currentRunNumber;
17191703
}
17201704
}
1705+
17211706
if (ShiftConfigs.cfgShiftCorr) {
1722-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1723-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1707+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1708+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
17241709
}
1710+
17251711
histos.fill(HIST("hPsiT0C"), psiT0CCorr);
17261712
histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
17271713

@@ -1931,29 +1917,24 @@ struct cascadeFlow {
19311917
histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC));
19321918
histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC));
19331919
}
1934-
19351920
if (ShiftConfigs.cfgShiftCorr) {
19361921
currentRunNumber = coll.runNumber();
19371922
if (currentRunNumber != lastRunNumber) {
1938-
shiftprofileFT0C.clear();
1939-
shiftprofileTPCL.clear();
1940-
shiftprofileTPCR.clear();
19411923
fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C;
19421924
fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL;
19431925
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);
1926+
shiftprofileFT0C = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathFT0C, coll.timestamp());
1927+
shiftprofileTPCL = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCL, coll.timestamp());
1928+
shiftprofileTPCR = ccdb->getForTimeStamp<TProfile3D>(fullCCDBShiftCorrPathTPCR, coll.timestamp());
19501929
lastRunNumber = currentRunNumber;
19511930
}
19521931
}
1932+
19531933
if (ShiftConfigs.cfgShiftCorr) {
1954-
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C);
1955-
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC);
1934+
psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C);
1935+
ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR);
19561936
}
1937+
19571938
histos.fill(HIST("hpsiT0C"), psiT0CCorr);
19581939
histos.fill(HIST("hpsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr);
19591940

0 commit comments

Comments
 (0)