Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 27 additions & 27 deletions PWGLF/TableProducer/Strangeness/sigma0builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
Preslice<V0DerivedMCDatas> perCollisionMCDerived = o2::aod::v0data::straCollisionId;
Preslice<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
PresliceUnsorted<soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraCollLabels>> perMcCollision = aod::v0data::straMCCollisionId;

// pack track quality but separte also afterburner
// dynamic range: 0-31
enum selection : int { hasTPC = 0,
Expand Down Expand Up @@ -147,7 +147,7 @@
Configurable<float> LambdaMaxv0radius{"LambdaMaxv0radius", 60, "Max V0 radius (cm)"};
Configurable<float> LambdaWindow{"LambdaWindow", 0.05, "Mass window around expected (in GeV/c2)"};

//// Photon criteria:
//// Photon criteria:
Configurable<float> PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"};
Configurable<float> PhotonMinDCAToPv{"PhotonMinDCAToPv", 0.0, "Min DCA daughter To PV (cm)"};
Configurable<float> PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"};
Expand Down Expand Up @@ -353,28 +353,28 @@
histos.add("Pi0QA/h2dPtVsMassPi0AfterSel_Candidates", "h2dPtVsMassPi0AfterSel_Candidates", kTH2D, {axisPt, axisPi0Mass});
}

if (doprocessGeneratedRun3){
if (doprocessGeneratedRun3) {

histos.add("Gen/hGenEvents", "hGenEvents", kTH2F, {{axisNch}, {2, -0.5f, +1.5f}});
histos.get<TH2>(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events");
histos.get<TH2>(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events");

histos.add("Gen/hGenEventCentrality", "hGenEventCentrality", kTH1F, {{101, 0.0f, 101.0f}});
histos.add("Gen/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}});
histos.add("Gen/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}});
histos.add("Gen/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2F, {{101, 0.0f, 101.0f}, axisNch});
histos.add("Gen/h2dGenGamma", "h2dGenGamma", kTH2D, {axisCentrality, axisPt});
histos.add("Gen/h2dGenLambda", "h2dGenLambda", kTH2D, {axisCentrality, axisPt});
histos.add("Gen/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt});
histos.add("Gen/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt});
histos.add("Gen/h2dGenGammaVsMultMC_RecoedEvt", "h2dGenGammaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenGammaVsMultMC", "h2dGenGammaVsMultMC", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt});
histos.add("Gen/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt});
histos.add("Gen/hEventPVzMC", "hEventPVzMC", kTH1F, {{100, -20.0f, +20.0f}});
histos.add("Gen/hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}});

auto hPrimaryV0s = histos.add<TH1>("Gen/hPrimaryV0s", "hPrimaryV0s", kTH1D, {{2, -0.5f, 1.5f}});
hPrimaryV0s->GetXaxis()->SetBinLabel(1, "All V0s");
hPrimaryV0s->GetXaxis()->SetBinLabel(2, "Primary V0s");
Expand Down Expand Up @@ -541,8 +541,8 @@
auto v0 = fullv0s.rawIteratorAt(selV0Indices[i]);
auto v0MC = v0.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();

float V0MCpT = RecoDecay::pt(array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});

Check failure on line 544 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float V0PA = TMath::ACos(v0.v0cosPA());

Check failure on line 545 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
bool fIsV0CorrectlyAssigned = (v0MC.straMCCollisionId() == v0MCCollision.globalIndex());
bool isPrimary = v0MC.isPhysicalPrimary();

Expand All @@ -567,15 +567,15 @@
}
}

// ______________________________________________________
// ______________________________________________________
// Simulated processing
// Return the list of indices to the recoed collision associated to a given MC collision.
template <typename TMCollisions, typename TCollisions>
std::vector<int> getListOfRecoCollIndices(TMCollisions const& mcCollisions, TCollisions const& collisions)
{
std::vector<int> listBestCollisionIdx(mcCollisions.size());
for (auto const& mcCollision : mcCollisions) {
auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
int biggestNContribs = -1;
int bestCollisionIndex = -1;
for (auto const& collision : groupedCollisions) {
Expand All @@ -590,7 +590,7 @@
if (biggestNContribs < collision.multPVTotalContributors()) {
biggestNContribs = collision.multPVTotalContributors();
bestCollisionIndex = collision.globalIndex();
}
}
}
listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex;
}
Expand Down Expand Up @@ -621,7 +621,7 @@

histos.fill(HIST("Gen/hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/);

auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
// Check if there is at least one of the reconstructed collisions associated to this MC collision
// If so, we consider it
bool atLeastOne = false;
Expand All @@ -633,12 +633,12 @@
if (!IsEventAccepted(collision, false)) {
continue;
}

if (biggestNContribs < collision.multPVTotalContributors()) {
biggestNContribs = collision.multPVTotalContributors();
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
}

nCollisions++;
atLeastOne = true;
}
Expand All @@ -656,7 +656,7 @@
}
return;
}

// ______________________________________________________
// Simulated processing (subscribes to MC information too)
template <typename TMCCollisions, typename TV0MCs, typename TCollisions>
Expand All @@ -674,17 +674,17 @@

histos.fill(HIST("Gen/hPrimaryV0s"), 1);

// TODO: get generated sigma0s
// TODO: get generated sigma0s

float ptmc = v0MC.ptMC();
float ymc = 1e3;
if (v0MC.pdgCode() == 22)
ymc = RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma);
ymc = RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma);

else if (std::abs(v0MC.pdgCode()) == 3122)
ymc = v0MC.rapidityMC(1);

if (std::abs(ymc) > V0Rapidity)
if (std::abs(ymc) > V0Rapidity)
continue;

auto mcCollision = v0MC.template straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
Expand All @@ -703,9 +703,9 @@

float centrality = 100.5f;
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();

if (v0MC.pdgCode() == 22) {
histos.fill(HIST("Gen/h2dGenGammaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
}
Expand All @@ -728,7 +728,7 @@
histos.fill(HIST("Gen/h2dGenAntiLambda"), centrality, ptmc);
histos.fill(HIST("Gen/h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
}
}
}
}

template <typename TV0Object>
Expand Down Expand Up @@ -776,8 +776,8 @@
auto negTrackGamma2 = gamma2.template negTrackExtra_as<dauTracks>();

// Gamma1 Selection
bool passedTPCGamma1 = (posTrackGamma1.tpcNSigmaEl() == -999.f || TMath::Abs(posTrackGamma1.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas) &&

Check failure on line 779 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
(negTrackGamma1.tpcNSigmaEl() == -999.f || TMath::Abs(negTrackGamma1.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas);

Check failure on line 780 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

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

if (TMath::Abs(gamma1.mGamma()) > Pi0PhotonMaxMass ||
gamma1.qtarm() >= Pi0PhotonMaxQt ||
Expand Down Expand Up @@ -1087,11 +1087,11 @@
TVector3 v2(lambda.px(), lambda.py(), lambda.pz());

// Sigma related
float fSigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()});

Check failure on line 1090 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float fSigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0});
float fSigmaRap = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0);
float fSigmaOPAngle = v1.Angle(v2);
float fSigmaCentrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();
float fSigmaCentrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();
uint64_t fSigmaTimeStamp = coll.timestamp();
int fSigmaRunNumber = coll.runNumber();

Expand Down Expand Up @@ -1197,7 +1197,7 @@
//_______________________________________________
// Wrongly collision association study
if (doAssocStudy && fhasMCColl) {
analyzeV0CollAssoc(coll, fullV0s, bestGammasArray, interactionRate, true); // Gamma
analyzeV0CollAssoc(coll, fullV0s, bestGammasArray, interactionRate, true); // Gamma
analyzeV0CollAssoc(coll, fullV0s, bestLambdasArray, interactionRate, false); // Lambda
}

Expand Down Expand Up @@ -1230,7 +1230,7 @@
std::array<float, 3> pVecLambda{lambda.px(), lambda.py(), lambda.pz()};
auto arrMom = std::array{pVecPhotons, pVecLambda};
float SigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0});
float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()});

Check failure on line 1233 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float SigmaY = TMath::Abs(RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0));

// MC properties
Expand All @@ -1245,9 +1245,9 @@
int LambdaCandPDGCode = lambdaMC.pdgCode();
int LambdaCandPDGCodeMother = lambdaMC.pdgCodeMother();

float SigmaMCpT = RecoDecay::pt(array{gammaMC.pxMC() + lambdaMC.pxMC(), gammaMC.pyMC() + lambdaMC.pyMC()});

Check failure on line 1248 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float PhotonMCpT = RecoDecay::pt(array{gammaMC.pxMC(), gammaMC.pyMC()});

Check failure on line 1249 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float LambdaMCpT = RecoDecay::pt(array{lambdaMC.pxMC(), lambdaMC.pyMC()});

Check failure on line 1250 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.

if (fhasMCColl) {
auto lambdaMCCollision = coll.template straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
Expand Down Expand Up @@ -1368,7 +1368,7 @@
std::array<float, 3> pVecLambda{lambda.px(), lambda.py(), lambda.pz()};
auto arrMom = std::array{pVecPhotons, pVecLambda};
float SigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0});
float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()});

Check failure on line 1371 in PWGLF/TableProducer/Strangeness/sigma0builder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.

histos.fill(HIST("SigmaSel/h3dMassSigma0BeforeSel"), centrality, SigmapT, SigmaMass);

Expand All @@ -1390,8 +1390,8 @@

// Simulated processing in Run 3 (subscribes to MC information too)
void processGeneratedRun3(soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const& mcCollisions, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& V0MCCores, soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels> const& collisions, aod::MotherMCParts const& mcmothers)
{
analyzeGeneratedV0s(mcCollisions, V0MCCores, collisions);
{
analyzeGeneratedV0s(mcCollisions, V0MCCores, collisions);
}

PROCESS_SWITCH(sigma0builder, processMonteCarlo, "process as if MC data", false);
Expand Down
8 changes: 4 additions & 4 deletions PWGLF/Tasks/Strangeness/sigmaanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct sigmaanalysis {
Configurable<bool> fillQAhistos{"fillQAhistos", false, "if true, fill QA histograms"};
Configurable<bool> fillBkgQAhistos{"fillBkgQAhistos", false, "if true, fill MC QA histograms for Bkg study. Only works with MC."};
Configurable<bool> fillpTResoQAhistos{"fillpTResoQAhistos", false, "if true, fill MC QA histograms for pT resolution study. Only works with MC."};

// Analysis strategy:
Configurable<bool> fUseMLSel{"fUseMLSel", false, "Flag to use ML selection. If False, the standard selection is applied."};
Configurable<bool> fselLambdaTPCPID{"fselLambdaTPCPID", true, "Flag to select lambda-like candidates using TPC NSigma."};
Expand Down Expand Up @@ -267,7 +267,7 @@ struct sigmaanalysis {
histos.add(histodir + "/MC/Photon/h2dPosTPCNSigmaEl", "h2dPosTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma});
histos.add(histodir + "/MC/Photon/h2dNegTPCNSigmaEl", "h2dNegTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma});
histos.add(histodir + "/MC/Photon/h2dPosTPCNSigmaPi", "h2dPosTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma});
histos.add(histodir + "/MC/Photon/h2dNegTPCNSigmaPi", "h2dNegTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma});
histos.add(histodir + "/MC/Photon/h2dNegTPCNSigmaPi", "h2dNegTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma});
histos.add(histodir + "/MC/Photon/h2dPAVsPt", "h2dPAVsPt", kTH2F, {axisPA, axisPt});
histos.add(histodir + "/MC/Photon/hPt_BadCollAssig", "hPt_BadCollAssig", kTH1F, {axisPt});
histos.add(histodir + "/MC/Photon/h2dPAVsPt_BadCollAssig", "h2dPAVsPt_BadCollAssig", kTH2F, {axisPA, axisPt});
Expand Down Expand Up @@ -578,7 +578,7 @@ struct sigmaanalysis {
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dNegTPCNSigmaEl"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaEl());
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPosTPCNSigmaPi"), sigma.photonPosPt(), sigma.photonPosTPCNSigmaPi());
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dNegTPCNSigmaPi"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaPi());

histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPAVsPt"), TMath::ACos(sigma.photonCosPA()), sigma.photonMCPt());

if (!sigma.photonIsCorrectlyAssoc()) {
Expand Down Expand Up @@ -857,7 +857,7 @@ struct sigmaanalysis {
template <typename TV0Object>
bool processSigmaCandidate(TV0Object const& cand)
{

// Do ML analysis
if (fUseMLSel) {
if ((cand.gammaBDTScore() == -1) || (cand.lambdaBDTScore() == -1) || (cand.antilambdaBDTScore() == -1)) {
Expand Down
Loading