53 : fFile(0), fTree(0), fIsClosed(false)
61 printf(
"TMCRootManager::TMCRootManager %p \n",
this);
74 Fatal(
"TMCRootManager",
"Attempt to create two instances of singleton.");
81 OpenFile(projectName, fileMode, threadRank);
87 printf(
"Done TMCRootManagerMT::TMCRootManagerMT %p \n",
this);
96 printf(
"TMCRootManager::~TMCRootManager %p \n",
this);
111 printf(
"Done TMCRootManager::~TMCRootManager %p \n",
this);
121 TString fileName(projectName);
122 if (threadRank >= 0) {
124 fileName += threadRank;
128 TString treeTitle(projectName);
129 treeTitle +=
" tree";
133 fFile =
new TFile(fileName);
139 printf(
"Going to create Root file \n");
140 fFile =
new TFile(fileName,
"recreate");
142 printf(
"Done: file %p \n",
fFile);
145 printf(
"Going to create TTree \n");
146 fTree =
new TTree(projectName, treeTitle);
148 printf(
"Done: TTree %p \n",
fTree);
167 if (!
fTree->GetBranch(name))
168 fTree->Branch(name, className, objAddress, 32000, 99);
170 fTree->GetBranch(name)->SetAddress(objAddress);
181 Register(name, className,
const_cast<void *
>(objAddress));
208 Error(
"Close",
"The file was already closed.");
#define TMCMUTEX_INITIALIZER
Definition of the TMCRootManager class.
The Root IO manager for VMC examples for both sequential and multi-threaded applications.
void OpenFile(const char *projectName, FileMode fileMode, Int_t threadRank)
static TMCThreadLocal TMCRootManager * fgInstance
void Register(const char *name, const char *className, void *objAddress)
virtual ~TMCRootManager()
static TMCRootManager * Instance()
TMCRootManager(const char *projectName, FileMode fileMode=kWrite, Int_t threadRank=-1)