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
examples
extended
runAndEvent
RE02
src
RE02NestedPhantomParameterisation.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
//
28
//
29
// $Id: $
30
//
32
#include "
RE02NestedPhantomParameterisation.hh
"
33
34
#include "
G4VPhysicalVolume.hh
"
35
#include "
G4VTouchable.hh
"
36
#include "
G4ThreeVector.hh
"
37
#include "
G4Box.hh
"
38
#include "
G4LogicalVolume.hh
"
39
#include "
G4Material.hh
"
40
41
//=======================================================================
42
// (RE02NestedPhantomParameterisation)
43
//
44
// (Description)
45
// Class for nested parameterisation.
46
// This parameterisation handles material and transfomation of voxles.
47
//
48
// T.Aso Created. Nov.2007.
49
//
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
RE02NestedPhantomParameterisation
54
::RE02NestedPhantomParameterisation
(
const
G4ThreeVector
& voxelSize,
55
G4int
nz,
56
std::vector<G4Material*>&
mat
):
57
G4VNestedParameterisation
(),
58
fdX(voxelSize.
x
()),fdY(voxelSize.
y
()),fdZ(voxelSize.
z
()),
59
fNz(nz),fMat(mat)
60
{
61
// Position of voxels.
62
// x and y positions are already defined in DetectorConstruction
63
// by using replicated volume. Here only we need to define is z positions
64
// of voxles.
65
fpZ.clear();
66
G4double
zp;
67
for
(
G4int
iz
= 0;
iz
< fNz;
iz
++){
68
zp = (-fNz+1+2*
iz
)*fdZ;
69
fpZ.push_back(zp);
70
}
71
72
}
73
74
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75
RE02NestedPhantomParameterisation::~RE02NestedPhantomParameterisation
(){
76
fpZ.clear();
77
}
78
79
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
//
81
// Material assignment to geometry.
82
//
83
G4Material
*
RE02NestedPhantomParameterisation
84
::ComputeMaterial
(
G4VPhysicalVolume
*
/*currentVol*/
,
const
G4int
copyNo,
85
const
G4VTouchable
* parentTouch)
86
{
87
if
(parentTouch==0)
return
fMat[0];
// protection for initialization and
88
// vis at idle state
89
// Copy number of voxels.
90
// Copy number of X and Y are obtained from replication number.
91
// Copy nymber of Z is the copy number of current voxel.
92
G4int
ix = parentTouch->
GetReplicaNumber
(0);
93
G4int
iy = parentTouch->
GetReplicaNumber
(1);
94
G4int
iz
= copyNo;
95
// For demonstration purpose,a couple of materials are chosen alternately.
96
G4Material
*
mat
=0;
97
if
( ix%2 == 0 && iy%2 == 0 && iz%2 == 0 ) mat = fMat[0];
98
else
mat = fMat[1];
99
100
return
mat
;
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
//
105
// Number of Materials
106
// Material scanner is required for preparing physics tables and so on before
107
// stating simulation, so that G4 has to know number of materials.
108
G4int
RE02NestedPhantomParameterisation::GetNumberOfMaterials
()
const
{
109
return
fMat.size();
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
//
114
// GetMaterial
115
// This is needed for material scanner and realizing geometry.
116
//
117
G4Material
*
RE02NestedPhantomParameterisation::GetMaterial
(
G4int
i)
const
{
118
return
fMat[i];
119
}
120
121
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122
//
123
// Transformation of voxels.
124
//
125
void
RE02NestedPhantomParameterisation
126
::ComputeTransformation
(
const
G4int
copyNo,
G4VPhysicalVolume
* physVol)
const
{
127
G4ThreeVector
position
(0.,0.,fpZ[copyNo]);
128
physVol->
SetTranslation
(position);
129
}
130
131
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132
//
133
// Dimensions are always same in this RE02 example.
134
//
135
void
RE02NestedPhantomParameterisation
136
::ComputeDimensions
(
G4Box
& box,
const
G4int
,
const
G4VPhysicalVolume
* )
const
{
137
box.
SetXHalfLength
(fdX);
138
box.
SetYHalfLength
(fdY);
139
box.
SetZHalfLength
(fdZ);
140
}
Generated on Sat May 25 2013 14:33:01 for Geant4 by
1.8.4