ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4MoleculeTable.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4MoleculeTable.cc
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
/*
27
* G4MoleculeTable.cc
28
*
29
* Created on: 23 oct. 2013
30
* Author: kara
31
*/
32
33
#include "
G4MoleculeTable.hh
"
34
#include "
G4MolecularConfiguration.hh
"
35
#include "
G4MoleculeDefinition.hh
"
36
37
G4MoleculeTable
*
G4MoleculeTable::fpgMoleculeTable
(0);
38
39
//------------------------------------------------------------------------------
40
41
G4MoleculeTable::G4MoleculeTable
()
42
{
43
}
44
45
//------------------------------------------------------------------------------
46
47
G4MoleculeTable::~G4MoleculeTable
()
48
{
49
}
50
51
//------------------------------------------------------------------------------
52
53
G4MoleculeTable
*
G4MoleculeTable::Instance
()
54
{
55
if
(!
fpgMoleculeTable
)
fpgMoleculeTable
=
new
G4MoleculeTable
;
56
return
fpgMoleculeTable
;
57
}
58
59
//------------------------------------------------------------------------------
60
61
G4MoleculeTable
*
G4MoleculeTable::GetMoleculeTable
()
62
{
63
return
Instance
();
64
}
65
66
//------------------------------------------------------------------------------
67
68
G4MoleculeDefinition
*
69
G4MoleculeTable::CreateMoleculeDefinition
(
const
G4String
&
name
,
70
double
diffusion_coefficient)
71
{
72
return
new
G4MoleculeDefinition
(name, -1
/* mass*/
,
73
diffusion_coefficient);
74
}
75
76
//------------------------------------------------------------------------------
77
78
G4MoleculeDefinition
*
79
G4MoleculeTable::GetMoleculeDefinition
(
const
G4String
&
name
,
80
bool
mustExist)
81
{
82
MoleculeDefTable::iterator
it
=
fMoleculeDefTable
.find(name);
83
G4MoleculeDefinition
* definition(0);
84
if
(it !=
fMoleculeDefTable
.end())
85
{
86
definition = it->second;
87
}
88
else
if
(mustExist)
89
{
90
// exception
91
G4ExceptionDescription
description;
92
description <<
"The molecule definition "
<< name
93
<<
" was NOT recorded in the table"
<<
G4endl
;
94
G4Exception
(
"G4MoleculeTable::CreateMoleculeModel"
,
95
"MOLECULE_DEFINITION_NOT_CREATED"
,
96
FatalException
,
97
description);
98
}
99
return
definition;
100
}
101
102
//------------------------------------------------------------------------------
103
104
G4MolecularConfiguration
*
105
G4MoleculeTable::GetConfiguration
(
const
G4String
&
name
,
bool
mustExist)
106
{
107
G4MolecularConfiguration
* species =
108
G4MolecularConfiguration::GetMolecularConfiguration
(name);
109
110
if
(species == 0 && mustExist)
111
{
112
// exception
113
G4ExceptionDescription
description;
114
description <<
"The configuration "
<< name
115
<<
" was not recorded in the table"
<<
G4endl
;
116
G4Exception
(
"G4MoleculeTable::GetConfiguration"
,
117
"CONF_NOT_CREATED"
,
118
FatalException
,
119
description);
120
}
121
122
return
species;
123
}
124
125
//------------------------------------------------------------------------------
126
127
G4MolecularConfiguration
*
128
G4MoleculeTable::GetConfiguration
(
G4int
id
)
129
{
130
G4MolecularConfiguration
* species =
131
G4MolecularConfiguration::GetMolecularConfiguration
(
id
);
132
133
return
species;
134
}
135
136
//------------------------------------------------------------------------------
137
138
void
G4MoleculeTable::Insert
(
G4MoleculeDefinition
* moleculeDefinition)
139
{
140
141
const
G4String
&
name
= moleculeDefinition->
GetName
();
142
MoleculeDefTable::iterator
it
=
fMoleculeDefTable
.find(name);
143
if
(it ==
fMoleculeDefTable
.end())
144
{
145
fMoleculeDefTable
[
name
] = moleculeDefinition;
146
}
147
else
148
{
149
// exception
150
G4ExceptionDescription
description;
151
description <<
"The molecule definition "
<< name
152
<<
" was already recorded in the table"
<<
G4endl
;
153
G4Exception
(
"G4MoleculeTable::CreateMoleculeDefinition"
,
154
"DEFINITION_ALREADY_CREATED"
,
FatalException
, description);
155
}
156
}
157
158
//------------------------------------------------------------------------------
159
160
void
G4MoleculeTable::PrepareMolecularConfiguration
()
161
{
162
MoleculeDefTable::iterator
it
=
fMoleculeDefTable
.begin();
163
164
for
(; it !=
fMoleculeDefTable
.end() ; ++
it
)
165
{
166
G4MolecularConfiguration::GetOrCreateMolecularConfiguration
(it->second);
167
}
168
}
169
170
//------------------------------------------------------------------------------
171
172
G4MolecularConfiguration
*
173
G4MoleculeTable::CreateConfiguration
(
const
G4String
& userIdentifier,
174
G4MoleculeDefinition
* molDef)
175
{
176
bool
alreadyCreated(
false
);
177
178
G4MolecularConfiguration
* molConf =
179
G4MolecularConfiguration::CreateMolecularConfiguration
(userIdentifier,
180
molDef,
181
alreadyCreated);
182
183
return
molConf;
184
}
185
186
//------------------------------------------------------------------------------
187
188
G4MolecularConfiguration
*
189
G4MoleculeTable::CreateConfiguration
(
const
G4String
& userIdentifier,
190
G4MoleculeDefinition
* molDef,
191
const
G4String
& configurationLabel,
192
int
charge
)
193
{
194
bool
alreadyCreated(
false
);
195
196
G4MolecularConfiguration
* molConf =
197
G4MolecularConfiguration::CreateMolecularConfiguration
(userIdentifier,
198
molDef,
199
charge,
200
configurationLabel,
201
alreadyCreated);
202
203
return
molConf;
204
}
205
206
//------------------------------------------------------------------------------
207
208
G4MolecularConfiguration
*
209
G4MoleculeTable::CreateConfiguration
(
const
G4String
& userIdentifier,
210
G4MoleculeDefinition
* molDef,
211
int
charge
,
212
double
diffusion_coefficient)
213
{
214
bool
alreadyCreated(
false
);
215
216
G4MolecularConfiguration
* molConf =
217
G4MolecularConfiguration::CreateMolecularConfiguration
(userIdentifier,
218
molDef,
219
charge,
220
userIdentifier,
221
alreadyCreated);
222
223
if
(diffusion_coefficient!=-1)
// TODO
224
{
225
molConf->
SetDiffusionCoefficient
(diffusion_coefficient);
226
}
227
return
molConf;
228
}
229
230
//------------------------------------------------------------------------------
231
232
G4MolecularConfiguration
*
233
G4MoleculeTable::CreateConfiguration
(
const
G4String
& userIdentifier,
234
const
G4MoleculeDefinition
* molDef,
235
const
G4String
& configurationLabel,
236
const
G4ElectronOccupancy
& eOcc)
237
{
238
bool
alreadyCreated(
false
);
239
240
G4MolecularConfiguration
* molConf =
241
G4MolecularConfiguration::CreateMolecularConfiguration
(userIdentifier,
242
molDef,
243
configurationLabel,
244
eOcc,
245
alreadyCreated);
246
247
return
molConf;
248
}
249
250
//------------------------------------------------------------------------------
251
252
void
G4MoleculeTable::Finalize
()
253
{
254
G4MolecularConfiguration::FinalizeAll
();
255
}
256
257
//------------------------------------------------------------------------------
258
259
G4ConfigurationIterator
G4MoleculeTable::GetConfigurationIterator
()
260
{
261
return
G4ConfigurationIterator
(
G4MolecularConfiguration::GetUserIDTable
());
262
}
263
264
//------------------------------------------------------------------------------
265
266
int
G4MoleculeTable::GetNumberOfDefinedSpecies
()
267
{
268
return
G4MolecularConfiguration::GetNumberOfSpecies
();
269
}
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
dna
molecules
management
src
G4MoleculeTable.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:30
using
1.8.2 with
ECCE GitHub integration