Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHTFileServer.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHTFileServer.h
1
// Tell emacs that this is a C++ source
2
// -*- C++ -*-.
4
11
12
13
#ifndef FUN4ALL_PHTFILESERVER_H
14
#define FUN4ALL_PHTFILESERVER_H
15
16
#include <TFile.h>
17
18
#include <map>
19
#include <sstream>
20
#include <string>
21
28
class
PHTFileServer
29
{
30
public
:
32
static
PHTFileServer
&
get
(void)
33
{
34
static
PHTFileServer
singleton;
35
return
singleton;
36
}
37
39
virtual
~PHTFileServer
();
40
45
void
open
(
const
std::string
&
filename
,
const
std::string
&
type
=
"RECREATE"
);
46
48
bool
flush
(
const
std::string
&
filename
);
49
51
bool
cd
(
const
std::string
&
filename
);
52
57
bool
write
(
const
std::string
&
filename
);
58
60
void
close
(
void
);
61
62
private
:
64
PHTFileServer
(
void
)
65
{
66
}
67
69
class
SafeTFile
:
public
TFile
70
{
71
public
:
73
SafeTFile
(
const
std::string
&
filename
,
const
std::string
&
type
=
"RECREATE"
)
74
: TFile(filename.c_str(),
type
.c_str())
75
,
_filename
(filename)
76
,
_counter
(1)
77
{
78
}
79
81
~SafeTFile
(
void
)
override
;
82
84
int
&
counter
()
85
{
86
return
_counter
;
87
}
88
90
const
int
&
counter
()
const
91
{
92
return
_counter
;
93
}
94
96
typedef
std::map<std::string, SafeTFile*>
TFileMap
;
97
98
static
TFileMap
&
file_map
(
void
)
99
{
100
return
_map
;
101
}
102
103
private
:
105
std::string
_filename
;
106
108
int
_counter
;
109
111
static
TFileMap
_map
;
112
};
113
};
114
115
#endif
coresoftware
blob
master
offline
framework
fun4all
PHTFileServer.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:04
using
1.8.2 with
sPHENIX GitHub integration