Skip to content

Commit 154e135

Browse files
EmilGormEmil Gorm Nielsen
andauthored
[PWGCF] RBR weight fix (#9407)
Co-authored-by: Emil Gorm Nielsen <emilgormnielsen@cern-ch>
1 parent 3a0382b commit 154e135

File tree

3 files changed

+44
-30
lines changed

3 files changed

+44
-30
lines changed

PWGCF/GenericFramework/Core/FlowPtContainer.cxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const double& centmult, const double
372372
continue;
373373
for (auto i = 0; i <= m; ++i) {
374374
if (cmDen[m] != 0) {
375-
dynamic_cast<BootstrapProfile*>(fCovList->At(fillCounter))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + (m - i)]), (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn);
375+
dynamic_cast<BootstrapProfile*>(fCovList->At(fillCounter))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + i + 1]), (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn);
376376
}
377377
++fillCounter;
378378
}
@@ -447,31 +447,31 @@ void FlowPtContainer::fillCMProfiles(const double& centmult, const double& rn)
447447
if (mpar < 1 || cmDen[1] == 0)
448448
return;
449449
cmVal.push_back(sumP[getVectorIndex(1, 1)] / cmDen[1]);
450-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(0))->FillProfile(centmult, cmVal[1], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[0], rn);
450+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(0))->FillProfile(centmult, cmVal[1], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[1], rn);
451451
if (mpar < 2 || sumP[getVectorIndex(2, 0)] == 0 || cmDen[2] == 0)
452452
return;
453453
cmVal.push_back(1 / cmDen[2] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - sumP[getVectorIndex(2, 2)]));
454-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(1))->FillProfile(centmult, cmVal[2], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[1], rn);
454+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(1))->FillProfile(centmult, cmVal[2], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn);
455455
cmVal.push_back(-2 * 1 / cmDen[2] * (sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 1)] - sumP[getVectorIndex(2, 1)]));
456-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(2))->FillProfile(centmult, cmVal[3], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[1], rn);
456+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(2))->FillProfile(centmult, cmVal[3], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn);
457457
if (mpar < 3 || sumP[getVectorIndex(3, 0)] == 0 || cmDen[3] == 0)
458458
return;
459459
cmVal.push_back(1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] + 2 * sumP[getVectorIndex(3, 3)]));
460-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(3))->FillProfile(centmult, cmVal[4], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn);
460+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(3))->FillProfile(centmult, cmVal[4], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
461461
cmVal.push_back(-3 * 1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 2 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 1)] + 2 * sumP[getVectorIndex(3, 2)] - sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 0)]));
462-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(4))->FillProfile(centmult, cmVal[5], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn);
462+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(4))->FillProfile(centmult, cmVal[5], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
463463
cmVal.push_back(3 * 1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 2 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 0)] + 2 * sumP[getVectorIndex(3, 1)] - sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 0)]));
464-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(5))->FillProfile(centmult, cmVal[6], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn);
464+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(5))->FillProfile(centmult, cmVal[6], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
465465
if (mpar < 4 || sumP[getVectorIndex(4, 0)] == 0 || cmDen[4] == 0)
466466
return;
467467
cmVal.push_back(1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - 6 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] + 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(2, 2)] + 8 * sumP[getVectorIndex(3, 3)] * sumP[getVectorIndex(1, 1)] - 6 * sumP[getVectorIndex(4, 4)]));
468-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(6))->FillProfile(centmult, cmVal[7], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
468+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(6))->FillProfile(centmult, cmVal[7], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn);
469469
cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 1)] + 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(2, 1)] + 6 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(3, 2)] - 6 * sumP[getVectorIndex(4, 3)]));
470-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(7))->FillProfile(centmult, cmVal[8], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
470+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(7))->FillProfile(centmult, cmVal[8], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn);
471471
cmVal.push_back(6 * 1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] + sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(2, 2)] - 4 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] + 4 * sumP[getVectorIndex(3, 2)] * sumP[getVectorIndex(1, 0)] + 4 * sumP[getVectorIndex(3, 1)] * sumP[getVectorIndex(1, 1)] + 2 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(2, 1)] - 6 * sumP[getVectorIndex(4, 2)]));
472-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(8))->FillProfile(centmult, cmVal[9], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
472+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(8))->FillProfile(centmult, cmVal[9], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn);
473473
cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(1, 0)] + 3 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(2, 0)] + 2 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(3, 0)] + 6 * sumP[getVectorIndex(3, 1)] * sumP[getVectorIndex(1, 0)] - 6 * sumP[getVectorIndex(4, 1)]));
474-
dynamic_cast<BootstrapProfile*>(fCMTermList->At(9))->FillProfile(centmult, cmVal[10], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn);
474+
dynamic_cast<BootstrapProfile*>(fCMTermList->At(9))->FillProfile(centmult, cmVal[10], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn);
475475
return;
476476
}
477477
void FlowPtContainer::fillArray(FillType a, FillType b, double c, double d)
@@ -518,7 +518,7 @@ double FlowPtContainer::getStdAABBCC(T& inarr)
518518
std::complex<double> bbcc = inarr[getVectorIndex(0, 2, 2, 0)];
519519
std::complex<double> aabbc = inarr[getVectorIndex(2, 2, 1, 0)];
520520
std::complex<double> aabcc = inarr[getVectorIndex(2, 1, 2, 0)];
521-
std::complex<double> abbcc = inarr[getVectorIndex(0, 0, 0, 0)];
521+
std::complex<double> abbcc = inarr[getVectorIndex(1, 2, 2, 0)];
522522
std::complex<double> aabbcc = inarr[getVectorIndex(2, 2, 2, 0)];
523523
return (a * a * b * b * c * c - aa * b * b * c * c - a * a * bb * c * c - a * a * b * b * cc - 4. * a * ab * b * c * c -
524524
4. * a * ac * b * b * c - 4. * a * a * b * bc * c + 4. * aab * b * c * c + 4. * aac * b * b * c +
@@ -567,7 +567,7 @@ double FlowPtContainer::getStdAABBCD(T& inarr)
567567
std::complex<double> aacd = inarr[getVectorIndex(2, 0, 1, 1)];
568568
std::complex<double> abbc = inarr[getVectorIndex(1, 2, 1, 0)];
569569
std::complex<double> abbd = inarr[getVectorIndex(1, 2, 0, 1)];
570-
std::complex<double> abcd = inarr[getVectorIndex(0, 1, 1, 1)];
570+
std::complex<double> abcd = inarr[getVectorIndex(1, 1, 1, 1)];
571571
std::complex<double> bbcd = inarr[getVectorIndex(0, 2, 1, 1)];
572572
std::complex<double> aabbc = inarr[getVectorIndex(2, 2, 1, 0)];
573573
std::complex<double> aabbd = inarr[getVectorIndex(2, 2, 0, 1)];
@@ -600,7 +600,7 @@ double FlowPtContainer::getStdAABBDD(T& inarr)
600600
{
601601
std::complex<double> a = inarr[getVectorIndex(1, 0, 0, 0)];
602602
std::complex<double> b = inarr[getVectorIndex(0, 1, 0, 0)];
603-
std::complex<double> d = inarr[getVectorIndex(0, 0, 1, 1)];
603+
std::complex<double> d = inarr[getVectorIndex(0, 0, 0, 1)];
604604
std::complex<double> aa = inarr[getVectorIndex(2, 0, 0, 0)];
605605
std::complex<double> bb = inarr[getVectorIndex(0, 2, 0, 0)];
606606
std::complex<double> dd = inarr[getVectorIndex(0, 0, 0, 2)];
@@ -622,7 +622,7 @@ double FlowPtContainer::getStdAABBDD(T& inarr)
622622
std::complex<double> bbdd = inarr[getVectorIndex(0, 2, 0, 2)];
623623
std::complex<double> aabbd = inarr[getVectorIndex(2, 2, 0, 1)];
624624
std::complex<double> aabdd = inarr[getVectorIndex(2, 1, 0, 2)];
625-
std::complex<double> abbdd = inarr[getVectorIndex(0, 0, 0, 2)];
625+
std::complex<double> abbdd = inarr[getVectorIndex(1, 2, 0, 2)];
626626
std::complex<double> aabbdd = inarr[getVectorIndex(2, 2, 0, 2)];
627627
return (-120. * aabbdd + 48. * a * abbdd + 16. * abd * abd + 24. * ab * abdd + 24. * abbd * ad +
628628
8. * abb * add + 48. * aabdd * b - 24. * a * abdd * b - 16. * abd * ad * b - 8. * ab * add * b -

PWGCF/GenericFramework/Core/FlowPtContainer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ class FlowPtContainer : public TNamed
122122
bool fUseGap; //!
123123
void mergeBSLists(TList* source, TList* target);
124124
TH1* raiseHistToPower(TH1* inh, double p);
125-
std::vector<double> sumP; //!
126-
std::vector<double> corrNum; //!
127-
std::vector<double> corrDen; //!
128-
std::vector<double> cmVal; //!
129-
std::vector<double> cmDen; //!
125+
std::vector<double> sumP; //!
126+
std::vector<double> corrNum; //!
127+
std::vector<double> corrDen; //!
128+
std::vector<double> cmVal; //!
129+
std::vector<double> cmDen; //!
130130
std::vector<std::complex<double>> arr; //!
131131
std::vector<double> warr; //!
132132
template <typename T>

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <TProfile.h>
4646
#include <TRandom3.h>
4747
#include <TF1.h>
48+
#include <TPDGCode.h>
4849

4950
using namespace o2;
5051
using namespace o2::framework;
@@ -104,6 +105,7 @@ struct GenericFramework {
104105
O2_DEFINE_CONFIGURABLE(cfgOccupancySelection, int, -999, "Max occupancy selection, -999 to disable");
105106
O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut");
106107
O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV");
108+
O2_DEFINE_CONFIGURABLE(cfgIsGoodITSLayersAll, bool, true, "kIsGoodITSLayersAll");
107109
O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard");
108110
O2_DEFINE_CONFIGURABLE(cfgDoOccupancySel, bool, true, "Bool for event selection on detector occupancy");
109111
O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, true, "Use additional evenr cut on mult correlations");
@@ -267,8 +269,9 @@ struct GenericFramework {
267269
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(6, "kIsGoodZvtxFT0vsPV");
268270
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(7, "kNoCollInTimeRangeStandard");
269271
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(8, "kIsVertexITSTPC");
270-
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(9, "after Mult cuts");
271-
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(10, "has track + within cent");
272+
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(9, "kIsGoodITSLayersAll");
273+
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(10, "after Mult cuts");
274+
registry.get<TH1>(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(11, "has track + within cent");
272275
}
273276

274277
if (regions.GetSize() < 0)
@@ -538,6 +541,13 @@ struct GenericFramework {
538541
}
539542
registry.fill(HIST("eventQA/eventSel"), 7.5);
540543
}
544+
545+
if (cfgIsGoodITSLayersAll) {
546+
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
547+
return 0;
548+
}
549+
registry.fill(HIST("eventQA/eventSel"), 8.5);
550+
}
541551
float vtxz = -999;
542552
if (collision.numContrib() > 1) {
543553
vtxz = collision.posZ();
@@ -560,7 +570,7 @@ struct GenericFramework {
560570
return 0;
561571
if (multTrk > fMultCutHigh->Eval(centrality))
562572
return 0;
563-
registry.fill(HIST("eventQA/eventSel"), 8.5);
573+
registry.fill(HIST("eventQA/eventSel"), 9.5);
564574
/* 22s
565575
if (multNTracksPV < fMultPVCutLow->Eval(centrality))
566576
return 0;
@@ -638,6 +648,8 @@ struct GenericFramework {
638648
std::vector<GFWWeights*> weights;
639649
std::vector<std::string> species = {"ref", "ch", "pi", "ka", "pr"};
640650
for (size_t i = 0; i < species.size(); ++i) {
651+
if (dynamic_cast<GFWWeights*>(fWeightList->FindObject(Form("w%i_%s", lastRun, species[i].c_str()))))
652+
continue;
641653
weights.push_back(new GFWWeights(Form("w%i_%s", lastRun, species[i].c_str())));
642654
if (i == 0) {
643655
auto it = std::find(ptbinning.begin(), ptbinning.end(), ptrefup);
@@ -650,6 +662,8 @@ struct GenericFramework {
650662
fWeightList->Add(weights[i]);
651663
}
652664
} else {
665+
if (dynamic_cast<GFWWeights*>(fWeightList->FindObject(Form("w%i_ch", lastRun))))
666+
return;
653667
GFWWeights* weight = new GFWWeights(Form("w%i_ch", lastRun));
654668
weight->SetPtBins(fPtAxis->GetNbins(), &ptbinning[0]);
655669
weight->Init(true, false);
@@ -699,7 +713,7 @@ struct GenericFramework {
699713
return;
700714
if (centrality < centbinning.front() || centrality > centbinning.back())
701715
return;
702-
registry.fill(HIST("eventQA/eventSel"), 9.5);
716+
registry.fill(HIST("eventQA/eventSel"), 10.5);
703717
float vtxz = collision.posZ();
704718
fGFW->Clear();
705719
fFCpt->clearVector();
@@ -732,11 +746,11 @@ struct GenericFramework {
732746

733747
int pidIndex = 0;
734748
if (cfgUsePID) {
735-
if (mcParticle.pdgCode() == 211)
749+
if (std::abs(mcParticle.pdgCode()) == kPiPlus)
736750
pidIndex = 1;
737-
if (mcParticle.pdgCode() == 321)
751+
if (std::abs(mcParticle.pdgCode()) == kKPlus)
738752
pidIndex = 2;
739-
if (mcParticle.pdgCode() == 2212)
753+
if (std::abs(mcParticle.pdgCode()) == kProton)
740754
pidIndex = 3;
741755
}
742756

@@ -761,11 +775,11 @@ struct GenericFramework {
761775

762776
int pidIndex = 0;
763777
if (cfgUsePID) {
764-
if (track.pdgCode() == 211)
778+
if (std::abs(track.pdgCode()) == kPiPlus)
765779
pidIndex = 1;
766-
if (track.pdgCode() == 321)
780+
if (std::abs(track.pdgCode()) == kKPlus)
767781
pidIndex = 2;
768-
if (track.pdgCode() == 2212)
782+
if (std::abs(track.pdgCode()) == kProton)
769783
pidIndex = 3;
770784
}
771785

0 commit comments

Comments
 (0)