Skip to content
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1a0328e
Improve TOF PID selection cut
skundu692 Aug 23, 2025
f679e1b
Improve TOF PID selection cut
skundu692 Aug 23, 2025
426c689
Add RCT flag for event selection
skundu692 Aug 24, 2025
fce48b5
Merge remote-tracking branch 'refs/remotes/upstream/master'
skundu692 Aug 25, 2025
93997fd
Merge remote-tracking branch 'upstream/master'
skundu692 Aug 26, 2025
48e43e3
Add charge information in derived data and QA histogram in analysis task
skundu692 Aug 26, 2025
fa64641
Merge remote-tracking branch 'upstream/master' into f1protonanalysis
skundu692 Sep 4, 2025
c111df1
Fix bug in derived data and rotational background in task
skundu692 Sep 4, 2025
cde397e
Merge remote-tracking branch 'upstream/master' into f1pnew2
skundu692 Sep 5, 2025
5aaa41f
Add new histogram for spin correlation
skundu692 Sep 5, 2025
7718812
Merge remote-tracking branch 'upstream/master' into spincorr254
skundu692 Sep 8, 2025
e17c906
Add new event-mixing process function
skundu692 Sep 8, 2025
d002be6
Merge remote-tracking branch 'upstream/master' into spincorr777
skundu692 Sep 11, 2025
9fc1433
Merge remote-tracking branch 'upstream/master' into spincorr777
skundu692 Sep 11, 2025
a94bdfd
Add new process function for doublephi and modify charge pairing for …
skundu692 Sep 11, 2025
1b625c8
Merge remote-tracking branch 'upstream/master' into doublephif1p
skundu692 Sep 19, 2025
b820e26
Add mixed event combinatorial background
skundu692 Sep 19, 2025
ef3cd2b
Merge remote-tracking branch 'upstream/master' into f1pmixbkg
skundu692 Sep 23, 2025
594d0be
Fix spin correlation definition
skundu692 Sep 23, 2025
11ea888
Fix megalinter error
skundu692 Sep 23, 2025
558d87b
Fix clang format error
skundu692 Sep 23, 2025
3732d52
Merge remote-tracking branch 'upstream/master' into spincorr154
skundu692 Sep 25, 2025
f765519
Add new definition of spin correlation same as STAR to compare
skundu692 Sep 25, 2025
80d5465
Merge remote-tracking branch 'upstream/master' into spincorrcomareSTAR
skundu692 Sep 26, 2025
aae382a
Add switch to activate sel8 trigger for QC check
skundu692 Sep 26, 2025
b3036a9
Merge remote-tracking branch 'upstream/master' into phiqcchk
skundu692 Sep 30, 2025
8a1784c
Add new weights for event mixing
skundu692 Sep 30, 2025
c86b5b3
Merge remote-tracking branch 'upstream/master' into spincorrnew
skundu692 Oct 5, 2025
37f4293
Merge remote-tracking branch 'upstream/master' into spincorrnew
skundu692 Oct 6, 2025
51d87a4
Fix issue with efficiency weight
skundu692 Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 29 additions & 78 deletions PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <Math/GenVector/Boost.h>
#include <Math/Vector3D.h>
#include <Math/Vector4D.h>
#include <TLorentzVector.h>

Check failure on line 33 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TMath.h>
#include <TRandom3.h>

Expand All @@ -39,7 +39,7 @@
#include <algorithm>
#include <cmath> // for std::fabs
#include <deque>
#include <iostream>

Check failure on line 42 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <iterator>
#include <set> // <<< CHANGED: for dedup sets
#include <string>
Expand Down Expand Up @@ -80,13 +80,9 @@
// Configurable<std::string> ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};
// Configurable<std::string> ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"};

Configurable<std::string> ConfRPathL{"ConfRPathL", "", "CCDB path to R_L (optional)"};
Configurable<std::string> ConfRPathAL{"ConfRPathAL", "", "CCDB path to R_AL (optional)"};
Configurable<std::string> ConfEffPathL{"ConfEffPathL", "", "CCDB path to Eff (optional)"};
Configurable<std::string> ConfEffPathAL{"ConfEffPathAL", "", "CCDB path to Eff (optional)"};

TH3D* hR_L = nullptr;
TH3D* hR_AL = nullptr;
TH3D* hEff_L = nullptr;
TH3D* hEff_AL = nullptr;

Expand Down Expand Up @@ -127,7 +123,7 @@
ConfigurableAxis configThnAxisPol{"configThnAxisPol", {80, 0.0, 8.0}, "cos#it{#theta *}"};
ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0.0, 80.0}, "Centrality"};
ConfigurableAxis configThnAxisRapidity{"configThnAxisRapidity", {5, 0.0, 1.0}, "Rapidity"};
ConfigurableAxis configThnAxisPhi{"configThnAxisPhi", {18, 0.0, 2.0 * TMath::Pi()}, "Phi"};

Check failure on line 126 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};

void init(o2::framework::InitContext&)
Expand All @@ -135,23 +131,17 @@
histos.add("hPtYSame", "hPtYSame", kTH2F, {{100, 0.0, 10.0}, {200, -1.0, 1.0}});
histos.add("hPtYMix", "hPtYMix", kTH2F, {{100, 0.0, 10.0}, {200, -1.0, 1.0}});
histos.add("hCentrality", "Centrality distribution", kTH1F, {{configThnAxisCentrality}});
histos.add("deltaPhiSame", "deltaPhiSame", HistType::kTH1D, {{72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 134 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
histos.add("deltaPhiMix", "deltaPhiMix", HistType::kTH1D, {{72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 135 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
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);

// --- Singles QA for data-driven MIXED reweight (one fill per candidate) ---
histos.add("hSE_L", "SE #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);
histos.add("hSE_AL", "SE #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);
histos.add("hME_L", "ME #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);
histos.add("hME_AL", "ME #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);

// Attempted-for-replacement (Den) and Succeeded (Num) per SE leg kinematics
histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 140 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 141 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.

histos.add("hMatchNum_L", "Succeeded #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 143 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
histos.add("hMatchNum_AL", "Succeeded #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);

Check failure on line 144 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.

// histos.add("hLambdaNUA", "hLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);
// histos.add("hAntiLambdaNUA", "hAntiLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true);
Expand Down Expand Up @@ -203,8 +193,6 @@
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
LOGF(info, "Getting alignment offsets from the CCDB...");
if (useweight) {
hR_L = ccdb->getForTimeStamp<TH3D>(ConfRPathL.value, cfgCcdbParam.nolaterthan.value);
hR_AL = ccdb->getForTimeStamp<TH3D>(ConfRPathAL.value, cfgCcdbParam.nolaterthan.value);
hEff_L = ccdb->getForTimeStamp<TH3D>(ConfEffPathL.value, cfgCcdbParam.nolaterthan.value);
hEff_AL = ccdb->getForTimeStamp<TH3D>(ConfEffPathAL.value, cfgCcdbParam.nolaterthan.value);
// hweight1 = ccdb->getForTimeStamp<TH3D>(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value);
Expand Down Expand Up @@ -421,7 +409,9 @@
auto costhetaz1costhetaz2 = -999.0;
if (cosDef == 0) {
cosThetaDiff = cosDeltaTheta_STAR_naive;
costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P());
if (proton1LambdaRF.P() * proton2LambdaRF.P() != 0.0) {
costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P());
}
} else {
cosThetaDiff = cosDeltaTheta_hel;
costhetaz1costhetaz2 = cosDeltaTheta_beam;
Expand All @@ -430,40 +420,22 @@
double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic));
double deltaEta = particle1Dummy.Eta() - particle2Dummy.Eta();
double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity());
double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi);

Check failure on line 423 in PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.

double nuaWeightParticle1 = 1.0, epsWeightParticle1 = 1.0;
double nuaWeightParticle2 = 1.0, epsWeightParticle2 = 1.0;

if (useweight && datatype == 1) {
// particle 1
{
auto* hR = (tag1 == 0 ? hR_L : hR_AL);
auto* hEff = (tag1 == 0 ? hEff_L : hEff_AL);
double epsWeightParticle1 = 1.0;
double epsWeightParticle2 = 1.0;

float pt = particle1.Pt();
float eta = particle1.Eta();
float phi = RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic);

nuaWeightParticle1 = hR->GetBinContent(hR->FindBin(pt, eta, phi));
if (replacedFlag == 1) {
epsWeightParticle1 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi));
}
if (useweight && datatype == 1 && replacedFlag == 1) {
if (tag1 == 0) {
epsWeightParticle1 = hEff_L->GetBinContent(hEff_L->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
} else {
epsWeightParticle1 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
}

// particle 2
{
auto* hR = (tag2 == 0 ? hR_L : hR_AL);
auto* hEff = (tag2 == 0 ? hEff_L : hEff_AL);

float pt = particle2.Pt();
float eta = particle2.Eta();
float phi = RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic);

nuaWeightParticle2 = hR->GetBinContent(hR->FindBin(pt, eta, phi));
if (replacedFlag == 2) {
epsWeightParticle2 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi));
}
} else if (useweight && datatype == 1 && replacedFlag == 2) {
if (tag2 == 0) {
epsWeightParticle2 = hEff_L->GetBinContent(hEff_L->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic)));
} else {
epsWeightParticle2 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic)));
}
}

Expand Down Expand Up @@ -492,17 +464,16 @@
// histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight);
}
} else if (datatype == 1) {
// double weight1 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2;
// double weight2 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2;
// double weight3 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2;
// double weight4 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2;
// if (useweight) {
// weight1 = mixpairweight * hweight1->GetBinContent(hweight1->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
// weight2 = mixpairweight * hweight2->GetBinContent(hweight2->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
// weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
// weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic)));
// }
double weight = mixpairweight * (nuaWeightParticle1 / epsWeightParticle1) * (nuaWeightParticle2 / epsWeightParticle2);
double weight = mixpairweight;
if (useweight && replacedFlag == 1) {
weight = mixpairweight / epsWeightParticle1;
}
if (useweight && replacedFlag == 2) {
weight = mixpairweight / epsWeightParticle2;
}
if (weight <= 0.0) {
weight = 1.0;
}
if (tag1 == 0 && tag2 == 0) {
histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight);
histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight);
Expand Down Expand Up @@ -552,13 +523,6 @@
proton = ROOT::Math::PtEtaPhiMVector(v0.protonPt(), v0.protonEta(), v0.protonPhi(), o2::constants::physics::MassProton);
lambda = ROOT::Math::PtEtaPhiMVector(v0.lambdaPt(), v0.lambdaEta(), v0.lambdaPhi(), v0.lambdaMass());

auto phiH0 = RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic);
if (v0.v0Status() == 0) {
histos.fill(HIST("hSE_L"), v0.lambdaPt(), v0.lambdaEta(), phiH0);
} else {
histos.fill(HIST("hSE_AL"), v0.lambdaPt(), v0.lambdaEta(), phiH0);
}

for (const auto& v02 : V0s) {
if (v02.index() <= v0.index()) {
continue;
Expand Down Expand Up @@ -803,11 +767,11 @@
int mixes = 0;
struct PoolView {
AllTrackCandidates* pool;
int nRepl;
double nRepl;
int collIdx;
};
std::vector<PoolView> usable;
int totalRepl = 0;
double totalRepl = 0;

for (auto it = eventPools[bin].rbegin();
it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) {
Expand All @@ -816,7 +780,7 @@
if (collision2idx == collision1.index())
continue; // safety

int nRepl = 0;
double nRepl = 0;
for (auto& tX : poolB) {
if (!selectionV0(tX))
continue;
Expand All @@ -836,8 +800,8 @@

if (totalRepl == 0)
continue;
const float wBase = 1.0f / static_cast<float>(totalRepl);

const float wBase = 1.0f / totalRepl;
// --- Second pass: actually build mixed pairs for the chosen leg
for (auto& pv : usable) {
auto& poolB = *pv.pool;
Expand Down Expand Up @@ -878,19 +842,6 @@

// after mixing with prior events, push current event into the pool
auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index());

// --- ME singles (one fill per candidate) for this event entering the pool ---
for (auto& t : sliced) {
if (!selectionV0(t))
continue;
const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic);
if (t.v0Status() == 0) {
histos.fill(HIST("hME_L"), t.lambdaPt(), t.lambdaEta(), phiH);
} else {
histos.fill(HIST("hME_AL"), t.lambdaPt(), t.lambdaEta(), phiH);
}
}

eventPools[bin].emplace_back(collision1.index(), std::move(sliced));
if (static_cast<int>(eventPools[bin].size()) > nEvtMixing) {
eventPools[bin].pop_front();
Expand Down
Loading