From efdd668318368fc803166c7ef5fe219f06812811 Mon Sep 17 00:00:00 2001 From: mt82 Date: Tue, 23 Dec 2025 13:33:09 +0000 Subject: [PATCH 1/2] added initialization --- sbnobj/Common/CRT/CRTHit.hh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sbnobj/Common/CRT/CRTHit.hh b/sbnobj/Common/CRT/CRTHit.hh index 21499ab19..a56677743 100644 --- a/sbnobj/Common/CRT/CRTHit.hh +++ b/sbnobj/Common/CRT/CRTHit.hh @@ -22,29 +22,29 @@ namespace sbn::crt { struct CRTHit{ - std::vector feb_id; ///< FEB address - std::map< uint8_t, std::vector > > pesmap; ///< Saves signal hit information (FEB, local-channel and PE) . - float peshit; ///< Total photo-electron (PE) in a crt hit. + std::vector feb_id{}; ///< FEB address + std::map< uint8_t, std::vector > > pesmap{}; ///< Saves signal hit information (FEB, local-channel and PE) . + float peshit{0.f}; ///< Total photo-electron (PE) in a crt hit. - uint64_t ts0_s; ///< Second-only part of timestamp T0. - double ts0_s_corr; ///< [Honestly, not sure at this point, it was there since long time (BB)] - double ts0_ns; ///< Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch. - double ts0_ns_corr; ///< [Honestly, not sure at this point, it was there since long time (BB)] + uint64_t ts0_s{0}; ///< Second-only part of timestamp T0. + double ts0_s_corr{0.0}; ///< [Honestly, not sure at this point, it was there since long time (BB)] + double ts0_ns{0.0}; ///< Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch. + double ts0_ns_corr{0.0}; ///< [Honestly, not sure at this point, it was there since long time (BB)] - double ts1_ns; ///< Timestamp T1 ([signal time w.r.t. Trigger time]), + double ts1_ns{0.0}; ///< Timestamp T1 ([signal time w.r.t. Trigger time]), - int plane; ///< Name of the CRT wall (in the form of numbers). + int plane{0}; ///< Name of the CRT wall (in the form of numbers). - float x_pos; ///< position in x-direction (cm). - float x_err; ///< position uncertainty in x-direction (cm). - float y_pos; ///< position in y-direction (cm). - float y_err; ///< position uncertainty in y-direction (cm). - float z_pos; ///< position in z-direction (cm). - float z_err; ///< position uncertainty in z-direction (cm). + float x_pos{0.f}; ///< position in x-direction (cm). + float x_err{0.f}; ///< position uncertainty in x-direction (cm). + float y_pos{0.f}; ///< position in y-direction (cm). + float y_err{0.f}; ///< position uncertainty in y-direction (cm). + float z_pos{0.f}; ///< position in z-direction (cm). + float z_err{0.f}; ///< position uncertainty in z-direction (cm). - std::string tagger; ///< Name of the CRT wall (in the form of strings). + std::string tagger{}; ///< Name of the CRT wall (in the form of strings). - CRTHit() {} + CRTHit() = default; int64_t ts0() const { return static_cast(ts0_s) * 1'000'000'000LL + static_cast(ts0_ns); } // T1 is a relative time not a timestamp, so we don't need second-part. From 5522f6320700b2a870f63bf454a5deff749aec97 Mon Sep 17 00:00:00 2001 From: mt82 Date: Fri, 9 Jan 2026 09:09:58 +0000 Subject: [PATCH 2/2] removing explicit call to constructor; modified initialization values: plain -1 for integer-like variables and std::numeric_limits<>::lowest() for the others --- sbnobj/Common/CRT/CRTHit.hh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/sbnobj/Common/CRT/CRTHit.hh b/sbnobj/Common/CRT/CRTHit.hh index a56677743..bb606e59e 100644 --- a/sbnobj/Common/CRT/CRTHit.hh +++ b/sbnobj/Common/CRT/CRTHit.hh @@ -22,29 +22,30 @@ namespace sbn::crt { struct CRTHit{ - std::vector feb_id{}; ///< FEB address - std::map< uint8_t, std::vector > > pesmap{}; ///< Saves signal hit information (FEB, local-channel and PE) . - float peshit{0.f}; ///< Total photo-electron (PE) in a crt hit. + static constexpr float kInvalidF = std::numeric_limits::lowest(); + static constexpr double kInvalidD = std::numeric_limits::lowest(); - uint64_t ts0_s{0}; ///< Second-only part of timestamp T0. - double ts0_s_corr{0.0}; ///< [Honestly, not sure at this point, it was there since long time (BB)] - double ts0_ns{0.0}; ///< Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch. - double ts0_ns_corr{0.0}; ///< [Honestly, not sure at this point, it was there since long time (BB)] + std::vector feb_id; ///< FEB address + std::map< uint8_t, std::vector > > pesmap; ///< Saves signal hit information (FEB, local-channel and PE) . + float peshit{kInvalidF}; ///< Total photo-electron (PE) in a crt hit. - double ts1_ns{0.0}; ///< Timestamp T1 ([signal time w.r.t. Trigger time]), + uint64_t ts0_s{-1}; ///< Second-only part of timestamp T0. + double ts0_s_corr{kInvalidD}; ///< [Honestly, not sure at this point, it was there since long time (BB)] + double ts0_ns{kInvalidD}; ///< Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch. + double ts0_ns_corr{kInvalidD}; ///< [Honestly, not sure at this point, it was there since long time (BB)] - int plane{0}; ///< Name of the CRT wall (in the form of numbers). + double ts1_ns{kInvalidD}; ///< Timestamp T1 ([signal time w.r.t. Trigger time]), - float x_pos{0.f}; ///< position in x-direction (cm). - float x_err{0.f}; ///< position uncertainty in x-direction (cm). - float y_pos{0.f}; ///< position in y-direction (cm). - float y_err{0.f}; ///< position uncertainty in y-direction (cm). - float z_pos{0.f}; ///< position in z-direction (cm). - float z_err{0.f}; ///< position uncertainty in z-direction (cm). + int plane{-1}; ///< Name of the CRT wall (in the form of numbers). - std::string tagger{}; ///< Name of the CRT wall (in the form of strings). + float x_pos{kInvalidF}; ///< position in x-direction (cm). + float x_err{kInvalidF}; ///< position uncertainty in x-direction (cm). + float y_pos{kInvalidF}; ///< position in y-direction (cm). + float y_err{kInvalidF}; ///< position uncertainty in y-direction (cm). + float z_pos{kInvalidF}; ///< position in z-direction (cm). + float z_err{kInvalidF}; ///< position uncertainty in z-direction (cm). - CRTHit() = default; + std::string tagger; ///< Name of the CRT wall (in the form of strings). int64_t ts0() const { return static_cast(ts0_s) * 1'000'000'000LL + static_cast(ts0_ns); } // T1 is a relative time not a timestamp, so we don't need second-part.