|
gdata
|
Container for digitized (electronics-level) observables for one hit. More...
#include <gDigitizedData.h>
Public Member Functions | |
| GDigitizedData (const std::shared_ptr< GOptions > &gopts, const GHit *ghit) | |
| Construct digitized data by copying identity from a hit. | |
| std::string | getIdentityString () const |
| Return a human-readable identity string for debugging and labeling. | |
| std::map< std::string, int > | getIntObservablesMap (int which) const |
| Return a filtered copy of the integer observables map. | |
| std::map< std::string, double > | getDblObservablesMap (int which) const |
| Return a filtered copy of the double observables map. | |
| int | getTimeAtElectronics () |
Convenience accessor for TIMEATELECTRONICS. | |
| int | getIntObservable (const std::string &varName) |
| Retrieve one integer observable by name. | |
| double | getDblObservable (const std::string &varName) |
| Retrieve one double observable by name. | |
| std::map< std::string, std::vector< int > > | getArrayIntObservablesMap () const |
| Get the array-valued integer observables map. | |
| std::map< std::string, std::vector< double > > | getArrayDblObservablesMap () const |
| Get the array-valued double observables map. | |
Per-hit insertion API | |
Store/overwrite observables for a single hit. These methods are typically called by digitization logic that computes observables for the current hit and wants to attach them to the output record. Overwrite semantics:
| |
| void | includeVariable (const std::string &vname, int value) |
| Store/overwrite an integer observable for this hit (event-level). | |
| void | includeVariable (const std::string &vname, double value) |
| Store/overwrite a double observable for this hit (event-level). | |
Run-level integration API | |
Accumulate observables across hits/events (summation). These are used when a single GDigitizedData is serving as an accumulator.
| |
| void | accumulateVariable (const std::string &vname, int value) |
| Accumulate an integer observable (run-level integration). | |
| void | accumulateVariable (const std::string &vname, double value) |
| Accumulate a double observable (run-level integration). | |
Public Member Functions inherited from GBase< GDigitizedData > | |
| 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< GDigitizedData > | create (const std::shared_ptr< GOptions > &gopts) |
| Test/example factory: create a digitized hit with deterministic dummy data. | |
Additional Inherited Members | |
Protected Attributes inherited from GBase< GDigitizedData > | |
| std::shared_ptr< GLogger > | log |
A GDigitizedData instance corresponds to one hit after digitization. It is designed to be schema-flexible (map-based storage) while still allowing:
Common usage patterns: 1) Event-level: create a new instance per hit; fill using includeVariable(). 2) Run-level: keep a single instance as an accumulator; integrate contributions with accumulateVariable().
Definition at line 85 of file gDigitizedData.h.
The constructor copies the hit identity (GIdentifier vector) from ghit. The identity can be rendered as a human-readable string via getIdentityString().
Ownership:
ghit is not owned and only needs to be valid during construction.| gopts | Shared options object used to configure logging and behavior. |
| ghit | Pointer to the hit providing identity information (not owned). |
Definition at line 29 of file gDigitizedData.cc.
| void GDigitizedData::accumulateVariable | ( | const std::string & | vname, |
| double | value ) |
Definition at line 110 of file gDigitizedData.cc.
| void GDigitizedData::accumulateVariable | ( | const std::string & | vname, |
| int | value ) |
Definition at line 98 of file gDigitizedData.cc.
|
inlinestatic |
This method exists to support examples and unit tests. It does not represent real detector digitization; instead it generates predictable values using a thread-safe counter.
The returned object includes:
| gopts | Shared options. |
Definition at line 258 of file gDigitizedData.h.
|
inline |
No filtering is applied to array-valued maps; their interpretation is producer-defined.
Definition at line 239 of file gDigitizedData.h.
|
inline |
Array observables are optional and may represent:
Definition at line 227 of file gDigitizedData.h.
| double GDigitizedData::getDblObservable | ( | const std::string & | varName | ) |
If the key is missing, an error is emitted via GLogger using ERR_VARIABLENOTFOUND.
| varName | Observable name/key. |
Definition at line 138 of file gDigitizedData.cc.
| std::map< std::string, double > GDigitizedData::getDblObservablesMap | ( | int | which | ) | const |
Uses the same filtering semantics as getIntObservablesMap().
| which | Filter mode (0 = non-SRO, 1 = SRO only). |
Definition at line 53 of file gDigitizedData.cc.
| std::string GDigitizedData::getIdentityString | ( | ) | const |
Format:
Definition at line 147 of file gDigitizedData.cc.
| int GDigitizedData::getIntObservable | ( | const std::string & | varName | ) |
If the key is missing, an error is emitted via GLogger using ERR_VARIABLENOTFOUND. Return behavior after logging depends on the logger configuration (fatal vs non-fatal).
| varName | Observable name/key. |
Definition at line 129 of file gDigitizedData.cc.
| std::map< std::string, int > GDigitizedData::getIntObservablesMap | ( | int | which | ) | const |
Filtering is based on whether a key is considered "streaming readout" (SRO):
which = 0: returns non-SRO variables (digitization outputs / physics-like quantities)which = 1: returns only SRO variables (crate/slot/channel/timeAtElectronics/chargeAtElectronics)| which | Filter mode (0 = non-SRO, 1 = SRO only). |
Definition at line 40 of file gDigitizedData.cc.
| int GDigitizedData::getTimeAtElectronics | ( | ) |
If the key is not present, returns TIMEATELECTRONICSNOTDEFINED (a sentinel). This avoids quietly inserting defaults and makes missing-data bugs easier to detect.
TIMEATELECTRONICSNOTDEFINED. Definition at line 122 of file gDigitizedData.cc.
| void GDigitizedData::includeVariable | ( | const std::string & | vname, |
| double | value ) |
Definition at line 92 of file gDigitizedData.cc.
| void GDigitizedData::includeVariable | ( | const std::string & | vname, |
| int | value ) |
Definition at line 86 of file gDigitizedData.cc.