Skip to content

Conversation

@Jjm321814
Copy link

This is part of a large array of PR to add blip objects to CAF files.
Previously the key blip structs were defined in sbndcode and this PR simply moves them to sbnobj.

@Jjm321814 Jjm321814 self-assigned this Nov 10, 2025
@Jjm321814 Jjm321814 requested a review from sungbinoh November 10, 2025 15:09
@Jjm321814
Copy link
Author

An associated branch in sbndcode (also feature/AddingBlipToCAF) has the updated libraries linking necessary to point here. Once this one is in a release we can delete the file copies in sbndcode

@kjplows
Copy link
Contributor

kjplows commented Nov 12, 2025

Hi @Jjm321814 , is there a required PR in sbndcode to accompany this? If yes, please point me to that PR. Thanks!

@kjplows
Copy link
Contributor

kjplows commented Nov 12, 2025

Also summoning @PetrilloAtWork to take a look if there's time, not sure if ICARUS has something similar to this?

@Jjm321814
Copy link
Author

The related sbndcode changes are in SBNSoftware/sbndcode#871 but they depend on this PR, not the other way around.
This one just moves some struct definitions out of sbndcode and into sbnobj so that it can be imported into sbncode for CAFMaker.

@Jjm321814
Copy link
Author

Adding a comment to each of these to track all 4 related PR.
sbncode: SBNSoftware/sbncode#603
sbndcode: SBNSoftware/sbndcode#871
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

Accidentally ran with the wrong blip tag and still produced a CAF file in sbndcode area, so I expect it will work with ICARUS but I can not test it.

@Jjm321814
Copy link
Author

Nope nothing is broken, just had a sbndcode area setup with an earlier LArSoft release that was causing me issues. I'll get back to the comments here

float dYZ = -9; // Approximate length scale in YZ space [cm]

// Plane/cluster-specific information
blip::HitClust clusters[kNplanes];
Copy link
Member

Choose a reason for hiding this comment

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

Consider:

Suggested change
blip::HitClust clusters[kNplanes];
std::array<blip::HitClust, kNplanes> clusters;

That object provides a size() member that is useful in user code.

Copy link
Author

Choose a reason for hiding this comment

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

Updated

@@ -0,0 +1,11 @@
cet_make_library( LIBRARY_NAME sbndobj_BlipDataTypes
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cet_make_library( LIBRARY_NAME sbndobj_BlipDataTypes
cet_make_library(

Library names are very hard to guess. A verbose but effective strategy is to leave it the default, which makes it easily predictable. And the most used convention guarantees at least the first element to be the repository the library belongs to ("sbndobj"?). I request it does not start with sbndobj, which is misleading, and strongly recommend to leave this library name the default:

  • in CMakeLists.txt link lists, people will have to write the annoyingly long sbnobj::SBND_Blip (could actually be worse);
  • when you #include "sbnobj/SBND/Blip/BlipDataTypes.h", you know that the library you need to add follows the path of the header (other example:
    #include "lardataobj/RecoBase/Hit.h"
    #include "nusimdata/SimulationBase/MCParticle.h"
    links to lardataobj::RecoBase and nusimdata::SimulationBase. Presto.)

Copy link
Author

Choose a reason for hiding this comment

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

Updated the library name here and in relevant include locations.

#ifndef BLIPDATATYPE
#define BLIPDATATYPE
#include "lardataobj/RecoBase/Hit.h"
#include "nusimdata/SimulationBase/MCParticle.h"
Copy link
Member

Choose a reason for hiding this comment

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

If TVector3 is going to stay, #include "TVector3.h".
Much better if a much better data type is chosen though.

Copy link
Author

Choose a reason for hiding this comment

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

TVector3 was removed from here. It only remains as a temporary variable in some steps of sbndcode processing

template class art::Assns<blip::Blip,recob::Hit,void>;
template class art::Wrapper<art::Assns<blip::Blip,recob::Hit,void> >;
template class art::Assns<blip::Blip,recob::SpacePoint,void>;
template class art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint,void> >;
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to bother specifying the void association metadata explicitly — it's a bit distracting, so I suggest the removal. Also, when you instantiate an art::Wrapper<T>, you also implicitly trigger the instantiation of T, so the others are redundant. This works because this is C++; classes_def.xml still needs all of them, unfortunately. Finally, the "partner association" instantiation is also not needed.

Suggested change
template class art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint,void> >;
template class art::Wrapper<std::vector<blip::Blip> >;
template class art::Wrapper<art::Assns<blip::Blip,recob::Hit> >;
template class art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint> >;

I think the map instantiation is also not needed — I am not sure where it comes from, so I might be wrong.

Copy link
Author

Choose a reason for hiding this comment

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

Removed voids and the map. Seems to build still

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.

In addition to the previous comments, I have added some on files I had missed.

Comment on lines 2 to 15
<class name="art::Wrapper<std::vector<blip::Blip> >"/>
<class name="blip::Blip"/>
<class name="std::vector<blip::Blip>"/>
<class name="blip::HitClust"/>
<class name="vector<blip::HitClust>"/>
<class name="art::Wrapper<std::vector<blip::HitClust> >"/>
<class name="blip::TrueBlip"/>
<class name="std::map<int,TVector3>"/>
<class name="art::Assns<blip::Blip,recob::Hit,void>"/>
<class name="art::Assns<recob::Hit, blip::Blip,void>"/>
<class name="art::Assns<blip::Blip,recob::SpacePoint,void>"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::Hit,void> >"/>
<class name="art::Wrapper<art::Assns<recob::Hit,blip::Blip,void> >"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint,void> >"/>
Copy link
Member

Choose a reason for hiding this comment

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

Some of these need to have ROOT I/O schema evolution enabled, that means that ROOT creates enough stuff so that old data can be read with newer code.
To do that, a class version needs to be added to the simple object (not std::vector, art::Assns etc.) and then the build needs to be run again. In that way, ROOT will extract and save the checksum of the current version of the class, and will do that again in the future each time the class changes.
This change is required.

Suggested change
<class name="art::Wrapper<std::vector<blip::Blip> >"/>
<class name="blip::Blip"/>
<class name="std::vector<blip::Blip>"/>
<class name="blip::HitClust"/>
<class name="vector<blip::HitClust>"/>
<class name="art::Wrapper<std::vector<blip::HitClust> >"/>
<class name="blip::TrueBlip"/>
<class name="std::map<int,TVector3>"/>
<class name="art::Assns<blip::Blip,recob::Hit,void>"/>
<class name="art::Assns<recob::Hit, blip::Blip,void>"/>
<class name="art::Assns<blip::Blip,recob::SpacePoint,void>"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::Hit,void> >"/>
<class name="art::Wrapper<art::Assns<recob::Hit,blip::Blip,void> >"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint,void> >"/>
<class name="art::Wrapper<std::vector<blip::Blip> >"/>
<class name="blip::Blip" ClassVersion="10" />
<class name="std::vector<blip::Blip>"/>
<class name="blip::HitClust" ClassVersion="10" />
<class name="vector<blip::HitClust>"/>
<class name="art::Wrapper<std::vector<blip::HitClust> >"/>
<class name="blip::TrueBlip" ClassVersion="10" />
<class name="std::map<int,TVector3>"/>
<class name="art::Assns<blip::Blip,recob::Hit,void>"/>
<class name="art::Assns<recob::Hit, blip::Blip,void>"/>
<class name="art::Assns<blip::Blip,recob::SpacePoint,void>"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::Hit,void> >"/>
<class name="art::Wrapper<art::Assns<recob::Hit,blip::Blip,void> >"/>
<class name="art::Wrapper<art::Assns<blip::Blip,recob::SpacePoint,void> >"/>

Again, where is std::map<int,TVector3> needed?
Also, I don't know if the order matters here. In case, put the simplest objects first.

Copy link
Author

Choose a reason for hiding this comment

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

The map is used to record intersection points of induction/collection plane wires for interplane matching. IntersectLocations in the HitClust struct. I am updating it to geo::point_t in accordance with the other suggestions

Copy link
Author

Choose a reason for hiding this comment

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

Updated with class version labels, and removed std::map. Its not saved to the event so its not needed here.

lardataobj::RecoBase
nusimdata::SimulationBase
)
art_dictionary(DICTIONARY_LIBRARIES sbndobj_BlipDataTypes)
Copy link
Member

Choose a reason for hiding this comment

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

(update this with the fixed library name)

Copy link
Author

Choose a reason for hiding this comment

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

Updated here and in other repo


// data-products
// lardataobj
//#include "lardata/Utilities/AssociationUtil.h"
Copy link
Member

Choose a reason for hiding this comment

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

This one is spurious here:

Suggested change
//#include "lardata/Utilities/AssociationUtil.h"

Copy link
Author

Choose a reason for hiding this comment

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

Removed this

// lardataobj
//#include "lardata/Utilities/AssociationUtil.h"
#include "canvas/Persistency/Common/Assns.h"
#include "lardataobj/RecoBase/PFParticle.h"
Copy link
Member

Choose a reason for hiding this comment

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

Unused:

Suggested change
#include "lardataobj/RecoBase/PFParticle.h"

Copy link
Author

Choose a reason for hiding this comment

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

Removed

#include "canvas/Persistency/Common/Assns.h"
#include "lardataobj/RecoBase/PFParticle.h"
#include "lardataobj/RecoBase/Hit.h"
#include "nusimdata/SimulationBase/MCTruth.h"
Copy link
Member

Choose a reason for hiding this comment

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

Also not needed:

Suggested change
#include "nusimdata/SimulationBase/MCTruth.h"

Copy link
Author

Choose a reason for hiding this comment

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

Removed

@Jjm321814
Copy link
Author

All the suggestions here have been committed. Every struct has doxygen comments, TVector3 has been generally replaced, and the few housekeeping comments have been accepted.
A later fix can remove TVector3 from blip processing steps too. May I ask what is the issue with TVector3?

@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!

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