Skip to content

Conversation

@Jjm321814
Copy link

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.

@Jjm321814 Jjm321814 self-assigned this Nov 13, 2025
@Jjm321814
Copy link
Author

Adding a comment to each of these to track all 4 related PR.
sbncode: #603
sbndcode: SBNSoftware/sbndcode#871
sbnobj: SBNSoftware/sbnobj#155
sbnanaobj: SBNSoftware/sbnanaobj#173

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.

@Jjm321814
Copy link
Author

Pushed all the fcl changes needed to run CAF on data and MC.
Have only tested on data. We see a 19% increase in the size of a standard CAF data file (3.7 MB to 4.4 MB) because of blips
image

Copy link

@JosiePaton JosiePaton left a 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!

int fGenieEvtRec_brStdHepLd [250] = {0}; ////< Last daughter
int fGenieEvtRec_brStdHepFm [250] = {0}; ////< First mother
int fGenieEvtRec_brStdHepLm [250] = {0}; ////< Last mother
//std::string fBlipTag;
Copy link
Member

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?

"cvn"
};
Atom<std::string> fBlipTag { Name("BlipTag"),
Comment("Provide a string to label the blip input"), "reco2:Blip:BlipReco"
Copy link
Member

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?

Copy link
Author

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

Comment on lines 66 to 72
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;
Copy link
Member

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"
Copy link
Member

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.

@Jjm321814
Copy link
Author

Just noting on this PR as well that the above Henry comments should all be addressed.

Copy link
Member

@PetrilloAtWork PetrilloAtWork left a 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.

Comment on lines 97 to 98
//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);
Copy link
Member

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():

Suggested change
//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:

Suggested change
//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:

Suggested change
//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.

Comment on lines 13 to 14
void FillMCTruthBlip(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip );
void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip);
Copy link
Member

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.

@kjplows kjplows moved this from Open pull requests to Partially reviewed in SBN software development Dec 14, 2025
@kjplows
Copy link
Contributor

kjplows commented Dec 14, 2025

Hi @PetrilloAtWork , it looks like Jacob has implemented all the changes requested. How does the PR look now? Thanks!

Copy link
Member

@PetrilloAtWork PetrilloAtWork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your changes.

@Jjm321814
Copy link
Author

Let me make one more push for changes to sbnanaobj

@Jjm321814
Copy link
Author

Okay that compiles. We may have to edit how the ID get recorded for CAF. Please hold off on this PR until then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Partially reviewed

Development

Successfully merging this pull request may close these issues.

6 participants