ARTEMIS-CRIB
 
Loading...
Searching...
No Matches
art::crib::TTreePeriodicEventStore Class Reference

A processor class that implements periodic event reading from a TTree. More...

#include <TTreePeriodicEventStore.h>

Inheritance diagram for art::crib::TTreePeriodicEventStore:
[legend]
Collaboration diagram for art::crib::TTreePeriodicEventStore:
[legend]

Public Member Functions

 TTreePeriodicEventStore ()
 Constructor.
 
 ~TTreePeriodicEventStore () override
 Destructor.
 
const char * GetRunName () const override
 Returns the run name as a C-style string.
 
Int_t GetRunNumber () const override
 Returns the run number of the current event.
 
std::string GetStrRunName () const
 Returns the run name as a std::string.
 
void Init (TEventCollection *col) override
 Initializes the TTreePeriodicEventStore with the given event collection.
 
void Process () override
 Processes one event from the TTree.
 

Private Member Functions

 ClassDefOverride (TTreePeriodicEventStore, 3)
 ROOT class definition macro.
 

Private Attributes

Long_t fCurrentNum {0}
 The current entry index in the TTree.
 
TEventHeader * fEventHeader {nullptr}
 ! Pointer to the TEventHeader object read from the TTree.
 
Long_t fEventNum {0}
 The current event number within the run.
 
TString fFileName {"temp.root"}
 The name (or pattern) of the input file(s). Default is "temp.root".
 
Long_t fMaxEventNum {0}
 The maximum number of events to process.
 
TTree * fTree {nullptr}
 ! Pointer to the TTree object that holds event data.
 
Long_t fTreeEventNum {0}
 The total number of events in the TTree.
 
TString fTreeName {"tree"}
 The name of the TTree to be processed. Default is "tree".
 

Detailed Description

A processor class that implements periodic event reading from a TTree.

This class inherits from TProcessor and IEventStore to provide a mechanism for initializing, reading, and processing events periodically from a ROOT TTree. The user can configure the input file name, tree name, and number of events to process through various parameters.

Example Steering File

Processor:
- name: MyTTreePeriodicEventStore
type: art::crib::TTreePeriodicEventStore
parameter:
FileName: temp.root # [TString] The name of input file
MaxEventNum: 0 # [Long_t] The maximum event number to be analyzed.
OutputTransparency: 0 # [Bool_t] Output is persistent if false (default)
TreeName: tree # [TString] The name of input tree
Verbose: 1 # [Int_t] verbose level (default 1 : non quiet)

Definition at line 46 of file TTreePeriodicEventStore.h.

Constructor & Destructor Documentation

◆ TTreePeriodicEventStore()

art::crib::TTreePeriodicEventStore::TTreePeriodicEventStore ( )

Constructor.

Definition at line 23 of file TTreePeriodicEventStore.cc.

◆ ~TTreePeriodicEventStore()

art::crib::TTreePeriodicEventStore::~TTreePeriodicEventStore ( )
override

Destructor.

Definition at line 28 of file TTreePeriodicEventStore.cc.

Member Function Documentation

◆ ClassDefOverride()

art::crib::TTreePeriodicEventStore::ClassDefOverride ( TTreePeriodicEventStore ,
3  )
private

ROOT class definition macro.

◆ GetRunName()

const char * art::crib::TTreePeriodicEventStore::GetRunName ( ) const
override

Returns the run name as a C-style string.

Returns
A const char pointer to the run name, or an empty string if unavailable.

Definition at line 268 of file TTreePeriodicEventStore.cc.

◆ GetRunNumber()

Int_t art::crib::TTreePeriodicEventStore::GetRunNumber ( ) const
override

Returns the run number of the current event.

Returns
The run number if available, otherwise 0.

Definition at line 264 of file TTreePeriodicEventStore.cc.

◆ GetStrRunName()

std::string art::crib::TTreePeriodicEventStore::GetStrRunName ( ) const

Returns the run name as a std::string.

Returns
The run name, or an empty string if unavailable.

Definition at line 272 of file TTreePeriodicEventStore.cc.

◆ Init()

void art::crib::TTreePeriodicEventStore::Init ( TEventCollection * col)
override

Initializes the TTreePeriodicEventStore with the given event collection.

Parameters
colPointer to a TEventCollection that holds shared objects and conditions among processors.

Init method: 1) Retrieve fCondition from TEventCollection 2) Get file list from shell command 3) Build TChain if necessary 4) Set branch addresses (primitive or class objects) 5) Load the first entry and get total entry counts

Definition at line 41 of file TTreePeriodicEventStore.cc.

◆ Process()

void art::crib::TTreePeriodicEventStore::Process ( )
override

Processes one event from the TTree.

Process method: called for each event

  • Load entry from fTree
  • Increment counters
  • Wrap around if needed
  • Stop if reaching fMaxEventNum

Definition at line 248 of file TTreePeriodicEventStore.cc.

Member Data Documentation

◆ fCurrentNum

Long_t art::crib::TTreePeriodicEventStore::fCurrentNum {0}
private

The current entry index in the TTree.

Definition at line 97 of file TTreePeriodicEventStore.h.

◆ fEventHeader

TEventHeader* art::crib::TTreePeriodicEventStore::fEventHeader {nullptr}
private

! Pointer to the TEventHeader object read from the TTree.

Definition at line 99 of file TTreePeriodicEventStore.h.

◆ fEventNum

Long_t art::crib::TTreePeriodicEventStore::fEventNum {0}
private

The current event number within the run.

Definition at line 94 of file TTreePeriodicEventStore.h.

◆ fFileName

TString art::crib::TTreePeriodicEventStore::fFileName {"temp.root"}
private

The name (or pattern) of the input file(s). Default is "temp.root".

Definition at line 91 of file TTreePeriodicEventStore.h.

◆ fMaxEventNum

Long_t art::crib::TTreePeriodicEventStore::fMaxEventNum {0}
private

The maximum number of events to process.

Definition at line 95 of file TTreePeriodicEventStore.h.

◆ fTree

TTree* art::crib::TTreePeriodicEventStore::fTree {nullptr}
private

! Pointer to the TTree object that holds event data.

Definition at line 93 of file TTreePeriodicEventStore.h.

◆ fTreeEventNum

Long_t art::crib::TTreePeriodicEventStore::fTreeEventNum {0}
private

The total number of events in the TTree.

Definition at line 96 of file TTreePeriodicEventStore.h.

◆ fTreeName

TString art::crib::TTreePeriodicEventStore::fTreeName {"tree"}
private

The name of the TTree to be processed. Default is "tree".

Definition at line 92 of file TTreePeriodicEventStore.h.


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