-
Notifications
You must be signed in to change notification settings - Fork 14
Adding SRTrkLikelihoodPID class into the StandardRecord #168
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
Adding SRTrkLikelihoodPID class into the StandardRecord #168
Conversation
henrylay97
left a comment
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated following the suggested change.
(added my email tooo :) )
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int pid_ndof; ///< Number of degress of freedom in likelihood PID | |
| int pid_ndof; ///< Number of degrees of freedom in likelihood PID |
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.
Added the space
| //////////////////////////////////////////////////////////////////////// | ||
| // \file SRTrkLikelihoodPID.h | ||
| //////////////////////////////////////////////////////////////////////// |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the suggested change.
|
Hi @PetrilloAtWork , thanks a lot for your review. For default values, I am reviving |
Co-authored-by: Gianluca Petrillo <[email protected]>
|
Hi @PetrilloAtWork , suggested update for |
PetrilloAtWork
left a comment
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.
Approved.
henrylay97
left a comment
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.
One technical change still needed, but with that addressed I'm happy to approve.
Co-authored-by: Henry Lay <[email protected]>
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