-
Notifications
You must be signed in to change notification settings - Fork 690
[PWGHF] First draft of Omegac0 to OmegaPi QA workflow #18126
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
mtorresc15
wants to merge
15
commits into
AliceO2Group:master
Choose a base branch
from
mtorresc15:omegac0-qa
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.
+2,497
−0
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d9fc6bc
Update QA candidate selector for Omegac0
mtorresc15 8434aa9
Update QA candidate selector for Omegac0
mtorresc15 4ab3779
Fix bugs in QA candidate selector for Omegac0
mtorresc15 3bc0ba8
Update OmegaC candidate selector QA
mtorresc15 3c24dab
First draft for OmegaC tree creator QA
mtorresc15 3fedfd7
Add OmegaC QA task
mtorresc15 7ae589e
Add OmegaC ML response QA header
mtorresc15 bd07df0
Update on OmegaC ML response QA header
mtorresc15 b3cf2b2
Update OmegaC QA task
mtorresc15 a793db1
Extend Omegac QA ML support to DCAFitter
mtorresc15 6a4c788
Refine Omegac QA ML implementation
mtorresc15 988a58a
Fix formatting issues in Omegac QA workflow
mtorresc15 d00fd34
Fix Omegac QA selections and DCA rapidity
mtorresc15 930c0db
Fix Omegac QA selections and clean up obsolete code
mtorresc15 49f2a15
Fix clang-format in Omegac QA tree creator
mtorresc15 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 |
|---|---|---|
| @@ -0,0 +1,233 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| /// \file HfMlResponseOmegacToOmegaPiQa.h | ||
| /// \brief Class to compute the ML response for Ωc0 → Ω- π+ (and charge-conjugate) analysis selections | ||
| /// \author Yunfan Liu <yunfan.liu@cern.ch>, China University of Geosciences | ||
| /// \author Maria Fernanda Torres Cabrera <maria.fernanda.torres.cabrera@cern.ch>, University of Houston | ||
|
|
||
| #ifndef PWGHF_CORE_HFMLRESPONSEOMEGACTOOMEGAPIQA_H_ | ||
| #define PWGHF_CORE_HFMLRESPONSEOMEGACTOOMEGAPIQA_H_ | ||
|
|
||
| #include "PWGHF/Core/HfMlResponse.h" | ||
| #include "PWGHF/DataModel/CandidateReconstructionTables.h" | ||
|
|
||
| #include "Tools/ML/MlResponse.h" | ||
|
|
||
| #include <cstdint> | ||
| #include <map> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| // Fill the map of available input features | ||
| // the key is the feature's name (std::string) | ||
| // the value is the corresponding value in EnumInputFeatures | ||
| #define FILL_MAP_OMEGAC0(FEATURE) \ | ||
| { \ | ||
| #FEATURE, static_cast<uint8_t>(InputFeaturesOmegacToOmegaPi::FEATURE)} | ||
|
|
||
| // Check if the index of mCachedIndices (index associated to a FEATURE) | ||
| // matches the entry in EnumInputFeatures associated to this FEATURE | ||
| // if so, the inputFeatures vector is filled with the FEATURE's value | ||
| // by calling the corresponding GETTER from OBJECT | ||
| #define CHECK_AND_FILL_VEC_OMEGAC0_FULL(OBJECT, FEATURE, GETTER) \ | ||
| case static_cast<uint8_t>(InputFeaturesOmegacToOmegaPi::FEATURE): { \ | ||
| inputFeatures.emplace_back(OBJECT.GETTER()); \ | ||
| break; \ | ||
| } | ||
|
|
||
| // Specific case of CHECK_AND_FILL_VEC_OMEGAC0_FULL(OBJECT, FEATURE, GETTER) | ||
| // where OBJECT is named candidate and FEATURE = GETTER | ||
| #define CHECK_AND_FILL_VEC_OMEGAC0(GETTER) \ | ||
| case static_cast<uint8_t>(InputFeaturesOmegacToOmegaPi::GETTER): { \ | ||
| inputFeatures.emplace_back(candidate.GETTER()); \ | ||
| break; \ | ||
| } | ||
| namespace o2::analysis | ||
| { | ||
| enum class InputFeaturesOmegacToOmegaPi : uint8_t { | ||
|
|
||
| // Common variables | ||
| dcaCharmBaryonDau = 0, | ||
| dcaCascDau, | ||
| nSigmaTPCPiFromV0, | ||
| nSigmaTPCPiFromOmegac, | ||
| nSigmaTPCKaFromCasc, | ||
|
|
||
| // DCAFitter variables | ||
| impactParBachFromCharmBaryonXY, | ||
| impactParBachFromCharmBaryonZ, | ||
| impactParCascXY, | ||
| impactParCascZ, | ||
| cosPACharmBaryon, | ||
| cosPACasc, | ||
|
|
||
| // KFParticle variables | ||
| cosPaOmegacToPv, | ||
| kfDcaXYPiFromOmegac, | ||
| chi2TopoPiFromOmegacToPv, | ||
| invMassCascade, | ||
| massCascChi2OverNdf, | ||
| kfDcaXYCascToPv, | ||
| cosPaCascToPv, | ||
| cosThetaStarPiFromOmegac, | ||
| chi2NdfTopoOmegacToPv, | ||
| ldlCasc, | ||
| cosPaCascToOmegac, | ||
| decayLenXYCasc, | ||
| decayLenXYOmegac, | ||
| ldlOmegac, | ||
| chi2NdfTopoCascToOmegac, | ||
| chi2NdfTopoCascToPv, | ||
| chi2GeoOmegac, | ||
| chi2GeoCasc, | ||
| }; | ||
|
|
||
| template <typename TypeOutputScore = float, aod::hf_cand_casc_lf::ConstructMethod reconstructionType = aod::hf_cand_casc_lf::ConstructMethod::DcaFitter> | ||
| class HfMlResponseOmegacToOmegaPi : public HfMlResponse<TypeOutputScore> | ||
| { | ||
| public: | ||
| /// Default constructor | ||
| HfMlResponseOmegacToOmegaPi() = default; | ||
| /// Default destructor | ||
| virtual ~HfMlResponseOmegacToOmegaPi() = default; | ||
|
|
||
| /// Method to get the input features vector needed for ML inference | ||
| /// \param candidate is the OMEGAC0 candidate | ||
| /// \param lamProngPi is the candidate's lamProngPi | ||
| /// \param cascProng is the bachelor track from the Omega decay | ||
| /// \param charmBaryonProng is the bachelor pion from the OmegaC decay | ||
| /// \return inputFeatures vector | ||
| template <typename T1, typename T2, typename T3> | ||
| std::vector<float> getInputFeatures(T1 const& candidate, T2 const& lamProngPi, T2 const& cascProng, T3 const& charmBaryonProng) | ||
| { | ||
| std::vector<float> inputFeatures; | ||
|
|
||
| for (const auto& idx : MlResponse<TypeOutputScore>::mCachedIndices) { | ||
|
|
||
| // Variables common to DCAFitter and KFParticle | ||
| switch (idx) { | ||
|
|
||
| CHECK_AND_FILL_VEC_OMEGAC0(dcaCharmBaryonDau); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(dcaCascDau); | ||
| // TPC PID variables | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(lamProngPi, nSigmaTPCPiFromV0, tpcNSigmaPi); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(cascProng, nSigmaTPCKaFromCasc, tpcNSigmaKa); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(charmBaryonProng, nSigmaTPCPiFromOmegac, tpcNSigmaPi); | ||
| } | ||
|
|
||
| // DCAFitter variables | ||
| if constexpr (reconstructionType == aod::hf_cand_casc_lf::ConstructMethod::DcaFitter) { | ||
|
|
||
| switch (idx) { | ||
|
|
||
| CHECK_AND_FILL_VEC_OMEGAC0(impactParBachFromCharmBaryonXY); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(impactParBachFromCharmBaryonZ); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(impactParCascXY); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(impactParCascZ); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(cosPACharmBaryon); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(cosPACasc); | ||
| } | ||
| } | ||
|
|
||
| // KFParticle variables | ||
| if constexpr (reconstructionType == aod::hf_cand_casc_lf::ConstructMethod::KfParticle) { | ||
|
|
||
| switch (idx) { | ||
|
|
||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, cosPaOmegacToPv, cosPACharmBaryon); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(kfDcaXYPiFromOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(chi2TopoPiFromOmegacToPv); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(invMassCascade); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(massCascChi2OverNdf); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(kfDcaXYCascToPv); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, cosPaCascToPv, cosPACasc); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(cosThetaStarPiFromOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, chi2NdfTopoOmegacToPv, chi2TopoOmegacToPv); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, ldlCasc, cascldl); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(cosPaCascToOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(decayLenXYCasc); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(decayLenXYOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, ldlOmegac, omegacldl); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, chi2NdfTopoCascToOmegac, chi2TopoCascToOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0_FULL(candidate, chi2NdfTopoCascToPv, chi2TopoCascToPv); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(chi2GeoOmegac); | ||
| CHECK_AND_FILL_VEC_OMEGAC0(chi2GeoCasc); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return inputFeatures; | ||
| } | ||
|
|
||
| protected: | ||
| /// Method to fill the map of available input features | ||
| void setAvailableInputFeatures() | ||
| { | ||
| // Common variables | ||
| MlResponse<TypeOutputScore>::mAvailableInputFeatures = { | ||
|
|
||
| FILL_MAP_OMEGAC0(dcaCharmBaryonDau), | ||
| FILL_MAP_OMEGAC0(dcaCascDau), | ||
| FILL_MAP_OMEGAC0(nSigmaTPCPiFromV0), | ||
| FILL_MAP_OMEGAC0(nSigmaTPCPiFromOmegac), | ||
| FILL_MAP_OMEGAC0(nSigmaTPCKaFromCasc)}; | ||
|
|
||
| // DCAFitter variables | ||
| if constexpr (reconstructionType == aod::hf_cand_casc_lf::ConstructMethod::DcaFitter) { | ||
|
|
||
| std::map<std::string, uint8_t> mapDcaFeatures{ | ||
|
|
||
| FILL_MAP_OMEGAC0(impactParBachFromCharmBaryonXY), | ||
| FILL_MAP_OMEGAC0(impactParBachFromCharmBaryonZ), | ||
| FILL_MAP_OMEGAC0(impactParCascXY), | ||
| FILL_MAP_OMEGAC0(impactParCascZ), | ||
| FILL_MAP_OMEGAC0(cosPACharmBaryon), | ||
| FILL_MAP_OMEGAC0(cosPACasc)}; | ||
|
|
||
| MlResponse<TypeOutputScore>::mAvailableInputFeatures.insert(mapDcaFeatures.begin(), mapDcaFeatures.end()); | ||
| } | ||
|
|
||
| // KFParticle variables | ||
| if constexpr (reconstructionType == aod::hf_cand_casc_lf::ConstructMethod::KfParticle) { | ||
|
|
||
| std::map<std::string, uint8_t> mapKfFeatures{ | ||
|
|
||
| FILL_MAP_OMEGAC0(cosPaOmegacToPv), | ||
| FILL_MAP_OMEGAC0(kfDcaXYPiFromOmegac), | ||
| FILL_MAP_OMEGAC0(chi2TopoPiFromOmegacToPv), | ||
| FILL_MAP_OMEGAC0(invMassCascade), | ||
| FILL_MAP_OMEGAC0(massCascChi2OverNdf), | ||
| FILL_MAP_OMEGAC0(kfDcaXYCascToPv), | ||
| FILL_MAP_OMEGAC0(cosPaCascToPv), | ||
| FILL_MAP_OMEGAC0(cosThetaStarPiFromOmegac), | ||
| FILL_MAP_OMEGAC0(chi2NdfTopoOmegacToPv), | ||
| FILL_MAP_OMEGAC0(ldlCasc), | ||
| FILL_MAP_OMEGAC0(cosPaCascToOmegac), | ||
| FILL_MAP_OMEGAC0(decayLenXYCasc), | ||
| FILL_MAP_OMEGAC0(decayLenXYOmegac), | ||
| FILL_MAP_OMEGAC0(ldlOmegac), | ||
| FILL_MAP_OMEGAC0(chi2NdfTopoCascToOmegac), | ||
| FILL_MAP_OMEGAC0(chi2NdfTopoCascToPv), | ||
| FILL_MAP_OMEGAC0(chi2GeoOmegac), | ||
| FILL_MAP_OMEGAC0(chi2GeoCasc)}; | ||
|
|
||
| MlResponse<TypeOutputScore>::mAvailableInputFeatures.insert(mapKfFeatures.begin(), mapKfFeatures.end()); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| } // namespace o2::analysis | ||
|
|
||
| #undef FILL_MAP_OMEGAC0 | ||
| #undef CHECK_AND_FILL_VEC_OMEGAC0_FULL | ||
| #undef CHECK_AND_FILL_VEC_OMEGAC0 | ||
| #endif // PWGHF_CORE_HFMLRESPONSEOMEGACTOOMEGAPIQA_H_ | ||
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.