-
Notifications
You must be signed in to change notification settings - Fork 613
[PWGHF] adding info on prompt / non prompt candidates in Lc tree creator #14269
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
Draft
emeninno
wants to merge
3
commits into
AliceO2Group:master
Choose a base branch
from
emeninno:test-branch
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.
+53
−8
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| /// Modified version of treeCreatorLcToPKPi.cxx | ||
| /// | ||
| /// \author Daniel Samitz <[email protected]> | ||
| /// \author Elisa Meninno <[email protected]> | ||
|
|
||
| #include "PWGHF/Core/HfHelper.h" | ||
| #include "PWGHF/DataModel/AliasTables.h" | ||
|
|
@@ -90,6 +91,7 @@ DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); | |
| DECLARE_SOA_COLUMN(MlScoreFirstClass, mlScoreFirstClass, float); | ||
| DECLARE_SOA_COLUMN(MlScoreSecondClass, mlScoreSecondClass, float); | ||
| DECLARE_SOA_COLUMN(MlScoreThirdClass, mlScoreThirdClass, float); | ||
| DECLARE_SOA_COLUMN(SigBgStatus, sigBgStatus, int); //! 0 bg, 1 prompt, 2 non-prompt,-1 default value (impossible, should not be the case), -999 for data | ||
| // Events | ||
| DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); | ||
| DECLARE_SOA_COLUMN(RunNumber, runNumber, int); | ||
|
|
@@ -135,7 +137,8 @@ DECLARE_SOA_TABLE(HfCandCascLites, "AOD", "HFCANDCASCLITE", | |
| full::OriginMcRec, | ||
| full::MlScoreFirstClass, | ||
| full::MlScoreSecondClass, | ||
| full::MlScoreThirdClass); | ||
| full::MlScoreThirdClass, | ||
| full::SigBgStatus); | ||
|
|
||
| DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", | ||
| collision::BCId, | ||
|
|
@@ -208,7 +211,8 @@ DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", | |
| full::OriginMcRec, | ||
| full::MlScoreFirstClass, | ||
| full::MlScoreSecondClass, | ||
| full::MlScoreThirdClass); | ||
| full::MlScoreThirdClass, | ||
| full::SigBgStatus); | ||
|
|
||
| DECLARE_SOA_TABLE(HfCandCascFullEs, "AOD", "HFCANDCASCFULLE", | ||
| collision::BCId, | ||
|
|
@@ -247,6 +251,38 @@ struct HfTreeCreatorLcToK0sP { | |
| using SelectedCandidatesMc = soa::Filtered<soa::Join<aod::HfCandCascade, aod::HfCandCascadeMcRec, aod::HfSelLcToK0sP>>; | ||
| Filter filterSelectCandidates = aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= 1; | ||
|
|
||
| // number showing MC status of the candidate (signal or background, prompt or non-prompt etc.) | ||
| enum SigBgStatus : int { | ||
| Background = 0, // combinatorial background, at least one of the prongs do not originate from the Lc decay | ||
| Prompt, // signal with Lc produced directly in the event | ||
| NonPrompt, // signal with Lc produced aftewards the event, e.g. during decay of beauty particle | ||
| Default = -1 // impossible, should not be the case, to catch logical error if any | ||
| }; | ||
|
|
||
| /// \brief function which determines if the candidate corresponds to MC-particle or belongs to a combinatorial background | ||
| /// \param candidate candidate to be checked for being signal or background | ||
| /// \return SigBgStatus enum with value encoding MC status of the candidate | ||
| template <typename CandType> | ||
| SigBgStatus determineSignalBgStatus(const CandType& candidate) | ||
| { | ||
| const int flag = candidate.flagMcMatchRec(); | ||
| const int origin = candidate.originMcRec(); | ||
|
|
||
| SigBgStatus status{Default}; | ||
|
|
||
| if (std::abs(flag) != 1) { | ||
| return Background; // combinatorial or wrong decay | ||
| } | ||
| // Otherwise it is signal: distinguish between Prompt/ NonPrompt | ||
| if (origin == RecoDecay::OriginType::Prompt) { | ||
| return Prompt; | ||
| } | ||
| if (origin == RecoDecay::OriginType::NonPrompt) { | ||
| return NonPrompt; | ||
| } | ||
| return Default; | ||
| } | ||
|
|
||
| void init(InitContext const&) | ||
| { | ||
| } | ||
|
|
@@ -276,7 +312,8 @@ struct HfTreeCreatorLcToK0sP { | |
| } | ||
|
|
||
| template <typename T, typename U> | ||
| void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec, aod::HfMlLcToK0sP::iterator const& candidateMlScore) | ||
| void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec, aod::HfMlLcToK0sP::iterator const& candidateMlScore, int sigbgstatus) | ||
| /// \param sigbgstatus for MC: number indicating if candidate is prompt, non-prompt or background; for data: UndefValueInt | ||
| { | ||
|
|
||
| float mlScoreFirstClass{UndefValueFloat}; | ||
|
|
@@ -328,7 +365,8 @@ struct HfTreeCreatorLcToK0sP { | |
| originMcRec, | ||
| mlScoreFirstClass, | ||
| mlScoreSecondClass, | ||
| mlScoreThirdClass); | ||
| mlScoreThirdClass, | ||
| sigbgstatus); | ||
| } else { | ||
| rowCandidateFull( | ||
| bach.collision().bcId(), | ||
|
|
@@ -401,7 +439,8 @@ struct HfTreeCreatorLcToK0sP { | |
| originMcRec, | ||
| mlScoreFirstClass, | ||
| mlScoreSecondClass, | ||
| mlScoreThirdClass); | ||
| mlScoreThirdClass, | ||
| sigbgstatus); | ||
| } | ||
| } | ||
| template <typename T> | ||
|
|
@@ -447,8 +486,14 @@ struct HfTreeCreatorLcToK0sP { | |
| auto bach = candidate.prong0_as<TracksWPid>(); // bachelor | ||
| const int flag = candidate.flagMcMatchRec(); | ||
|
|
||
| if ((fillOnlySignal && flag != 0) || (fillOnlyBackground && flag == 0) || (!fillOnlySignal && !fillOnlyBackground)) { | ||
| fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); | ||
| // get status (Prompt / NonPrompt / Background) | ||
| SigBgStatus sigbgstatus = determineSignalBgStatus(candidate); | ||
|
|
||
| bool isSignal = (std::abs(flag) == 1); | ||
| bool isBackground = !isSignal; | ||
|
|
||
| if ((fillOnlySignal && isSignal) || (fillOnlyBackground && isBackground) || (!fillOnlySignal && !fillOnlyBackground)) { | ||
| fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore, sigbgstatus); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -500,7 +545,7 @@ struct HfTreeCreatorLcToK0sP { | |
| auto bach = candidate.prong0_as<TracksWPid>(); // bachelor | ||
| double const pseudoRndm = bach.pt() * 1000. - static_cast<int16_t>(bach.pt() * 1000); | ||
| if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) { | ||
| fillCandidate(candidate, bach, 0, 0, candidateMlScore); | ||
| fillCandidate(candidate, bach, 0, 0, candidateMlScore, -999); | ||
| } | ||
| } | ||
| } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This flag contains exactly the information about prompt/non-prompt. Why do you need to add another one?