Skip to content

Commit 220d1f2

Browse files
committed
Add information to get generated signals with daughters in acceptance
1 parent 62661e6 commit 220d1f2

1 file changed

Lines changed: 117 additions & 5 deletions

File tree

‎PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx‎

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,20 @@ DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //!
7070
DECLARE_SOA_COLUMN(PtXi, ptXi, float); //! Transverse momentum of Xi (prong0) (GeV/c)
7171
DECLARE_SOA_COLUMN(ImpactParameterXi, impactParameterXi, float); //! Impact parameter of Xi (prong0)
7272
DECLARE_SOA_COLUMN(ImpactParameterNormalisedXi, impactParameterNormalisedXi, float); //! Normalised impact parameter of Xi (prong0)
73+
DECLARE_SOA_COLUMN(EtaBachelorPi, etaBachelorPi, float); //! Pseudorapidity of bachelor Pi
7374
DECLARE_SOA_COLUMN(PPi0, pPi0, float); //! Momentum of Pi0 (prong1) (GeV/c)
7475
DECLARE_SOA_COLUMN(PtPi0, ptPi0, float); //! Transverse momentum of Pi0 (prong1) (GeV/c)
76+
DECLARE_SOA_COLUMN(EtaPi0, etaPi0, float); //! Pseudorapidity of Pi0 (prong1
7577
DECLARE_SOA_COLUMN(ImpactParameterPi0, impactParameterPi0, float); //! Impact parameter of Pi0 (prong1)
7678
DECLARE_SOA_COLUMN(ImpactParameterNormalisedPi0, impactParameterNormalisedPi0, float); //! Normalised impact parameter of Pi0 (prong1)
7779
DECLARE_SOA_COLUMN(PPi1, pPi1, float); //! Momentum of Pi1 (prong2) (GeV/c)
7880
DECLARE_SOA_COLUMN(PtPi1, ptPi1, float); //! Transverse momentum of Pi1 (prong2) (GeV/c)
79-
DECLARE_SOA_COLUMN(ImpactParameterPi1, impactParameterPi1, float); //! Normalised impact parameter of Pi1 (prong2)
81+
DECLARE_SOA_COLUMN(EtaPi1, etaPi1, float); //! Pseudorapidity of Pi1 (prong2)
82+
DECLARE_SOA_COLUMN(PtPiFromLambda, ptPiFromLambda, float); //! Transverse momentum of pion from Lambda (GeV/c)
83+
DECLARE_SOA_COLUMN(EtaPiFromLambda, etaPiFromLambda, float); //! Pseudorapidity of pion from Lambda (GeV/c)
84+
DECLARE_SOA_COLUMN(PtPrFromLambda, ptPrFromLambda, float); //! Transverse momentum of proton from Lambda (GeV/c)
85+
DECLARE_SOA_COLUMN(EtaPrFromLambda, etaPrFromLambda, float); //! Pseudorapidity of proton from Lambda (GeV/c)
86+
DECLARE_SOA_COLUMN(ImpactParameterPi1, impactParameterPi1, float); //! Impact parameter of Pi1 (prong2)
8087
DECLARE_SOA_COLUMN(ImpactParameterNormalisedPi1, impactParameterNormalisedPi1, float); //! Normalised impact parameter of Pi1 (prong2)
8188
DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs
8289
DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML score for background class
@@ -367,7 +374,17 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP",
367374
full::Eta,
368375
full::Phi,
369376
full::Y,
370-
hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen);
377+
hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen,
378+
full::PtPi0,
379+
full::PtPi1,
380+
hf_cand_xic_to_xi_pi_pi::PtBachelorPi,
381+
full::PtPiFromLambda,
382+
full::PtPrFromLambda,
383+
full::EtaPi0,
384+
full::EtaPi1,
385+
full::EtaBachelorPi,
386+
full::EtaPiFromLambda,
387+
full::EtaPrFromLambda);
371388
} // namespace o2::aod
372389

373390
/// Writes the full information in an output TTree
@@ -382,6 +399,7 @@ struct HfTreeCreatorXicToXiPiPi {
382399
Configurable<int> selectionFlagXic{"selectionFlagXic", 1, "Selection Flag for Xic"};
383400
Configurable<bool> fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"};
384401
Configurable<bool> fillGenParticleTable{"fillGenParticleTable", false, "Switch to fill table with MC truth for generated particles"};
402+
Configurable<bool> fillGenInfoForAcceptance{"fillGenInfoForAcceptance", true, "Enable filling of information for acceptance computation"};
385403
// parameters for production of training samples
386404
Configurable<bool> fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"};
387405
Configurable<bool> fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"};
@@ -715,6 +733,54 @@ struct HfTreeCreatorXicToXiPiPi {
715733
}
716734
}
717735

736+
template <typename Parts>
737+
void getMcDaughterInformation(Parts const& particles,
738+
Parts::iterator const& particle,
739+
float& ptPi0,
740+
float& ptPi1,
741+
float& ptPiBachelor,
742+
float& ptPiFromLambda,
743+
float& ptPrFromLambda,
744+
float& etaPi0,
745+
float& etaPi1,
746+
float& etaPiBachelor,
747+
float& etaPiFromLambda,
748+
float& etaPrFromLambda)
749+
{
750+
std::vector<int> arrDaughIndex = {};
751+
RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2);
752+
bool foundFirstPi{false};
753+
for (const int iProng : arrDaughIndex) {
754+
auto daugh = particles.rawIteratorAt(iProng);
755+
if (std::abs(daugh.pdgCode()) == +kPiPlus) {
756+
if (foundFirstPi) {
757+
ptPi1 = daugh.pt();
758+
} else {
759+
ptPi0 = daugh.pt();
760+
foundFirstPi = true;
761+
}
762+
} else if (std::abs(daugh.pdgCode()) == +kXiMinus) {
763+
RecoDecay::getDaughters(daugh, &arrDaughIndex, std::array{+kLambda0, -kPiPlus}, 1);
764+
for (const int iProngXi : arrDaughIndex) {
765+
auto daughXi = particles.rawIteratorAt(iProngXi);
766+
if (std::abs(daughXi.pdgCode()) == +kPiPlus) {
767+
ptPiBachelor = daughXi.pt();
768+
} else {
769+
RecoDecay::getDaughters(daughXi, &arrDaughIndex, std::array{+kProton, -kPiPlus}, 1);
770+
for (const int iProngLambda : arrDaughIndex) {
771+
auto daughLambda = particles.rawIteratorAt(iProngLambda);
772+
if (std::abs(daughLambda.pdgCode()) == +kPiPlus) {
773+
ptPiFromLambda = daughLambda.pt();
774+
} else {
775+
ptPrFromLambda = daughLambda.pt();
776+
}
777+
}
778+
}
779+
}
780+
}
781+
}
782+
}
783+
718784
void processData(SelectedCandidates const& candidates)
719785
{
720786
// Filling candidate properties
@@ -806,6 +872,11 @@ struct HfTreeCreatorXicToXiPiPi {
806872
if (fillGenParticleTable) {
807873
rowCandidateFullParticles.reserve(particles.size());
808874
for (const auto& particle : particles) {
875+
float ptPi0{-1.f}, ptPi1{-1.f}, ptPiBachelor{-1.f}, ptPiFromLambda{-1.f}, ptPrFromLambda{-1.f};
876+
float etaPi0{-1.f}, etaPi1{-1.f}, etaPiBachelor{-1.f}, etaPiFromLambda{-1.f}, etaPrFromLambda{-1.f};
877+
if (fillGenInfoForAcceptance) {
878+
getMcDaughterInformation(particles, particle, ptPi0, ptPi1, ptPiBachelor, ptPiFromLambda, ptPrFromLambda, etaPi0, etaPi1, etaPiBachelor, etaPiFromLambda, etaPrFromLambda);
879+
}
809880
rowCandidateFullParticles(
810881
particle.flagMcMatchGen(),
811882
particle.originMcGen(),
@@ -814,7 +885,17 @@ struct HfTreeCreatorXicToXiPiPi {
814885
particle.eta(),
815886
particle.phi(),
816887
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus),
817-
particle.decayLengthMcGen());
888+
particle.decayLengthMcGen(),
889+
ptPi0,
890+
ptPi1,
891+
ptPiBachelor,
892+
ptPiFromLambda,
893+
ptPrFromLambda,
894+
etaPi0,
895+
etaPi1,
896+
etaPiBachelor,
897+
etaPiFromLambda,
898+
etaPrFromLambda);
818899
}
819900
}
820901
}
@@ -860,6 +941,11 @@ struct HfTreeCreatorXicToXiPiPi {
860941
if (fillGenParticleTable) {
861942
rowCandidateFullParticles.reserve(particles.size());
862943
for (const auto& particle : particles) {
944+
float ptPi0{-1.f}, ptPi1{-1.f}, ptPiBachelor{-1.f}, ptPiFromLambda{-1.f}, ptPrFromLambda{-1.f};
945+
float etaPi0{-1.f}, etaPi1{-1.f}, etaPiBachelor{-1.f}, etaPiFromLambda{-1.f}, etaPrFromLambda{-1.f};
946+
if (fillGenInfoForAcceptance) {
947+
getMcDaughterInformation(particles, particle, ptPi0, ptPi1, ptPiBachelor, ptPiFromLambda, ptPrFromLambda, etaPi0, etaPi1, etaPiBachelor, etaPiFromLambda, etaPrFromLambda);
948+
}
863949
rowCandidateFullParticles(
864950
particle.flagMcMatchGen(),
865951
particle.originMcGen(),
@@ -868,7 +954,17 @@ struct HfTreeCreatorXicToXiPiPi {
868954
particle.eta(),
869955
particle.phi(),
870956
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus),
871-
particle.decayLengthMcGen());
957+
particle.decayLengthMcGen(),
958+
ptPi0,
959+
ptPi1,
960+
ptPiBachelor,
961+
ptPiFromLambda,
962+
ptPrFromLambda,
963+
etaPi0,
964+
etaPi1,
965+
etaPiBachelor,
966+
etaPiFromLambda,
967+
etaPrFromLambda);
872968
}
873969
}
874970
}
@@ -906,6 +1002,12 @@ struct HfTreeCreatorXicToXiPiPi {
9061002
if (fillGenParticleTable) {
9071003
rowCandidateFullParticles.reserve(particles.size());
9081004
for (const auto& particle : particles) {
1005+
float ptPi0{-1.f}, ptPi1{-1.f}, ptPiBachelor{-1.f}, ptPiFromLambda{-1.f}, ptPrFromLambda{-1.f};
1006+
float etaPi0{-1.f}, etaPi1{-1.f}, etaPiBachelor{-1.f}, etaPiFromLambda{-1.f}, etaPrFromLambda{-1.f};
1007+
if (fillGenInfoForAcceptance) {
1008+
getMcDaughterInformation(particles, particle, ptPi0, ptPi1, ptPiBachelor, ptPiFromLambda, ptPrFromLambda, etaPi0, etaPi1, etaPiBachelor, etaPiFromLambda, etaPrFromLambda);
1009+
}
1010+
9091011
rowCandidateFullParticles(
9101012
particle.flagMcMatchGen(),
9111013
particle.originMcGen(),
@@ -914,7 +1016,17 @@ struct HfTreeCreatorXicToXiPiPi {
9141016
particle.eta(),
9151017
particle.phi(),
9161018
RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus),
917-
particle.decayLengthMcGen());
1019+
particle.decayLengthMcGen(),
1020+
ptPi0,
1021+
ptPi1,
1022+
ptPiBachelor,
1023+
ptPiFromLambda,
1024+
ptPrFromLambda,
1025+
etaPi0,
1026+
etaPi1,
1027+
etaPiBachelor,
1028+
etaPiFromLambda,
1029+
etaPrFromLambda);
9181030
}
9191031
}
9201032
}

0 commit comments

Comments
 (0)