Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
persistency
ascii
src
G4tgrVolumeDivision.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
//
27
// $Id: G4tgrVolumeDivision.cc 69803 2013-05-15 15:24:50Z gcosmo $
28
//
29
//
30
// class G4tgrVolumeDivision
31
32
// History:
33
// - Created. P.Arce, CIEMAT (November 2007)
34
// -------------------------------------------------------------------------
35
36
#include "
G4tgrVolumeDivision.hh
"
37
38
#include "
G4SystemOfUnits.hh
"
39
#include "
G4tgrUtils.hh
"
40
#include "
G4tgrVolumeMgr.hh
"
41
#include "
G4tgrPlace.hh
"
42
#include "
G4tgrFileReader.hh
"
43
#include "
G4tgrPlaceDivRep.hh
"
44
#include "
G4tgrMessenger.hh
"
45
46
47
//-------------------------------------------------------------
48
G4tgrVolumeDivision::~G4tgrVolumeDivision
()
49
{
50
}
51
52
//-------------------------------------------------------------
53
G4tgrVolumeDivision::G4tgrVolumeDivision
(
const
std::vector<G4String>& wl )
54
{
55
// wl: NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
56
57
G4tgrUtils::CheckWLsize
( wl, 6,
WLSIZE_GE
,
58
"G4tgrVolumeDivision::G4tgrVolumeDivision"
);
59
G4tgrUtils::CheckWLsize
( wl, 8,
WLSIZE_LE
,
60
"G4tgrVolumeDivision::G4tgrVolumeDivision"
);
61
62
theType
=
"VOLDivision"
;
63
64
// :DIV NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
65
66
//---------- set name
67
theName
=
G4tgrUtils::GetString
( wl[1] );
68
69
//---------- set the pointer to the parent DU
70
G4String
parentName =
G4tgrUtils::GetString
(wl[2]);
71
G4tgrVolumeMgr::GetInstance
()->
FindVolume
( parentName, 1);
// check existance
72
73
//---------- initialize G4tgrPlace
74
thePlaceDiv =
new
G4tgrPlaceDivRep
();
75
thePlaceDiv->
SetParentName
( parentName );
76
thePlaceDiv->
SetType
(
"PlaceDivision"
);
77
thePlaceDiv->
SetVolume
(
this
);
78
79
//---------- set material name
80
theMaterialName
=
G4tgrUtils::GetString
( wl[3] );
81
82
//----- set axis of replica
83
thePlaceDiv->
SetAxis
( thePlaceDiv->
BuildAxis
(
G4tgrUtils::GetString
(wl[4])) );
84
85
//------ register parent - child
86
G4tgrVolumeMgr::GetInstance
()->
RegisterParentChild
( parentName, thePlaceDiv );
87
#ifdef G4VERBOSE
88
if
(
G4tgrMessenger::GetVerboseLevel
() >= 3 )
89
{
90
G4cout
<<
" G4tgrVolumeDivision::G4tgrVolumeDivision() -"
91
<<
" Replica register parent - child "
<<
G4endl
;
92
}
93
#endif
94
95
//---------- set if division is given by number of divisions of by width
96
G4String
wl0 = wl[0];
97
for
(
size_t
ii = 0; ii < wl0.length(); ii++ )
98
{
99
wl0[ii] = toupper( wl0[ii] );
100
}
101
102
if
( wl0 ==
":DIV_NDIV"
)
103
{
104
thePlaceDiv->
SetDivType
(
DivByNdiv
);
105
thePlaceDiv->
SetNDiv
(
G4tgrUtils::GetInt
( wl[5] ) );
106
if
( wl.size() == 7 )
107
{
108
thePlaceDiv->
SetOffset
(
G4tgrUtils::GetDouble
( wl[6] )*
mm
);
109
}
110
}
111
else
if
( wl0 ==
":DIV_WIDTH"
)
112
{
113
thePlaceDiv->
SetDivType
(
DivByWidth
);
114
thePlaceDiv->
SetWidth
(
G4tgrUtils::GetDouble
( wl[5] )*
mm
);
115
if
( wl.size() == 7 )
116
{
117
thePlaceDiv->
SetOffset
(
G4tgrUtils::GetDouble
( wl[6] )*mm );
118
}
119
}
120
else
if
( wl0 ==
":DIV_NDIV_WIDTH"
)
121
{
122
thePlaceDiv->
SetDivType
(
DivByNdivAndWidth
);
123
thePlaceDiv->
SetNDiv
(
G4tgrUtils::GetInt
( wl[5] ) );
124
thePlaceDiv->
SetWidth
(
G4tgrUtils::GetDouble
( wl[6] )*
mm
);
125
if
( wl.size() == 8 )
126
{
127
thePlaceDiv->
SetOffset
(
G4tgrUtils::GetDouble
( wl[7] )*mm );
128
}
129
}
130
else
131
{
132
G4String
ErrMessage =
"Division type not supported, sorry... "
+ wl[0];
133
G4Exception
(
"G4tgrVolumeDivision::G4tgrVolumeDivision()"
,
134
"NotImplemented"
,
FatalException
, ErrMessage);
135
}
136
137
theVisibility
= 1;
138
theRGBColour
=
new
G4double
[3];
139
for
(
size_t
ii=0; ii<3; ii++) {
theRGBColour
[ii] = -1.; }
140
141
#ifdef G4VERBOSE
142
if
(
G4tgrMessenger::GetVerboseLevel
() >= 1 )
143
{
144
G4cout
<<
" Created "
<< *
this
<<
G4endl
;
145
}
146
#endif
147
148
theSolid
= 0;
149
}
150
151
152
// -------------------------------------------------------------------------
153
std::ostream&
operator<<
(std::ostream& os,
const
G4tgrVolumeDivision
& obj)
154
{
155
os <<
"G4tgrVolumeDivision= "
<< obj.
theName
156
<<
" Placement= "
<< *(obj.thePlaceDiv) <<
G4endl
;
157
158
return
os;
159
}
Generated on Sat May 25 2013 14:33:24 for Geant4 by
1.8.4