-
Notifications
You must be signed in to change notification settings - Fork 677
[PWGCF] Femto: Add D0 meson support to the femto framework #17253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IgorPtak
wants to merge
8
commits into
AliceO2Group:master
Choose a base branch
from
IgorPtak:charm-hadrons
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ae1a197
[PWGCF] Femto: Add D0 data model, builder and histogram manager
IgorPtak 5e178a5
[PWGCF] Femto: Add D0-hadron pair builder
IgorPtak 1aabea9
[PWGCF] Femto: Add D0-hadron correlation task
IgorPtak dbd030b
[PWGCF] Femto: Add D0 QA task
IgorPtak 86f7c91
[PWGCF] Femto: Add MC support for D0 candidates
IgorPtak 869d15d
[PWGCF] Femto: Apply linter and formatting fixes
IgorPtak efb5fab
[PWGCF] Femto: Adapt D0 builder to the new track builder interface
IgorPtak 250a654
[PWGCF] Femto: Fix code checker issues
IgorPtak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,17 @@ | |
| #include "PWGCF/Femto/Core/modes.h" | ||
| #include "PWGCF/Femto/DataModel/FemtoTables.h" | ||
|
|
||
| #include "Common/Core/RecoDecay.h" | ||
|
|
||
| #include <CommonConstants/MathConstants.h> | ||
| #include <CommonConstants/PhysicsConstants.h> | ||
| #include <Framework/AnalysisHelpers.h> | ||
| #include <Framework/Configurable.h> | ||
| #include <Framework/Logger.h> | ||
|
|
||
| #include <TPDGCode.h> | ||
|
|
||
| #include <array> | ||
| #include <cmath> | ||
| #include <cstdint> | ||
| #include <string> | ||
|
|
@@ -44,6 +48,7 @@ struct ConfMc : o2::framework::ConfigurableGroup { | |
| o2::framework::Configurable<bool> passThrough{"passThrough", false, "Passthrough all MC collisions and particles"}; | ||
| o2::framework::Configurable<bool> findLastPartonicMother{"findLastPartonicMother", true, "If true, the partonic mother will be the first parton directly after the initial collision. If false, the partonic mother will be the last parton before hadronization"}; | ||
| o2::framework::Configurable<float> etaAcceptanceMcOnly{"etaAcceptanceMcOnly", 0.8, "For MC ONLY processing. |eta| acceptance for estimating primary track multiplicity"}; | ||
| o2::framework::Configurable<float> charmYGenMax{"charmYGenMax", 0.8f, "Max |y| (rapidity) for generated charm hadrons (mc-only truth acceptance)"}; | ||
| }; | ||
|
|
||
| struct McBuilderProducts : o2::framework::ProducesGroup { | ||
|
|
@@ -57,6 +62,7 @@ struct McBuilderProducts : o2::framework::ProducesGroup { | |
| o2::framework::Produces<o2::aod::FTrackLabels> producedTrackLabels; | ||
| o2::framework::Produces<o2::aod::FLambdaLabels> producedLambdaLabels; | ||
| o2::framework::Produces<o2::aod::FK0shortLabels> producedK0shortLabels; | ||
| o2::framework::Produces<o2::aod::FD0Labels> producedD0Labels; | ||
| o2::framework::Produces<o2::aod::FSigmaLabels> producedSigmaLabels; | ||
| o2::framework::Produces<o2::aod::FSigmaPlusLabels> producedSigmaPlusLabels; | ||
| o2::framework::Produces<o2::aod::FXiLabels> producedXiLabels; | ||
|
|
@@ -75,6 +81,7 @@ struct ConfMcTables : o2::framework::ConfigurableGroup { | |
| o2::framework::Configurable<int> producedTrackLabels{"producedTrackLabels", -1, "Produce track labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedLambdaLabels{"producedLambdaLabels", -1, "Produce lambda labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedK0shortLabels{"producedK0shortLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedD0Labels{"producedD0Labels", -1, "Produce D0 labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedSigmaLabels{"producedSigmaLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedSigmaPlusLabels{"producedSigmaPlusLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; | ||
| o2::framework::Configurable<int> producedXiLabels{"producedXiLabels", -1, "Produce xi labels (-1: auto; 0 off; 1 on)"}; | ||
|
|
@@ -134,6 +141,7 @@ class McBuilder | |
| mProduceTrackLabels = utils::enableTable("FTrackLabels", table.producedTrackLabels.value, initContext); | ||
| mProduceLambdaLabels = utils::enableTable("FLambdaLabels", table.producedLambdaLabels.value, initContext); | ||
| mProduceK0shortLabels = utils::enableTable("FK0shortLabels", table.producedK0shortLabels.value, initContext); | ||
| mProduceD0Labels = utils::enableTable("FD0Labels", table.producedD0Labels.value, initContext); | ||
| mProduceSigmaLabels = utils::enableTable("FSigmaLabels", table.producedSigmaLabels.value, initContext); | ||
| mProduceSigmaPlusLabels = utils::enableTable("FSigmaPlusLabels", table.producedSigmaPlusLabels.value, initContext); | ||
| mProduceXiLabels = utils::enableTable("FXiLabels", table.producedXiLabels.value, initContext); | ||
|
|
@@ -155,6 +163,7 @@ class McBuilder | |
| mPassThrough = config.passThrough.value; | ||
| mEtaAcceptanceMcOnly = config.etaAcceptanceMcOnly.value; | ||
| mFindLastPartonicMother = config.findLastPartonicMother.value; | ||
| mCharmYGenMax = config.charmYGenMax.value; | ||
| LOG(info) << "Initialization done..."; | ||
| } | ||
|
|
||
|
|
@@ -229,7 +238,23 @@ class McBuilder | |
| template <modes::System system, typename T1, typename T2, typename T3, typename T4> | ||
| void fillMcParticle(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, T4& mcProducts) | ||
| { | ||
| this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, mcProducts); | ||
| // charm hadrons get a prompt/non-prompt origin, consistent with the reco-matched path; | ||
| // all other particles use the generic getOrigin inside getOrCreateMcParticleRow | ||
| if (std::abs(mcParticle.pdgCode()) == o2::constants::physics::Pdg::kD0) { | ||
| // truth-level acceptance for the efficiency denominator: keep only | ||
| // generated D0 -> K pi decays inside the rapidity acceptance | ||
| int8_t sign = 0; | ||
| if (!RecoDecay::isMatchedMCGen(mcParticles, mcParticle, o2::constants::physics::Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { | ||
| return; | ||
| } | ||
| if (std::abs(mcParticle.y()) > mCharmYGenMax) { | ||
| return; | ||
| } | ||
| const modes::McOrigin origin = this->resolveCharmOrigin(mcParticle, mcParticles); | ||
| this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts); | ||
| } else { | ||
| this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, mcProducts); | ||
| } | ||
| } | ||
|
|
||
| template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5> | ||
|
|
@@ -262,6 +287,37 @@ class McBuilder | |
| fillMcLabelGeneric<system>(col, mcCols, k0short, mcParticles, mcProducts, [](auto& prod, int64_t p) { prod.producedK0shortLabels(p); }); | ||
| } | ||
|
|
||
| // D0 has no direct MC label (2-prong hypothesis built by PWGHF), so fillMcLabelGeneric | ||
| // cannot be reused. Both prongs are matched to a generated D0 -> K pi decay with | ||
| // RecoDecay::getMatchedMCRec, which returns the index of the generated mother; | ||
| // unmatched candidates get -1. | ||
| template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> | ||
| void fillMcD0WithLabel(T1 const& /*col*/, T2 const& /*mcCols*/, T3 const& d0candidate, T4 const& /*tracks*/, T5 const& mcParticles, T6& mcProducts) | ||
| { | ||
| if (!mProduceD0Labels) { | ||
| mcProducts.producedD0Labels(-1); | ||
| return; | ||
| } | ||
|
|
||
| auto prong0 = d0candidate.template prong0_as<T4>(); | ||
| auto prong1 = d0candidate.template prong1_as<T4>(); | ||
| auto arrayDaughters = std::array{prong0, prong1}; | ||
| int8_t sign = 0; | ||
| const int indexMcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, o2::constants::physics::Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign); | ||
|
|
||
| if (indexMcRec < 0) { | ||
| mcProducts.producedD0Labels(-1); | ||
| return; | ||
| } | ||
|
|
||
| auto mcParticle = mcParticles.rawIteratorAt(indexMcRec); | ||
| auto mcCol = mcParticle.template mcCollision_as<T2>(); | ||
| const modes::McOrigin origin = this->resolveCharmOrigin(mcParticle, mcParticles); | ||
| int64_t mcParticleRow = this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts); | ||
|
|
||
| mcProducts.producedD0Labels(mcParticleRow); | ||
| } | ||
|
|
||
| template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5> | ||
| void fillMcSigmaWithLabel(T1 const& col, T2 const& mcCols, T3 const& sigmaDaughter, T4 const& mcParticles, T5& mcProducts) | ||
| { | ||
|
|
@@ -331,6 +387,15 @@ class McBuilder | |
| } | ||
|
|
||
| private: | ||
| // classify a charm hadron as prompt (charm from a c quark) or non-prompt (charm from a | ||
| // beauty decay) from the mc decay tree; shared by the reco-matched and generator-level paths | ||
| template <typename T1, typename T2> | ||
| modes::McOrigin resolveCharmOrigin(T1 const& mcParticle, T2 const& mcParticles) | ||
| { | ||
| const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle); | ||
| return (charmOrigin == RecoDecay::OriginType::NonPrompt) ? modes::McOrigin::kNonPrompt : modes::McOrigin::kPrompt; | ||
| } | ||
|
|
||
| template <typename T1, typename T2, typename T3> | ||
| modes::McOrigin getOrigin(T1 const& col, T2 const& /*mcCols*/, T3 const& mcParticle) | ||
| { | ||
|
|
@@ -393,6 +458,14 @@ class McBuilder | |
| return this->buildMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts); | ||
| } | ||
|
|
||
| /// \brief Overload for a caller-provided origin, e.g. prompt vs non-prompt for a charm | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment above, I think this overload is not needed |
||
| /// hadron, which getOrigin does not classify; the origin is stored as given | ||
| template <modes::System system, typename T1, typename T2, typename T3, typename T4> | ||
| int64_t getOrCreateMcParticleRow(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, modes::McOrigin origin, T4& mcProducts) | ||
| { | ||
| return this->buildMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts); | ||
| } | ||
|
|
||
| /// Reco-matched entry point: origin is derived by comparing the reconstructed | ||
| /// collision against the mc collision. | ||
| template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> | ||
|
|
@@ -612,11 +685,13 @@ class McBuilder | |
| bool mProduceTrackLabels = false; | ||
| bool mProduceLambdaLabels = false; | ||
| bool mProduceK0shortLabels = false; | ||
| bool mProduceD0Labels = false; | ||
| bool mProduceSigmaLabels = false; | ||
| bool mProduceSigmaPlusLabels = false; | ||
| bool mProduceXiLabels = false; | ||
| bool mProduceOmegaLabels = false; | ||
| bool mProduceMcMotherLabels = false; | ||
| float mCharmYGenMax = 0.8; | ||
|
|
||
| float mEtaAcceptanceMcOnly = 0.8; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would more elegant to have this resolved in here
here you add the check for the PID and then call a custom getHeavyFlavourOrigin function and set the correct origin for the D meson, the the new function overlaod can be avoided