Skip to content

Commit

Permalink
PWGHF:First implementation of MC analysis for D resonances (#7922)
Browse files Browse the repository at this point in the history
* Firts steps on MC analysis

* introduced generated reso processing

* updates to resonance data creator for MC analysis

* added Ml prosses functions

* changed MC gen histo

* reverted change to CMakeList

* Please consider the following formatting changes

* Update dataCreatorCharmResoReduced.cxx

Fixed else statements for linter

* implemented suggested changes

* Please consider the following formatting changes

---------

Co-authored-by: ALICE Action Bot <[email protected]>
  • Loading branch information
Luca610 and alibuild authored Oct 9, 2024
1 parent 62a2164 commit 01d0098
Show file tree
Hide file tree
Showing 3 changed files with 430 additions and 36 deletions.
77 changes: 54 additions & 23 deletions PWGHF/D2H/DataModel/ReducedDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,29 +429,6 @@ DECLARE_SOA_TABLE(HfCandBpConfigs, "AOD", "HFCANDBPCONFIG", //! Table with confi
hf_cand_bplus_config::MyInvMassWindowD0Pi);

// Charm resonances analysis
namespace hf_reso_cand_reduced
{
DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass in GeV/c2
DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c
DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c
DECLARE_SOA_COLUMN(MlScoreBkgProng0, mlScoreBkgProng0, float); //! Bkg ML score of the D daughter
DECLARE_SOA_COLUMN(MlScorePromptProng0, mlScorePromptProng0, float); //! Prompt ML score of the D daughter
DECLARE_SOA_COLUMN(MlScoreNonpromptProng0, mlScoreNonpromptProng0, float); //! Nonprompt ML score of the D daughter

DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //!
[](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); });
DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //!
[](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); });
DECLARE_SOA_DYNAMIC_COLUMN(PtProng1, ptProng1, //!
[](float pxProng1, float pyProng1) -> float { return RecoDecay::pt(pxProng1, pyProng1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs1, cosThetaStarDs1, //! costhetastar under Ds1 hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0}, invMass, 1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs2Star, cosThetaStarDs2Star, //! costhetastar under Ds2Star hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0}, invMass, 1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarXiC3055, cosThetaStarXiC3055, //! costhetastar under XiC3055 hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMass, 1); });
} // namespace hf_reso_cand_reduced

namespace hf_reso_3_prong
{
DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus
Expand Down Expand Up @@ -583,10 +560,41 @@ DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong
hf_reso_3_prong::InvMassAntiDstar<hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1>,
hf_reso_3_prong::Pt<hf_cand::PxProng0, hf_cand::PxProng1, hf_cand::PxProng2, hf_cand::PyProng0, hf_cand::PyProng1, hf_cand::PyProng2>);

namespace hf_reso_cand_reduced
{
DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass in GeV/c2
DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c
DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c
DECLARE_SOA_COLUMN(MlScoreBkgProng0, mlScoreBkgProng0, float); //! Bkg ML score of the D daughter
DECLARE_SOA_COLUMN(MlScorePromptProng0, mlScorePromptProng0, float); //! Prompt ML score of the D daughter
DECLARE_SOA_COLUMN(MlScoreNonpromptProng0, mlScoreNonpromptProng0, float); //! Nonprompt ML score of the D daughter

DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3PrNoTrks, "_0"); //! Prong0 index (D daughter)
DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedVzeros, "_1"); //! Prong1 index (V0 daughter)
DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for decay channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level
DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level

DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //!
[](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); });
DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //!
[](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); });
DECLARE_SOA_DYNAMIC_COLUMN(PtProng1, ptProng1, //!
[](float pxProng1, float pyProng1) -> float { return RecoDecay::pt(pxProng1, pyProng1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs1, cosThetaStarDs1, //! costhetastar under Ds1 hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0}, invMass, 1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs2Star, cosThetaStarDs2Star, //! costhetastar under Ds2Star hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0}, invMass, 1); });
DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarXiC3055, cosThetaStarXiC3055, //! costhetastar under XiC3055 hypothesis
[](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMass, 1); });
} // namespace hf_reso_cand_reduced

DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Resonance candidate information for resonances reduced workflow
o2::soa::Index<>,
// Indices
hf_track_index_reduced::HfRedCollisionId,
hf_reso_cand_reduced::Prong0Id,
hf_reso_cand_reduced::Prong1Id,
// Static
hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0,
hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1,
Expand All @@ -611,6 +619,29 @@ DECLARE_SOA_TABLE(HfCharmResoMLs, "AOD", "HFCHARMRESOML", //! Table with ML scor
hf_reso_cand_reduced::MlScorePromptProng0,
hf_reso_cand_reduced::MlScoreNonpromptProng0,
o2::soa::Marker<1>);

// Tables for MC Resonance analysis
// table with results of reconstruction level MC matching
DECLARE_SOA_TABLE(HfMcRecRedDV0s, "AOD", "HFMCRECREDDV0", //! Table with reconstructed MC information on DV0(<-Ds*) pairs for reduced workflow
hf_reso_cand_reduced::Prong0Id,
hf_reso_cand_reduced::Prong1Id,
hf_reso_cand_reduced::FlagMcMatchRec,
hf_reso_cand_reduced::DebugMcRec,
hf_b0_mc::PtMother,
o2::soa::Marker<1>);

DECLARE_SOA_TABLE(HfMcGenRedResos, "AOD", "HFMCGENREDRESO", //! Generation-level MC information on B0 candidates for reduced workflow
hf_cand_b0::FlagMcMatchGen,
hf_b0_mc::PtTrack,
hf_b0_mc::YTrack,
hf_b0_mc::EtaTrack,
hf_b0_mc::PtProng0,
hf_b0_mc::YProng0,
hf_b0_mc::EtaProng0,
hf_b0_mc::PtProng1,
hf_b0_mc::YProng1,
hf_b0_mc::EtaProng1,
o2::soa::Marker<1>);
} // namespace aod

namespace soa
Expand Down
4 changes: 3 additions & 1 deletion PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ struct HfCandidateCreatorCharmResoReduced {
invMassD = candD.invMassAntiDstar();
std::array<float, 3> pVecD = {candD.px(), candD.py(), candD.pz()};
std::array<int, 3> dDaughtersIds = {candD.prong0Id(), candD.prong1Id(), candD.prong2Id()};
;

// loop on V0 candidates
bool alreadyCounted{false};
for (const auto& candV0 : candsV0) {
Expand Down Expand Up @@ -297,6 +297,8 @@ struct HfCandidateCreatorCharmResoReduced {
}
// Filling Output table
rowCandidateReso(collision.globalIndex(),
candD.globalIndex(),
candV0.globalIndex(),
pVecD[0], pVecD[1], pVecD[2],
pVecV0[0], pVecV0[1], pVecV0[2],
invMassReso,
Expand Down
Loading

0 comments on commit 01d0098

Please sign in to comment.