Geant4
10.03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4HCIOcatalog.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// File: G4HCIOcatalog.cc
27
//
28
// History:
29
// '01.09.12 Youhei Morita Initial creation
30
31
#include "
G4HCIOcatalog.hh
"
32
33
// Addtional Include:
34
#include "
G4VHCIOentry.hh
"
35
36
G4ThreadLocal
G4HCIOcatalog
*
G4HCIOcatalog::f_thePointer
= 0;
37
38
// Implementation of Constructor #1
39
G4HCIOcatalog::G4HCIOcatalog
()
40
: m_verbose(0)
41
{}
42
43
// Implementation of GetHCIOcatalog
44
G4HCIOcatalog
*
G4HCIOcatalog::GetHCIOcatalog
()
45
{
46
if
(
f_thePointer
== 0 )
f_thePointer
=
new
G4HCIOcatalog
;
47
return
f_thePointer
;
48
}
49
50
// Implementation of RegisterEntry
51
void
G4HCIOcatalog::RegisterEntry
(
G4VHCIOentry
* d)
52
{
53
if
(
m_verbose
> 0 ) {
54
G4cout
<<
"registering I/O manager entry \""
<< d->
GetName
()
55
<<
"\" "
<< d <<
"."
<<
G4endl
;
56
}
57
if
(
theCatalog
.find(d->
GetName
()) !=
theCatalog
.end() ) {
58
G4cout
<<
"Redefining I/O Managers list "
<< d->
GetName
() <<
G4endl
;
59
}
else
{
60
theCatalog
[d->
GetName
()] = d;
61
}
62
}
63
64
// Implementation of RegisterHCIOmanager
65
void
G4HCIOcatalog::RegisterHCIOmanager
(
G4VPHitsCollectionIO
* d)
66
{
67
if
(
m_verbose
> 0 ) {
68
G4cout
<<
"registering I/O manager \""
<< d->
SDname
()
69
<<
"\" "
<< d <<
"."
<<
G4endl
;
70
}
71
if
(
theStore
.find(d->
SDname
()) !=
theStore
.end() ) {
72
G4cout
<<
"Redefining I/O Manager "
<< d->
SDname
() <<
G4endl
;
73
}
else
{
74
theStore
[d->
SDname
()] = d;
75
}
76
}
77
78
// Implementation of GetEntry
79
G4VHCIOentry
*
G4HCIOcatalog::GetEntry
(std::string
name
)
80
{
81
if
(
theCatalog
.find(name) ==
theCatalog
.end() ) {
82
G4cout
<<
"Hit Collection I/O manager entry \""
<< name
83
<<
"\" not found!"
<< std::endl;
84
return
0;
85
}
else
{
86
G4VHCIOentry
* ds =
theCatalog
[
name
];
87
return
ds;
88
}
89
}
90
91
// Implementation of GetHCIOmanager
92
G4VPHitsCollectionIO
*
G4HCIOcatalog::GetHCIOmanager
(std::string
name
)
93
{
94
if
(
theStore
.find(name) ==
theStore
.end() ) {
95
G4cout
<<
"Hit Collection I/O manager \""
<< name
96
<<
"\" not found!"
<<
G4endl
;
97
return
0;
98
}
else
{
99
G4VPHitsCollectionIO
* ds =
theStore
[
name
];
100
return
ds;
101
}
102
}
103
104
// Implementation of PrintEntries
105
void
G4HCIOcatalog::PrintEntries
()
106
{
107
G4cout
<<
"I/O manager entries: "
;
108
G4cout
<<
theCatalog
.size() <<
G4endl
;
109
HCIOmap::const_iterator it;
110
for
( it=
theCatalog
.begin(); it !=
theCatalog
.end(); it++ ) {
111
G4cout
<<
" --- "
<< (*it).first <<
G4endl
;
112
}
113
}
114
115
// Implementation of CurrentHCIOmanager
116
std::string
G4HCIOcatalog::CurrentHCIOmanager
()
117
{
118
std::string list =
""
;
119
HCIOstore::const_iterator it;
120
for
( it=
theStore
.begin(); it !=
theStore
.end(); it++ ) {
121
list += (*it).first +
" "
;
122
}
123
return
list;
124
}
125
126
// Implementation of PrintHCIOmanager
127
void
G4HCIOcatalog::PrintHCIOmanager
()
128
{
129
G4cout
<<
"I/O managers: "
;
130
G4cout
<<
theStore
.size() <<
G4endl
;
131
HCIOstore::const_iterator it;
132
for
( it=
theStore
.begin(); it !=
theStore
.end(); it++ ) {
133
G4cout
<<
" --- "
<< (*it).first
134
<<
", "
<< (*it).second <<
"."
<<
G4endl
;
135
}
136
}
137
138
// Implementation of GetHCIOmanager
139
G4VPHitsCollectionIO
*
G4HCIOcatalog::GetHCIOmanager
(
int
n
)
140
{
141
int
i = 0;
142
HCIOstore::const_iterator it;
143
for
( it=
theStore
.begin(); it !=
theStore
.end(); it++ ) {
144
if
(i++ == n)
return
(*it).second;
145
}
146
return
0;
147
}
148
149
// End of G4HCIOcatalog.cc
150
G4VPHitsCollectionIO
Definition:
G4VPHitsCollectionIO.hh:39
G4VHCIOentry::GetName
std::string GetName()
Definition:
G4VHCIOentry.hh:54
G4HCIOcatalog::GetEntry
G4VHCIOentry * GetEntry(std::string name)
Definition:
G4HCIOcatalog.cc:79
G4HCIOcatalog::CurrentHCIOmanager
std::string CurrentHCIOmanager()
Definition:
G4HCIOcatalog.cc:116
G4HCIOcatalog::RegisterEntry
void RegisterEntry(G4VHCIOentry *d)
Definition:
G4HCIOcatalog.cc:51
G4HCIOcatalog::theStore
HCIOstore theStore
Definition:
G4HCIOcatalog.hh:94
G4HCIOcatalog
Definition:
G4HCIOcatalog.hh:47
G4HCIOcatalog::PrintEntries
void PrintEntries()
Definition:
G4HCIOcatalog.cc:105
G4HCIOcatalog::GetHCIOcatalog
static G4HCIOcatalog * GetHCIOcatalog()
Definition:
G4HCIOcatalog.cc:44
G4InuclParticleNames::name
const char * name(G4int ptype)
Definition:
G4InuclParticleNames.hh:77
G4ThreadLocal
#define G4ThreadLocal
Definition:
tls.hh:89
G4HCIOcatalog::m_verbose
int m_verbose
Definition:
G4HCIOcatalog.hh:91
G4cout
G4GLOB_DLL std::ostream G4cout
G4HCIOcatalog::PrintHCIOmanager
void PrintHCIOmanager()
Definition:
G4HCIOcatalog.cc:127
G4VHCIOentry.hh
G4HCIOcatalog::theCatalog
HCIOmap theCatalog
Definition:
G4HCIOcatalog.hh:93
G4HCIOcatalog::GetHCIOmanager
G4VPHitsCollectionIO * GetHCIOmanager(std::string name)
Definition:
G4HCIOcatalog.cc:92
G4HCIOcatalog::G4HCIOcatalog
G4HCIOcatalog()
Definition:
G4HCIOcatalog.cc:39
n
const G4int n
Definition:
G4UrQMD1_3Interface.hh:144
G4VHCIOentry
Definition:
G4VHCIOentry.hh:41
G4HCIOcatalog::RegisterHCIOmanager
void RegisterHCIOmanager(G4VPHitsCollectionIO *d)
Definition:
G4HCIOcatalog.cc:65
G4HCIOcatalog.hh
G4HCIOcatalog::f_thePointer
static G4ThreadLocal G4HCIOcatalog * f_thePointer
Definition:
G4HCIOcatalog.hh:92
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4VPHitsCollectionIO::SDname
std::string SDname()
Definition:
G4VPHitsCollectionIO.hh:62
geant4.10.03
source
persistency
mctruth
src
G4HCIOcatalog.cc
Generated on Thu Feb 14 2002 02:28:29 for Geant4 by
1.8.8