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
G4tgbElement.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4tgbElement.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
//
28
//
29
// class G4tgbElement
30
31
// History:
32
// - Created. P.Arce, CIEMAT (November 2007)
33
// -------------------------------------------------------------------------
34
35
#include "
G4tgbElement.hh
"
36
#include "
G4tgbMaterialMgr.hh
"
37
#include "
G4tgrElementSimple.hh
"
38
#include "
G4tgrElementFromIsotopes.hh
"
39
#include "
G4tgrMessenger.hh
"
40
41
42
//----------------------------------------------------------------------
43
G4tgbElement::G4tgbElement
(
G4tgrElement
* hg )
44
{
45
theTgrElem
= hg;
46
theG4Elem
= 0;
47
}
48
49
50
//----------------------------------------------------------------------
51
G4Element
*
G4tgbElement::BuildG4ElementSimple
()
52
{
53
G4Element
* elem = 0;
54
55
//-------- if G4Element not found, construct it
56
if
(
theG4Elem
== 0 )
57
{
58
//----- construct new G4Element
59
G4tgrElementSimple
* tgrElem =
static_cast<
G4tgrElementSimple
*
>
(
theTgrElem
);
60
61
elem =
new
G4Element
(tgrElem->
GetName
(), tgrElem->
GetSymbol
(),
62
tgrElem->
GetZ
(), tgrElem->
GetA
() );
63
#ifdef G4VERBOSE
64
if
(
G4tgrMessenger::GetVerboseLevel
() >= 1 )
65
{
66
G4cout
<<
" Constructing new G4Element: "
67
<< *elem <<
G4endl
;
68
}
69
#endif
70
theG4Elem
= elem;
71
}
72
else
73
{
74
elem =
theG4Elem
;
75
}
76
77
return
elem;
78
}
79
80
81
//----------------------------------------------------------------------
82
G4Element
*
G4tgbElement::BuildG4ElementFromIsotopes
()
83
{
84
G4Element
* elem = 0;
85
86
//-------- if G4Element not found, construct it
87
if
(
theG4Elem
== 0 )
88
{
89
//----- construct new G4Element
90
G4tgrElementFromIsotopes
* tgrElem
91
=
static_cast<
G4tgrElementFromIsotopes
*
>
(
theTgrElem
);
92
93
elem =
new
G4Element
(tgrElem->
GetName
(), tgrElem->
GetSymbol
(),
94
tgrElem->
GetNumberOfIsotopes
() );
95
96
//----- add isotopes
97
G4Isotope
* compIsot;
98
G4tgbMaterialMgr
* mf =
G4tgbMaterialMgr::GetInstance
();
99
for
(
G4int
ii = 0; ii < tgrElem->
GetNumberOfIsotopes
(); ii++)
100
{
101
// Look if this component is a material
102
103
compIsot = mf->
FindOrBuildG4Isotope
( tgrElem->
GetComponent
(ii) );
104
if
( compIsot != 0 )
105
{
106
elem->
AddIsotope
( compIsot, tgrElem->
GetAbundance
(ii) );
107
}
108
else
109
{
110
G4String
ErrMessage =
"Component "
+ tgrElem->
GetComponent
(ii)
111
+
" of element "
+ tgrElem->
GetName
()
112
+
" is not an isotope !"
;
113
G4Exception
(
"G4tgbElement::BuildG4ElementFromIsotopes()"
,
114
"InvalidSetup"
,
FatalException
, ErrMessage );
115
}
116
}
117
theG4Elem
= elem;
118
}
119
else
120
{
121
elem =
theG4Elem
;
122
}
123
124
125
#ifdef G4VERBOSE
126
if
(
G4tgrMessenger::GetVerboseLevel
() >= 1 )
127
{
128
G4cout
<<
" Constructing new G4Element from isotopes: "
129
<< *elem <<
G4endl
;
130
}
131
#endif
132
133
return
elem;
134
}
geant4
tree
geant4-10.6-release
source
persistency
ascii
src
G4tgbElement.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:25
using
1.8.2 with
ECCE GitHub integration