From 1009534628e963dd3b9dad290381cb88aefb4f46 Mon Sep 17 00:00:00 2001 From: dariopullia Date: Thu, 7 May 2026 11:15:14 -0500 Subject: [PATCH 1/3] Included extra information for PD --- duneanaobj/StandardRecord/SRInteraction.h | 5 ++- .../StandardRecord/SRInteractionBranch.h | 38 +++++++++++++++++++ duneanaobj/StandardRecord/SRPFP.h | 38 +++++++++++++++++++ duneanaobj/StandardRecord/SRRecoParticle.h | 5 +++ duneanaobj/StandardRecord/SRTrueParticle.h | 5 +++ duneanaobj/StandardRecord/classes_def.xml | 24 +++++++++--- 6 files changed, 109 insertions(+), 6 deletions(-) diff --git a/duneanaobj/StandardRecord/SRInteraction.h b/duneanaobj/StandardRecord/SRInteraction.h index e7b7458..096dcd6 100644 --- a/duneanaobj/StandardRecord/SRInteraction.h +++ b/duneanaobj/StandardRecord/SRInteraction.h @@ -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; + + }; } // caf diff --git a/duneanaobj/StandardRecord/SRInteractionBranch.h b/duneanaobj/StandardRecord/SRInteractionBranch.h index 3bdab85..5d0d78b 100644 --- a/duneanaobj/StandardRecord/SRInteractionBranch.h +++ b/duneanaobj/StandardRecord/SRInteractionBranch.h @@ -12,18 +12,56 @@ namespace caf { + struct BeamInstrumentation + { + BeamInstrumentation(){std::cout << "Default constructor called for BeamInstrumentation" << std::endl;}; + BeamInstrumentation(double p, bool valid, int trigger, std::vector tof, std::vector pdg_candidates, std::vector tof_chan, double x, double y, double z, double dirX, double dirY, double dirZ, int nFibersP1, int nFibersP2, int nFibersP3, int nTracks, int nMomenta, int C0, int C1, double C0_pressure, double C1_pressure) + : beam_inst_P(p), beam_inst_valid(valid), beam_inst_trigger(trigger), beam_inst_TOF(tof), beam_inst_PDG_candidates(pdg_candidates), beam_inst_TOF_Chan(tof_chan), beam_inst_X(x), beam_inst_Y(y), beam_inst_Z(z), beam_inst_dirX(dirX), beam_inst_dirY(dirY), beam_inst_dirZ(dirZ), beam_inst_nFibersP1(nFibersP1), beam_inst_nFibersP2(nFibersP2), beam_inst_nFibersP3(nFibersP3), beam_inst_nTracks(nTracks), beam_inst_nMomenta(nMomenta), beam_inst_C0(C0), beam_inst_C1(C1), beam_inst_C0_pressure(C0_pressure), beam_inst_C1_pressure(C1_pressure) + {std::cout << "Parameterized constructor called for BeamInstrumentation" << std::endl;}; + + double beam_inst_P{-1.0}; + bool beam_inst_valid{false}; + int beam_inst_trigger{-1}; + std::vector beam_inst_TOF{}; + std::vector< int > beam_inst_PDG_candidates{}, beam_inst_TOF_Chan{}; + double beam_inst_X{-1.0}, beam_inst_Y{-1.0}, beam_inst_Z{-1.0}; + double beam_inst_dirX{-1.0}, beam_inst_dirY{-1.0}, beam_inst_dirZ{-1.0}; + int beam_inst_nFibersP1{-1}, beam_inst_nFibersP2{-1}, beam_inst_nFibersP3{-1}; + int beam_inst_nTracks{-1}, beam_inst_nMomenta{-1}; + int beam_inst_C0{-1}, beam_inst_C1{-1}; + double beam_inst_C0_pressure{-1.0}, beam_inst_C1_pressure{-1.0}; + + }; + + class SRInteractionBranch { public: + // prepare object to host beam instrumentation information, to be filled by the user if available + // BeamInstrumentation beamInstrumentation; + std::vector dlp; ///< Interactions from Deep Learn Physics machine learning reconstruction std::size_t ndlp; std::vector 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) std::vector sandreco; ///< Interactions from sadreco reconstruction std::size_t nsandreco; + double beam_inst_P{-1.0}; + bool beam_inst_valid{false}; + int beam_inst_trigger{-1}; + std::vector beam_inst_TOF{}; + std::vector< int > beam_inst_PDG_candidates{}, beam_inst_TOF_Chan{}; + double beam_inst_X{-1.0}, beam_inst_Y{-1.0}, beam_inst_Z{-1.0}; + double beam_inst_dirX{-1.0}, beam_inst_dirY{-1.0}, beam_inst_dirZ{-1.0}; + int beam_inst_nFibersP1{-1}, beam_inst_nFibersP2{-1}, beam_inst_nFibersP3{-1}; + int beam_inst_nTracks{-1}, beam_inst_nMomenta{-1}; + int beam_inst_C0{-1}, beam_inst_C1{-1}; + double beam_inst_C0_pressure{-1.0}, beam_inst_C1_pressure{-1.0}; + }; } diff --git a/duneanaobj/StandardRecord/SRPFP.h b/duneanaobj/StandardRecord/SRPFP.h index af8dfd5..7d0de0c 100644 --- a/duneanaobj/StandardRecord/SRPFP.h +++ b/duneanaobj/StandardRecord/SRPFP.h @@ -13,6 +13,40 @@ namespace caf { + struct SRSTEMScore + { + SRSTEMScore(){}; + SRSTEMScore(float tscore, float sscore, float escore, float mscore, bool weighted, int plane) + : track_score(tscore), shower_score(sscore), empty_score(escore), michel_score(mscore), + charge_weighted(weighted), plane_ID(plane) {}; + + float track_score{0}; + float shower_score{0}; + float empty_score{0}; + float michel_score{0}; + bool charge_weighted{false}; + int plane_ID{-1}; + + public: + SRSTEMScore& operator/=(double scalar) { + track_score /= scalar; + shower_score /= scalar; + empty_score /= scalar; + michel_score /= scalar; + return *this; // Return a reference to the modified object + } + + SRSTEMScore operator/(double scalar) { + track_score /= scalar; + shower_score /= scalar; + empty_score /= scalar; + michel_score /= scalar; + return SRSTEMScore(track_score, shower_score, empty_score, michel_score, charge_weighted, plane_ID); // Return a reference to the modified object + } + }; + + + class SRPFP { public: @@ -50,6 +84,10 @@ namespace caf //Track/Shower BDT score float track_score = NaN; + + // EM/Track/Michel ID Scores -- see https://doi.org/10.1140/epjc/s10052-022-10791-2 + SRSTEMScore cnn_stem_scores; + }; } diff --git a/duneanaobj/StandardRecord/SRRecoParticle.h b/duneanaobj/StandardRecord/SRRecoParticle.h index bf60b88..fb53e0b 100644 --- a/duneanaobj/StandardRecord/SRRecoParticle.h +++ b/duneanaobj/StandardRecord/SRRecoParticle.h @@ -7,6 +7,8 @@ #ifndef DUNEANAOBJ_SRRECOPARTICLE_H #define DUNEANAOBJ_SRRECOPARTICLE_H +#include + #include "duneanaobj/StandardRecord/SREnums.h" #include "duneanaobj/StandardRecord/SRLorentzVector.h" #include "duneanaobj/StandardRecord/SRVector3D.h" @@ -49,6 +51,9 @@ namespace caf std::vector truth; ///< Associated SRTrueParticle(s), if relevant (use SRTruthBranch::Particle() with these IDs to grab them) std::vector truthOverlap; ///< Fractional overlap between this reco particle and true particle + int truthMatchByHits = -1; ///< Index of the best truth match by hits in the SRTruthBranch, or -1 if no match + std::tuple truthMatchByHitsIndex = std::make_tuple(-1, -1, -1); + }; } // caf diff --git a/duneanaobj/StandardRecord/SRTrueParticle.h b/duneanaobj/StandardRecord/SRTrueParticle.h index 3422aa8..a9a6de5 100644 --- a/duneanaobj/StandardRecord/SRTrueParticle.h +++ b/duneanaobj/StandardRecord/SRTrueParticle.h @@ -7,6 +7,7 @@ #define DUNEANAOBJ_SRTRUEPARTICLE_H #include +#include #include "duneanaobj/StandardRecord/SREnums.h" #include "duneanaobj/StandardRecord/SRLorentzVector.h" @@ -27,6 +28,8 @@ 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) + std::tuple thisIndex = std::make_tuple(-1, -1, -1); // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be -1 if not applicable (e.g. for a primary particle, the secondary index will be -1) + 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] @@ -37,7 +40,9 @@ namespace caf SRVector3D end_pos; ///< Particle end position (decay, interaction, stop) [cm] int parent = -1; ///< GEANT4 trackID of parent particle from this particle + std::tuple parentIndex = std::make_tuple(-1, -1, -1); // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be -1 if not applicable (e.g. for a primary particle, the secondary index will be -1) std::vector daughters; ///< GEANT4 trackIDs of daughter particles from this particle + std::vector> daughterIndices; // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be empty if not applicable (e.g. for a primary particle, the secondary index will be empty) /// @name GEANT4 process codes. /// The "process" codes are defined here: https://geant4.kek.jp/Reference/11.1.1/G4ProcessType_8hh_source.html diff --git a/duneanaobj/StandardRecord/classes_def.xml b/duneanaobj/StandardRecord/classes_def.xml index 3b0f7e7..8db679b 100644 --- a/duneanaobj/StandardRecord/classes_def.xml +++ b/duneanaobj/StandardRecord/classes_def.xml @@ -60,12 +60,20 @@ - + + + + + + + + - + + @@ -105,7 +113,9 @@ - + + + @@ -183,7 +193,8 @@ - + + @@ -339,7 +350,10 @@ - + + + + From 26c20777698d2695626b068f57e33a1f8c390917 Mon Sep 17 00:00:00 2001 From: dariopullia Date: Wed, 13 May 2026 04:04:45 -0500 Subject: [PATCH 2/3] remove extra fields --- .../StandardRecord/SRInteractionBranch.h | 13 ------- duneanaobj/StandardRecord/SRPFP.h | 37 ------------------- duneanaobj/StandardRecord/SRRecoParticle.h | 3 +- duneanaobj/StandardRecord/SRTrueParticle.h | 3 -- duneanaobj/StandardRecord/classes_def.xml | 12 ++++-- 5 files changed, 9 insertions(+), 59 deletions(-) diff --git a/duneanaobj/StandardRecord/SRInteractionBranch.h b/duneanaobj/StandardRecord/SRInteractionBranch.h index 5d0d78b..59391a7 100644 --- a/duneanaobj/StandardRecord/SRInteractionBranch.h +++ b/duneanaobj/StandardRecord/SRInteractionBranch.h @@ -49,19 +49,6 @@ namespace caf std::vector sandreco; ///< Interactions from sadreco reconstruction std::size_t nsandreco; - - double beam_inst_P{-1.0}; - bool beam_inst_valid{false}; - int beam_inst_trigger{-1}; - std::vector beam_inst_TOF{}; - std::vector< int > beam_inst_PDG_candidates{}, beam_inst_TOF_Chan{}; - double beam_inst_X{-1.0}, beam_inst_Y{-1.0}, beam_inst_Z{-1.0}; - double beam_inst_dirX{-1.0}, beam_inst_dirY{-1.0}, beam_inst_dirZ{-1.0}; - int beam_inst_nFibersP1{-1}, beam_inst_nFibersP2{-1}, beam_inst_nFibersP3{-1}; - int beam_inst_nTracks{-1}, beam_inst_nMomenta{-1}; - int beam_inst_C0{-1}, beam_inst_C1{-1}; - double beam_inst_C0_pressure{-1.0}, beam_inst_C1_pressure{-1.0}; - }; } diff --git a/duneanaobj/StandardRecord/SRPFP.h b/duneanaobj/StandardRecord/SRPFP.h index 7d0de0c..82c1565 100644 --- a/duneanaobj/StandardRecord/SRPFP.h +++ b/duneanaobj/StandardRecord/SRPFP.h @@ -13,40 +13,6 @@ namespace caf { - struct SRSTEMScore - { - SRSTEMScore(){}; - SRSTEMScore(float tscore, float sscore, float escore, float mscore, bool weighted, int plane) - : track_score(tscore), shower_score(sscore), empty_score(escore), michel_score(mscore), - charge_weighted(weighted), plane_ID(plane) {}; - - float track_score{0}; - float shower_score{0}; - float empty_score{0}; - float michel_score{0}; - bool charge_weighted{false}; - int plane_ID{-1}; - - public: - SRSTEMScore& operator/=(double scalar) { - track_score /= scalar; - shower_score /= scalar; - empty_score /= scalar; - michel_score /= scalar; - return *this; // Return a reference to the modified object - } - - SRSTEMScore operator/(double scalar) { - track_score /= scalar; - shower_score /= scalar; - empty_score /= scalar; - michel_score /= scalar; - return SRSTEMScore(track_score, shower_score, empty_score, michel_score, charge_weighted, plane_ID); // Return a reference to the modified object - } - }; - - - class SRPFP { public: @@ -85,9 +51,6 @@ namespace caf //Track/Shower BDT score float track_score = NaN; - // EM/Track/Michel ID Scores -- see https://doi.org/10.1140/epjc/s10052-022-10791-2 - SRSTEMScore cnn_stem_scores; - }; } diff --git a/duneanaobj/StandardRecord/SRRecoParticle.h b/duneanaobj/StandardRecord/SRRecoParticle.h index fb53e0b..4e8379c 100644 --- a/duneanaobj/StandardRecord/SRRecoParticle.h +++ b/duneanaobj/StandardRecord/SRRecoParticle.h @@ -51,8 +51,7 @@ namespace caf std::vector truth; ///< Associated SRTrueParticle(s), if relevant (use SRTruthBranch::Particle() with these IDs to grab them) std::vector truthOverlap; ///< Fractional overlap between this reco particle and true particle - int truthMatchByHits = -1; ///< Index of the best truth match by hits in the SRTruthBranch, or -1 if no match - std::tuple truthMatchByHitsIndex = std::make_tuple(-1, -1, -1); + int truthMatchIndex = -1; ///< Index of the best truth match by hits in truth and truthOverlap array, defaults to -1 if no match }; diff --git a/duneanaobj/StandardRecord/SRTrueParticle.h b/duneanaobj/StandardRecord/SRTrueParticle.h index a9a6de5..a049eba 100644 --- a/duneanaobj/StandardRecord/SRTrueParticle.h +++ b/duneanaobj/StandardRecord/SRTrueParticle.h @@ -28,7 +28,6 @@ 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) - std::tuple thisIndex = std::make_tuple(-1, -1, -1); // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be -1 if not applicable (e.g. for a primary particle, the secondary index will be -1) 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] @@ -40,9 +39,7 @@ namespace caf SRVector3D end_pos; ///< Particle end position (decay, interaction, stop) [cm] int parent = -1; ///< GEANT4 trackID of parent particle from this particle - std::tuple parentIndex = std::make_tuple(-1, -1, -1); // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be -1 if not applicable (e.g. for a primary particle, the secondary index will be -1) std::vector daughters; ///< GEANT4 trackIDs of daughter particles from this particle - std::vector> daughterIndices; // will have size 3, with the indices for interaction, primary, and secondary arrays respectively. Will be empty if not applicable (e.g. for a primary particle, the secondary index will be empty) /// @name GEANT4 process codes. /// The "process" codes are defined here: https://geant4.kek.jp/Reference/11.1.1/G4ProcessType_8hh_source.html diff --git a/duneanaobj/StandardRecord/classes_def.xml b/duneanaobj/StandardRecord/classes_def.xml index 8db679b..c11d59f 100644 --- a/duneanaobj/StandardRecord/classes_def.xml +++ b/duneanaobj/StandardRecord/classes_def.xml @@ -60,7 +60,8 @@ - + + @@ -113,7 +114,8 @@ - + + @@ -193,7 +195,8 @@ - + + @@ -350,7 +353,8 @@ - + + From 184fd94afd994a6c671f640e3ee96552a95e010f Mon Sep 17 00:00:00 2001 From: dariopullia Date: Wed, 13 May 2026 04:43:34 -0500 Subject: [PATCH 3/3] removed useless information --- .../StandardRecord/SRInteractionBranch.h | 24 ------------------- duneanaobj/StandardRecord/SRRecoParticle.h | 2 -- duneanaobj/StandardRecord/SRTrueParticle.h | 1 - 3 files changed, 27 deletions(-) diff --git a/duneanaobj/StandardRecord/SRInteractionBranch.h b/duneanaobj/StandardRecord/SRInteractionBranch.h index 59391a7..7c0a752 100644 --- a/duneanaobj/StandardRecord/SRInteractionBranch.h +++ b/duneanaobj/StandardRecord/SRInteractionBranch.h @@ -12,33 +12,9 @@ namespace caf { - struct BeamInstrumentation - { - BeamInstrumentation(){std::cout << "Default constructor called for BeamInstrumentation" << std::endl;}; - BeamInstrumentation(double p, bool valid, int trigger, std::vector tof, std::vector pdg_candidates, std::vector tof_chan, double x, double y, double z, double dirX, double dirY, double dirZ, int nFibersP1, int nFibersP2, int nFibersP3, int nTracks, int nMomenta, int C0, int C1, double C0_pressure, double C1_pressure) - : beam_inst_P(p), beam_inst_valid(valid), beam_inst_trigger(trigger), beam_inst_TOF(tof), beam_inst_PDG_candidates(pdg_candidates), beam_inst_TOF_Chan(tof_chan), beam_inst_X(x), beam_inst_Y(y), beam_inst_Z(z), beam_inst_dirX(dirX), beam_inst_dirY(dirY), beam_inst_dirZ(dirZ), beam_inst_nFibersP1(nFibersP1), beam_inst_nFibersP2(nFibersP2), beam_inst_nFibersP3(nFibersP3), beam_inst_nTracks(nTracks), beam_inst_nMomenta(nMomenta), beam_inst_C0(C0), beam_inst_C1(C1), beam_inst_C0_pressure(C0_pressure), beam_inst_C1_pressure(C1_pressure) - {std::cout << "Parameterized constructor called for BeamInstrumentation" << std::endl;}; - - double beam_inst_P{-1.0}; - bool beam_inst_valid{false}; - int beam_inst_trigger{-1}; - std::vector beam_inst_TOF{}; - std::vector< int > beam_inst_PDG_candidates{}, beam_inst_TOF_Chan{}; - double beam_inst_X{-1.0}, beam_inst_Y{-1.0}, beam_inst_Z{-1.0}; - double beam_inst_dirX{-1.0}, beam_inst_dirY{-1.0}, beam_inst_dirZ{-1.0}; - int beam_inst_nFibersP1{-1}, beam_inst_nFibersP2{-1}, beam_inst_nFibersP3{-1}; - int beam_inst_nTracks{-1}, beam_inst_nMomenta{-1}; - int beam_inst_C0{-1}, beam_inst_C1{-1}; - double beam_inst_C0_pressure{-1.0}, beam_inst_C1_pressure{-1.0}; - - }; - - class SRInteractionBranch { public: - // prepare object to host beam instrumentation information, to be filled by the user if available - // BeamInstrumentation beamInstrumentation; std::vector dlp; ///< Interactions from Deep Learn Physics machine learning reconstruction std::size_t ndlp; diff --git a/duneanaobj/StandardRecord/SRRecoParticle.h b/duneanaobj/StandardRecord/SRRecoParticle.h index 4e8379c..b0cec65 100644 --- a/duneanaobj/StandardRecord/SRRecoParticle.h +++ b/duneanaobj/StandardRecord/SRRecoParticle.h @@ -7,8 +7,6 @@ #ifndef DUNEANAOBJ_SRRECOPARTICLE_H #define DUNEANAOBJ_SRRECOPARTICLE_H -#include - #include "duneanaobj/StandardRecord/SREnums.h" #include "duneanaobj/StandardRecord/SRLorentzVector.h" #include "duneanaobj/StandardRecord/SRVector3D.h" diff --git a/duneanaobj/StandardRecord/SRTrueParticle.h b/duneanaobj/StandardRecord/SRTrueParticle.h index a049eba..5654b7b 100644 --- a/duneanaobj/StandardRecord/SRTrueParticle.h +++ b/duneanaobj/StandardRecord/SRTrueParticle.h @@ -7,7 +7,6 @@ #define DUNEANAOBJ_SRTRUEPARTICLE_H #include -#include #include "duneanaobj/StandardRecord/SREnums.h" #include "duneanaobj/StandardRecord/SRLorentzVector.h"