-
Notifications
You must be signed in to change notification settings - Fork 14
add first NuGraph2 info to CAF #137
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
Conversation
brucehoward-physics
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.
Seems pretty uncontroversial, but I do have a few suggestions for collapsing the checksum versions.
| <version ClassVersion="23" checksum="2124497341"/> | ||
| <version ClassVersion="22" checksum="4187618741"/> |
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 believe you can just collapse these to ClassVersion 22 with the latest checksum no?
| <version ClassVersion="17" checksum="135310109"/> | ||
| <version ClassVersion="16" checksum="1684266144"/> |
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.
same here.
…nto feature/cerati_ng2caf
|
@brucehoward-physics Suggestions implemented. Thanks |
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.
Left a few comments.
Only two, really.
A shame.
sbnanaobj/StandardRecord/SRPFP.h
Outdated
| int ng_sem_cat; ///< NuGraph semantic category with largest hit fraction | ||
| float ng_mip_frac; ///< Fraction of PFP hits labeled by NuGraph as MIP | ||
| float ng_hip_frac; ///< Fraction of PFP hits labeled by NuGraph as HIP | ||
| float ng_shr_frac; ///< Fraction of PFP hits labeled by NuGraph as shower | ||
| float ng_mhl_frac; ///< Fraction of PFP hits labeled by NuGraph as Michel | ||
| float ng_dif_frac; ///< Fraction of PFP hits labeled by NuGraph as diffuse | ||
| float ng_bkg_frac; ///< Fraction of PFP hits labeled by NuGraph as background |
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 recommend to enclose this group of data members into their own class, like in SRCNNScore (e.g. SRNGScore) or, even better from my point of view, use and extend SRCNNScore itself (half the categories are the same), with the unsupported categories defaulting to 0.0 (and nclusters to -5).
sbnanaobj/StandardRecord/SRPFP.h
Outdated
|
|
||
| SRCNNScore cnnscore; // CNN scores for this PFP | ||
|
|
||
| int ng_sem_cat; ///< NuGraph semantic category with largest hit fraction |
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.
Consider an enum type instead of a bare int.
And consider very well having at very least an enum to describe the possible categories rather than using integer values in the code.
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for e26:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for c14:prof -- details 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 |
|
❌ 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 |
|
🚨 For more details about the warning phase, check the ci_tests SBND phase logs parent CI build details are available through the CI dashboard |
|
🚨 For more details about the warning phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
…nto feature/cerati_ng2caf
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.
Several formal C++ fixes requested.
Also, I believe the new class should be added to classes_def.xml.
As usual, do not accept suggested documentation without checking what I wrote, that may be badly written, misleading or plain wrong.
| class SRNuGraphScore { | ||
| public: | ||
| SRNuGraphScore(); | ||
| ~SRNuGraphScore() {} |
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 this destructor: it's useless and sometimes deleterious.
| ~SRNuGraphScore() {} |
| float mip_frac; | ||
| float hip_frac; | ||
| float shr_frac; | ||
| float mhl_frac; | ||
| float dif_frac; | ||
| float bkg_frac; |
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.
- Initialize the data members inline.
- Add in comment what these are supposed to be. Maybe something like:
| float mip_frac; | |
| float hip_frac; | |
| float shr_frac; | |
| float mhl_frac; | |
| float dif_frac; | |
| float bkg_frac; | |
| static constexpr float kUnassigned = std::numeric_limits<float>::signaling_NaN(); | |
| float mip_frac = kUnassigned; ///< Fraction of hits that are most likely to be `MIP`. | |
| float hip_frac = kUnassigned; ///< Fraction of hits that are most likely to be `HIP`. | |
| float shr_frac = kUnassigned; ///< Fraction of hits that are most likely to be `Shower`. | |
| float mhl_frac = kUnassigned; ///< Fraction of hits that are most likely to be `Michel`. | |
| float dif_frac = kUnassigned; ///< Fraction of hits that are most likely to be `Diffuse`. | |
| float bkg_frac = kUnassigned; ///< Fraction of hits that are most likely to be none of the above. |
(for this example you also have to #include <limits> here instead of the implementation file).
Here I am defining kUnassigned just for convenience. It may be private, it may be just spelled out — your choice.
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.
If you're going to use signaling NaN why not just use this ;)
https://github.com/SBNSoftware/sbnanaobj/blob/develop/sbnanaobj/StandardRecord/SRConstants.h#L8
| Diffuse = 4 | ||
| }; | ||
|
|
||
| int sem_cat; |
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.
- Initialize the data members inline (
[CF-155]). It used to be not the CAF standard, but it is going to become under by guard. Too many times members are added that are left uninitialised, and this helps a lot against it. - Add in comment what these are supposed to be. For example:
| int sem_cat; | |
| int sem_cat = NuGraphCategory::Unset; ///< The category of the majority of the hits. |
Finally, in CAF the pattern used to distinguish between default-constructed and positively set as invalid/unknown; consider to use -5 instead of Unset for this construction (yes, it's not in the enum, and it might be ok considering that it represents a "logic error" state where the object was not appropriately initialised).
I am even not sure whether I would do that, but as CAF maintainer I am bound to explain that this is the custom ([NA-01]).
sbnanaobj/StandardRecord/SRPFP.h
Outdated
|
|
||
| SRCNNScore cnnscore; // CNN scores for this PFP | ||
|
|
||
| SRNuGraphScore ngscore; // NuGraph scores for this PFP |
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.
Doxy it!
| SRNuGraphScore ngscore; // NuGraph scores for this PFP | |
| SRNuGraphScore ngscore; ///< NuGraph scores for this PFP |
(if you can, also the cnnscore one above)
| <class name="caf::SRPFP" ClassVersion="17"> | ||
| <version ClassVersion="17" checksum="2252062519"/> | ||
| <version ClassVersion="16" checksum="135310109"/> |
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 compress this into a single checksum:
| <class name="caf::SRPFP" ClassVersion="17"> | |
| <version ClassVersion="17" checksum="2252062519"/> | |
| <version ClassVersion="16" checksum="135310109"/> | |
| <class name="caf::SRPFP" ClassVersion="16"> | |
| <version ClassVersion="16" checksum="2252062519"/> |
| #include <limits> | ||
|
|
||
| namespace caf | ||
| { | ||
| SRNuGraphScore::SRNuGraphScore() : | ||
| sem_cat(NuGraphCategory::Unset), | ||
| mip_frac(std::numeric_limits<float>::signaling_NaN()), | ||
| hip_frac(std::numeric_limits<float>::signaling_NaN()), | ||
| shr_frac(std::numeric_limits<float>::signaling_NaN()), | ||
| mhl_frac(std::numeric_limits<float>::signaling_NaN()), | ||
| dif_frac(std::numeric_limits<float>::signaling_NaN()), | ||
| bkg_frac(std::numeric_limits<float>::signaling_NaN()) | ||
| { | ||
| } | ||
| } |
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.
When following the recommendations on the constructor (below), not much is left here.
| #include <limits> | |
| namespace caf | |
| { | |
| SRNuGraphScore::SRNuGraphScore() : | |
| sem_cat(NuGraphCategory::Unset), | |
| mip_frac(std::numeric_limits<float>::signaling_NaN()), | |
| hip_frac(std::numeric_limits<float>::signaling_NaN()), | |
| shr_frac(std::numeric_limits<float>::signaling_NaN()), | |
| mhl_frac(std::numeric_limits<float>::signaling_NaN()), | |
| dif_frac(std::numeric_limits<float>::signaling_NaN()), | |
| bkg_frac(std::numeric_limits<float>::signaling_NaN()) | |
| { | |
| } | |
| } |
(in fact, the only reason to include a .cxx is to make sure that the header is compiled and checked)
|
|
||
| class SRNuGraphScore { | ||
| public: | ||
| SRNuGraphScore(); |
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.
Following the recommendation on the in-class initialization, this is not needed:
| SRNuGraphScore(); |
| Unset = -1, | ||
| Mip = 0, | ||
| Hip = 1, | ||
| Shower = 2, | ||
| Michel = 3, | ||
| Diffuse = 4 |
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.
Shouldn't MIP and HIP go all capital?
Also have some comment, e.g. to explain that MIP and HIP refer to a track-like object, what is "diffuse" meaning, that Michel is not the pianist...
| Unset = -1, | |
| Mip = 0, | |
| Hip = 1, | |
| Shower = 2, | |
| Michel = 3, | |
| Diffuse = 4 | |
| Unset = -1, ///< Unset/unknown/undecided/ category. | |
| Mip = 0, ///< Track from a minimum-ionizing particle. | |
| Hip = 1, ///< Track from a high ionization particle. | |
| Shower = 2, ///< Particle shower. | |
| Michel = 3, ///< Michel electron (from muon decay). | |
| Diffuse = 4 ///< Diffuse background. |
Still not sure how to define Diffuse.
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.
Just one fix to the documentation left.
| /** | ||
| * @brief Categorization of the object/PFP by NuGraph. | ||
| * | ||
| * This object summarizes the results from running NuGraph over hits in a slice | ||
| * (see e.g. [https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=40585](SBN DocDB 40585). | ||
| * | ||
| * The semantic category is the one that most hits belong to. | ||
| * The fractions describe the categorization of the hits in the object/PFP. | ||
| */ | ||
| namespace caf { | ||
|
|
||
| class SRNuGraphScore { |
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.
The comment needs to be just before the object it's commenting about (in this code, the documentation would have been attached to the caf namespace):
| /** | |
| * @brief Categorization of the object/PFP by NuGraph. | |
| * | |
| * This object summarizes the results from running NuGraph over hits in a slice | |
| * (see e.g. [https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=40585](SBN DocDB 40585). | |
| * | |
| * The semantic category is the one that most hits belong to. | |
| * The fractions describe the categorization of the hits in the object/PFP. | |
| */ | |
| namespace caf { | |
| class SRNuGraphScore { | |
| namespace caf { | |
| /** | |
| * @brief Categorization of the object/PFP by NuGraph. | |
| * | |
| * This object summarizes the results from running NuGraph over hits in a slice | |
| * (see e.g. [https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=40585](SBN | |
| * DocDB 40585). | |
| * | |
| * The semantic category is the one that most hits belong to. | |
| * The fractions describe the categorization of the hits in the object/PFP. | |
| */ | |
| class SRNuGraphScore { |
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.
ops...
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.
Thank you, Giuseppe.
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for e26:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for c14: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 |
|
🚨 For more details about the warning phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
This PR adds a few NuGraph-related variables to CAFs, along the lines of what presented on docdb 40585. Once SBNSoftware/icaruscode#815 is merged the needed data products can be produced, but it won't break CAF making if they are not there. The related SBNSoftware/sbncode#532 is also being made.