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

Stores minimal metadata for one event. More...

#include <gEventHeader.h>

Public Member Functions

 GEventHeader (const std::shared_ptr< GOptions > &gopts, int n, int tid)
 Constructs an event header with explicit event and thread identifiers.
 
std::string getTimeStamp () const
 Returns the formatted timestamp string.
 
int getG4LocalEvn () const
 Returns the local event number.
 
int getThreadID () const
 Returns the thread identifier associated with the event.
 
- Public Member Functions inherited from GBase< GEventHeader >
 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< GEventHeadercreate (const std::shared_ptr< GOptions > &gopts, int tid=-1)
 Creates a header with a unique event number for tests and examples.
 

Additional Inherited Members

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

Detailed Description

The object provides a compact event label and provenance bundle containing:

  • the local event number
  • the thread identifier used for diagnostics
  • a construction-time timestamp string

Ownership:

Definition at line 69 of file gEventHeader.h.

Constructor & Destructor Documentation

◆ GEventHeader()

GEventHeader::GEventHeader ( const std::shared_ptr< GOptions > & gopts,
int n,
int tid )
inline

The constructor also assigns a local-time timestamp string and emits an informational summary through the logger.

Parameters
goptsShared options used to configure logging and related behavior.
nLocal event number.
tidThread identifier associated with the event.

Definition at line 83 of file gEventHeader.h.

Member Function Documentation

◆ create()

static std::unique_ptr< GEventHeader > GEventHeader::create ( const std::shared_ptr< GOptions > & gopts,
int tid = -1 )
inlinestatic

If tid is negative, a synthetic thread identifier is derived from the event number. The generated event number comes from a static atomic counter so concurrent example code can obtain unique values.

Parameters
goptsShared options.
tidOptional thread identifier override.
Returns
Newly created event header.

Definition at line 105 of file gEventHeader.h.

◆ getG4LocalEvn()

int GEventHeader::getG4LocalEvn ( ) const
inline

In typical Geant4-style usage, this value is run-local.

Returns
Local event number.

Definition at line 129 of file gEventHeader.h.

◆ getThreadID()

int GEventHeader::getThreadID ( ) const
inline
Returns
Thread identifier.

Definition at line 136 of file gEventHeader.h.

◆ getTimeStamp()

std::string GEventHeader::getTimeStamp ( ) const
inline
Returns
Timestamp assigned at construction.

Definition at line 119 of file gEventHeader.h.


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