-
Notifications
You must be signed in to change notification settings - Fork 33
Feature/adding blip to caf #603
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
base: develop
Are you sure you want to change the base?
Conversation
|
Adding a comment to each of these to track all 4 related PR. The changes to sbnobj, and sbnanaobj are fully independent of any other changes, so they can be approved first. sbndcode changes rely on sbnobj, so it will have to wait for the first approval. A later simple PR will delete the (now duplicated) class files in the BlipUtils folder here sbncode changes rely on both sbnobj and sbnanaobj, so that will have to wait for both of the first two approvals. |
JosiePaton
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.
Assuming reasonable file size change result!
sbncode/CAFMaker/CAFMaker_module.cc
Outdated
| int fGenieEvtRec_brStdHepLd [250] = {0}; ////< Last daughter | ||
| int fGenieEvtRec_brStdHepFm [250] = {0}; ////< First mother | ||
| int fGenieEvtRec_brStdHepLm [250] = {0}; ////< Last mother | ||
| //std::string fBlipTag; |
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.
Can you remove old commented code?
sbncode/CAFMaker/CAFMakerParams.h
Outdated
| "cvn" | ||
| }; | ||
| Atom<std::string> fBlipTag { Name("BlipTag"), | ||
| Comment("Provide a string to label the blip input"), "reco2:Blip:BlipReco" |
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 should be the producer that made the blips.
Is that not defined as blipreco here?
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.
Yes that is what it should be. I thought it would be the whole LArSoft label, so guessed this version. Its wrong and I am happy to update it to blipreco
sbncode/CAFMaker/FillBlip.cxx
Outdated
| CAF_Blip.clusters[iPlane].ID = LarBlip.clusters[iPlane].ID; | ||
| CAF_Blip.clusters[iPlane].isValid = LarBlip.clusters[iPlane].isValid; | ||
| CAF_Blip.clusters[iPlane].CenterChan = LarBlip.clusters[iPlane].CenterChan; | ||
| CAF_Blip.clusters[iPlane].CenterWire = LarBlip.clusters[iPlane].CenterWire; | ||
| CAF_Blip.clusters[iPlane].isTruthMatched = LarBlip.clusters[iPlane].isTruthMatched; | ||
| CAF_Blip.clusters[iPlane].isMerged = LarBlip.clusters[iPlane].isMerged; | ||
| CAF_Blip.clusters[iPlane].isMatched = LarBlip.clusters[iPlane].isMatched; |
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.
In general there are quite a few indentation inconsistencies across these PRs. It's often different editors and how they treat tabs, there are normally ways to untabify though.
| @@ -0,0 +1,104 @@ | |||
| #include "sbncode/CAFMaker/FillBlip.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.
Thanks for putting in a separate file, FillReco is getting unwieldy.
|
Just noting on this PR as well that the above Henry comments should all be addressed. |
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.
A few things need to be changed (redundant headers, missing const parameters), others are recommended to.
Details in the comments.
| //for(int i=0; i<int(*(blipHandle)->size()); i++) | ||
| // { | ||
| // auto LarBlips = (*(blipHandle))[i]; | ||
| // FillBlip( (LarBlips) , srblips); | ||
| // } |
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 remove obsolete, commented out code:
| //for(int i=0; i<int(*(blipHandle)->size()); i++) | |
| // { | |
| // auto LarBlips = (*(blipHandle))[i]; | |
| // FillBlip( (LarBlips) , srblips); | |
| // } |
| std::vector<caf::SRBlip> srblips; | ||
| if(evt.getByLabel( fParams.fBlipTag(), blipHandle)) //fill SR blips | ||
| { | ||
| FillBlip( (*blipHandle), srblips); |
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.
Parentheses are redundant here. Just saying.
| FillBlip( (*blipHandle), srblips); | |
| FillBlip( *blipHandle, srblips); |
(this is a suggestion)
sbncode/CAFMaker/CMakeLists.txt
Outdated
| sbnobj::Common_Trigger | ||
| sbnobj::SBND_CRT | ||
| sbnobj::SBND_Timing | ||
| sbndobj_BlipDataTypes |
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 fix the alignment. My suggestion is to copy the line above, to make sure the same indentation characters are use.
| Atom<std::string> fBlipTag { Name("BlipTag"), | ||
| Comment("Provide a string to label the blip input"), "blipreco" | ||
| }; |
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.
Conform to the existing alignment ([CO-02]).
| int NBlips = LarBlips.size(); | ||
| for(int iBlip=0; iBlip<NBlips; iBlip++) | ||
| { | ||
| blip::Blip CurrentBlip = LarBlips[iBlip]; |
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 think this is equivalent to using a range-for loop:
| int NBlips = LarBlips.size(); | |
| for(int iBlip=0; iBlip<NBlips; iBlip++) | |
| { | |
| blip::Blip CurrentBlip = LarBlips[iBlip]; | |
| for(blip::Blip const& CurrentBlip: LarBlips) | |
| { |
This avoids copies (blip::Blip CurrentBlip = LarBlips[iBlip] copies) and the definition of two variables that are not used anywhere else.
I recommend to adopt the suggested syntax.
|
|
||
| void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip &CAF_Blip) | ||
| { | ||
| int NumPlanes = sizeof(LarBlip.clusters)/sizeof(LarBlip.clusters[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.
Since you defined a kNplanes constant, you can use that one directly.
Or, if you have adopted the suggestion of replacing the C array with a std::array, you do have LarBlip.clusters.size(). Both are more readable than the (functionally correct) code in this line.
sbncode/CAFMaker/FillBlip.cxx
Outdated
| //These are sets that need to become vectors so we need to do some loops | ||
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); |
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 use the appropriate std::vector member function, assign():
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| CAF_Blip.clusters[iPlane].HitIDs.assign(begin(LarBlip.clusters[iPlane].HitIDs), end(LarBlip.clusters[iPlane].HitIDs)); |
If this function is changed as recommended above to work on a single cluster, this becomes less wordy and more readable:
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| CAFcluster.HitIDs.assign(begin(LArCluster.HitIDs), end(LArCluster.HitIDs)); |
same for the next three lines; in fact, you could even write a specific function and use it repeatedly:
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| auto copyToVector = [](auto& dest, auto const& src) | |
| { dest.assign(begin(src), end(src)); }; | |
| copyToVector(CAF_Blip.clusters[iPlane].HitIDs, LarBlip.clusters[iPlane].HitIDs); |
etc.
| @@ -0,0 +1,17 @@ | |||
| #ifndef CAF_FILLBLIP_H | |||
| #define CAF_FILLBLIP_H | |||
| #include<iostream> | |||
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.
Unused header:
| #include<iostream> |
| void FillMCTruthBlip(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip ); | ||
| void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip); |
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.
In both these functions one of the operands (the first one, I'd wage) must be declared const.
Also, it seems that the only function needed externally (by CAFMaker module) is the first one; the other two do not need to be publicly visible in the header, and their declaration can be either omitted or moved out of the header into the implementation (.cxx) file.
| @@ -0,0 +1,17 @@ | |||
| #ifndef CAF_FILLBLIP_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.
It would be good to add a standard header with file name, brief description and author identification, like in:
| #ifndef CAF_FILLBLIP_H | |
| /** | |
| * @file sbncode/CAFMaker/FillBlip.h | |
| * @brief CAFMaker utilities for filling "blip" objects into CAF. | |
| * @author Jacob McLaughlin (jmclaughlin2@illinoistech.edu) | |
| / | |
| #ifndef CAF_FILLBLIP_H |
The same holds for the .cxx file and, in fact, all other headers and source files. This is not often done in SBN repositories, and it would be better if it were.

Added CAFMaker interface to add blips to CAF files.
This PR must not be approved until SBNSoftware/sbnobj#155 and SBNSoftware/sbnanaobj#173 are approved/released.
Working on estimating the file size change now.