Skip to content
72 changes: 58 additions & 14 deletions PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ struct lambdaspincorrderived {
TH3D* hweight22;
TH3D* hweight32;
TH3D* hweight42;
TH2D* hweightCentPair = nullptr;

Configurable<std::string> ConfWeightPathCentPair{"ConfWeightPathCentPair", "", "Centrality x pair-type weight path"};
Configurable<std::string> ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
Configurable<std::string> ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
Configurable<std::string> ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
Expand Down Expand Up @@ -278,6 +280,9 @@ struct lambdaspincorrderived {
histos.add("ptCent", "ptCent", HistType::kTH2D, {{100, 0.0, 10.0}, {8, 0.0, 80.0}}, true);
histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true);

histos.add("hCentPairTypeSE", "SE pair-weighted centrality;Centrality;PairType", kTH2D, {{110, 0.0, 110.0}, {4, -0.5, 3.5}});
histos.add("hCentPairTypeME", "ME pair-weighted centrality;Centrality;PairType", kTH2D, {{110, 0.0, 110.0}, {4, -0.5, 3.5}});

// --- 3D SE/ME pair-space maps per category (LL, LAL, ALL, ALAL)
histos.add("SE_LL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true);
histos.add("SE_LAL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true);
Expand Down Expand Up @@ -368,6 +373,9 @@ struct lambdaspincorrderived {
hweight32 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathALL2.value, cfgCcdbParam.nolaterthan.value);
hweight42 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathALAL2.value, cfgCcdbParam.nolaterthan.value);
}
if (!ConfWeightPathCentPair.value.empty()) {
hweightCentPair = ccdb->getForTimeStamp<TH2D>(ConfWeightPathCentPair.value, cfgCcdbParam.nolaterthan.value);
}
}

template <typename T>
Expand Down Expand Up @@ -694,6 +702,18 @@ struct lambdaspincorrderived {
}
}

static inline int pairTypeCode(int tag1, int tag2)
{
if (tag1 == 0 && tag2 == 0) {
return 0; // LL
} else if (tag1 == 0 && tag2 == 1) {
return 1; // LAL
} else if (tag1 == 1 && tag2 == 0) {
return 2; // ALL
} else {
return 3; // ALAL
}
}
ROOT::Math::PtEtaPhiMVector lambda0, proton0;
ROOT::Math::PtEtaPhiMVector lambda, proton;
ROOT::Math::PtEtaPhiMVector lambda2, proton2;
Expand Down Expand Up @@ -737,6 +757,8 @@ struct lambdaspincorrderived {
proton2 = ROOT::Math::PtEtaPhiMVector(v02.protonPt(), v02.protonEta(), v02.protonPhi(), o2::constants::physics::MassProton);
lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass());
histos.fill(HIST("deltaPhiSame"), RecoDecay::constrainAngle(v0.lambdaPhi() - v02.lambdaPhi(), -TMath::Pi(), harmonicDphi));
const int ptype = pairTypeCode(v0.v0Status(), v02.v0Status());
histos.fill(HIST("hCentPairTypeSE"), collision.cent(), ptype, 1.0);
if (v0.v0Status() == 0 && v02.v0Status() == 0) {
fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0);
}
Expand Down Expand Up @@ -1030,7 +1052,8 @@ struct lambdaspincorrderived {
MixBinner(float ptMin_, float ptMax_, float ptStep_,
float etaAbsMax, float etaStep_,
float phiStep_)
: ptMin(ptMin_), ptMax(ptMax_), ptStep(ptStep_), etaMin(-etaAbsMax), etaMax(+etaAbsMax), etaStep(etaStep_), phiMin(0.f), phiMax(static_cast<float>(2.0 * TMath::Pi())), phiStep(phiStep_)
: ptMin(ptMin_), ptMax(ptMax_), ptStep(ptStep_), etaMin(-etaAbsMax), etaMax(+etaAbsMax), etaStep(etaStep_), phiMin(-static_cast<float>(TMath::Pi())), phiMax(+static_cast<float>(TMath::Pi())), phiStep(phiStep_)
// : ptMin(ptMin_), ptMax(ptMax_), ptStep(ptStep_), etaMin(-etaAbsMax), etaMax(+etaAbsMax), etaStep(etaStep_), phiMin(0.f), phiMax(static_cast<float>(2.0 * TMath::Pi())), phiStep(phiStep_)
{
ptStep = (ptStep > 0.f ? ptStep : 0.1f);
etaStep = (etaStep > 0.f ? etaStep : 0.1f);
Expand Down Expand Up @@ -1138,7 +1161,7 @@ struct lambdaspincorrderived {
// Bin kinematics (φ already constrained via your call-site)
const int ptB = mb.ptBin(t.lambdaPt());
const int etaB = mb.etaBin(t.lambdaEta());
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t.lambdaPhi(), -TMath::Pi(), harmonic));
const int mB = mb.massBin(t.lambdaMass());
if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0)
continue;
Expand Down Expand Up @@ -1187,7 +1210,7 @@ struct lambdaspincorrderived {
// Bin of t1 defines where to search (exact bin, but handle φ wrap at edges)
const int ptB = mb.ptBin(t1.lambdaPt());
const int etaB = mb.etaBin(t1.lambdaEta());
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t1.lambdaPhi(), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t1.lambdaPhi(), -TMath::Pi(), harmonic));
const int mB = mb.massBin(t1.lambdaMass());
if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0)
continue;
Expand Down Expand Up @@ -1410,6 +1433,8 @@ struct lambdaspincorrderived {
RecoDecay::constrainAngle(mcacc::lamPhi(v0) - mcacc::lamPhi(v02),
-TMath::Pi(), harmonicDphi));

const int ptype = pairTypeCode(mcacc::v0Status(v0), mcacc::v0Status(v02));
histos.fill(HIST("hCentPairTypeSE"), mcacc::cent(collision), ptype, 1.0);
// datatype=0 (same event)
fillHistograms(mcacc::v0Status(v0), mcacc::v0Status(v02),
lambda, lambda2, proton, proton2,
Expand Down Expand Up @@ -1573,7 +1598,7 @@ struct lambdaspincorrderived {

const int ptB = mb.ptBin(mcacc::lamPt(t));
const int etaB = mb.etaBin(mcacc::lamEta(t));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t), -TMath::Pi(), harmonic));
const int mB = mb.massBin(mcacc::lamMass(t));
if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) {
continue;
Expand Down Expand Up @@ -1625,7 +1650,7 @@ struct lambdaspincorrderived {

const int ptB = mb.ptBin(mcacc::lamPt(t1));
const int etaB = mb.etaBin(mcacc::lamEta(t1));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t1), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t1), -TMath::Pi(), harmonic));
const int mB = mb.massBin(mcacc::lamMass(t1));
if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) {
continue;
Expand Down Expand Up @@ -1846,7 +1871,7 @@ struct lambdaspincorrderived {
etaB = mb.etaBin(lv.Rapidity()); // treat "eta axis" as rapidity axis
}

const int phiB = mb.phiBin(RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t.lambdaPhi(), -TMath::Pi(), harmonic));
const int mB = mb.massBin(t.lambdaMass());

if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) {
Expand Down Expand Up @@ -1919,7 +1944,7 @@ struct lambdaspincorrderived {
etaB = mb.etaBin(lv1.Rapidity());
}

const int phiB = mb.phiBin(RecoDecay::constrainAngle(t1.lambdaPhi(), 0.0F, harmonic));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(t1.lambdaPhi(), -TMath::Pi(), harmonic));
const int mB = mb.massBin(t1.lambdaMass());

if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) {
Expand Down Expand Up @@ -2011,12 +2036,22 @@ struct lambdaspincorrderived {
auto lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(),
t2.lambdaMass());

const int ptype = pairTypeCode(tX.v0Status(), t2.v0Status());
double centPairWeight = 1.0;
if (hweightCentPair) {
const int bin = hweightCentPair->FindBin(col1.cent(), ptype);
centPairWeight = hweightCentPair->GetBinContent(bin);
if (centPairWeight <= 0.0) {
centPairWeight = 1.0;
}
}
const float meWeight = wBase * centPairWeight;
const float dPhi = deltaPhiMinusPiToPi((float)lambda.Phi(), (float)lambda2.Phi());
histos.fill(HIST("deltaPhiMix"), dPhi, wBase);

histos.fill(HIST("hCentPairTypeME"), col1.cent(), ptype, wBase);
fillHistograms(tX.v0Status(), t2.v0Status(),
lambda, lambda2, proton, proton2,
/*datatype=*/1, /*mixpairweight=*/wBase);
/*datatype=*/1, /*mixpairweight=*/meWeight);
}
}
}
Expand Down Expand Up @@ -2076,7 +2111,7 @@ struct lambdaspincorrderived {
etaB = mb.etaBin(lv.Rapidity());
}

const int phiB = mb.phiBin(phi0To2Pi(mcacc::lamPhi(t)));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t), -TMath::Pi(), harmonic));
if (ptB < 0 || etaB < 0 || phiB < 0) {
continue;
}
Expand Down Expand Up @@ -2142,8 +2177,7 @@ struct lambdaspincorrderived {
mcacc::lamPhi(t1), mcacc::lamMass(t1));
etaB = mb.etaBin(lv1.Rapidity());
}

const int phiB = mb.phiBin(phi0To2Pi(mcacc::lamPhi(t1)));
const int phiB = mb.phiBin(RecoDecay::constrainAngle(mcacc::lamPhi(t1), -TMath::Pi(), harmonic));
if (ptB < 0 || etaB < 0 || phiB < 0) {
continue;
}
Expand Down Expand Up @@ -2230,12 +2264,22 @@ struct lambdaspincorrderived {
auto l2 = ROOT::Math::PtEtaPhiMVector(mcacc::lamPt(t2), mcacc::lamEta(t2), mcacc::lamPhi(t2),
mcacc::lamMass(t2));

const int ptype = pairTypeCode(mcacc::v0Status(tX), mcacc::v0Status(t2));
double centPairWeight = 1.0;
if (hweightCentPair) {
const int bin = hweightCentPair->FindBin(mcacc::cent(col1), ptype);
centPairWeight = hweightCentPair->GetBinContent(bin);
if (centPairWeight <= 0.0) {
centPairWeight = 1.0;
}
}
const float meWeight = wBase * centPairWeight;
const float dPhi = deltaPhiMinusPiToPi((float)lX.Phi(), (float)l2.Phi());
histos.fill(HIST("deltaPhiMix"), dPhi, wBase);

histos.fill(HIST("hCentPairTypeME"), mcacc::cent(col1), ptype, wBase);
fillHistograms(mcacc::v0Status(tX), mcacc::v0Status(t2),
lX, l2, pX, p2,
/*datatype=*/1, /*mixpairweight=*/wBase);
/*datatype=*/1, /*mixpairweight=*/meWeight);
}
}
}
Expand Down
Loading