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
5 changes: 3 additions & 2 deletions PWGLF/DataModel/LFSigmaProtonTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace sigmaproton
{
DECLARE_SOA_COLUMN(ChargeSigma, chargeSigma, int); //! Charge of the sigma candidate
DECLARE_SOA_COLUMN(SigmaDecRad, sigmaDecRad, float); //! Decay radius of the Sigma candidate
DECLARE_SOA_COLUMN(SigmaCosPA, sigmaCosPA, float); //! Cosine of pointing angle of the Sigma candidate
DECLARE_SOA_COLUMN(ChargePr, chargePr, int); //! Charge of the proton candidate
DECLARE_SOA_COLUMN(PxPr, pxPr, float); //! Px of the proton candidate
DECLARE_SOA_COLUMN(PyPr, pyPr, float); //! Py of the proton candidate
Expand All @@ -49,14 +50,14 @@ DECLARE_SOA_COLUMN(PrPDG, prPDG, int); //! PDG code of the proton ca
DECLARE_SOA_TABLE(SigmaProtonCands, "AOD", "SIGMAPROTONCANDS",
o2::soa::Index<>,
sigmaproton::ChargeSigma, kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth,
kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, sigmaproton::SigmaDecRad,
kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, sigmaproton::SigmaDecRad, sigmaproton::SigmaCosPA,
sigmaproton::ChargePr, sigmaproton::PxPr, sigmaproton::PyPr, sigmaproton::PzPr,
sigmaproton::NSigmaTPCPr, sigmaproton::NSigmaTOFPr);

DECLARE_SOA_TABLE(SigmaProtonMCCands, "AOD", "SIGMAPROTONMCCANDS",
o2::soa::Index<>,
sigmaproton::ChargeSigma, kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth,
kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, sigmaproton::SigmaDecRad,
kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, sigmaproton::SigmaDecRad, sigmaproton::SigmaCosPA,
sigmaproton::ChargePr, sigmaproton::PxPr, sigmaproton::PyPr, sigmaproton::PzPr,
sigmaproton::NSigmaTPCPr, sigmaproton::NSigmaTOFPr,
sigmaproton::SigmaPDG, sigmaproton::DaughterPDG, sigmaproton::PrPDG);
Expand Down
71 changes: 58 additions & 13 deletions PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -25,6 +25,11 @@
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/PID.h"

#include <Math/GenVector/Boost.h>
#include <Math/Vector4D.h>
#include <TLorentzVector.h>

Check failure on line 30 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.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>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
Expand Down Expand Up @@ -54,6 +59,7 @@
float sigmaDauPy = -1; // Py of the daughter track from Sigma decay
float sigmaDauPz = -1; // Pz of the daughter track from Sigma decay
float sigmaDecRadius = -1; // Decay radius of the Sigma candidate
float sigmaCosPA = -1; // Cosine of pointing angle of the Sigma candidate

int chargePr = 0; // Charge of the proton candidate
float pxPr = -1; // Px of the proton candidate
Expand All @@ -77,14 +83,14 @@
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
HistogramRegistry rSigmaProton{"sigmaProton", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
// Configurable for event selection
Configurable<float> cutzvertex{"cutZVertex", 10.0f, "Accepted z-vertex range (cm)"};

Check failure on line 86 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)

Configurable<float> minPtSigma{"minPtSigma", 1.f, "Minimum pT for Sigma candidates (GeV/c)"};
Configurable<float> cutEtaDaught{"cutEtaDaughter", 0.8f, "Eta cut for daughter tracks"};

Check failure on line 89 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> cutDCAtoPVSigma{"cutDCAtoPVSigma", 0.1f, "Max DCA to primary vertex for Sigma candidates (cm)"};
Configurable<bool> doSigmaMinus{"doSigmaMinus", true, "If true, pair Sigma- candidates, else Sigma+"};
Configurable<float> cutSigmaRadius{"cutSigmaRadius", 20.f, "Minimum radius for Sigma candidates (cm)"};
Configurable<float> cutSigmaMass{"cutSigmaMass", 0.3, "Sigma mass window (MeV/c^2)"};
Configurable<float> cutSigmaMass{"cutSigmaMass", 0.3, "Sigma mass window (GeV/c^2)"};
Configurable<float> alphaAPCut{"alphaAPCut", 0., "Alpha AP cut for Sigma candidates"};
Configurable<float> qtAPCutLow{"qtAPCutLow", 0.15, "Lower qT AP cut for Sigma candidates (GeV/c)"};
Configurable<float> qtAPCutHigh{"qtAPCutHigh", 0.2, "Upper qT AP cut for Sigma candidates (GeV/c)"};
Expand All @@ -94,10 +100,12 @@
Configurable<float> cutNSigmaTPC{"cutNSigmaTPC", 3, "NSigmaTPCPr"};
Configurable<float> cutNSigmaTOF{"cutNSigmaTOF", 3, "NSigmaTOFPr"};

Configurable<float> cutMaxKStar{"cutMaxKStar", 1.5, "Maximum k* for Sigma-Proton pairs (GeV/c)"};

Configurable<bool> fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Sigma-Proton candidates"};

ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"};

Check failure on line 107 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 40.0, 80.0, 500.0}, "Mixing bins - number of contributor"};

Check failure on line 108 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<int> nEvtMixingBkg{"nEvtMixingBkg", 5, "Number of events to mix for background reconstruction"};

Preslice<aod::KinkCands> kinkCandsPerCollisionPreslice = aod::kinkcand::collisionId;
Expand Down Expand Up @@ -142,6 +150,36 @@
return std::sqrt(p2A - dp * dp / p2V0);
}

float getCosPA(const std::array<float, 3>& momMother, const std::array<float, 3>& decayVertex, const std::array<float, 3>& primaryVertex)
{
std::array<float, 3> decayVec = {decayVertex[0] - primaryVertex[0], decayVertex[1] - primaryVertex[1], decayVertex[2] - primaryVertex[2]};
float dotProduct = std::inner_product(momMother.begin(), momMother.end(), decayVec.begin(), 0.f);
float momMotherMag = std::sqrt(std::inner_product(momMother.begin(), momMother.end(), momMother.begin(), 0.f));
float decayVecMag = std::sqrt(std::inner_product(decayVec.begin(), decayVec.end(), decayVec.begin(), 0.f));
return dotProduct / (momMotherMag * decayVecMag);
}

TLorentzVector trackSum, PartOneCMS, PartTwoCMS, trackRelK;

Check failure on line 162 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.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.
float getKStar(const sigmaProtonCand& candidate)
{
TLorentzVector part1; // Sigma

Check failure on line 165 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.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.
TLorentzVector part2; // Proton

Check failure on line 166 in PWGLF/TableProducer/Strangeness/sigmaProtonCorr.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.
part1.SetXYZM(candidate.sigmaPx, candidate.sigmaPy, candidate.sigmaPz, o2::constants::physics::MassSigmaMinus);
part2.SetXYZM(candidate.pxPr, candidate.pyPr, candidate.pzPr, o2::constants::physics::MassProton);
trackSum = part1 + part2;
const float beta = trackSum.Beta();
const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta());
const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta());
const float betaz = beta * std::cos(trackSum.Theta());
PartOneCMS.SetXYZM(part1.Px(), part1.Py(), part1.Pz(), part1.M());
PartTwoCMS.SetXYZM(part2.Px(), part2.Py(), part2.Pz(), part2.M());
const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz);
PartOneCMS = boostPRF(PartOneCMS);
PartTwoCMS = boostPRF(PartTwoCMS);
trackRelK = PartOneCMS - PartTwoCMS;
return 0.5 * trackRelK.P();
}

template <typename Ttrack>
bool selectPrTrack(const Ttrack& candidate)
{
Expand Down Expand Up @@ -211,8 +249,8 @@
return true;
}

template <typename Ttrack>
void fillTreeAndHistograms(aod::KinkCands const& kinkCands, Ttrack const& tracksDauSigma, Ttrack const& tracks)
template <typename Ttrack, typename Tcollision>
void fillTreeAndHistograms(aod::KinkCands const& kinkCands, Ttrack const& tracksDauSigma, Ttrack const& tracks, Tcollision const& collision)
{
for (const auto& sigmaCand : kinkCands) {
if (selectSigma(sigmaCand, tracksDauSigma)) {
Expand All @@ -237,6 +275,11 @@
candidate.sigmaDauPz = sigmaCand.pzDaug();
candidate.sigmaDecRadius = std::hypot(sigmaCand.xDecVtx(), sigmaCand.yDecVtx());

std::array<float, 3> momMoth = {sigmaCand.pxMoth(), sigmaCand.pyMoth(), sigmaCand.pzMoth()};
std::array<float, 3> decayVtx = {sigmaCand.xDecVtx(), sigmaCand.yDecVtx(), sigmaCand.zDecVtx()};
std::array<float, 3> primaryVtx = {collision.posX(), collision.posY(), collision.posZ()};
candidate.sigmaCosPA = getCosPA(momMoth, decayVtx, primaryVtx);

candidate.chargePr = prTrack.sign();
candidate.pxPr = prTrack.px();
candidate.pyPr = prTrack.py();
Expand All @@ -249,6 +292,10 @@
candidate.kinkDauID = sigmaCand.trackDaugId();
candidate.prID = prTrack.globalIndex();

if (getKStar(candidate) > cutMaxKStar) {
continue;
}

rSigmaProton.fill(HIST("h2PtPrNSigma"), candidate.ptPr(), candidate.nSigmaTPCPr);
if (prTrack.hasTOF()) {
rSigmaProton.fill(HIST("h2PtPrNSigmaTOF"), candidate.ptPr(), candidate.nSigmaTOFPr);
Expand All @@ -270,7 +317,7 @@
continue;
}
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
fillTreeAndHistograms(kinkCands_c, tracks_c, tracks_c);
fillTreeAndHistograms(kinkCands_c, tracks_c, tracks_c, collision);
if (fillOutputTree) {
// Fill output table
for (const auto& candidate : sigmaProtonCandidates) {
Expand All @@ -282,6 +329,7 @@
candidate.sigmaDauPy,
candidate.sigmaDauPz,
candidate.sigmaDecRadius,
candidate.sigmaCosPA,
candidate.chargePr,
candidate.pxPr,
candidate.pyPr,
Expand Down Expand Up @@ -316,10 +364,7 @@
auto kinkCands_c1 = kinkCands.sliceBy(kinkCandsPerCollisionPreslice, collision1.globalIndex());
auto tracks_c1 = tracks.sliceBy(tracksPerCollisionPreslice, collision1.globalIndex());
auto tracks_c2 = tracks.sliceBy(tracksPerCollisionPreslice, collision2.globalIndex());
fillTreeAndHistograms(kinkCands_c1, tracks_c1, tracks_c2);

auto kinkCands_c2 = kinkCands.sliceBy(kinkCandsPerCollisionPreslice, collision2.globalIndex());
fillTreeAndHistograms(kinkCands_c2, tracks_c2, tracks_c1);
fillTreeAndHistograms(kinkCands_c1, tracks_c1, tracks_c2, collision1);

if (fillOutputTree) {
// Fill output table
Expand All @@ -332,6 +377,7 @@
candidate.sigmaDauPy,
candidate.sigmaDauPz,
candidate.sigmaDecRadius,
candidate.sigmaCosPA,
candidate.chargePr,
candidate.pxPr,
candidate.pyPr,
Expand All @@ -357,7 +403,7 @@
continue;
}
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
fillTreeAndHistograms(kinkCands_c, tracks_c, tracks_c);
fillTreeAndHistograms(kinkCands_c, tracks_c, tracks_c, collision);
if (fillOutputTree) {
// Fill output table
for (const auto& candidate : sigmaProtonCandidates) {
Expand All @@ -375,6 +421,7 @@
candidate.sigmaDauPy,
candidate.sigmaDauPz,
candidate.sigmaDecRadius,
candidate.sigmaCosPA,
candidate.chargePr,
candidate.pxPr,
candidate.pyPr,
Expand Down Expand Up @@ -407,10 +454,7 @@
auto kinkCands_c1 = kinkCands.sliceBy(kinkCandsPerCollisionPreslice, collision1.globalIndex());
auto tracks_c1 = tracks.sliceBy(tracksPerCollisionPreslice, collision1.globalIndex());
auto tracks_c2 = tracks.sliceBy(tracksPerCollisionPreslice, collision2.globalIndex());
fillTreeAndHistograms(kinkCands_c1, tracks_c1, tracks_c2);

auto kinkCands_c2 = kinkCands.sliceBy(kinkCandsPerCollisionPreslice, collision2.globalIndex());
fillTreeAndHistograms(kinkCands_c2, tracks_c2, tracks_c1);
fillTreeAndHistograms(kinkCands_c1, tracks_c1, tracks_c2, collision1);

if (fillOutputTree) {
// Fill output table
Expand All @@ -429,6 +473,7 @@
candidate.sigmaDauPy,
candidate.sigmaDauPz,
candidate.sigmaDecRadius,
candidate.sigmaCosPA,
candidate.chargePr,
candidate.pxPr,
candidate.pyPr,
Expand Down
Loading