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

Owns all detector-local data for one event. More...

#include <gEventDataCollection.h>

Public Member Functions

 GEventDataCollection (const std::shared_ptr< GOptions > &gopts, std::unique_ptr< GEventHeader > header)
 Constructs an event data collection with an owned header.
 
void addDetectorTrueInfoData (const std::string &sdName, std::unique_ptr< GTrueInfoData > data)
 Appends one truth object to the specified detector entry.
 
void addDetectorDigitizedData (const std::string &sdName, std::unique_ptr< GDigitizedData > data)
 Appends one digitized object to the specified detector entry.
 
auto getHeader () const -> const std::unique_ptr< GEventHeader > &
 Returns read-only access to the owned event header.
 
auto getDataCollectionMap () const -> const std::map< std::string, std::unique_ptr< GDataCollection > > &
 Returns read-only access to the detector map for this event.
 
void setGeneratedParticles (GGeneratedParticleBank particles)
 Stores the full generated-particle bank for this event.
 
void setGeneratedTrackedParticles (GGeneratedParticleBank particles)
 Stores the Geant4-tracked generated-particle bank for this event.
 
const GGeneratedParticleBankgetGeneratedParticles () const
 Returns the full generated-particle bank.
 
const GGeneratedParticleBankgetGeneratedTrackedParticles () const
 Returns the Geant4-tracked generated-particle bank.
 
auto getEventNumber () const -> int
 Returns the event number stored in the owned header.
 
- Public Member Functions inherited from GBase< GEventDataCollection >
 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 auto create (const std::shared_ptr< GOptions > &gopts) -> std::shared_ptr< GEventDataCollection >
 Creates a minimal example event containing one detector entry and one hit pair.
 

Additional Inherited Members

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

Detailed Description

The object combines:

  • one owned GEventHeader describing the event
  • one map of detector names to GDataCollection instances
  • optional generated-particle banks used by event streamers

Each detector entry can contain:

  • zero or more truth objects
  • zero or more digitized objects

The class does not enforce structural invariants such as matching truth and digitized counts. Applications that require such guarantees should validate them at a higher level.

Definition at line 145 of file gEventDataCollection.h.

Constructor & Destructor Documentation

◆ GEventDataCollection()

GEventDataCollection::GEventDataCollection ( const std::shared_ptr< GOptions > & gopts,
std::unique_ptr< GEventHeader > header )
inline

Ownership of header is transferred to the collection.

Parameters
goptsShared options used to configure logging and related behavior.
headerOwned event header.

Definition at line 157 of file gEventDataCollection.h.

Member Function Documentation

◆ addDetectorDigitizedData()

void GEventDataCollection::addDetectorDigitizedData ( const std::string & sdName,
std::unique_ptr< GDigitizedData > data )

If the detector key does not exist yet, a new GDataCollection is created automatically. Ownership of data is transferred to the target detector entry.

Parameters
sdNameSensitive detector name used as the map key.
dataDigitized object to store.

Definition at line 30 of file gEventDataCollection.cc.

◆ addDetectorTrueInfoData()

void GEventDataCollection::addDetectorTrueInfoData ( const std::string & sdName,
std::unique_ptr< GTrueInfoData > data )

If the detector key does not exist yet, a new GDataCollection is created automatically. Ownership of data is transferred to the target detector entry.

Parameters
sdNameSensitive detector name used as the map key.
dataTruth object to store.

Definition at line 19 of file gEventDataCollection.cc.

◆ create()

static auto GEventDataCollection::create ( const std::shared_ptr< GOptions > & gopts) -> std::shared_ptr<GEventDataCollection>
inlinestatic

This helper is intended for examples and tests. It creates:

  • a fresh GEventHeader
  • a new event container
  • one digitized object under detector ctof
  • one truth object under detector ctof
Parameters
goptsShared options.
Returns
Shared pointer to the created event collection.

Definition at line 268 of file gEventDataCollection.h.

◆ getDataCollectionMap()

auto GEventDataCollection::getDataCollectionMap ( ) const -> const std::map<std::string, std::unique_ptr<GDataCollection>>&
inline

Keys are sensitive detector names and values are per-detector GDataCollection instances.

Returns
Const reference to the detector map.

Definition at line 200 of file gEventDataCollection.h.

◆ getEventNumber()

auto GEventDataCollection::getEventNumber ( ) const -> int
inline

This is a convenience wrapper around the header accessor.

Returns
Event number.

Definition at line 252 of file gEventDataCollection.h.

◆ getGeneratedParticles()

const GGeneratedParticleBank & GEventDataCollection::getGeneratedParticles ( ) const
inline
Returns
Rows published as the generated output bank.

Definition at line 235 of file gEventDataCollection.h.

◆ getGeneratedTrackedParticles()

const GGeneratedParticleBank & GEventDataCollection::getGeneratedTrackedParticles ( ) const
inline
Returns
Rows published as the generated_tracked output bank.

Definition at line 242 of file gEventDataCollection.h.

◆ getHeader()

auto GEventDataCollection::getHeader ( ) const -> const std::unique_ptr<GEventHeader>&
inline
Returns
Const reference to the owned event-header pointer.

Definition at line 190 of file gEventDataCollection.h.

◆ setGeneratedParticles()

void GEventDataCollection::setGeneratedParticles ( GGeneratedParticleBank particles)
inline

The bank named generated contains inline -gparticle definitions plus all parsed -gparticlefile rows, including file particles that are not propagated in Geant4.

Parameters
particlesGenerated-particle rows to store.

Definition at line 213 of file gEventDataCollection.h.

◆ setGeneratedTrackedParticles()

void GEventDataCollection::setGeneratedTrackedParticles ( GGeneratedParticleBank particles)
inline

The bank named generated_tracked contains inline -gparticle definitions plus only the file particles propagated in Geant4, normally those with source type == 1.

Parameters
particlesGenerated-particle rows to store.

Definition at line 226 of file gEventDataCollection.h.


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