Skip to content
Merged
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
55 changes: 37 additions & 18 deletions PWGLF/TableProducer/Strangeness/sigma0builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
Service<o2::ccdb::BasicCCDBManager> ccdb;
ctpRateFetcher rateFetcher;

SliceCache cache;
// SliceCache cache;

Produces<aod::Sigma0Cores> sigma0cores; // save sigma0 candidates for analysis
Produces<aod::SigmaPhotonExtras> sigmaPhotonExtras; // save sigma0 candidates for analysis
Produces<aod::SigmaLambdaExtras> sigmaLambdaExtras; // save sigma0 candidates for analysis
Produces<aod::SigmaMCCores> sigma0mccores;

// For manual sliceBy
PresliceUnsorted<V0DerivedMCDatas> perCollisionMCDerived = o2::aod::v0data::straCollisionId;
PresliceUnsorted<V0StandardDerivedDatas> perCollisionSTDDerived = o2::aod::v0data::straCollisionId;
// PresliceUnsorted<V0DerivedMCDatas> perCollisionMCDerived = o2::aod::v0data::straCollisionId;
// PresliceUnsorted<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
Expand Down Expand Up @@ -385,7 +385,7 @@
}

template <typename TCollision>
bool IsEventAccepted(TCollision collision, bool fillHists)
bool IsEventAccepted(TCollision const& collision, bool fillHists)
// check whether the collision passes our collision selections
{
if (fillHists)
Expand Down Expand Up @@ -546,8 +546,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 549 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 550 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 Down Expand Up @@ -782,8 +782,8 @@
auto negTrackGamma2 = gamma2.template negTrackExtra_as<dauTracks>();

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

Check failure on line 785 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.
(TMath::Abs(negTrackGamma1.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas);

Check failure on line 786 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 @@ -943,7 +943,7 @@
auto arrMom = std::array{pVecPhotons, pVecLambda};
float sigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0});
float sigmaY = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0);
float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()});

Check failure on line 946 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 centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();

// Before any selection
Expand Down Expand Up @@ -1106,7 +1106,7 @@
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 1109 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);
Expand Down Expand Up @@ -1138,14 +1138,25 @@

void processMonteCarlo(soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels> const& collisions, V0DerivedMCDatas const& fullV0s, dauTracks const&, aod::MotherMCParts const&, soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const&, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const&)
{
// Initialize auxiliary vectors
std::vector<int> bestGammasArray;
std::vector<int> bestLambdasArray;

// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());

for (const auto& v0 : fullV0s) {
v0grouped[v0.straCollisionId()].push_back(v0.globalIndex());
}

for (const auto& coll : collisions) {
// Clear vectors
bestGammasArray.clear();
bestLambdasArray.clear();

if (!IsEventAccepted(coll, true))
continue;

// Do analysis with collision-grouped V0s, retain full collision information
const uint64_t collIdx = coll.globalIndex();
auto V0s = fullV0s.sliceBy(perCollisionMCDerived, collIdx);
float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();

bool fhasMCColl = false;
Expand All @@ -1164,12 +1175,11 @@
histos.fill(HIST("GeneralQA/hCentralityVsInteractionRate"), centrality, interactionRate);
}

std::vector<int> bestGammasArray;
std::vector<int> bestLambdasArray;

//_______________________________________________
// V0s loop
for (auto& v0 : V0s) {
for (size_t i = 0; i < v0grouped[coll.globalIndex()].size(); i++) {
auto v0 = fullV0s.rawIteratorAt(v0grouped[coll.globalIndex()][i]);

if (!v0.has_v0MCCore())
continue;

Expand Down Expand Up @@ -1246,7 +1256,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 1259 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 @@ -1261,9 +1271,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 1274 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 1275 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 1276 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 @@ -1317,14 +1327,25 @@

void processRealData(soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps> const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&)
{
// Initialize auxiliary vectors
std::vector<int> bestGammasArray;
std::vector<int> bestLambdasArray;

// brute force grouped index construction
std::vector<std::vector<int>> v0grouped(collisions.size());

for (const auto& v0 : fullV0s) {
v0grouped[v0.straCollisionId()].push_back(v0.globalIndex());
}

for (const auto& coll : collisions) {
// Clear vectors
bestGammasArray.clear();
bestLambdasArray.clear();

if (!IsEventAccepted(coll, true))
continue;

// Do analysis with collision-grouped V0s, retain full collision information
const uint64_t collIdx = coll.globalIndex();
auto V0s = fullV0s.sliceBy(perCollisionSTDDerived, collIdx);
float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();

//_______________________________________________
Expand All @@ -1339,12 +1360,10 @@
histos.fill(HIST("GeneralQA/hCentralityVsInteractionRate"), centrality, interactionRate);
}

std::vector<int> bestGammasArray;
std::vector<int> bestLambdasArray;

//_______________________________________________
// V0s loop
for (auto& v0 : V0s) {
for (size_t i = 0; i < v0grouped[coll.globalIndex()].size(); i++) {
auto v0 = fullV0s.rawIteratorAt(v0grouped[coll.globalIndex()][i]);
if (processPhotonCandidate(v0, coll)) // selecting photons
bestGammasArray.push_back(v0.globalIndex()); // Save indices of best gamma candidates

Expand Down
Loading