From db5cfc2a7cde70e9cb5607ce11b4f651617d7b28 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 29 Nov 2023 21:29:26 +0100 Subject: [PATCH] More minor adjustments to data model (#4022) * Final adjustments to data model * Please consider the following formatting changes (#193) * Update strangederivedbuilder.cxx --------- Co-authored-by: ALICE Builder --- PWGLF/DataModel/LFStrangenessPIDTables.h | 47 +++----- PWGLF/DataModel/LFStrangenessTables.h | 88 ++++++-------- PWGLF/TableProducer/cascadebuilder.cxx | 4 - PWGLF/TableProducer/cascademcbuilder.cxx | 108 ------------------ PWGLF/TableProducer/cascadepid.cxx | 41 +------ PWGLF/TableProducer/lambdakzeropid.cxx | 37 +----- PWGLF/TableProducer/strangederivedbuilder.cxx | 84 +++++++++++--- 7 files changed, 121 insertions(+), 288 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessPIDTables.h b/PWGLF/DataModel/LFStrangenessPIDTables.h index 9ed74ab65ab..531d124af71 100644 --- a/PWGLF/DataModel/LFStrangenessPIDTables.h +++ b/PWGLF/DataModel/LFStrangenessPIDTables.h @@ -22,17 +22,25 @@ namespace o2::aod { -namespace v0data +namespace dautrack { // ==== TPC INFORMATION === -DECLARE_SOA_COLUMN(PosTPCSignal, posTPCSignal, float); //! positive track signal -DECLARE_SOA_COLUMN(NegTPCSignal, negTPCSignal, float); //! negative track signal +DECLARE_SOA_COLUMN(TPCSignal, tpcSignal, float); //! track signal + +DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, float); //! Nsigma proton +DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, float); //! Nsigma proton +DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, float); //! Nsigma proton +DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, float); //! Nsigma proton +DECLARE_SOA_COLUMN(TPCNSigmaHe, tpcNSigmaHe, float); //! Nsigma proton +} // namespace dautrack -DECLARE_SOA_COLUMN(PosTPCNSigmaPr, posTPCNSigmaPr, float); //! positive track Nsigma proton -DECLARE_SOA_COLUMN(PosTPCNSigmaPi, posTPCNSigmaPi, float); //! positive track Nsigma pion -DECLARE_SOA_COLUMN(NegTPCNSigmaPr, negTPCNSigmaPr, float); //! negative track Nsigma proton -DECLARE_SOA_COLUMN(NegTPCNSigmaPi, negTPCNSigmaPi, float); //! negative track Nsigma pion +DECLARE_SOA_TABLE(DauTrackTPCPIDs, "AOD", "DAUTRACKTPCPID", // nsigma table (for analysis) + dautrack::TPCSignal, dautrack::TPCNSigmaEl, + dautrack::TPCNSigmaPi, dautrack::TPCNSigmaKa, + dautrack::TPCNSigmaPr, dautrack::TPCNSigmaHe); +namespace v0data +{ // ==== TOF INFORMATION === // lengths as stored in the AO2D for TOF calculations DECLARE_SOA_COLUMN(PosTOFLength, posTOFLength, float); //! positive track length @@ -55,12 +63,6 @@ DECLARE_SOA_COLUMN(PosNSigmaK0Pi, posNSigmaK0Pi, float); //! positive track NSig DECLARE_SOA_COLUMN(NegNSigmaK0Pi, negNSigmaK0Pi, float); //! positive track NSigma from pion <- k0short expectation } // namespace v0data -DECLARE_SOA_TABLE(V0TPC, "AOD", "V0TPC", // raw information table (for debug, etc) - v0data::PosTPCSignal, v0data::NegTPCSignal); -DECLARE_SOA_TABLE(V0TPCPID, "AOD", "V0TPCPID", // raw information table (for debug, etc) - v0data::PosTPCNSigmaPr, v0data::PosTPCNSigmaPi, - v0data::NegTPCNSigmaPr, v0data::NegTPCNSigmaPi); - DECLARE_SOA_TABLE(V0TOF, "AOD", "V0TOF", // raw information table (for debug, etc) v0data::PosTOFLength, v0data::NegTOFLength, v0data::PosTOFDeltaTLaPi, v0data::PosTOFDeltaTLaPr, @@ -73,18 +75,6 @@ DECLARE_SOA_TABLE(V0TOFPID, "AOD", "V0TOFPID", // nsigma table (for analysis) namespace cascdata { -// ==== TPC INFORMATION === -DECLARE_SOA_COLUMN(PosTPCSignal, posTPCSignal, float); //! positive track signal -DECLARE_SOA_COLUMN(NegTPCSignal, negTPCSignal, float); //! negative track signal -DECLARE_SOA_COLUMN(BachTPCSignal, bachTPCSignal, float); //! negative track signal - -DECLARE_SOA_COLUMN(PosTPCNSigmaPr, posTPCNSigmaPr, float); //! positive track Nsigma proton -DECLARE_SOA_COLUMN(PosTPCNSigmaPi, posTPCNSigmaPi, float); //! positive track Nsigma pion -DECLARE_SOA_COLUMN(NegTPCNSigmaPr, negTPCNSigmaPr, float); //! negative track Nsigma proton -DECLARE_SOA_COLUMN(NegTPCNSigmaPi, negTPCNSigmaPi, float); //! negative track Nsigma pion -DECLARE_SOA_COLUMN(BachTPCNSigmaKa, bachTPCNSigmaKa, float); //! negative track Nsigma proton -DECLARE_SOA_COLUMN(BachTPCNSigmaPi, bachTPCNSigmaPi, float); //! negative track Nsigma pion - // ==== TOF INFORMATION === // lengths as stored in the AO2D for TOF calculations DECLARE_SOA_COLUMN(PosTOFLength, posTOFLength, float); //! positive track length @@ -116,13 +106,6 @@ DECLARE_SOA_COLUMN(NegNSigmaOmPr, negNSigmaOmPr, float); //! negative tr DECLARE_SOA_COLUMN(BachNSigmaOmKa, bachNSigmaOmKa, float); //! bachelor track NSigma from kaon <- omega expectation } // namespace cascdata -DECLARE_SOA_TABLE(CascTPC, "AOD", "CASCTPC", // raw information table (for debug, etc) - cascdata::PosTPCSignal, cascdata::NegTPCSignal, cascdata::BachTPCSignal); -DECLARE_SOA_TABLE(CascTPCPID, "AOD", "CASCTPCPID", // raw information table (for debug, etc) - cascdata::PosTPCNSigmaPr, cascdata::PosTPCNSigmaPi, - cascdata::NegTPCNSigmaPr, cascdata::NegTPCNSigmaPi, - cascdata::BachTPCNSigmaKa, cascdata::BachTPCNSigmaPi); - DECLARE_SOA_TABLE(CascTOF, "AOD", "CascTOF", // raw information table (for debug, etc) cascdata::PosTOFLength, cascdata::NegTOFLength, cascdata::BachTOFLength, cascdata::PosTOFDeltaTXiPi, cascdata::PosTOFDeltaTXiPr, diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 62aeddd5478..6d5d0374f7d 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -16,6 +16,7 @@ #include "Common/Core/RecoDecay.h" #include "CommonConstants/PhysicsConstants.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Qvectors.h" namespace o2::aod { @@ -23,12 +24,20 @@ namespace o2::aod // Collision declarations for derived data analysis // this is optional but will ensure full flexibility // if required (for 2pc, etc) -DECLARE_SOA_TABLE(StraCollisions, "AOD", "STRACOLLISION", //! track X positions at minima when using AO2Ds - collision::PosX, collision::PosY, collision::PosZ, +DECLARE_SOA_TABLE(StraCollisions, "AOD", "STRACOLLISION", //! basic collision properties: position + collision::PosX, collision::PosY, collision::PosZ); +DECLARE_SOA_TABLE(StraCents, "AOD", "STRACENTS", //! centrality percentiles cent::CentFT0M, cent::CentFT0A, - cent::CentFT0C, cent::CentFV0A, o2::soa::Marker<2>); + cent::CentFT0C, cent::CentFV0A); +DECLARE_SOA_TABLE(StraEPs, "AOD", "STRAEPS", //! centrality percentiles + qvec::QvecFT0ARe, qvec::QvecFT0AIm, qvec::SumAmplFT0A, + qvec::QvecFT0CRe, qvec::QvecFT0CIm, qvec::SumAmplFT0C, + qvec::QvecFT0MRe, qvec::QvecFT0MIm, qvec::SumAmplFT0M, + qvec::QvecFV0ARe, qvec::QvecFV0AIm, qvec::SumAmplFV0A); using StraCollision = StraCollisions::iterator; +using StraCent = StraCents::iterator; +using StraEP = StraEPs::iterator; namespace dautrack { @@ -451,6 +460,7 @@ DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! DECLARE_SOA_INDEX_COLUMN_FULL(PosTrackExtra, posTrackExtra, int, DauTrackExtras, "_PosExtra"); //! DECLARE_SOA_INDEX_COLUMN_FULL(NegTrackExtra, negTrackExtra, int, DauTrackExtras, "_NegExtra"); //! DECLARE_SOA_INDEX_COLUMN_FULL(BachTrackExtra, bachTrackExtra, int, DauTrackExtras, "_BachExtra"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(StrangeTrackExtra, strangeTrackExtra, int, DauTrackExtras, "_StrangeExtra"); //! DECLARE_SOA_INDEX_COLUMN(StraCollision, straCollision); //! //______________________________________________________ @@ -519,21 +529,6 @@ DECLARE_SOA_COLUMN(MatchingChi2, matchingChi2, float); //! DECLARE_SOA_COLUMN(TopologyChi2, topologyChi2, float); //! DECLARE_SOA_COLUMN(ItsClsSize, itsCluSize, float); //! -//______________________________________________________ -// REGULAR COLUMNS FOR CASCEXTRAS -DECLARE_SOA_COLUMN(PosTrackDetectorMap, posTrackDetectorMap, uint8_t); //! detector map for reference -DECLARE_SOA_COLUMN(NegTrackDetectorMap, negTrackDetectorMap, uint8_t); //! detector map for reference -DECLARE_SOA_COLUMN(BachTrackDetectorMap, bachTrackDetectorMap, uint8_t); //! detector map for reference -DECLARE_SOA_COLUMN(PosTrackITSClusterSizes, posTrackITSClusterSizes, uint32_t); //! ITS cluster sizes per layer -DECLARE_SOA_COLUMN(NegTrackITSClusterSizes, negTrackITSClusterSizes, uint32_t); //! ITS cluster sizes per layer -DECLARE_SOA_COLUMN(BachTrackITSClusterSizes, bachTrackITSClusterSizes, uint32_t); //! ITS cluster sizes per layer -DECLARE_SOA_COLUMN(PosTrackTPCClusters, posTrackTPCClusters, uint8_t); //! N TPC clusters -DECLARE_SOA_COLUMN(NegTrackTPCClusters, negTrackTPCClusters, uint8_t); //! N TPC clusters -DECLARE_SOA_COLUMN(BachTrackTPCClusters, bachTrackTPCClusters, uint8_t); //! N TPC clusters -DECLARE_SOA_COLUMN(PosTrackTPCCrossedRows, posTrackTPCCrossedRows, uint8_t); //! N TPC clusters -DECLARE_SOA_COLUMN(NegTrackTPCCrossedRows, negTrackTPCCrossedRows, uint8_t); //! N TPC clusters -DECLARE_SOA_COLUMN(BachTrackTPCCrossedRows, bachTrackTPCCrossedRows, uint8_t); //! N TPC clusters - //______________________________________________________ // REGULAR COLUMNS FOR CASCMCCORES DECLARE_SOA_COLUMN(PDGCode, pdgCode, int); //! cascade PDG Code @@ -669,7 +664,7 @@ DECLARE_SOA_TABLE(KFCascExtras, "AOD", "KFCASCEXTRA", //! optional table to refe cascdata::BachTrackExtraId, o2::soa::Marker<2>); DECLARE_SOA_TABLE(TraCascExtras, "AOD", "TRACASCEXTRA", //! optional table to refer to custom track extras o2::soa::Index<>, cascdata::PosTrackExtraId, cascdata::NegTrackExtraId, - cascdata::BachTrackExtraId, o2::soa::Marker<3>); + cascdata::BachTrackExtraId, cascdata::StrangeTrackExtraId); DECLARE_SOA_TABLE(StoredCascCores, "AOD", "CASCCORE", //! core information about decay, viable with AO2Ds or derived cascdata::Sign, cascdata::MXi, cascdata::MOmega, @@ -762,35 +757,10 @@ DECLARE_SOA_TABLE(CascMCCores, "AOD", "CASCMCCORE", //! bachelor-baryon correlat cascdata::PxPosMC, cascdata::PyPosMC, cascdata::PzPosMC, cascdata::PxNegMC, cascdata::PyNegMC, cascdata::PzNegMC, cascdata::PxBachMC, cascdata::PyBachMC, cascdata::PzBachMC, - cascdata::PxMC, cascdata::PyMC, cascdata::PzMC, - o2::soa::Marker<1>); -DECLARE_SOA_TABLE(KFCascMCCores, "AOD", "KFCASCMCCORE", //! bachelor-baryon correlation variables - cascdata::PDGCode, cascdata::PDGCodeMother, cascdata::PDGCodeV0, cascdata::IsPhysicalPrimary, - cascdata::PDGCodePositive, cascdata::PDGCodeNegative, cascdata::PDGCodeBachelor, - cascdata::XMC, cascdata::YMC, cascdata::ZMC, - cascdata::XlambdaMC, cascdata::YlambdaMC, cascdata::ZlambdaMC, - cascdata::PxPosMC, cascdata::PyPosMC, cascdata::PzPosMC, - cascdata::PxNegMC, cascdata::PyNegMC, cascdata::PzNegMC, - cascdata::PxBachMC, cascdata::PyBachMC, cascdata::PzBachMC, - cascdata::PxMC, cascdata::PyMC, cascdata::PzMC, - o2::soa::Marker<2>); -DECLARE_SOA_TABLE(TraCascMCCores, "AOD", "TRACASCMCCORE", //! bachelor-baryon correlation variables - cascdata::PDGCode, cascdata::PDGCodeMother, cascdata::PDGCodeV0, cascdata::IsPhysicalPrimary, - cascdata::PDGCodePositive, cascdata::PDGCodeNegative, cascdata::PDGCodeBachelor, - cascdata::XMC, cascdata::YMC, cascdata::ZMC, - cascdata::XlambdaMC, cascdata::YlambdaMC, cascdata::ZlambdaMC, - cascdata::PxPosMC, cascdata::PyPosMC, cascdata::PzPosMC, - cascdata::PxNegMC, cascdata::PyNegMC, cascdata::PzNegMC, - cascdata::PxBachMC, cascdata::PyBachMC, cascdata::PzBachMC, - cascdata::PxMC, cascdata::PyMC, cascdata::PzMC, - o2::soa::Marker<3>); + cascdata::PxMC, cascdata::PyMC, cascdata::PzMC); DECLARE_SOA_TABLE(CascBBs, "AOD", "CASCBB", //! bachelor-baryon correlation variables - cascdata::BachBaryonCosPA, cascdata::BachBaryonDCAxyToPV, o2::soa::Marker<1>) -DECLARE_SOA_TABLE(KFCascBBs, "AOD", "KFCASCBB", //! bachelor-baryon correlation variables, KF - cascdata::BachBaryonCosPA, cascdata::BachBaryonDCAxyToPV, o2::soa::Marker<2>) -DECLARE_SOA_TABLE(TraCascBBs, "AOD", "TRACASCBB", //! bachelor-baryon correlation variables, tracked - cascdata::BachBaryonCosPA, cascdata::BachBaryonDCAxyToPV, o2::soa::Marker<3>) + cascdata::BachBaryonCosPA, cascdata::BachBaryonDCAxyToPV) DECLARE_SOA_TABLE_FULL(CascCovs, "CascCovs", "AOD", "CASCCOVS", //! cascdata::PositionCovMat, cascdata::MomentumCovMat); @@ -812,6 +782,24 @@ DECLARE_SOA_EXTENDED_TABLE_USER(TraCascCores, StoredTraCascCores, "TraCascDATAEX cascdataext::PxLambda, cascdataext::PyLambda, cascdataext::PzLambda, cascdataext::Pt, cascdataext::P, cascdataext::Eta, cascdataext::Phi); +namespace cascdata +{ +// For cross-linking all cascade kinds +DECLARE_SOA_INDEX_COLUMN_FULL(TrackedCascade, trackedCascade, int, TraCascCores, "_Refs"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(KFCascade, kfCascade, int, KFCascCores, "_Refs"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(StandardCascade, standardCascade, int, CascCores, "_Refs"); //! +} // namespace cascdata + +// interlink different cascade types +DECLARE_SOA_TABLE(CascToTraRefs, "AOD", "CASCTOTRAREFS", //! standard -> tracked + o2::soa::Index<>, cascdata::TrackedCascadeId); +DECLARE_SOA_TABLE(CascToKFRefs, "AOD", "CASCTOKFREFS", //! standard -> KF + o2::soa::Index<>, cascdata::KFCascadeId); +DECLARE_SOA_TABLE(TraToCascRefs, "AOD", "TRATOCASCREFS", //! standard -> KF + o2::soa::Index<>, cascdata::StandardCascadeId, o2::soa::Marker<1>); +DECLARE_SOA_TABLE(KFToCascRefs, "AOD", "KFTOCASCREFS", //! standard -> KF + o2::soa::Index<>, cascdata::StandardCascadeId, o2::soa::Marker<2>); + using CascIndex = CascIndices::iterator; using CascCore = CascCores::iterator; using KFCascIndex = KFCascIndices::iterator; @@ -820,8 +808,8 @@ using TraCascIndex = TraCascIndices::iterator; using TraCascCore = TraCascCores::iterator; using CascDatas = soa::Join; -using KFCascDatas = soa::Join; -using TraCascDatas = soa::Join; +using KFCascDatas = soa::Join; +using TraCascDatas = soa::Join; using CascData = CascDatas::iterator; using KFCascData = KFCascDatas::iterator; @@ -961,11 +949,7 @@ DECLARE_EQUIVALENT_FOR_INDEX(aod::CascIndices, aod::CascCores); DECLARE_EQUIVALENT_FOR_INDEX(aod::CascIndices, aod::CascBBs); DECLARE_EQUIVALENT_FOR_INDEX(aod::CascCores, aod::CascBBs); DECLARE_EQUIVALENT_FOR_INDEX(aod::KFCascIndices, aod::KFCascCores); -DECLARE_EQUIVALENT_FOR_INDEX(aod::KFCascIndices, aod::KFCascBBs); -DECLARE_EQUIVALENT_FOR_INDEX(aod::KFCascCores, aod::KFCascBBs); DECLARE_EQUIVALENT_FOR_INDEX(aod::TraCascIndices, aod::TraCascCores); -DECLARE_EQUIVALENT_FOR_INDEX(aod::TraCascIndices, aod::TraCascBBs); -DECLARE_EQUIVALENT_FOR_INDEX(aod::TraCascCores, aod::TraCascBBs); } // namespace o2::soa #endif // PWGLF_DATAMODEL_LFSTRANGENESSTABLES_H_ diff --git a/PWGLF/TableProducer/cascadebuilder.cxx b/PWGLF/TableProducer/cascadebuilder.cxx index 03eb77eb0db..4534975f6a1 100644 --- a/PWGLF/TableProducer/cascadebuilder.cxx +++ b/PWGLF/TableProducer/cascadebuilder.cxx @@ -110,8 +110,6 @@ struct cascadeBuilder { Produces kfcascdata; Produces trackedcascdata; Produces cascbb; - Produces kfcascbb; - Produces trackedcascbb; Produces casccovs; // if requested by someone Produces kfcasccovs; // if requested by someone Service ccdb; @@ -1331,7 +1329,6 @@ struct cascadeBuilder { cascadecandidate.v0dcapostopv, cascadecandidate.v0dcanegtopv, cascadecandidate.bachDCAxy, cascadecandidate.cascDCAxy, cascadecandidate.cascDCAz, cascadecandidate.kfMLambda, cascadecandidate.kfV0Chi2, cascadecandidate.kfCascadeChi2); - kfcascbb(cascadecandidate.bachBaryonCosPA, cascadecandidate.bachBaryonDCAxyToPV); if (createCascCovMats) { gpu::gpustd::array covmatrix; @@ -1526,7 +1523,6 @@ struct cascadeBuilder { cascadecandidate.v0dcapostopv, cascadecandidate.v0dcanegtopv, cascadecandidate.bachDCAxy, cascadecandidate.cascDCAxy, cascadecandidate.cascDCAz, // <--- stratrack (cascDCAxy/z) trackedCascade.matchingChi2(), trackedCascade.topologyChi2(), trackedCascade.itsClsSize()); // <--- stratrack fit info - trackedcascbb(cascadecandidate.bachBaryonCosPA, cascadecandidate.bachBaryonDCAxyToPV); } } // En masse filling at end of process call diff --git a/PWGLF/TableProducer/cascademcbuilder.cxx b/PWGLF/TableProducer/cascademcbuilder.cxx index edfb51d40d0..55abc37a156 100644 --- a/PWGLF/TableProducer/cascademcbuilder.cxx +++ b/PWGLF/TableProducer/cascademcbuilder.cxx @@ -50,12 +50,8 @@ struct cascademcbuilder { Produces tracasclabels; // MC labels for tracked cascades Produces bbtags; // bb tags (inv structure tagging) Produces cascmccores; // optionally aggregate information from MC side for posterior analysis (derived data) - Produces kfcascmccores; // optionally aggregate information from MC side for posterior analysis (derived data) - Produces tracascmccores; // optionally aggregate information from MC side for posterior analysis (derived data) Configurable populateCascMCCores{"populateCascMCCores", false, "populate CascMCCores table for derived data analysis"}; - Configurable populateKFCascMCCores{"populateKFCascMCCores", false, "populate KFCascMCCores table for derived data analysis"}; - Configurable populateTraCascMCCores{"populateTraCascMCCores", false, "populate TraCascMCCores table for derived data analysis"}; void init(InitContext const&) {} @@ -165,15 +161,6 @@ struct cascademcbuilder { // build kf cascade labels void processKFCascades(aod::KFCascDatas const& casctable, aod::V0sLinked const&, aod::V0Datas const& v0table, aod::McTrackLabels const&, aod::McParticles const&) { - int pdgCode = -1, pdgCodeMother = -1; - int pdgCodePositive = -1, pdgCodeNegative = -1, pdgCodeBachelor = -1, pdgCodeV0 = -1; - bool isPhysicalPrimary = false; - float xmc = -999.0f, ymc = -999.0f, zmc = -999.0f; - float xlmc = -999.0f, ylmc = -999.0f, zlmc = -999.0f; - float pxposmc = -999.0f, pyposmc = -999.0f, pzposmc = -999.0f; - float pxnegmc = -999.0f, pynegmc = -999.0f, pznegmc = -999.0f; - float pxbachmc = -999.0f, pybachmc = -999.0f, pzbachmc = -999.0f; - float px = -999.0f, py = -999.0f, pz = -999.0f; for (auto& casc : casctable) { // Loop over those that actually have the corresponding V0 associated to them auto v0 = casc.v0(); @@ -190,50 +177,17 @@ struct cascademcbuilder { auto lMCBachTrack = lBachTrack.mcParticle_as(); auto lMCNegTrack = lNegTrack.mcParticle_as(); auto lMCPosTrack = lPosTrack.mcParticle_as(); - - pdgCodePositive = lMCPosTrack.pdgCode(); - pdgCodeNegative = lMCNegTrack.pdgCode(); - pdgCodeBachelor = lMCBachTrack.pdgCode(); - pxposmc = lMCPosTrack.px(); - pyposmc = lMCPosTrack.py(); - pzposmc = lMCPosTrack.pz(); - pxnegmc = lMCNegTrack.px(); - pynegmc = lMCNegTrack.py(); - pznegmc = lMCNegTrack.pz(); - pxbachmc = lMCBachTrack.px(); - pybachmc = lMCBachTrack.py(); - pzbachmc = lMCBachTrack.pz(); - // Step 1: check if the mother is the same, go up a level if (lMCNegTrack.has_mothers() && lMCPosTrack.has_mothers()) { for (auto& lNegMother : lMCNegTrack.mothers_as()) { for (auto& lPosMother : lMCPosTrack.mothers_as()) { if (lNegMother == lPosMother) { - // acquire information - xlmc = lNegMother.vx(); - ylmc = lNegMother.vy(); - zlmc = lNegMother.vz(); - pdgCodeV0 = lNegMother.pdgCode(); - // if we got to this level, it means the mother particle exists and is the same // now we have to go one level up and compare to the bachelor mother too for (auto& lV0Mother : lNegMother.mothers_as()) { for (auto& lBachMother : lMCBachTrack.mothers_as()) { if (lV0Mother == lBachMother) { lLabel = lV0Mother.globalIndex(); - pdgCode = lV0Mother.pdgCode(); - isPhysicalPrimary = lV0Mother.isPhysicalPrimary(); - xmc = lV0Mother.vx(); - ymc = lV0Mother.vy(); - zmc = lV0Mother.vz(); - px = lV0Mother.px(); - py = lV0Mother.py(); - pz = lV0Mother.pz(); - if (lV0Mother.has_mothers()) { - for (auto& lV0GrandMother : lV0Mother.mothers_as()) { - pdgCodeMother = lV0GrandMother.pdgCode(); - } - } } } } // end conditional V0-bach pair @@ -245,16 +199,6 @@ struct cascademcbuilder { // Construct label table (note: this will be joinable with CascDatas) kfcasclabels( lLabel); - if (populateKFCascMCCores) { - kfcascmccores( - pdgCode, pdgCodeMother, pdgCodeV0, isPhysicalPrimary, - pdgCodePositive, pdgCodeNegative, pdgCodeBachelor, - xmc, ymc, zmc, xlmc, ylmc, zlmc, - pxposmc, pyposmc, pzposmc, - pxnegmc, pynegmc, pznegmc, - pxbachmc, pybachmc, pzbachmc, - px, py, pz); - } } // end casctable loop } @@ -262,15 +206,6 @@ struct cascademcbuilder { // build tracked cascade labels void processTrackedCascades(aod::TraCascDatas const& casctable, aod::V0sLinked const&, aod::V0Datas const& v0table, aod::McTrackLabels const&, aod::McParticles const&) { - int pdgCode = -1, pdgCodeMother = -1; - int pdgCodePositive = -1, pdgCodeNegative = -1, pdgCodeBachelor = -1, pdgCodeV0 = -1; - bool isPhysicalPrimary = false; - float xmc = -999.0f, ymc = -999.0f, zmc = -999.0f; - float xlmc = -999.0f, ylmc = -999.0f, zlmc = -999.0f; - float pxposmc = -999.0f, pyposmc = -999.0f, pzposmc = -999.0f; - float pxnegmc = -999.0f, pynegmc = -999.0f, pznegmc = -999.0f; - float pxbachmc = -999.0f, pybachmc = -999.0f, pzbachmc = -999.0f; - float px = -999.0f, py = -999.0f, pz = -999.0f; for (auto& casc : casctable) { // Loop over those that actually have the corresponding V0 associated to them auto v0 = casc.v0_as(); @@ -292,50 +227,17 @@ struct cascademcbuilder { auto lMCBachTrack = lBachTrack.mcParticle_as(); auto lMCNegTrack = lNegTrack.mcParticle_as(); auto lMCPosTrack = lPosTrack.mcParticle_as(); - - pdgCodePositive = lMCPosTrack.pdgCode(); - pdgCodeNegative = lMCNegTrack.pdgCode(); - pdgCodeBachelor = lMCBachTrack.pdgCode(); - pxposmc = lMCPosTrack.px(); - pyposmc = lMCPosTrack.py(); - pzposmc = lMCPosTrack.pz(); - pxnegmc = lMCNegTrack.px(); - pynegmc = lMCNegTrack.py(); - pznegmc = lMCNegTrack.pz(); - pxbachmc = lMCBachTrack.px(); - pybachmc = lMCBachTrack.py(); - pzbachmc = lMCBachTrack.pz(); - // Step 1: check if the mother is the same, go up a level if (lMCNegTrack.has_mothers() && lMCPosTrack.has_mothers()) { for (auto& lNegMother : lMCNegTrack.mothers_as()) { for (auto& lPosMother : lMCPosTrack.mothers_as()) { if (lNegMother == lPosMother) { - // acquire information - xlmc = lNegMother.vx(); - ylmc = lNegMother.vy(); - zlmc = lNegMother.vz(); - pdgCodeV0 = lNegMother.pdgCode(); - // if we got to this level, it means the mother particle exists and is the same // now we have to go one level up and compare to the bachelor mother too for (auto& lV0Mother : lNegMother.mothers_as()) { for (auto& lBachMother : lMCBachTrack.mothers_as()) { if (lV0Mother == lBachMother) { lLabel = lV0Mother.globalIndex(); - pdgCode = lV0Mother.pdgCode(); - isPhysicalPrimary = lV0Mother.isPhysicalPrimary(); - xmc = lV0Mother.vx(); - ymc = lV0Mother.vy(); - zmc = lV0Mother.vz(); - px = lV0Mother.px(); - py = lV0Mother.py(); - pz = lV0Mother.pz(); - if (lV0Mother.has_mothers()) { - for (auto& lV0GrandMother : lV0Mother.mothers_as()) { - pdgCodeMother = lV0GrandMother.pdgCode(); - } - } } } } // end conditional V0-bach pair @@ -347,16 +249,6 @@ struct cascademcbuilder { // Construct label table (note: this will be joinable with CascDatas) tracasclabels( lLabel); - if (populateTraCascMCCores) { - tracascmccores( - pdgCode, pdgCodeMother, pdgCodeV0, isPhysicalPrimary, - pdgCodePositive, pdgCodeNegative, pdgCodeBachelor, - xmc, ymc, zmc, xlmc, ylmc, zlmc, - pxposmc, pyposmc, pzposmc, - pxnegmc, pynegmc, pznegmc, - pxbachmc, pybachmc, pzbachmc, - px, py, pz); - } } // end casctable loop } diff --git a/PWGLF/TableProducer/cascadepid.cxx b/PWGLF/TableProducer/cascadepid.cxx index c0132237046..6646528b498 100644 --- a/PWGLF/TableProducer/cascadepid.cxx +++ b/PWGLF/TableProducer/cascadepid.cxx @@ -76,10 +76,6 @@ using TaggedCascades = soa::Join; using LabeledTracksExtra = soa::Join; struct cascadepid { - // TPC pid (copied over from central services for reference) - Produces casctpc; // raw table for checks - Produces casctpcpid; // table with Nsigmas - // TOF pid for strangeness (recalculated with topology) Produces casctof; // raw table for checks Produces casctofpid; // table with Nsigmas @@ -233,36 +229,7 @@ struct cascadepid { return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); } - void processTPC(aod::Collisions const& collisions, aod::CascDatas const& Cascades, TracksExtraWithPID const&, aod::BCsWithTimestamps const&, aod::V0s const&) - { - for (const auto& collision : collisions) { - // Fire up CCDB - auto bc = collision.bc_as(); - initCCDB(bc); - // Do analysis with collision-grouped cascades, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto CascTable_thisCollision = Cascades.sliceBy(perCollision, collIdx); - // cascade table sliced - for (auto const& cascade : CascTable_thisCollision) { - // Track casting - auto bachTrack = cascade.bachelor_as(); - auto v0 = cascade.v0(); - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - - // Fill raw information if requested - if (fillRawPID) { - casctpc(posTrack.tpcSignal(), negTrack.tpcSignal(), bachTrack.tpcSignal()); - } - // Fill NSigma (always provided) - casctpcpid(posTrack.tpcNSigmaPr(), posTrack.tpcNSigmaPi(), - negTrack.tpcNSigmaPr(), negTrack.tpcNSigmaPi(), - bachTrack.tpcNSigmaKa(), bachTrack.tpcNSigmaPi()); - } - } - } - - void processTOF(aod::Collisions const& collisions, aod::CascDatas const& Cascades, FullTracksExtIU const&, aod::BCsWithTimestamps const&, aod::V0s const&) + void process(aod::Collisions const& collisions, aod::CascDatas const& Cascades, FullTracksExtIU const&, aod::BCsWithTimestamps const&, aod::V0s const&) { for (const auto& collision : collisions) { // Fire up CCDB @@ -289,12 +256,6 @@ struct cascadepid { } } } - - //*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<* - /// basic building options (one of them must be chosen) - PROCESS_SWITCH(cascadepid, processTPC, "process dE/dx information", true); // generate TPC information tables for V0s - PROCESS_SWITCH(cascadepid, processTOF, "process TOF information", true); // generate TOF information tables for V0s - //*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<* }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/lambdakzeropid.cxx b/PWGLF/TableProducer/lambdakzeropid.cxx index 7746a10b7c8..7b6d1834184 100644 --- a/PWGLF/TableProducer/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/lambdakzeropid.cxx @@ -76,10 +76,6 @@ using TaggedV0s = soa::Join; using LabeledTracksExtra = soa::Join; struct lambdakzeropid { - // TPC pid (copied over from central services for reference) - Produces v0tpc; // raw table for checks - Produces v0tpcpid; // table with Nsigmas - // TOF pid for strangeness (recalculated with topology) Produces v0tof; // raw table for checks Produces v0tofpid; // table with Nsigmas @@ -246,32 +242,7 @@ struct lambdakzeropid { return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); } - void processTPC(aod::Collisions const& collisions, aod::V0Datas const& V0s, TracksExtraWithPID const&, aod::BCsWithTimestamps const&, TaggedV0s const& allV0s) - { - for (const auto& collision : collisions) { - // Fire up CCDB - auto bc = collision.bc_as(); - initCCDB(bc); - // Do analysis with collision-grouped V0s, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto V0Table_thisCollision = V0s.sliceBy(perCollision, collIdx); - // V0 table sliced - for (auto const& v0 : V0Table_thisCollision) { - auto const& posTrackRow = v0.posTrack_as(); - auto const& negTrackRow = v0.negTrack_as(); - - // Fill raw information if requested - if (fillRawPID) { - v0tpc(posTrackRow.tpcSignal(), negTrackRow.tpcSignal()); - } - // Fill NSigma (always provided) - v0tpcpid(posTrackRow.tpcNSigmaPr(), posTrackRow.tpcNSigmaPi(), - negTrackRow.tpcNSigmaPr(), negTrackRow.tpcNSigmaPi()); - } - } - } - - void processTOF(aod::Collisions const& collisions, aod::V0Datas const& V0s, FullTracksExtIU const&, aod::BCsWithTimestamps const&, TaggedV0s const& allV0s) + void process(aod::Collisions const& collisions, aod::V0Datas const& V0s, FullTracksExtIU const&, aod::BCsWithTimestamps const&, TaggedV0s const& allV0s) { for (const auto& collision : collisions) { // Fire up CCDB @@ -351,12 +322,6 @@ struct lambdakzeropid { } } } - - //*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<* - /// basic building options (one of them must be chosen) - PROCESS_SWITCH(lambdakzeropid, processTPC, "process dE/dx information", true); // generate TPC information tables for V0s - PROCESS_SWITCH(lambdakzeropid, processTOF, "process TOF information", true); // generate TOF information tables for V0s - //*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<*>-~-<* }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/strangederivedbuilder.cxx b/PWGLF/TableProducer/strangederivedbuilder.cxx index 3427e499121..9d5b35066bf 100644 --- a/PWGLF/TableProducer/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/strangederivedbuilder.cxx @@ -51,7 +51,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using TracksWithExtra = soa::Join; +using TracksWithExtra = soa::Join; // simple checkers #define bitset(var, nbit) ((var) |= (1 << (nbit))) @@ -61,18 +61,27 @@ struct strangederivedbuilder { //__________________________________________________ // fundamental building blocks of derived data Produces strangeColl; // characterises collisions + Produces strangeCents; // characterises collisions / centrality Produces v0collref; // references collisions from V0s Produces casccollref; // references collisions from cascades - Produces kfcasccollref; // references collisions from cascades - Produces tracasccollref; // references collisions from cascades + Produces kfcasccollref; // references collisions from KF cascades + Produces tracasccollref; // references collisions from tracked cascades //__________________________________________________ // track extra references - Produces dauTrackExtras; // DauTrackExtras - Produces v0Extras; // references DauTracks from V0s - Produces cascExtras; // references DauTracks from V0s - Produces kfcascExtras; // references DauTracks from V0s - Produces tracascExtras; // references DauTracks from V0s + Produces dauTrackExtras; // daughter track detector properties + Produces dauTrackTPCPIDs; // daughter track TPC PID + Produces v0Extras; // references DauTracks from V0s + Produces cascExtras; // references DauTracks from cascades + Produces kfcascExtras; // references DauTracks from KF cascades + Produces tracascExtras; // references DauTracks from tracked cascades + + //__________________________________________________ + // cascade interlinks + Produces cascToTraRefs; // cascades -> tracked + Produces cascToKFRefs; // cascades -> KF + Produces traToCascRefs; // tracked -> cascades + Produces kfToCascRefs; // KF -> cascades // histogram registry for bookkeeping HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -131,9 +140,9 @@ struct strangederivedbuilder { // casc table sliced if (strange || fillEmptyCollisions) { if (currentCollIdx != collIdx) { - strangeColl(collision.posX(), collision.posY(), collision.posZ(), - collision.centFT0M(), collision.centFT0A(), - collision.centFT0C(), collision.centFV0A()); + strangeColl(collision.posX(), collision.posY(), collision.posZ()); + strangeCents(collision.centFT0M(), collision.centFT0A(), + collision.centFT0C(), collision.centFV0A()); currentCollIdx = collIdx; } } @@ -158,9 +167,9 @@ struct strangederivedbuilder { // casc table sliced if (strange || fillEmptyCollisions) { if (currentCollIdx != collIdx) { - strangeColl(collision.posX(), collision.posY(), collision.posZ(), - collision.centFT0M(), collision.centFT0A(), - collision.centFT0C(), collision.centFV0A()); + strangeColl(collision.posX(), collision.posY(), collision.posZ()); + strangeCents(collision.centFT0M(), collision.centFT0A(), + collision.centFT0C(), collision.centFV0A()); currentCollIdx = collIdx; } } @@ -257,9 +266,11 @@ struct strangederivedbuilder { auto v0 = casc.v0(); auto posTrack = v0.posTrack_as(); auto negTrack = v0.negTrack_as(); + auto strangeTrack = casc.strangeTrack_as(); trackMap[posTrack.globalIndex()] = 0; trackMap[negTrack.globalIndex()] = 0; trackMap[bachTrack.globalIndex()] = 0; + trackMap[strangeTrack.globalIndex()] = 0; } //__________________________________________________ // Figure out the numbering of the new tracks table @@ -307,9 +318,11 @@ struct strangederivedbuilder { auto v0 = casc.v0(); auto posTrack = v0.posTrack_as(); auto negTrack = v0.negTrack_as(); + auto strangeTrack = casc.strangeTrack_as(); tracascExtras(trackMap[posTrack.globalIndex()], trackMap[negTrack.globalIndex()], - trackMap[bachTrack.globalIndex()]); // joinable with TraCascDatas + trackMap[bachTrack.globalIndex()], + trackMap[strangeTrack.globalIndex()]); // joinable with TraCascDatas } //__________________________________________________ // circle back and populate actual DauTrackExtra table @@ -317,11 +330,49 @@ struct strangederivedbuilder { if (trackMap[tr.globalIndex()] >= 0) { dauTrackExtras(tr.detectorMap(), tr.itsClusterSizes(), tr.tpcNClsFound(), tr.tpcNClsCrossedRows()); + dauTrackTPCPIDs(tr.tpcSignal(), tr.tpcNSigmaEl(), + tr.tpcNSigmaPi(), tr.tpcNSigmaKa(), + tr.tpcNSigmaPr(), tr.tpcNSigmaHe()); } } // done! } + using interlinkedCascades = soa::Join; + + void processCascadeInterlink(interlinkedCascades const& masterCascades, aod::CascIndices const& Cascades, aod::KFCascIndices const& KFCascades, aod::TraCascIndices const& TraCascades) + { + // Standard to tracked + for (auto const& c : Cascades) { + int indexTracked = -1, indexKF = -1; + if (c.has_cascade()) { + auto cascade = c.cascade_as(); + indexTracked = cascade.traCascDataId(); + indexKF = cascade.kfCascDataId(); + } + cascToTraRefs(indexTracked); + cascToKFRefs(indexKF); + } + // Tracked to standard + for (auto const& c : TraCascades) { + int index = -1; + if (c.has_cascade()) { + auto cascade = c.cascade_as(); + index = cascade.cascDataId(); + } + traToCascRefs(index); + } + // Tracked to KF + for (auto const& c : KFCascades) { + int index = -1; + if (c.has_cascade()) { + auto cascade = c.cascade_as(); + index = cascade.cascDataId(); + } + kfToCascRefs(index); + } + } + void processSimulation(aod::McParticles const& mcParticles) { // check if collision successfully reconstructed @@ -341,6 +392,7 @@ struct strangederivedbuilder { PROCESS_SWITCH(strangederivedbuilder, processCollisions, "Produce collisions (V0s + casc)", true); PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasV0sOnly, "Produce track extra information (V0s only)", true); PROCESS_SWITCH(strangederivedbuilder, processTrackExtras, "Produce track extra information (V0s + casc)", true); + PROCESS_SWITCH(strangederivedbuilder, processCascadeInterlink, "Produce tables interconnecting cascades", true); PROCESS_SWITCH(strangederivedbuilder, processSimulation, "Produce simulated information", true); }; @@ -360,4 +412,4 @@ const std::vector strangederivedbuilder::particlePDGCodes{22, 310, 3122, -3 1010010030, -1010010030, 3312, -3312, 3334, -3334}; const std::vector strangederivedbuilder::parameterNames{"Enable"}; -const int strangederivedbuilder::defaultParameters[strangederivedbuilder::nSpecies][strangederivedbuilder::nParameters] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}}; \ No newline at end of file +const int strangederivedbuilder::defaultParameters[strangederivedbuilder::nSpecies][strangederivedbuilder::nParameters] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};