VMC
Version 2.2
Toggle main menu visibility
Loading...
Searching...
No Matches
source
include
TMCRootManager.h
Go to the documentation of this file.
1
#ifndef ROOT_TMCRootManager
2
#define ROOT_TMCRootManager
3
4
//------------------------------------------------
5
// The Geant4 Virtual Monte Carlo package
6
// Copyright (C) 2013 - 2018 Ivana Hrivnacova
7
// All rights reserved.
8
//
9
// For the licensing terms see geant4_vmc/LICENSE.
10
// Contact: root-vmc@cern.ch
11
//-------------------------------------------------
12
17
18
#include "
TMCtls.h
"
19
#include <Rtypes.h>
20
21
class
TParticle;
22
class
TFile;
23
class
TTree;
24
30
31
class
TMCRootManager
{
32
public
:
34
enum
FileMode
{
35
kRead
,
// Read mode
36
kWrite
// Write mode
37
};
38
39
public
:
40
// static access method
41
static
TMCRootManager
*
Instance
();
42
43
// static method for activating debug mode
44
static
void
SetDebug
(Bool_t debug);
45
static
Bool_t
GetDebug
();
46
47
TMCRootManager
(
const
char
*projectName,
FileMode
fileMode =
kWrite
, Int_t threadRank = -1);
48
virtual
~TMCRootManager
();
49
50
// methods
51
void
Register
(
const
char
*name,
const
char
*className,
void
*objAddress);
52
void
Register
(
const
char
*name,
const
char
*className,
const
void
*objAddress);
53
void
Fill
();
54
void
WriteAll
();
55
void
Close
();
56
void
WriteAndClose
();
57
void
ReadEvent
(Int_t i);
58
59
private
:
60
// not implemented
61
TMCRootManager
(
const
TMCRootManager
&rhs);
62
TMCRootManager
&
operator=
(
const
TMCRootManager
&rhs);
63
64
// global static data members
65
static
Int_t
fgCounter
;
// The counter of instances
66
// static data members
67
static
Bool_t
fgDebug
;
// Option to activate debug printings
68
69
#if !defined(__CINT__)
70
static
TMCThreadLocal
TMCRootManager
*
fgInstance
;
// singleton instance
71
#else
72
static
TMCRootManager
*
fgInstance
;
// singleton instance
73
#endif
74
75
// Methods
76
void
OpenFile
(
const
char
*projectName,
FileMode
fileMode, Int_t threadRank);
77
78
// data members
79
Int_t
fId
;
// This manager ID
80
TFile *
fFile
;
// Root output file
81
TTree *
fTree
;
// Root output tree
82
Bool_t
fIsClosed
;
// Info whether its file was closed
83
};
84
85
// inline functions
86
87
inline
void
TMCRootManager::SetDebug
(Bool_t debug)
88
{
89
fgDebug
= debug;
90
}
91
92
inline
Bool_t
TMCRootManager::GetDebug
()
93
{
94
return
fgDebug
;
95
}
96
97
#endif
// ROOT_TMCRootManager
TMCtls.h
TMCRootManager
The Root IO manager for VMC examples for both sequential and multi-threaded applications.
Definition
TMCRootManager.h:31
TMCRootManager::fId
Int_t fId
Definition
TMCRootManager.h:79
TMCRootManager::fFile
TFile * fFile
Definition
TMCRootManager.h:80
TMCRootManager::WriteAll
void WriteAll()
Definition
TMCRootManager.cxx:218
TMCRootManager::OpenFile
void OpenFile(const char *projectName, FileMode fileMode, Int_t threadRank)
Definition
TMCRootManager.cxx:142
TMCRootManager::TMCRootManager
TMCRootManager(const TMCRootManager &rhs)
TMCRootManager::ReadEvent
void ReadEvent(Int_t i)
Definition
TMCRootManager.cxx:251
TMCRootManager::Fill
void Fill()
Definition
TMCRootManager.cxx:209
TMCRootManager::fgInstance
static TMCThreadLocal TMCRootManager * fgInstance
Definition
TMCRootManager.h:70
TMCRootManager::Close
void Close()
Definition
TMCRootManager.cxx:227
TMCRootManager::FileMode
FileMode
Root file mode.
Definition
TMCRootManager.h:34
TMCRootManager::kWrite
@ kWrite
Definition
TMCRootManager.h:36
TMCRootManager::kRead
@ kRead
Definition
TMCRootManager.h:35
TMCRootManager::operator=
TMCRootManager & operator=(const TMCRootManager &rhs)
TMCRootManager::fgDebug
static Bool_t fgDebug
Definition
TMCRootManager.h:67
TMCRootManager::fIsClosed
Bool_t fIsClosed
Definition
TMCRootManager.h:82
TMCRootManager::WriteAndClose
void WriteAndClose()
Definition
TMCRootManager.cxx:242
TMCRootManager::fTree
TTree * fTree
Definition
TMCRootManager.h:81
TMCRootManager::Register
void Register(const char *name, const char *className, void *objAddress)
Definition
TMCRootManager.cxx:183
TMCRootManager::~TMCRootManager
virtual ~TMCRootManager()
Definition
TMCRootManager.cxx:114
TMCRootManager::fgCounter
static Int_t fgCounter
Definition
TMCRootManager.h:65
TMCRootManager::Instance
static TMCRootManager * Instance()
Definition
TMCRootManager.cxx:63
TMCRootManager::SetDebug
static void SetDebug(Bool_t debug)
Definition
TMCRootManager.h:87
TMCRootManager::TMCRootManager
TMCRootManager(const char *projectName, FileMode fileMode=kWrite, Int_t threadRank=-1)
Definition
TMCRootManager.cxx:75
TMCRootManager::GetDebug
static Bool_t GetDebug()
Definition
TMCRootManager.h:92
Generated on
for VMC by
1.17.0