Adding SRTrkLikelihoodPID class into the StandardRecord#168
Conversation
henrylay97
left a comment
There was a problem hiding this comment.
Couple of comments, one critical, one not.
You also need to request a review from either @JosiePaton or @PetrilloAtWork as it affects the CAF data format.
Hi @henrylay97 , thank you for the review! |
henrylay97
left a comment
There was a problem hiding this comment.
Looking good. Thanks for updating the name.
I'm still being picky about defaults sorry!
| SRTrkLikelihoodPID::SRTrkLikelihoodPID(): | ||
| pdg(-999), | ||
| pid_ndof(-99), | ||
| lambda_muon(std::numeric_limits<float>::signaling_NaN()), | ||
| lambda_pion(std::numeric_limits<float>::signaling_NaN()), | ||
| lambda_proton(std::numeric_limits<float>::signaling_NaN()) | ||
| { } | ||
|
|
||
| SRTrkLikelihoodPID::~SRTrkLikelihoodPID(){ } | ||
|
|
||
| void SRTrkLikelihoodPID::setDefault() | ||
| { | ||
| pdg = -5; | ||
| pid_ndof = -5; | ||
| lambda_muon = -5.0; | ||
| lambda_pion = -5.0; | ||
| lambda_proton = -5.0; | ||
| } |
There was a problem hiding this comment.
Sorry to be picky. I still don't like that we have default values set in 3 places. In the default constructor, in the setDefault function and in the corresponding sbncode PR they get set explicitly when making the object.
I like the defaults used in the default constructor here so my suggestion is to remove the other two instances completely. For this PR this means removing the setDefault() function, it doesn't appear to be used anywhere?
There was a problem hiding this comment.
Hi @henrylay97 , no problem at all!
I've removed the other two places setting the default values, also removing void SRTrkLikelihoodPID::setDefault().
There was a problem hiding this comment.
I don't like it either, but there was a rationale that aimed to distinguish data that was never initialised (values from constructor), and the data that was defaulted by the user (setDefault()).
Without the former, if code omits an initialisation we end up with random values in the data files, and when we try comparing two versions of data we may see red-herring differences because of that.
PetrilloAtWork
left a comment
There was a problem hiding this comment.
I have left some comments.
@henrylay97 has a (partially) different opinion on initialisation than I do, and you are getting caught in the middle... but uninitialised data is bad, so we need to avoid it.
| //////////////////////////////////////////////////////////////////////// | ||
| // \file SRTrkLikelihoodPID.cxx | ||
| // \brief An SRTrkLikelihoodPID is a high level track ParticlePID object for | ||
| // for larana LikelihoodPIDAlg results. | ||
| //////////////////////////////////////////////////////////////////////// |
There was a problem hiding this comment.
Please turn this into a Doxygen comment and add your name for glory/blame:
| //////////////////////////////////////////////////////////////////////// | |
| // \file SRTrkLikelihoodPID.cxx | |
| // \brief An SRTrkLikelihoodPID is a high level track ParticlePID object for | |
| // for larana LikelihoodPIDAlg results. | |
| //////////////////////////////////////////////////////////////////////// | |
| /** | |
| * @file sbnanaobj/StandardRecord/SRTrkLikelihoodPID.cxx | |
| * @brief An `SRTrkLikelihoodPID` is a high level track ParticlePID object for | |
| * for larana LikelihoodPIDAlg results. | |
| * @author Sungbin Oh | |
| */ |
(you can add your e-mail in the @author line if you are comfortable with it)
There was a problem hiding this comment.
Updated following the suggested change.
(added my email tooo :) )
There was a problem hiding this comment.
Good! If you can fix the repeated "for" in the brief description it's even better.
| SRTrkLikelihoodPID::SRTrkLikelihoodPID(): | ||
| pdg(-999), | ||
| pid_ndof(-99), | ||
| lambda_muon(std::numeric_limits<float>::signaling_NaN()), | ||
| lambda_pion(std::numeric_limits<float>::signaling_NaN()), | ||
| lambda_proton(std::numeric_limits<float>::signaling_NaN()) | ||
| { } | ||
|
|
||
| SRTrkLikelihoodPID::~SRTrkLikelihoodPID(){ } | ||
|
|
||
| void SRTrkLikelihoodPID::setDefault() | ||
| { | ||
| pdg = -5; | ||
| pid_ndof = -5; | ||
| lambda_muon = -5.0; | ||
| lambda_pion = -5.0; | ||
| lambda_proton = -5.0; | ||
| } |
There was a problem hiding this comment.
I don't like it either, but there was a rationale that aimed to distinguish data that was never initialised (values from constructor), and the data that was defaulted by the user (setDefault()).
Without the former, if code omits an initialisation we end up with random values in the data files, and when we try comparing two versions of data we may see red-herring differences because of that.
| public: | ||
|
|
||
| SRTrkLikelihoodPID(); | ||
| virtual ~SRTrkLikelihoodPID(); |
There was a problem hiding this comment.
Remove the destructor, since it does not do anything (CF-151).
Also I would like to know if you copied that idea from anywhere in our code, so that we can fix that too.
| virtual ~SRTrkLikelihoodPID(); |
[edit] I guess that's SRTrkChi2PID.
There was a problem hiding this comment.
Removing the destructor in both .h and .cxx.
And yes, I've copied a structure in SRTrkChi2PID .
| virtual ~SRTrkLikelihoodPID(); | ||
|
|
||
| int pdg; ///< Likelihood PID pdg | ||
| int pid_ndof; ///< Number of degress of freedom in likelihood PID |
There was a problem hiding this comment.
| int pid_ndof; ///< Number of degress of freedom in likelihood PID | |
| int pid_ndof; ///< Number of degrees of freedom in likelihood PID |
| //////////////////////////////////////////////////////////////////////// | ||
| // \file SRTrkLikelihoodPID.h | ||
| //////////////////////////////////////////////////////////////////////// |
There was a problem hiding this comment.
Please turn this comment block into Doxygen format:
| //////////////////////////////////////////////////////////////////////// | |
| // \file SRTrkLikelihoodPID.h | |
| //////////////////////////////////////////////////////////////////////// | |
| /** | |
| * @file sbnanaobj/StandardRecord/SRTrkLikelihoodPID.h | |
| * @brief An `SRTrkLikelihoodPID` is a high level track ParticlePID object for | |
| * for larana LikelihoodPIDAlg results. | |
| * @author Sungbin Oh | |
| */ |
(like in the class implementation file)
There was a problem hiding this comment.
Updated to the suggested change.
|
Hi @PetrilloAtWork , thanks a lot for your review. For default values, I am reviving |
Co-authored-by: Gianluca Petrillo <petrillo.at.work@gmail.com>
|
Hi @PetrilloAtWork , suggested update for |
henrylay97
left a comment
There was a problem hiding this comment.
One technical change still needed, but with that addressed I'm happy to approve.
Co-authored-by: Henry Lay <h.lay@sheffield.ac.uk>
Hi @henrylay97 , the suggested update is committed. Thank you! |
|
trigger build LArSoft/lar*@LARSOFT_SUITE_v10_12_02 |
|
✔️ CI build for LArSoft Succeeded on slf7 for c14:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for e26:prof -- details available through the CI dashboard |
|
❌ CI build for SBND Failed at phase build SBND on slf7 for c14:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build SBND phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase build ICARUS on slf7 for c14:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build ICARUS phase logs parent CI build details are available through the CI dashboard |
|
🚨 For more details about the warning phase, check the ci_tests SBND phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for e26:prof - ignored warnings for build -- details available through the CI dashboard 🚨 For more details about the failed phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
Adding a new StandardRecord
SRTrkLikePIDfor likelihood-based PID variables.It saves sum of the normalized log likelihood (lambda = -lnL/L_max) for muon, charged pion and proton hypotheses.
Relevant PR in larana is PR41.
Also relevant: SBNSoftware/sbncode#593