From b0ac4d5c0016c4883642d7bd7624801d03dbc291 Mon Sep 17 00:00:00 2001 From: emeninno Date: Fri, 13 Oct 2023 10:51:10 +0200 Subject: [PATCH 1/3] added the possibility to create a LITE table with less information with respect the FULL table, in order to reduce the size of the produced tree. This is done in similar way to what done as exmample for D0ToKPi tree creator. --- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 101 ++++++++++++++++++-- 1 file changed, 95 insertions(+), 6 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 3d571ba6059..cc58ad00bce 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -75,6 +75,45 @@ DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); DECLARE_SOA_COLUMN(RunNumber, runNumber, int); } // namespace full +DECLARE_SOA_TABLE(HfCandCascLites, "AOD", "HFCANDCASCLITE", + hf_cand::Chi2PCA, + full::DecayLength, + full::DecayLengthXY, + full::DecayLengthNormalised, + full::DecayLengthXYNormalised, + full::PtProng0, + full::PtProng1, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + full::ImpactParameterNormalised0, + full::ImpactParameterNormalised1, + full::V0Radius, + full::V0CosPA, + full::V0MLambda, + full::V0MAntiLambda, + full::V0MK0Short, + full::V0MGamma, + full::V0CtK0Short, + full::V0CtLambda, + v0data::DCAV0Daughters, + full::PtV0Pos, + full::PtV0Neg, + v0data::DCANegToPV, + v0data::DCAPosToPV, + full::NSigmaTPCPr0, + full::NSigmaTOFPr0, + full::M, + full::Pt, + full::CPA, + full::CPAXY, + full::Ct, + full::Eta, + full::Phi, + full::Y, + full::E, + full::FlagMc, + full::OriginMcRec) + DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", collision::BCId, collision::NumContrib, @@ -168,10 +207,12 @@ struct HfTreeCreatorLcToK0sP { Produces rowCandidateFull; Produces rowCandidateFullEvents; Produces rowCandidateFullParticles; + Produces rowCandidateLite; - HfHelper hfHelper; - + Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; + + HfHelper hfHelper; using TracksWPid = soa::Join; @@ -182,7 +223,47 @@ struct HfTreeCreatorLcToK0sP { template void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec) { - rowCandidateFull( + if (fillCandidateLiteTable) { + rowCandidateLite( + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.v0radius(), + candidate.v0cosPA(), + candidate.mLambda(), + candidate.mAntiLambda(), + candidate.mK0Short(), + candidate.mGamma(), + hfHelper.ctV0K0s(candidate), + hfHelper.ctV0Lambda(candidate), + candidate.dcaV0daughters(), + candidate.ptV0Pos(), + candidate.ptV0Neg(), + candidate.dcanegtopv(), + candidate.dcapostopv(), + bach.tpcNSigmaPr(), + bach.tofNSigmaPr(), + hfHelper.invMassLcToK0sP(candidate), + candidate.pt(), + candidate.cpa(), + candidate.cpaXY(), + hfHelper.ctLc(candidate), + candidate.eta(), + candidate.phi(), + hfHelper.yLc(candidate), + hfHelper.eLc(candidate), + flagMc, + originMcRec); + } else { + rowCandidateFull( bach.collision().bcId(), bach.collision().numContrib(), candidate.posX(), @@ -251,8 +332,8 @@ struct HfTreeCreatorLcToK0sP { hfHelper.eLc(candidate), flagMc, originMcRec); + } } - template void fillEvent(const T& collision) { @@ -278,7 +359,11 @@ struct HfTreeCreatorLcToK0sP { } // Filling candidate properties - rowCandidateFull.reserve(candidates.size()); + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(candidates.size()); + } else { + rowCandidateFull.reserve(candidates.size()); + } for (const auto& candidate : candidates) { auto bach = candidate.prong0_as(); // bachelor double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); @@ -317,7 +402,11 @@ struct HfTreeCreatorLcToK0sP { } // Filling candidate properties - rowCandidateFull.reserve(candidates.size()); + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(candidates.size()); + } else { + rowCandidateFull.reserve(candidates.size()); + } for (const auto& candidate : candidates) { auto bach = candidate.prong0_as(); // bachelor double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); From 15da8341892b68c47413289c228ea97fe549d6c9 Mon Sep 17 00:00:00 2001 From: emeninno Date: Fri, 13 Oct 2023 17:07:05 +0200 Subject: [PATCH 2/3] added for the Lc->pK0s tree creator the possibility to select a maximum pT for the application of the downsampling factor --- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index cc58ad00bce..1039d06a499 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -112,7 +112,7 @@ DECLARE_SOA_TABLE(HfCandCascLites, "AOD", "HFCANDCASCLITE", full::Y, full::E, full::FlagMc, - full::OriginMcRec) + full::OriginMcRec); DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", collision::BCId, @@ -204,14 +204,15 @@ DECLARE_SOA_TABLE(HfCandCascFullPs, "AOD", "HFCANDCASCFULLP", /// Writes the full information in an output TTree struct HfTreeCreatorLcToK0sP { + Produces rowCandidateLite; Produces rowCandidateFull; Produces rowCandidateFullEvents; - Produces rowCandidateFullParticles; - Produces rowCandidateLite; + Produces rowCandidateFullParticles; Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; - + Configurable ptMaxForDownSample{"ptMaxForDownSample", 24., "Maximum pt for the application of the downsampling factor"}; + HfHelper hfHelper; using TracksWPid = soa::Join; @@ -366,8 +367,13 @@ struct HfTreeCreatorLcToK0sP { } for (const auto& candidate : candidates) { auto bach = candidate.prong0_as(); // bachelor - double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); - if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) { + if (downSampleBkgFactor < 1.) { + double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); + if(candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } + } + if (candidate.isSelLcToK0sP() >= 1) { fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); } } From f59c585e4c9b01e397630282b76a7aa578eb24a1 Mon Sep 17 00:00:00 2001 From: emeninno Date: Sat, 14 Oct 2023 14:34:46 +0200 Subject: [PATCH 3/3] clang format used --- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 230 ++++++++++---------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 1039d06a499..80f91610d86 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -113,7 +113,7 @@ DECLARE_SOA_TABLE(HfCandCascLites, "AOD", "HFCANDCASCLITE", full::E, full::FlagMc, full::OriginMcRec); - + DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", collision::BCId, collision::NumContrib, @@ -207,7 +207,7 @@ struct HfTreeCreatorLcToK0sP { Produces rowCandidateLite; Produces rowCandidateFull; Produces rowCandidateFullEvents; - Produces rowCandidateFullParticles; + Produces rowCandidateFullParticles; Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; @@ -224,116 +224,116 @@ struct HfTreeCreatorLcToK0sP { template void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec) { - if (fillCandidateLiteTable) { + if (fillCandidateLiteTable) { rowCandidateLite( - candidate.chi2PCA(), - candidate.decayLength(), - candidate.decayLengthXY(), - candidate.decayLengthNormalised(), - candidate.decayLengthXYNormalised(), - candidate.ptProng0(), - candidate.ptProng1(), - candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameterNormalised0(), - candidate.impactParameterNormalised1(), - candidate.v0radius(), - candidate.v0cosPA(), - candidate.mLambda(), - candidate.mAntiLambda(), - candidate.mK0Short(), - candidate.mGamma(), - hfHelper.ctV0K0s(candidate), - hfHelper.ctV0Lambda(candidate), - candidate.dcaV0daughters(), - candidate.ptV0Pos(), - candidate.ptV0Neg(), - candidate.dcanegtopv(), - candidate.dcapostopv(), - bach.tpcNSigmaPr(), - bach.tofNSigmaPr(), - hfHelper.invMassLcToK0sP(candidate), - candidate.pt(), - candidate.cpa(), - candidate.cpaXY(), - hfHelper.ctLc(candidate), - candidate.eta(), - candidate.phi(), - hfHelper.yLc(candidate), - hfHelper.eLc(candidate), - flagMc, - originMcRec); - } else { + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.v0radius(), + candidate.v0cosPA(), + candidate.mLambda(), + candidate.mAntiLambda(), + candidate.mK0Short(), + candidate.mGamma(), + hfHelper.ctV0K0s(candidate), + hfHelper.ctV0Lambda(candidate), + candidate.dcaV0daughters(), + candidate.ptV0Pos(), + candidate.ptV0Neg(), + candidate.dcanegtopv(), + candidate.dcapostopv(), + bach.tpcNSigmaPr(), + bach.tofNSigmaPr(), + hfHelper.invMassLcToK0sP(candidate), + candidate.pt(), + candidate.cpa(), + candidate.cpaXY(), + hfHelper.ctLc(candidate), + candidate.eta(), + candidate.phi(), + hfHelper.yLc(candidate), + hfHelper.eLc(candidate), + flagMc, + originMcRec); + } else { rowCandidateFull( - bach.collision().bcId(), - bach.collision().numContrib(), - candidate.posX(), - candidate.posY(), - candidate.posZ(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), - candidate.errorDecayLength(), - candidate.errorDecayLengthXY(), - candidate.chi2PCA(), - candidate.rSecondaryVertex(), - candidate.decayLength(), - candidate.decayLengthXY(), - candidate.decayLengthNormalised(), - candidate.decayLengthXYNormalised(), - candidate.impactParameterNormalised0(), - candidate.ptProng0(), - RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), - candidate.impactParameterNormalised1(), - candidate.ptProng1(), - RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), - candidate.pxProng0(), - candidate.pyProng0(), - candidate.pzProng0(), - candidate.pxProng1(), - candidate.pyProng1(), - candidate.pzProng1(), - candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.errorImpactParameter0(), - candidate.errorImpactParameter1(), - candidate.v0x(), - candidate.v0y(), - candidate.v0z(), - candidate.v0radius(), - candidate.v0cosPA(), - candidate.mLambda(), - candidate.mAntiLambda(), - candidate.mK0Short(), - candidate.mGamma(), - hfHelper.ctV0K0s(candidate), - hfHelper.ctV0Lambda(candidate), - candidate.dcaV0daughters(), - candidate.pxpos(), - candidate.pypos(), - candidate.pzpos(), - candidate.ptV0Pos(), - candidate.dcapostopv(), - candidate.pxneg(), - candidate.pyneg(), - candidate.pzneg(), - candidate.ptV0Neg(), - candidate.dcanegtopv(), - bach.tpcNSigmaPr(), - bach.tofNSigmaPr(), - hfHelper.invMassLcToK0sP(candidate), - candidate.pt(), - candidate.p(), - candidate.cpa(), - candidate.cpaXY(), - hfHelper.ctLc(candidate), - candidate.eta(), - candidate.phi(), - hfHelper.yLc(candidate), - hfHelper.eLc(candidate), - flagMc, - originMcRec); - } + bach.collision().bcId(), + bach.collision().numContrib(), + candidate.posX(), + candidate.posY(), + candidate.posZ(), + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.chi2PCA(), + candidate.rSecondaryVertex(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.impactParameterNormalised0(), + candidate.ptProng0(), + RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), + candidate.impactParameterNormalised1(), + candidate.ptProng1(), + RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.errorImpactParameter0(), + candidate.errorImpactParameter1(), + candidate.v0x(), + candidate.v0y(), + candidate.v0z(), + candidate.v0radius(), + candidate.v0cosPA(), + candidate.mLambda(), + candidate.mAntiLambda(), + candidate.mK0Short(), + candidate.mGamma(), + hfHelper.ctV0K0s(candidate), + hfHelper.ctV0Lambda(candidate), + candidate.dcaV0daughters(), + candidate.pxpos(), + candidate.pypos(), + candidate.pzpos(), + candidate.ptV0Pos(), + candidate.dcapostopv(), + candidate.pxneg(), + candidate.pyneg(), + candidate.pzneg(), + candidate.ptV0Neg(), + candidate.dcanegtopv(), + bach.tpcNSigmaPr(), + bach.tofNSigmaPr(), + hfHelper.invMassLcToK0sP(candidate), + candidate.pt(), + candidate.p(), + candidate.cpa(), + candidate.cpaXY(), + hfHelper.ctLc(candidate), + candidate.eta(), + candidate.phi(), + hfHelper.yLc(candidate), + hfHelper.eLc(candidate), + flagMc, + originMcRec); + } } template void fillEvent(const T& collision) @@ -368,10 +368,10 @@ struct HfTreeCreatorLcToK0sP { for (const auto& candidate : candidates) { auto bach = candidate.prong0_as(); // bachelor if (downSampleBkgFactor < 1.) { - double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); - if(candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { - continue; - } + double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } } if (candidate.isSelLcToK0sP() >= 1) { fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); @@ -412,7 +412,7 @@ struct HfTreeCreatorLcToK0sP { rowCandidateLite.reserve(candidates.size()); } else { rowCandidateFull.reserve(candidates.size()); - } + } for (const auto& candidate : candidates) { auto bach = candidate.prong0_as(); // bachelor double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000);