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

Event container that owns per-detector hit data for one event. More...

#include <gEventDataCollection.h>

Public Member Functions

 GEventDataCollection (const std::shared_ptr< GOptions > &gopts, std::unique_ptr< GEventHeader > header)
 Construct an event data collection with an owned header.
 
void addDetectorTrueInfoData (const std::string &sdName, std::unique_ptr< GTrueInfoData > data)
 Append one true-hit entry to the specified detector.
 
void addDetectorDigitizedData (const std::string &sdName, std::unique_ptr< GDigitizedData > data)
 Append one digitized-hit entry to the specified detector.
 
auto getHeader () const -> const std::unique_ptr< GEventHeader > &
 Access the owned event header.
 
auto getDataCollectionMap () const -> const std::map< std::string, std::unique_ptr< GDataCollection > > &
 Access the per-detector map for this event.
 
auto getEventNumber () const -> int
 Convenience accessor for the event number.
 
- 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 >
 Test/example factory: create an event collection with one dummy hit for "ctof".
 

Additional Inherited Members

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

Detailed Description

The container is built around a map from sensitive detector name to GDataCollection. Each detector collection stores per-hit truth and digitized objects.

The header (GEventHeader) stores identifying metadata such as:

  • local event number
  • thread ID label
  • timestamp string
Note
This class intentionally does not enforce invariants such as "truth hits must equal digitized hits". If an application requires such invariants, it should validate them at a higher level.

Definition at line 83 of file gEventDataCollection.h.

Constructor & Destructor Documentation

◆ GEventDataCollection()

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

Ownership:

  • header is moved into this object and is owned exclusively.
Parameters
goptsShared options object used to configure logging and behavior.
headerOwned event header.

Definition at line 96 of file gEventDataCollection.h.

Member Function Documentation

◆ addDetectorDigitizedData()

void GEventDataCollection::addDetectorDigitizedData ( const std::string & sdName,
std::unique_ptr< GDigitizedData > data )
  • If sdName is new, a per-detector GDataCollection is created automatically.
  • Ownership of data is transferred to this event container.
Parameters
sdNameSensitive detector name (map key).
dataDigitized-hit object; ownership is transferred to this collection.

Definition at line 34 of file gEventDataCollection.cc.

◆ addDetectorTrueInfoData()

void GEventDataCollection::addDetectorTrueInfoData ( const std::string & sdName,
std::unique_ptr< GTrueInfoData > data )
  • If sdName is new, a per-detector GDataCollection is created automatically.
  • Ownership of data is transferred to this event container.
Parameters
sdNameSensitive detector name (map key).
dataTrue-hit object; ownership is transferred to this collection.

Definition at line 23 of file gEventDataCollection.cc.

◆ create()

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

This method exists to support examples/tests. It:

This provides a minimal "event contains something" baseline for examples.

Parameters
goptsShared options.
Returns
Shared pointer to the created event data collection.

Definition at line 167 of file gEventDataCollection.h.

◆ getDataCollectionMap()

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

Key: sensitive detector name. Value: per-detector GDataCollection containing per-hit entries.

Returns
Const reference to the detector map.

Definition at line 139 of file gEventDataCollection.h.

◆ getEventNumber()

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

Equivalent to getG4LocalEvn() on the owned header.

Returns
Event number stored in the header.

Definition at line 151 of file gEventDataCollection.h.

◆ getHeader()

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

Definition at line 128 of file gEventDataCollection.h.


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