VMC Version 2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TMCRootManager Class Reference

The Root IO manager for VMC examples for both sequential and multi-threaded applications. More...

#include <TMCRootManager.h>

Public Types

enum  FileMode { kRead , kWrite }
 Root file mode. More...
 

Public Member Functions

 TMCRootManager (const char *projectName, FileMode fileMode=kWrite, Int_t threadRank=-1)
 
virtual ~TMCRootManager ()
 
void Register (const char *name, const char *className, void *objAddress)
 
void Register (const char *name, const char *className, const void *objAddress)
 
void Fill ()
 
void WriteAll ()
 
void Close ()
 
void WriteAndClose ()
 
void ReadEvent (Int_t i)
 

Static Public Member Functions

static TMCRootManagerInstance ()
 
static void SetDebug (Bool_t debug)
 
static Bool_t GetDebug ()
 

Private Member Functions

 TMCRootManager (const TMCRootManager &rhs)
 
TMCRootManageroperator= (const TMCRootManager &rhs)
 
void OpenFile (const char *projectName, FileMode fileMode, Int_t threadRank)
 

Private Attributes

Int_t fId
 
TFile * fFile
 
TTree * fTree
 
Bool_t fIsClosed
 

Static Private Attributes

static Int_t fgCounter = 0
 
static Bool_t fgDebug = false
 
static TMCThreadLocal TMCRootManagerfgInstance = 0
 

Detailed Description

The Root IO manager for VMC examples for both sequential and multi-threaded applications.

It facilitates use of ROOT IO in VMC examples and also handles necessary locking in multi-threaded applications.

Definition at line 31 of file TMCRootManager.h.

Member Enumeration Documentation

◆ FileMode

Root file mode.

Enumerator
kRead 
kWrite 

Definition at line 34 of file TMCRootManager.h.

Constructor & Destructor Documentation

◆ TMCRootManager() [1/2]

TMCRootManager::TMCRootManager ( const char *  projectName,
TMCRootManager::FileMode  fileMode = kWrite,
Int_t  threadRank = -1 
)

Standard constructor

Parameters
projectNameThe project name (passed as the Root tree name)
fileModeOption for opening Root file (read or write mode)
threadRankThe thread Id (-1 when sequential mode)

Definition at line 52 of file TMCRootManager.cxx.

◆ ~TMCRootManager()

TMCRootManager::~TMCRootManager ( )
virtual

Destructor

Definition at line 91 of file TMCRootManager.cxx.

◆ TMCRootManager() [2/2]

TMCRootManager::TMCRootManager ( const TMCRootManager rhs)
private

Member Function Documentation

◆ Instance()

TMCRootManager * TMCRootManager::Instance ( )
static
Returns
The singleton instance.

Definition at line 40 of file TMCRootManager.cxx.

◆ SetDebug()

void TMCRootManager::SetDebug ( Bool_t  debug)
inlinestatic

Definition at line 87 of file TMCRootManager.h.

◆ GetDebug()

Bool_t TMCRootManager::GetDebug ( )
inlinestatic

Definition at line 92 of file TMCRootManager.h.

◆ Register() [1/2]

void TMCRootManager::Register ( const char *  name,
const char *  className,
void *  objAddress 
)

Create a branch and associates it with the given address.

Parameters
nameThe branch name
classNameThe class name of the object
objAddressThe object address

Definition at line 159 of file TMCRootManager.cxx.

Referenced by Register().

◆ Register() [2/2]

void TMCRootManager::Register ( const char *  name,
const char *  className,
const void *  objAddress 
)

Create a branch and associates it with the given address.

Parameters
nameThe branch name
classNameThe class name of the object
objAddressThe object address

Definition at line 174 of file TMCRootManager.cxx.

◆ Fill()

void TMCRootManager::Fill ( )

Fill the Root tree.

Definition at line 185 of file TMCRootManager.cxx.

◆ WriteAll()

void TMCRootManager::WriteAll ( )

Write the Root tree in the file.

Definition at line 194 of file TMCRootManager.cxx.

Referenced by WriteAndClose().

◆ Close()

void TMCRootManager::Close ( )

Close the Root file.

Definition at line 203 of file TMCRootManager.cxx.

Referenced by WriteAndClose().

◆ WriteAndClose()

void TMCRootManager::WriteAndClose ( )

Write the Root tree in the file and close the file

Definition at line 218 of file TMCRootManager.cxx.

◆ ReadEvent()

void TMCRootManager::ReadEvent ( Int_t  i)

Read the event data for i -th event for all connected branches.

Parameters
iThe event to be read

Definition at line 227 of file TMCRootManager.cxx.

◆ operator=()

TMCRootManager & TMCRootManager::operator= ( const TMCRootManager rhs)
private

◆ OpenFile()

void TMCRootManager::OpenFile ( const char *  projectName,
FileMode  fileMode,
Int_t  threadRank 
)
private

Definition at line 119 of file TMCRootManager.cxx.

Referenced by TMCRootManager().

Member Data Documentation

◆ fgCounter

Int_t TMCRootManager::fgCounter = 0
staticprivate

Definition at line 65 of file TMCRootManager.h.

Referenced by TMCRootManager(), and ~TMCRootManager().

◆ fgDebug

Bool_t TMCRootManager::fgDebug = false
staticprivate

Definition at line 67 of file TMCRootManager.h.

Referenced by GetDebug(), OpenFile(), SetDebug(), TMCRootManager(), and ~TMCRootManager().

◆ fgInstance

TMCThreadLocal TMCRootManager * TMCRootManager::fgInstance = 0
staticprivate

Definition at line 70 of file TMCRootManager.h.

Referenced by Instance(), and TMCRootManager().

◆ fId

Int_t TMCRootManager::fId
private

Definition at line 79 of file TMCRootManager.h.

Referenced by TMCRootManager().

◆ fFile

TFile* TMCRootManager::fFile
private

Definition at line 80 of file TMCRootManager.h.

Referenced by Close(), Fill(), OpenFile(), Register(), WriteAll(), and ~TMCRootManager().

◆ fTree

TTree* TMCRootManager::fTree
private

Definition at line 81 of file TMCRootManager.h.

Referenced by Fill(), OpenFile(), ReadEvent(), and Register().

◆ fIsClosed

Bool_t TMCRootManager::fIsClosed
private

Definition at line 82 of file TMCRootManager.h.

Referenced by Close(), and ~TMCRootManager().


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