|
gdata
|
Container for true (simulation-level) observables for one hit. More...
#include <gTrueInfoData.h>
Public Member Functions | |
| GTrueInfoData (const std::shared_ptr< GOptions > &gopts, const GHit *ghit) | |
| Construct true-hit data by copying identity from a hit. | |
| std::string | getIdentityString () const |
| Return a human-readable identity string for debugging and labeling. | |
| void | includeVariable (const std::string &varName, double var) |
| Store/overwrite a numeric "true" observable for this hit. | |
| void | includeVariable (const std::string &varName, std::string var) |
| Store/overwrite a string "true" observable for this hit. | |
| void | accumulateVariable (const std::string &vname, double value) |
| Accumulate a numeric observable into this object (run-level integration). | |
| std::map< std::string, double > | getDoubleVariablesMap () const |
| Get a copy of all numeric truth observables. | |
| std::map< std::string, std::string > | getStringVariablesMap () const |
| Get a copy of all string truth observables. | |
Public Member Functions inherited from GBase< GTrueInfoData > | |
| GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="") | |
| GBase (const std::shared_ptr< GLogger > &logger) | |
| GBase (const GBase &)=default | |
| GBase (GBase &&) noexcept=default | |
| virtual | ~GBase () |
| GBase & | operator= (const GBase &)=default |
| GBase & | operator= (GBase &&) noexcept=default |
Static Public Member Functions | |
| static std::unique_ptr< GTrueInfoData > | create (const std::shared_ptr< GOptions > &gopts) |
| Test/example factory: create a true-hit object with deterministic dummy data. | |
Additional Inherited Members | |
Protected Attributes inherited from GBase< GTrueInfoData > | |
| std::shared_ptr< GLogger > | log |
A GTrueInfoData instance conceptually corresponds to one simulated hit.
The container supports two usage patterns: 1) Event-level storage: create a new instance per hit and populate it using includeVariable(). 2) Run-level integration: keep a single instance as an accumulator and call accumulateVariable() to sum contributions across hits/events.
Definition at line 91 of file gTrueInfoData.h.
GIdentifier list) from ghit.Ownership:
ghit is not owned; it must remain valid only for the duration of the constructor.| gopts | Shared options object used to configure logging and behavior. |
| ghit | Pointer to the hit providing identity information (not owned). |
Definition at line 24 of file gTrueInfoData.cc.
| void GTrueInfoData::accumulateVariable | ( | const std::string & | vname, |
| double | value ) |
Summation semantics:
vname is absent, it is created with value.value is added to the existing entry.This method is typically used when integrating many hits/events into a run-level summary.
| vname | Observable name/key. |
| value | Contribution to add. |
Definition at line 57 of file gTrueInfoData.cc.
|
inlinestatic |
This method exists to support examples and unit tests. It does not represent real physics truth generation. Values are created using a thread-safe counter so that:
The returned object includes a small set of conventional truth keys used in examples:
| gopts | Shared options. |
Definition at line 216 of file gTrueInfoData.h.
|
inline |
Returning by value keeps the internal storage encapsulated and avoids exposing a mutable reference. For very large maps, consider whether a const reference accessor is desirable at higher layers.
Definition at line 184 of file gTrueInfoData.h.
| std::string GTrueInfoData::getIdentityString | ( | ) | const |
Format:
The underlying identity is the gidentity vector copied from the GHit.
Definition at line 75 of file gTrueInfoData.cc.
|
inline |
String observables are typically per-hit categorical/provenance values and are not accumulated by GDataCollection in run mode.
Definition at line 197 of file gTrueInfoData.h.
| void GTrueInfoData::includeVariable | ( | const std::string & | varName, |
| double | var ) |
Overwrite semantics:
varName already exists, the stored value is replaced.Typical numeric truth keys (examples, not enforced):
| varName | Observable name/key. |
| var | Value to store. |
Definition at line 36 of file gTrueInfoData.cc.
| void GTrueInfoData::includeVariable | ( | const std::string & | varName, |
| std::string | var ) |
String observables are typically used for categorical metadata such as:
Semantics:
| varName | Observable name/key. |
| var | String value to store (moved into the map). |
Definition at line 45 of file gTrueInfoData.cc.