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

Per-sensitive-detector container that owns true and digitized hit data. More...

#include <gDataCollection.h>

Public Member Functions

 GDataCollection ()=default
 Constructs an empty data collection for a single sensitive detector.
 
 ~GDataCollection ()=default
 Destructor for GDataCollection.
 
void collectTrueInfosData (const std::unique_ptr< GTrueInfoData > &data)
 Integrate ("collect") true-hit data into a run-level aggregate entry.
 
void collectDigitizedData (const std::unique_ptr< GDigitizedData > &data)
 Integrate ("collect") digitized data into a run-level aggregate entry.
 
void addDigitizedData (std::unique_ptr< GDigitizedData > data)
 Add one digitized-hit entry (event-level ownership transfer).
 
void addTrueInfoData (std::unique_ptr< GTrueInfoData > data)
 Add one true-hit entry (event-level ownership transfer).
 
auto getTrueInfoData () const -> const std::vector< std::unique_ptr< GTrueInfoData > > &
 Read-only access to stored true-hit data.
 
auto getDigitizedData () const -> const std::vector< std::unique_ptr< GDigitizedData > > &
 Read-only access to stored digitized-hit data.
 

Detailed Description

A GDataCollection is keyed by sensitive detector name in higher-level containers (e.g. in getDataCollectionMap()).

The container stores:

  • trueInfosData : vector of per-hit truth objects (or size 1 in run-integrated usage)
  • digitizedData : vector of per-hit digitized objects (or size 1 in run-integrated usage)

Two usage modes are supported:

  • Event mode: append one entry per hit (ownership transfer).
  • Run mode: repeatedly integrate hits so the first entry becomes an accumulator.
Note
In run mode, the "accumulator" is implemented as the first element of each vector. Consumers should treat vector size > 1 as a sign of event-level content.

Definition at line 61 of file gDataCollection.h.

Constructor & Destructor Documentation

◆ GDataCollection()

GDataCollection::GDataCollection ( )
explicitdefault

The detector name itself is stored at higher layers (e.g. as a key in getDataCollectionMap()).

◆ ~GDataCollection()

GDataCollection::~GDataCollection ( )
default

All stored hit objects are owned via std::unique_ptr and are released automatically.

Member Function Documentation

◆ addDigitizedData()

void GDataCollection::addDigitizedData ( std::unique_ptr< GDigitizedData > data)
inline

Event-level API: each hit corresponds to one GDigitizedData object that is owned by this collection after insertion.

Parameters
dataDigitized-hit object; ownership is moved into this collection.

Definition at line 152 of file gDataCollection.h.

◆ addTrueInfoData()

void GDataCollection::addTrueInfoData ( std::unique_ptr< GTrueInfoData > data)
inline

Event-level API: each hit corresponds to one GTrueInfoData object that is owned by this collection after insertion.

Parameters
dataTrue-hit object; ownership is moved into this collection.

Definition at line 165 of file gDataCollection.h.

◆ collectDigitizedData()

void GDataCollection::collectDigitizedData ( const std::unique_ptr< GDigitizedData > & data)
inline

Intended for run-level accumulation:

  • On the first call, a deep copy of data is stored as the first element.
  • On subsequent calls, integer and double observables are accumulated into the first element via accumulateVariable().

Filtering policy:

  • This method uses which=0 when reading observables maps, i.e. it excludes streaming readout keys (crate/slot/channel/timeAtElectronics/chargeAtElectronics).

Rationale:

  • SRO keys identify per-hit readout coordinates and are not meaningful to sum across hits.
Parameters
dataSource digitized-hit object (not owned; values are copied/accumulated).

Definition at line 127 of file gDataCollection.h.

◆ collectTrueInfosData()

void GDataCollection::collectTrueInfosData ( const std::unique_ptr< GTrueInfoData > & data)
inline

Intended for run-level accumulation where a detector accumulates hit contributions:

  • On the first call, a deep copy of data is stored as the first element.
  • On subsequent calls, each double observable from data is accumulated into the first element via accumulateVariable().

Notes / design choices:

  • Only the double observables are accumulated here.
  • String observables are treated as per-hit metadata and are not merged.
  • This method performs summation; if you need averages, normalize in the consumer.
Parameters
dataSource true-hit object (not owned; values are copied/accumulated).

Definition at line 97 of file gDataCollection.h.

◆ getDigitizedData()

auto GDataCollection::getDigitizedData ( ) const -> const std::vector<std::unique_ptr<GDigitizedData>>&
inline

Interpretation depends on usage:

  • Event-level: vector size == number of hits stored for the detector.
  • Run-level: vector size is typically 1 (the integrated entry).
Returns
Const reference to the owned vector of digitized-hit objects.

Definition at line 193 of file gDataCollection.h.

◆ getTrueInfoData()

auto GDataCollection::getTrueInfoData ( ) const -> const std::vector<std::unique_ptr<GTrueInfoData>>&
inline

Interpretation depends on usage:

  • Event-level: vector size == number of hits stored for the detector.
  • Run-level: vector size is typically 1 (the integrated entry).
Returns
Const reference to the owned vector of true-hit objects.

Definition at line 179 of file gDataCollection.h.


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