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.
 
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:

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 87 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 99 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 170 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 142 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 154 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 132 of file gEventDataCollection.h.


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