@@ -226,6 +226,37 @@ class GHit : public G4VHit
226226 */
227227 std::vector<double > stepSize;
228228
229+ /* *
230+ * \brief Track 3-momentum per recorded step (unconditional).
231+ *
232+ * Values are derived from the pre-step point momentum via \c G4StepPoint::GetMomentum().
233+ * Stored in Geant4 internal units (MeV).
234+ */
235+ std::vector<G4ThreeVector> momenta;
236+
237+ /* *
238+ * \brief Track total energy per recorded step (unconditional).
239+ *
240+ * Values are derived from \c preStepPoint->GetTotalEnergy() (kinetic + rest mass, in MeV).
241+ */
242+ std::vector<double > trackEs;
243+
244+ /* *
245+ * \brief Mother particle PDG encodings per recorded step (unconditional).
246+ *
247+ * Looked up from the per-thread \c pdgById cache using the parent track ID.
248+ * Stores the uninitialized sentinel when the parent track has not yet been seen.
249+ */
250+ std::vector<int > motherPids;
251+
252+ /* *
253+ * \brief Per-thread cache of track-id to particle PDG encoding.
254+ *
255+ * Populated alongside \c trackVertexById so that mother PDG can be resolved
256+ * when the parent track was already processed by GEMC hit logic.
257+ */
258+ static thread_local std::map<int , int > pdgById;
259+
229260 // -------------------------------------------------------------------------
230261 // Aggregated / calculated quantities (lazy)
231262 // -------------------------------------------------------------------------
@@ -400,28 +431,84 @@ class GHit : public G4VHit
400431 [[nodiscard]] inline int getMotherTid () const { return motherTids.front (); }
401432
402433 /* *
403- * \brief Get per-step total energies (when enabled).
434+ * \brief Get per-step total energies (when enabled by bit 0 ).
404435 * \return A copy of the vector of per-step energies.
405436 */
406437 [[nodiscard]] inline std::vector<double > getEs () const { return Es; }
407438
408439 /* *
409- * \brief Convenience accessor for the first energy value.
440+ * \brief Convenience accessor for the first energy value (requires bit 0) .
410441 * \return The first energy value.
411442 *
412443 * \warning This assumes the internal \c Es vector is non-empty.
413444 */
414445 [[nodiscard]] inline double getE () const { return Es.front (); }
415446
416447 /* *
417- * \brief Number of recorded steps for the optional-energy vector.
448+ * \brief Number of recorded steps for the optional-energy vector (requires bit 0) .
418449 * \return The size of the \c Es vector.
419450 *
420451 * \note Depending on the \c HitBitSet configuration, \c Es may remain empty even if
421452 * always-present vectors have entries.
422453 */
423454 [[nodiscard]] inline size_t nsteps () const { return Es.size (); }
424455
456+ /* *
457+ * \brief True number of recorded steps (always-present edep vector).
458+ * \return The size of the \c edeps vector, which is always populated regardless of HitBitSet.
459+ */
460+ [[nodiscard]] inline size_t getStepCount () const { return edeps.size (); }
461+
462+ /* *
463+ * \brief Get per-step track 3-momenta (always present).
464+ * \return A copy of the vector of per-step momenta.
465+ */
466+ [[nodiscard]] inline std::vector<G4ThreeVector> getMomenta () const { return momenta; }
467+
468+ /* *
469+ * \brief Convenience accessor for the first step 3-momentum.
470+ * \return The first recorded track momentum.
471+ *
472+ * \warning This assumes the internal \c momenta vector is non-empty.
473+ */
474+ [[nodiscard]] inline G4ThreeVector getMomentum () const { return momenta.front (); }
475+
476+ /* *
477+ * \brief Get per-step track total energies (always present).
478+ * \return A copy of the vector of per-step track total energies (MeV).
479+ */
480+ [[nodiscard]] inline std::vector<double > getTrackEs () const { return trackEs; }
481+
482+ /* *
483+ * \brief Convenience accessor for the first step track total energy.
484+ * \return The first recorded track total energy (MeV).
485+ *
486+ * \warning This assumes the internal \c trackEs vector is non-empty.
487+ */
488+ [[nodiscard]] inline double getTrackE () const { return trackEs.front (); }
489+
490+ /* *
491+ * \brief Get per-step mother particle PDG encodings (always present).
492+ * \return A copy of the vector of per-step mother PDG codes.
493+ */
494+ [[nodiscard]] inline std::vector<int > getMotherPids () const { return motherPids; }
495+
496+ /* *
497+ * \brief Convenience accessor for the first step mother particle PDG encoding.
498+ * \return The first recorded mother PDG code (sentinel when parent not yet seen).
499+ *
500+ * \warning This assumes the internal \c motherPids vector is non-empty.
501+ */
502+ [[nodiscard]] inline int getMpid () const { return motherPids.front (); }
503+
504+ /* *
505+ * \brief Get the representative creator process name for this hit.
506+ *
507+ * Alias for \ref getProcessName() following G4 naming conventions.
508+ * \return The cached representative process name.
509+ */
510+ [[nodiscard]] inline std::string getProcID () const { return processName; }
511+
425512 /* *
426513 * \brief Get the representative process name for the hit.
427514 * \return The cached representative process name string.
0 commit comments