gstreamer
Loading...
Searching...
No Matches
GRootTree Class Reference

Adapter that owns a ROOT TTree and provides a type-safe fill interface for gstreamer data. More...

#include <gRootTree.h>

Public Member Functions

 ~GRootTree ()
 Destructor prints a debug trace when a logger is present.
 
 GRootTree (const std::unique_ptr< GEventHeader > &gevent_header, std::shared_ptr< GLogger > &log)
 Construct a header tree and register header branches.
 
 GRootTree (const std::string &detectorName, const GTrueInfoData *gdata, std::shared_ptr< GLogger > &log)
 Construct a true info tree and register branches from the provided hit.
 
 GRootTree (const std::string &detectorName, const GDigitizedData *gdata, std::shared_ptr< GLogger > &log)
 Construct a digitized tree and register branches from the provided hit.
 
bool fillTree (const std::unique_ptr< GEventHeader > &gevent_header)
 Fill the header tree for one event.
 
bool fillTree (const std::vector< const GTrueInfoData * > &trueInfoData)
 Fill the true info tree for one event and one detector.
 
bool fillTree (const std::vector< const GDigitizedData * > &digitizedData)
 Fill the digitized tree for one event and one detector.
 

Detailed Description

This class encapsulates:

  • creation of a TTree with a specific schema (header, true info, or digitized)
  • branch registration based on variable maps encountered in the first data sample
  • per-fill clearing and repopulation of branch vectors, then a call to Fill()

Data model:

  • Each branch is a std::vector<T> where T is int, double, or std::string.
  • For hit banks, each vector stores one entry per hit; the vector index corresponds to hit index.

Notes:

  • This class is used internally by the ROOT plugin and is typically stored in a map keyed by tree name.
  • Logging uses the module logger passed at construction time.

Definition at line 47 of file gRootTree.h.

Constructor & Destructor Documentation

◆ ~GRootTree()

GRootTree::~GRootTree ( )
inline

Definition at line 51 of file gRootTree.h.

◆ GRootTree() [1/3]

GRootTree::GRootTree ( const std::unique_ptr< GEventHeader > & gevent_header,
std::shared_ptr< GLogger > & log )

Branches registered:

  • g4localEventNumber
  • threadID
  • timeStamp
Parameters
gevent_headerEvent header providing initial values and schema.
logLogger used for diagnostics.

Definition at line 8 of file gRootTree.cc.

◆ GRootTree() [2/3]

GRootTree::GRootTree ( const std::string & detectorName,
const GTrueInfoData * gdata,
std::shared_ptr< GLogger > & log )

The schema is determined from the variable maps exposed by gdata:

  • double variables become std::vector<double> branches
  • string variables become std::vector<std::string> branches
Parameters
detectorNameTree name (already includes the true info prefix).
gdataSample true info hit used to determine the schema.
logLogger used for diagnostics.

Definition at line 26 of file gRootTree.cc.

◆ GRootTree() [3/3]

GRootTree::GRootTree ( const std::string & detectorName,
const GDigitizedData * gdata,
std::shared_ptr< GLogger > & log )

The schema is determined from the observable maps exposed by gdata:

  • int observables become std::vector<int> branches
  • double observables become std::vector<double> branches
Parameters
detectorNameTree name (already includes the digitized prefix).
gdataSample digitized hit used to determine the schema.
logLogger used for diagnostics.

Definition at line 44 of file gRootTree.cc.

Member Function Documentation

◆ fillTree() [1/3]

bool GRootTree::fillTree ( const std::unique_ptr< GEventHeader > & gevent_header)

This clears previous header vectors, pushes the current values, then calls Fill().

Parameters
gevent_headerEvent header providing values for this entry.
Returns
true on success.

Definition at line 61 of file gRootTree.cc.

◆ fillTree() [2/3]

bool GRootTree::fillTree ( const std::vector< const GDigitizedData * > & digitizedData)

For each hit:

  • appends int observables to the corresponding int branch vectors
  • appends double observables to the corresponding double branch vectors
Parameters
digitizedDataVector of raw pointers to digitized hits.
Returns
true on success.

Definition at line 100 of file gRootTree.cc.

◆ fillTree() [3/3]

bool GRootTree::fillTree ( const std::vector< const GTrueInfoData * > & trueInfoData)

For each hit:

  • appends double variables to the corresponding double branch vectors
  • appends string variables to the corresponding string branch vectors
Parameters
trueInfoDataVector of raw pointers to true info hits.
Returns
true on success.

Definition at line 80 of file gRootTree.cc.


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