Skip to content

Conversation

@Jjm321814
Copy link

Added classes to hold blip information in CAF format.
This results in the normal amount of CAF code duplication and replaces a few std::map and std::set objects in the LArSoft side with vectors.
This PR is independent of the associated ones in sbnobj, sbndcode, and sbncode.

@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: SBNSoftware/sbnobj#155
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.

Comment on lines 9 to 11
<version ClassVersion="17" checksum="1651571235"/>
<version ClassVersion="16" checksum="3738947418"/>
<version ClassVersion="15" checksum="2636549707"/>
Copy link
Member

Choose a reason for hiding this comment

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

Only need to retain the most recent checksum and set it to version 15

Copy link
Author

Choose a reason for hiding this comment

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

Updated to reflect this change

Copy link
Author

Choose a reason for hiding this comment

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

Surprisingly the changes to default values don't seem to impact the checksum?

{
SRBlip::SRBlip()
{
ID = -9; // Blip ID / index
Copy link
Member

Choose a reason for hiding this comment

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

@PetrilloAtWork and @JosiePaton can comment but I believe there are some pre-defined defaults in CAF-land? Plus I believe -5 is often used as long as it is unphysical.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment for other objs

Copy link
Author

Choose a reason for hiding this comment

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

Updated most values to -5. For time of blips/hits -5 is a physical value, so I left it at -999. For the time tick I think index 0 is time 0, but I am not sure so I left that at -999 as well.

Comment on lines 21 to 41
int ID = -9; // Blip ID / index
bool isValid = false; // Blip passes basic checks
int Cryostat = -9; // Cryostat
int TPC = -9; // TPC
int NPlanes = -9; // Num. matched planes
int MaxWireSpan = -9; // Maximum span of wires on any plane cluster
float TimeTick = -999; // Readout time [ticks]
float Time = -999; // Drift time [us]
float Charge = -9; // Charge on calorimetry plane
float Energy = -999; // Energy (const dE/dx, fcl-configurable) [GeV]
float EnergyESTAR = -999; // Energy (ESTAR method from ArgoNeuT) [GeV]
float EnergyPSTAR = -999; // Energy (PSTAR method similar with ESTAR method from ArgoNeuT) [GeV]
float ProxTrkDist = -9; // Distance to cloest track
int ProxTrkID = -9; // ID of closest track
bool inCylinder = false; // Is it in a cone/cylinder region?
SRVector3D Position; // 3D position TVector3
float SigmaYZ = -9.; // Uncertainty in YZ intersect [cm]
float dX = -9; // Equivalent length along drift direction [cm]
float dYZ = -9; // Approximate length scale in YZ space [cm]
SRBlipHitClust clusters[kNplanes]; // Plane/cluster-specific information
SRBlipTrueBlip truthBlip; // Truth-matched energy deposition
Copy link
Member

Choose a reason for hiding this comment

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

Defaults are set in the constructor, can remove them from here.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment to other objs

Copy link
Author

Choose a reason for hiding this comment

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

For blips I removed these from here. The others are just structs so I kept the values in the header file.

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.

I left some comments on how to make the new classes more closely follow CAF standards.

I am left wondering though: this is an analysis format, and it seems to me that the vast majority of the information in these objects is unlikely to be used in an analysis — it feels more like input for reconstruction.

<lcgdict>
<class name="caf::StandardRecord" ClassVersion="15">
<version ClassVersion="15" checksum="1805006132"/>
<version ClassVersion="15" checksum="1651571235"/>
Copy link
Member

Choose a reason for hiding this comment

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

There is a change of checksum, which is Bad.
The recommendation is to restore the old line and then rebuild:

Suggested change
<version ClassVersion="15" checksum="1651571235"/>

At that point, ROOT will add another checksum and bump the version, and that new classes_def.xml file should be committed for this PR.

Comment on lines 1 to 5
////////////////////////////////////////////////////////////////////////
// \file SRBlip.cxx
// \brief SRBlip object for localized energy deposits in bulk LAr
// \author $Author: jmclaughlin2@illinoistech.edu
////////////////////////////////////////////////////////////////////////
Copy link
Member

Choose a reason for hiding this comment

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

Convert this header into Doxygen format.

Suggested change
////////////////////////////////////////////////////////////////////////
// \file SRBlip.cxx
// \brief SRBlip object for localized energy deposits in bulk LAr
// \author $Author: jmclaughlin2@illinoistech.edu
////////////////////////////////////////////////////////////////////////
/**
* @file SRBlip.h
* @brief SRBlip object for localized energy deposits in bulk LAr
* @author jmclaughlin2@illinoistech.edu
*/

(the full name would be also nice to add in the @author line, if you are ok with that)

Comment on lines 26 to 27
int NHits = -5;
int NWires = -5;
Copy link
Member

Choose a reason for hiding this comment

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

If there is a relation between these counts and HitIDs/Wires vector size, write it explicitly.

Copy link
Author

Choose a reason for hiding this comment

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

Added comments through this file. Now the vectors include a detail on their size matching these int

@Jjm321814
Copy link
Author

Okay I think all the comments across each PR is now at least partly addressed, and the code compiles and seems to make sensible output when I run it.

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

classes_def.xml needs to be fixes.
I am recommending the renaming of one of the classes.
I have follow up on a couple of the comments, and added a few more.

Comment on lines +332 to +346
<class name="caf::SRBlip" ClassVersion="11">
<version ClassVersion="11" checksum="2097549339"/>
<version ClassVersion="10" checksum="3364148027"/>
</class>

<class name="caf::SRBlipHitClust" ClassVersion="12">
<version ClassVersion="12" checksum="1544666038"/>
<version ClassVersion="11" checksum="3137900176"/>
<version ClassVersion="10" checksum="1233871129"/>
</class>

<class name="caf::SRBlipTrueBlip" ClassVersion="11">
<version ClassVersion="11" checksum="451846977"/>
<version ClassVersion="10" checksum="984259034"/>
</class>
Copy link
Member

Choose a reason for hiding this comment

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

A single PR should increment a class version only by one unit.
These classes also list intermediate versions.
One way is to remove the checksums and let ROOT Cling do its job again (by building the library twice):

Suggested change
<class name="caf::SRBlip" ClassVersion="11">
<version ClassVersion="11" checksum="2097549339"/>
<version ClassVersion="10" checksum="3364148027"/>
</class>
<class name="caf::SRBlipHitClust" ClassVersion="12">
<version ClassVersion="12" checksum="1544666038"/>
<version ClassVersion="11" checksum="3137900176"/>
<version ClassVersion="10" checksum="1233871129"/>
</class>
<class name="caf::SRBlipTrueBlip" ClassVersion="11">
<version ClassVersion="11" checksum="451846977"/>
<version ClassVersion="10" checksum="984259034"/>
</class>
<class name="caf::SRBlip" ClassVersion="10" />
<class name="caf::SRBlipHitClust" ClassVersion="10" />
<class name="caf::SRBlipTrueBlip" ClassVersion="10" />

An alternative is to fix it by hand by keeping the latest checksum but naming it "version 10":

Suggested change
<class name="caf::SRBlip" ClassVersion="11">
<version ClassVersion="11" checksum="2097549339"/>
<version ClassVersion="10" checksum="3364148027"/>
</class>
<class name="caf::SRBlipHitClust" ClassVersion="12">
<version ClassVersion="12" checksum="1544666038"/>
<version ClassVersion="11" checksum="3137900176"/>
<version ClassVersion="10" checksum="1233871129"/>
</class>
<class name="caf::SRBlipTrueBlip" ClassVersion="11">
<version ClassVersion="11" checksum="451846977"/>
<version ClassVersion="10" checksum="984259034"/>
</class>
<class name="caf::SRBlip" ClassVersion="10">
<version ClassVersion="10" checksum="2097549339"/>
</class>
<class name="caf::SRBlipHitClust" ClassVersion="10">
<version ClassVersion="10" checksum="1544666038"/>
</class>
<class name="caf::SRBlipTrueBlip" ClassVersion="10">
<version ClassVersion="10" checksum="451846977"/>
</class>

It would be good to rebuild after this change too, for added safety.

/*!
please note the blip X position is unreliable, so these distance and 3-d position derived variables may be incorrect
*/
SRVector3D position; ///< 3D position vector. Reconstructed with wrong t0! [cm]
Copy link
Member

Choose a reason for hiding this comment

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

Aggregate initialisation should work here:

Suggested change
SRVector3D position; ///< 3D position vector. Reconstructed with wrong t0! [cm]
SRVector3D position { -999., -999., -999. }; ///< 3D position vector. Reconstructed with wrong t0! [cm]

(if compiler complains about narrowing, you may need to explicitly use float constants, like in -999.0f).
This will allow the removal of the default constructor.
Also, z -999 [cm] is almost within ICARUS detector, and it's not a particularly crazy value. If you don't like the default (NaN), use a more extreme value (e.g. -9999. is well outside SBN-FD).

Comment on lines +16 to +18
class SRBlip
{
public:
Copy link
Member

Choose a reason for hiding this comment

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

Hmm... that means that the scores would be the only private members, and you would need a specific accessor only for that. That makes the data members asymmetric. Alternatively, you'd have to set all data private and provide one accessor per data member, which is tedious.
I would rather suggest that the new scores be a public data member of a new custom type, say, SRBlipScores (side effect is that this one can still be a struct), and that the sorting be handled within the custom type.

/*!
please note the blip X position is unreliable, so these distance and 3-d position derived variables may be incorrect
*/
SRVector3D position; ///< 3D position vector. Reconstructed with wrong t0! [cm]
Copy link
Member

Choose a reason for hiding this comment

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

"wrong t0" is maybe too strong... "assuming the blip was coincident with event trigger", for the slice happening at trigger time that ends up the right time (provided that the blip is not a delayed product of some decay of long-wandering particle).
I can't think of a better way to say that compactly though, so if you want to keep it as is, I am also fine with that.

* That blip reconstruction applies cuts to overall blip size/spread
* A single TrueBlip will be constructed for energy depositions within TrueBlipMergeDist (fcl set 0.3 cm by default)
*/
struct SRBlipTrueBlip {
Copy link
Member

Choose a reason for hiding this comment

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

Something that I missed from the previous run: SRBlipTrueBlip... isn't there too much Blip in it? SRTrueBlip should be descriptive enough and consistent with, e.g., SRTrueParticle.
Please seriously consider renaming this one.

@@ -0,0 +1,20 @@
/**
* @file SRBlip.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 is the wrong file name (Doxygen will go crazy):

Suggested change
* @file SRBlip.h
* @file SRBlip.cxx

(and yes, I did mistype it in my suggestion)

/*!
for properly flash matched out-of-time tracks this distance will be wrong! The blips have no such flash matching ability as of yet
*/
int proxTrkID=caf::kUninitializedInt; ///< index of the of closest track, assuming the blip was concident with event trigger
Copy link
Member

Choose a reason for hiding this comment

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

Typo:

Suggested change
int proxTrkID=caf::kUninitializedInt; ///< index of the of closest track, assuming the blip was concident with event trigger
int proxTrkID=caf::kUninitializedInt; ///< index of the of closest track, assuming the blip was coincident with event trigger

float EnergyESTAR; // Energy (ESTAR method from ArgoNeuT) [GeV]
float EnergyPSTAR; // Energy (PSTAR method similar with ESTAR method from ArgoNeuT) [GeV]
float ProxTrkDist; // Distance to cloest track
int ProxTrkID; // ID of closest track
Copy link
Member

Choose a reason for hiding this comment

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

So maybe just add in parentheses " (recob::Track::ID())" to the documentation?

Comment on lines +56 to +57
std::vector<int> hitIDs; ///< Index of the recob::hit objects making up this cluster. Size should match nHits
std::vector<int> wires; ///< Set of geo::wireIDs contributing hits to this cluster. Size should match nWires
Copy link
Member

Choose a reason for hiding this comment

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

Using the exact name if the classes will help Doxygen cross-link.

Suggested change
std::vector<int> hitIDs; ///< Index of the recob::hit objects making up this cluster. Size should match nHits
std::vector<int> wires; ///< Set of geo::wireIDs contributing hits to this cluster. Size should match nWires
std::vector<int> hitIDs; ///< Index of the `recob::Hit` objects making up this cluster. Size should match `nHits`.
std::vector<int> wires; ///< Set of `geo::WireID` contributing hits to this cluster. Size should match `nWires`.

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