Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
RootIO Class Reference

Root IO implementation for the persistency example. More...

#include <Doxymodules_persistency.h>

Public Member Functions

virtual ~RootIO ()
 
void Write (std::vector< ExP01TrackerHit * > *)
 
void Close ()
 

Static Public Member Functions

static RootIOGetInstance ()
 

Protected Member Functions

 RootIO ()
 

Private Attributes

TFile * fFile
 
int fNevents
 

Detailed Description

Root IO implementation for the persistency example.

Author
Witold POKORSKI
Date
2005-10-27

Definition at line 90 of file Doxymodules_persistency.h.

Constructor & Destructor Documentation

◆ ~RootIO()

RootIO::~RootIO ( )
virtual

Definition at line 62 of file RootIO.cc.

63{}

◆ RootIO()

RootIO::RootIO ( )
protected

Definition at line 49 of file RootIO.cc.

49 :fNevents(0)
50{
51 // initialize ROOT
52 TSystem ts;
53 gSystem->Load("libExP01ClassesDict");
54
55 //gDebug = 1;
56
57 fFile = new TFile("hits.root","RECREATE");
58}
int fNevents
Definition RootIO.hh:63
TFile * fFile
Definition RootIO.hh:62

Member Function Documentation

◆ GetInstance()

RootIO * RootIO::GetInstance ( )
static

Definition at line 67 of file RootIO.cc.

68{
69 if (instance == 0 )
70 {
71 instance = new RootIO();
72 }
73 return instance;
74}
static RootIO * instance
Definition RootIO.cc:45
RootIO()
Definition RootIO.cc:49

◆ Write()

void RootIO::Write ( std::vector< ExP01TrackerHit * > *  hcont)

Definition at line 78 of file RootIO.cc.

79{
80 fNevents++;
81
82 std::ostringstream os;
83 os << fNevents;
84 std::string stevt = "Event_" + os.str();
85 const char* chevt = stevt.c_str();
86
87 G4cout << "writing " << stevt << G4endl;
88
89 fFile->WriteObject(hcont, chevt);
90
91}

◆ Close()

void RootIO::Close ( )

Definition at line 95 of file RootIO.cc.

96{
97 fFile->Close();
98}

Member Data Documentation

◆ fFile

TFile* RootIO::fFile
private

Definition at line 62 of file RootIO.hh.

◆ fNevents

int RootIO::fNevents
private

Definition at line 63 of file RootIO.hh.


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

Applications | User Support | Publications | Collaboration