Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion duneanaobj/StandardRecord/SRInteraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ namespace caf
bool preselected = false; ///< Was this interaction preselected? (Useful for workflows where CAFs are preprocessed / filtered in the process of making concatenated files)

bool contained() const; ///< Convenience function to check if the interaction is contained in the detector by checking the contained flag of all reco particles
};

bool isBeamSlice = false;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See the more general comment above, but I think this should probably become isFromTrigger or something similar. It also needs a very clear explanatory comment. Here's one possibility:

Suggested change
bool isBeamSlice = false;
bool isFromTrigger = true; ///< Did this interaction arise from the physics process that triggered this readout?
///< e.g. for a neutrino beam trigger, this is true for beam-induced neutrino
///< interactions and false for cosmic overlays; for a ProtoDUNE test-beam trigger,
///< true for the beam particle interaction and false for cosmics in the readout window.
///< In the ND with significant pileup, multiple interactions in the same SR may be true.
///< Defaults to true since in most contexts beam-induced interactions are the expected case.


};

} // caf

Expand Down
3 changes: 2 additions & 1 deletion duneanaobj/StandardRecord/SRInteractionBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ namespace caf
class SRInteractionBranch
{
public:

std::vector<SRInteraction> dlp; ///< Interactions from Deep Learn Physics machine learning reconstruction
std::size_t ndlp;

std::vector<SRInteraction> pandora; ///< Interactions from Pandora reconstruction
std::size_t npandora;
int beamPandoraSliceIndex = -1; ///< Index of the slice identified as the beam slice by the reconstruction (if any)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This field is too ProtoDUNE-specific for the SRInteractionBranch (see general comments). I think it should become a free function (not a SRInteractionBranch method, since it should work on any of the SRInteraction collections here) that computes it here (which you can cache at the call site if you'll otherwise need to do it repeatedly):

/// Returns the indices of all interactions in the collection that arose from                                                                       
  /// the physics process that triggered this readout (see SRInteraction::isFromTrigger).                                                           
  inline std::vector<std::size_t> IxnsFromThisTrigger(const std::vector<SRInteraction>& interactions)                                                 
  {                                                                                                                                                   
    std::vector<std::size_t> indices;                                                                                                                 
    for (std::size_t i = 0; i < interactions.size(); ++i)                                                                                             
      if (interactions[i].isFromTrigger)                                                                                                              
        indices.push_back(i);
    return indices;                                                                                                                                   
  }                                                                                                                                                 

Then it could be used like:

  for (std::size_t idx : IxnsFromThisTrigger(sr.common.ixn.pandora))                                                                                  
  {
    const SRInteraction& ixn = sr.common.ixn.pandora[idx];                                                                                            
    // analyse beam-induced interaction                                                                                                               
  }

or

   std::vector<std::size_t> triggerIxns = IxnsFromThisTrigger(sr.common.ixn.pandora);
   if (triggerIxns.size() != 1)  // uh oh, unexpected for ProtoDUNE
      throw ...;
   // do something with triggerIxns[0]


std::vector<SRInteraction> sandreco; ///< Interactions from sadreco reconstruction
std::size_t nsandreco;

};
}

Expand Down
1 change: 1 addition & 0 deletions duneanaobj/StandardRecord/SRPFP.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace caf

//Track/Shower BDT score
float track_score = NaN;

};

}
Expand Down
2 changes: 2 additions & 0 deletions duneanaobj/StandardRecord/SRRecoParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace caf

std::vector<TrueParticleID> truth; ///< Associated SRTrueParticle(s), if relevant (use SRTruthBranch::Particle() with these IDs to grab them)
std::vector<float> truthOverlap; ///< Fractional overlap between this reco particle and true particle
int truthMatchIndex = -1; ///< Index of the best truth match by hits in truth and truthOverlap array, defaults to -1 if no match

Comment on lines +52 to +53
Copy link
Copy Markdown
Collaborator

@chenel chenel May 15, 2026

Choose a reason for hiding this comment

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

I think this needs to be removed (it's redundant), unless you have a good counterargument. You could easily write a helper function analogous to the one above.

};

} // caf
Expand Down
1 change: 1 addition & 0 deletions duneanaobj/StandardRecord/SRTrueParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace caf
public:
int pdg = 0; ///< Particle
int G4ID = -1; ///< ID of the particle (taken from GEANT4 -- -1 if this particle is not propogated by G4)

long int interaction_id = -1; ///< True interaction ID (edep-sim 'vertexID' for ND, or GENIe record number for FD) of the source of this particle
double time = NaN; ///< Generation time at true interaction vertex [ns]

Expand Down
28 changes: 23 additions & 5 deletions duneanaobj/StandardRecord/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,21 @@
<version ClassVersion="10" checksum="2681983110"/>
</class>

<class name="caf::SRInteractionBranch" ClassVersion="11">
<class name="caf::SRInteractionBranch" ClassVersion="19">
<version ClassVersion="19" checksum="995432799"/>
<version ClassVersion="18" checksum="1572816117"/>
<version ClassVersion="17" checksum="2838705083"/>
<version ClassVersion="16" checksum="1999633423"/>
<version ClassVersion="15" checksum="4122733970"/>
<version ClassVersion="14" checksum="1999633423"/>
<version ClassVersion="13" checksum="5494552"/>
<version ClassVersion="12" checksum="995432799"/>
<version ClassVersion="11" checksum="3254538684"/>
<version ClassVersion="10" checksum="1911225621"/>
</class>

<class name="caf::SRInteraction" ClassVersion="12">
<class name="caf::SRInteraction" ClassVersion="13">
<version ClassVersion="13" checksum="319519243"/>
<version ClassVersion="12" checksum="2000195876"/>
<version ClassVersion="11" checksum="1154108588"/>
<version ClassVersion="10" checksum="2468658506"/>
Expand Down Expand Up @@ -105,7 +114,10 @@
<version ClassVersion="10" checksum="684361603"/>
</class>

<class name="caf::SRRecoParticle" ClassVersion="16">
<class name="caf::SRRecoParticle" ClassVersion="19">
<version ClassVersion="19" checksum="2513933526"/>
<version ClassVersion="18" checksum="1754766699"/>
<version ClassVersion="17" checksum="3246791971"/>
<version ClassVersion="16" checksum="4230274279"/>
<version ClassVersion="15" checksum="4130745478"/>
<version ClassVersion="14" checksum="621972464"/>
Expand Down Expand Up @@ -183,7 +195,9 @@
<version ClassVersion="10" checksum="3607270087"/>
</class>

<class name="caf::SRPFP" ClassVersion="10">
<class name="caf::SRPFP" ClassVersion="12">
<version ClassVersion="12" checksum="3744464743"/>
<version ClassVersion="11" checksum="126299658"/>
<version ClassVersion="10" checksum="3744464743"/>
</class>

Expand Down Expand Up @@ -339,7 +353,11 @@
<version ClassVersion="10" checksum="2662412328"/>
</class>

<class name="caf::SRTrueParticle" ClassVersion="16">
<class name="caf::SRTrueParticle" ClassVersion="20">
<version ClassVersion="20" checksum="399263066"/>
<version ClassVersion="19" checksum="3434896655"/>
<version ClassVersion="18" checksum="2703534434"/>
<version ClassVersion="17" checksum="2332556504"/>
<version ClassVersion="16" checksum="399263066"/>
<version ClassVersion="15" checksum="1980366129"/>
<version ClassVersion="14" checksum="1907525372"/>
Expand Down