gdata
Loading...
Searching...
No Matches
GDigitizedData Class Reference

Stores digitized, electronics-level observables for one hit. More...

#include <gDigitizedData.h>

Public Member Functions

 GDigitizedData (const std::shared_ptr< GOptions > &gopts, const GHit *ghit)
 Constructs the object and copies the hit identity from the source hit.
 
std::string getIdentityString () const
 Builds a readable identity string from the stored hit identifiers.
 
void includeVariable (const std::string &vname, int value)
 Stores or overwrites one integer observable for this hit.
 
void includeVariable (const std::string &vname, double value)
 Stores or overwrites one floating-point observable for this hit.
 
void accumulateVariable (const std::string &vname, int value)
 Accumulates one integer observable into the current object.
 
void accumulateVariable (const std::string &vname, double value)
 Accumulates one floating-point observable into the current object.
 
std::map< std::string, int > getIntObservablesMap (int which) const
 Returns a filtered copy of the integer observables map.
 
std::map< std::string, double > getDblObservablesMap (int which) const
 Returns a filtered copy of the floating-point observables map.
 
int getTimeAtElectronics ()
 Returns the conventional timeAtElectronics integer observable when present.
 
int getIntObservable (const std::string &varName)
 Returns one integer observable by key.
 
double getDblObservable (const std::string &varName)
 Returns one floating-point observable by key.
 
std::map< std::string, std::vector< int > > getArrayIntObservablesMap () const
 Returns a copy of the array-valued integer observables.
 
std::map< std::string, std::vector< double > > getArrayDblObservablesMap () const
 Returns a copy of the array-valued floating-point observables.
 
- 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 ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Static Public Member Functions

static std::unique_ptr< GDigitizedDatacreate (const std::shared_ptr< GOptions > &gopts)
 Creates deterministic example data for tests and examples.
 

Friends

std::ostream & operator<< (std::ostream &os, const GDigitizedData &data)
 

Additional Inherited Members

- Protected Attributes inherited from GBase< GDigitizedData >
std::shared_ptr< GLoggerlog
 

Detailed Description

A GDigitizedData instance models one hit after detector-response and digitization processing. It is typically attached to:

Main responsibilities:

  • hold integer and floating scalar observables
  • optionally hold array-valued observables
  • provide filtered access that separates streaming-readout keys from physics-like content

Typical usage:

Note
Accumulation is summation only. No averaging or normalization is performed by this class.

Definition at line 115 of file gDigitizedData.h.

Constructor & Destructor Documentation

◆ GDigitizedData()

GDigitizedData::GDigitizedData ( const std::shared_ptr< GOptions > & gopts,
const GHit * ghit )

The constructor initializes the base logging domain and copies the vector of GIdentifier entries from the provided hit so that this object becomes self-contained.

Ownership and lifetime:

  • ghit is not owned
  • ghit only needs to remain valid during construction
  • after construction, this object no longer depends on the source hit
Parameters
goptsShared options used to configure logging and related behavior.
ghitSource hit providing the identity vector.

Definition at line 25 of file gDigitizedData.cc.

Member Function Documentation

◆ accumulateVariable() [1/2]

void GDigitizedData::accumulateVariable ( const std::string & vname,
double value )

This method supports run-level or integrated accumulation.

Behavior:

  • if the key does not exist, it is created with value
  • if the key already exists, value is added to the stored entry
Parameters
vnameObservable key.
valueContribution to add to the running sum.

Definition at line 93 of file gDigitizedData.cc.

◆ accumulateVariable() [2/2]

void GDigitizedData::accumulateVariable ( const std::string & vname,
int value )

This method supports run-level or integrated accumulation.

Behavior:

  • if the key does not exist, it is created with value
  • if the key already exists, value is added to the stored entry
Parameters
vnameObservable key.
valueContribution to add to the running sum.

Definition at line 81 of file gDigitizedData.cc.

◆ create()

static std::unique_ptr< GDigitizedData > GDigitizedData::create ( const std::shared_ptr< GOptions > & gopts)
inlinestatic

This helper is intended only for demonstrations and tests. It does not model real detector digitization.

The returned object contains:

  • the conventional SRO keys crate, slot, channel, and timeAtElectronics
  • one non-SRO floating observable, adc

Uniqueness across calls is derived from a static atomic counter.

Parameters
goptsShared options.
Returns
Newly created example object.

Definition at line 308 of file gDigitizedData.h.

◆ getArrayDblObservablesMap()

std::map< std::string, std::vector< double > > GDigitizedData::getArrayDblObservablesMap ( ) const
inline

No SRO filtering is applied to array-valued content. Interpretation remains detector- or producer-specific.

Returns
Copy of the floating-point-array observables map.

Definition at line 288 of file gDigitizedData.h.

◆ getArrayIntObservablesMap()

std::map< std::string, std::vector< int > > GDigitizedData::getArrayIntObservablesMap ( ) const
inline

These arrays are producer-defined and may represent multi-sample or structured readout content.

Returns
Copy of the integer-array observables map.

Definition at line 275 of file gDigitizedData.h.

◆ getDblObservable()

double GDigitizedData::getDblObservable ( const std::string & varName)

If the key is missing, an error is reported with the stable error code ERR_VARIABLENOTFOUND.

Parameters
varNameObservable key.
Returns
Stored floating-point value.

Definition at line 121 of file gDigitizedData.cc.

◆ getDblObservablesMap()

std::map< std::string, double > GDigitizedData::getDblObservablesMap ( int which) const

The which argument uses the same semantics as getIntObservablesMap().

Parameters
whichFilter selector.
Returns
Filtered copy of the floating-point observables.

Definition at line 41 of file gDigitizedData.cc.

◆ getIdentityString()

std::string GDigitizedData::getIdentityString ( ) const

The generated format is:

name1->value1, name2->value2, ...
Returns
Identity string assembled from the stored gidentity vector.

Definition at line 130 of file gDigitizedData.cc.

◆ getIntObservable()

int GDigitizedData::getIntObservable ( const std::string & varName)

If the key is missing, an error is reported with the stable error code ERR_VARIABLENOTFOUND.

Parameters
varNameObservable key.
Returns
Stored integer value.

Definition at line 112 of file gDigitizedData.cc.

◆ getIntObservablesMap()

std::map< std::string, int > GDigitizedData::getIntObservablesMap ( int which) const

The which argument selects the filtering mode:

  • 0 : return non-SRO variables only
  • 1 : return SRO variables only

SRO variables are the conventional readout keys defined in gdataConventions.h.

Parameters
whichFilter selector.
Returns
Filtered copy of the integer observables.

Definition at line 31 of file gDigitizedData.cc.

◆ getTimeAtElectronics()

int GDigitizedData::getTimeAtElectronics ( )

If the key is absent, the method returns the sentinel value TIMEATELECTRONICSNOTDEFINED.

This method provides a compact accessor for a commonly used SRO quantity without forcing callers to inspect the observables map directly.

Returns
Stored timeAtElectronics value, or TIMEATELECTRONICSNOTDEFINED if missing.

Definition at line 105 of file gDigitizedData.cc.

◆ includeVariable() [1/2]

void GDigitizedData::includeVariable ( const std::string & vname,
double value )

This method is usually used during event-level filling. Repeated insertion with the same key replaces the previous value.

Parameters
vnameObservable key.
valueFloating-point value to store.

Definition at line 75 of file gDigitizedData.cc.

◆ includeVariable() [2/2]

void GDigitizedData::includeVariable ( const std::string & vname,
int value )

This method is usually used during event-level filling. Repeated insertion with the same key replaces the previous value.

Parameters
vnameObservable key.
valueInteger value to store.

Definition at line 69 of file gDigitizedData.cc.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const GDigitizedData & data )
friend

Definition at line 140 of file gDigitizedData.cc.


The documentation for this class was generated from the following files: