Geant4-11
Public Member Functions | Protected Attributes
G4EzVolume Class Reference

#include <G4EzVolume.hh>

Public Member Functions

void CreateBoxVolume (G4Material *amaterial, G4double dx, G4double dy, G4double dz)
 
void CreateConeVolume (G4Material *amaterial, G4double rmin1, G4double rmax1, G4double rmin2, G4double rmax2, G4double dz, G4double phi0=0., G4double dphi=360.*deg)
 
void CreateOrbVolume (G4Material *amaterial, G4double rmax)
 
void CreateSphereVolume (G4Material *amaterial, G4double rmin, G4double rmax, G4double phi0=0., G4double dphi=360.*deg, G4double theta0=0., G4double dtheta=180.*deg)
 
void CreateTubeVolume (G4Material *amaterial, G4double rmin, G4double rmax, G4double dz, G4double phi0=0., G4double dphi=360 *deg)
 
 G4EzVolume ()
 
 G4EzVolume (const G4String &aname)
 
G4MaterialGetMaterial () const
 
const G4StringGetName () const
 
G4int GetNofPlacements () const
 
const G4VSolidGetSolid () const
 
G4VPhysicalVolumePlaceIt (const G4ThreeVector &pos, G4int ncopy=0, G4EzVolume *parent=0)
 
G4VPhysicalVolumePlaceIt (const G4Transform3D &transform, G4int ncopy=0, G4EzVolume *parent=0)
 
G4VPhysicalVolumeReplicateIt (G4EzVolume *parent, EAxis pAxis, G4int nReplicas, G4double width, G4double offset=0)
 
void SetColor (const G4Color &color)
 
void SetColor (G4double red, G4double green, G4double blue)
 
void SetMaterial (G4Material *amaterial)
 
void SetSensitiveDetector (G4VSensitiveDetector *asd)
 
void SetSolid (G4VSolid *asolid)
 
void SetVisibility (G4bool qvisible)
 
G4ThreeVector VoxelizeIt (G4int nx, G4int ny, G4int nz)
 
 ~G4EzVolume ()
 

Protected Attributes

G4LogicalVolumelv
 
G4LogicalVolumelvsub
 
G4String name
 
G4int nplacement
 
G4VSolidsolid
 
G4VisAttributesva
 

Detailed Description

Definition at line 51 of file G4EzVolume.hh.

Constructor & Destructor Documentation

◆ G4EzVolume() [1/2]

G4EzVolume::G4EzVolume ( )

Definition at line 53 of file G4EzVolume.cc.

54 : name("MyVolume"),
55 solid(0),
56 lv(0), lvsub(0),
57 nplacement(0)
59{
60}
G4int nplacement
Definition: G4EzVolume.hh:59
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:57
G4String name
Definition: G4EzVolume.hh:54
G4VSolid * solid
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:56

◆ G4EzVolume() [2/2]

G4EzVolume::G4EzVolume ( const G4String aname)

Definition at line 64 of file G4EzVolume.cc.

65 : name(aname), solid(0), lv(0), lvsub(0),
66 nplacement(0)
68{
69}

◆ ~G4EzVolume()

G4EzVolume::~G4EzVolume ( )

Definition at line 73 of file G4EzVolume.cc.

75{
76}

Member Function Documentation

◆ CreateBoxVolume()

void G4EzVolume::CreateBoxVolume ( G4Material amaterial,
G4double  dx,
G4double  dy,
G4double  dz 
)

Definition at line 80 of file G4EzVolume.cc.

83{
84 if(lv !=0 ) {
85 G4cout << "%%% Warning (G4EzVolume): volume is already created."
86 << G4endl;
87 return;
88 }
89
90 solid= new G4Box(name, dx/2., dy/2., dz/2.);
91 lv= new G4LogicalVolume(solid, amaterial, name);
92
93 // vis. attributes
94 va= new G4VisAttributes();
95 lv-> SetVisAttributes(va);
96}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
Definition: G4Box.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:58

References G4cout, G4endl, lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

◆ CreateConeVolume()

void G4EzVolume::CreateConeVolume ( G4Material amaterial,
G4double  rmin1,
G4double  rmax1,
G4double  rmin2,
G4double  rmax2,
G4double  dz,
G4double  phi0 = 0.,
G4double  dphi = 360.*deg 
)

Definition at line 121 of file G4EzVolume.cc.

127{
128 if(lv !=0 ) {
129 G4cout << "%%% Warning (G4EzVolume): volume is already created."
130 << G4endl;
131 return;
132 }
133
134 solid= new G4Cons(name, rmin1, rmax1, rmin2, rmax2,
135 dz, phi0, dphi);
136 lv= new G4LogicalVolume(solid, amaterial, name);
137
138 // vis. attributes
139 va= new G4VisAttributes();
140 lv-> SetVisAttributes(va);
141}
Definition: G4Cons.hh:78

References G4cout, G4endl, lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

◆ CreateOrbVolume()

void G4EzVolume::CreateOrbVolume ( G4Material amaterial,
G4double  rmax 
)

Definition at line 167 of file G4EzVolume.cc.

169{
170 if(lv !=0 ) {
171 G4cout << "%%% Warning (G4EzVolume): volume is already created."
172 << G4endl;
173 return;
174 }
175
176 solid= new G4Orb(name, rmax);
177 lv= new G4LogicalVolume(solid, amaterial, name);
178
179 // vis. attributes
180 va= new G4VisAttributes();
181 lv-> SetVisAttributes(va);
182}
Definition: G4Orb.hh:56

References G4cout, G4endl, lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

◆ CreateSphereVolume()

void G4EzVolume::CreateSphereVolume ( G4Material amaterial,
G4double  rmin,
G4double  rmax,
G4double  phi0 = 0.,
G4double  dphi = 360.*deg,
G4double  theta0 = 0.,
G4double  dtheta = 180.*deg 
)

Definition at line 145 of file G4EzVolume.cc.

150{
151 if(lv !=0 ) {
152 G4cout << "%%% Warning (G4EzVolume): volume is already created."
153 << G4endl;
154 return;
155 }
156
157 solid= new G4Sphere(name, rmin, rmax, phi0, dphi, theta0, dtheta);
158 lv= new G4LogicalVolume(solid, amaterial, name);
159
160 // vis. attributes
161 va= new G4VisAttributes();
162 lv-> SetVisAttributes(va);
163}

References G4cout, G4endl, lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

◆ CreateTubeVolume()

void G4EzVolume::CreateTubeVolume ( G4Material amaterial,
G4double  rmin,
G4double  rmax,
G4double  dz,
G4double  phi0 = 0.,
G4double  dphi = 360*deg 
)

Definition at line 100 of file G4EzVolume.cc.

104{
105 if(lv !=0 ) {
106 G4cout << "%%% Warning (G4EzVolume): volume is already created."
107 << G4endl;
108 return;
109 }
110
111 solid= new G4Tubs(name, rmin, rmax, dz, phi0, dphi);
112 lv= new G4LogicalVolume(solid, amaterial, name);
113
114 // vis. attributes
115 va= new G4VisAttributes();
116 lv-> SetVisAttributes(va);
117}
Definition: G4Tubs.hh:75

References G4cout, G4endl, lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

◆ GetMaterial()

G4Material * G4EzVolume::GetMaterial ( ) const
inline

Definition at line 142 of file G4EzVolume.hh.

143{
144 if(lv!=0) return lv-> GetMaterial();
145 else return 0;
146}
G4Material * GetMaterial() const
Definition: G4EzVolume.hh:142

References GetMaterial(), and lv.

Referenced by BOOST_PYTHON_MODULE(), GetMaterial(), and VoxelizeIt().

◆ GetName()

const G4String & G4EzVolume::GetName ( ) const
inline

Definition at line 130 of file G4EzVolume.hh.

130{ return name; }

References name.

◆ GetNofPlacements()

G4int G4EzVolume::GetNofPlacements ( ) const
inline

Definition at line 148 of file G4EzVolume.hh.

148{ return nplacement; }

References nplacement.

◆ GetSolid()

const G4VSolid * G4EzVolume::GetSolid ( ) const
inline

Definition at line 134 of file G4EzVolume.hh.

134{ return solid; }

References solid.

Referenced by BOOST_PYTHON_MODULE().

◆ PlaceIt() [1/2]

G4VPhysicalVolume * G4EzVolume::PlaceIt ( const G4ThreeVector pos,
G4int  ncopy = 0,
G4EzVolume parent = 0 
)

Definition at line 186 of file G4EzVolume.cc.

190{
191 if(lv==0) {
192 G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
193 << G4endl;
194 return 0;
195 }
196
197 G4PVPlacement* pv;
198 if(parent==0) { // place it in the world
200 pv= new G4PVPlacement(0, pos, name, lv, world, false, ncopy);
201 } else {
202 pv= new G4PVPlacement(0, pos, lv, name, parent->lv, false, ncopy);
203 }
204
205 nplacement++;
206 return pv;
207}
static const G4double pos
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:73

References G4cout, G4endl, G4EzWorld::GetWorldVolume(), lv, name, nplacement, and pos.

◆ PlaceIt() [2/2]

G4VPhysicalVolume * G4EzVolume::PlaceIt ( const G4Transform3D transform,
G4int  ncopy = 0,
G4EzVolume parent = 0 
)

Definition at line 211 of file G4EzVolume.cc.

215{
216 if(lv==0) {
217 G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
218 << G4endl;
219 return 0;
220 }
221
222 G4PVPlacement* pv;
223 if(parent==0) { // place it in the world
225 pv= new G4PVPlacement(transform, name, lv, world, false, ncopy);
226 } else {
227 pv= new G4PVPlacement(transform, lv, name, parent->lv, false, ncopy);
228 }
229
230 nplacement++;
231 return pv;
232}
G4bool transform(G4String &input, const G4String &type)

References G4cout, G4endl, G4EzWorld::GetWorldVolume(), lv, name, nplacement, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

◆ ReplicateIt()

G4VPhysicalVolume * G4EzVolume::ReplicateIt ( G4EzVolume parent,
EAxis  pAxis,
G4int  nReplicas,
G4double  width,
G4double  offset = 0 
)

Definition at line 236 of file G4EzVolume.cc.

240{
241 if(lv==0) {
242 G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
243 << G4endl;
244 return 0;
245 }
246
247 G4PVReplica* pv=
248 new G4PVReplica(name, lv, parent->lv, pAxis, nReplicas, width, offset);
249
250 nplacement += nReplicas;
251 return pv;
252}

References G4cout, G4endl, lv, name, and nplacement.

Referenced by BOOST_PYTHON_MODULE().

◆ SetColor() [1/2]

void G4EzVolume::SetColor ( const G4Color color)
inline

Definition at line 155 of file G4EzVolume.hh.

156{
157 if(va!=0) va-> SetColor(color);
158}
void SetColor(const G4Color &color)
Definition: G4EzVolume.hh:155

References SetColor(), and va.

Referenced by SetColor().

◆ SetColor() [2/2]

void G4EzVolume::SetColor ( G4double  red,
G4double  green,
G4double  blue 
)
inline

Definition at line 160 of file G4EzVolume.hh.

161{
162 if(va!=0) va-> SetColor(red, green, blue);
163}

References SetColor(), and va.

◆ SetMaterial()

void G4EzVolume::SetMaterial ( G4Material amaterial)
inline

Definition at line 136 of file G4EzVolume.hh.

137{
138 if(lv!= 0) lv-> SetMaterial(amaterial);
139 if(lvsub!= 0) lvsub-> SetMaterial(amaterial);
140}
void SetMaterial(G4Material *amaterial)
Definition: G4EzVolume.hh:136

References lv, lvsub, and SetMaterial().

Referenced by BOOST_PYTHON_MODULE(), and SetMaterial().

◆ SetSensitiveDetector()

void G4EzVolume::SetSensitiveDetector ( G4VSensitiveDetector asd)

Definition at line 300 of file G4EzVolume.cc.

302{
303 if(lvsub!=0) {
305 return;
306 }
307
308 if(lv!=0) lv-> SetSensitiveDetector(asd);
309
310}
void SetSensitiveDetector(G4VSensitiveDetector *asd)
Definition: G4EzVolume.cc:300

References lv, lvsub, and SetSensitiveDetector().

Referenced by BOOST_PYTHON_MODULE(), and SetSensitiveDetector().

◆ SetSolid()

void G4EzVolume::SetSolid ( G4VSolid asolid)
inline

Definition at line 132 of file G4EzVolume.hh.

132{ solid= asolid; }

References solid.

Referenced by BOOST_PYTHON_MODULE().

◆ SetVisibility()

void G4EzVolume::SetVisibility ( G4bool  qvisible)
inline

Definition at line 150 of file G4EzVolume.hh.

151{
152 if(va!=0) va-> SetVisibility(qvisible);
153}
void SetVisibility(G4bool qvisible)
Definition: G4EzVolume.hh:150

References SetVisibility(), and va.

Referenced by BOOST_PYTHON_MODULE(), and SetVisibility().

◆ VoxelizeIt()

G4ThreeVector G4EzVolume::VoxelizeIt ( G4int  nx,
G4int  ny,
G4int  nz 
)

Definition at line 256 of file G4EzVolume.cc.

258{
259 // creating voxel volume...
260 G4Box* avolume= dynamic_cast<G4Box*>(solid);
261 if(avolume ==0 ) {
262 G4cout << "%%% Error (G4EzVolume): voxelization is valid "
263 << "only for Box geometry." << G4endl;
264 return G4ThreeVector();
265 }
266
267 if(lvsub !=0) {
268 G4cout << "%%% Error (G4EzVolume): already voxelized." << G4endl;
269 return G4ThreeVector();
270 }
271
272 G4double dx= (avolume-> GetXHalfLength())*2.;
273 G4double dy= (avolume-> GetYHalfLength())*2.;
274 G4double dz= (avolume-> GetZHalfLength())*2.;
275
276 // voxel size
277 G4double ddx= dx/nx;
278 G4double ddy= dy/ny;
279 G4double ddz= dz/nz;
280
281 G4Box* voxel= new G4Box("voxel", ddx/2., ddy/2., ddz/2.);
282 G4Material* voxelMaterial= lv-> GetMaterial();
283 lvsub= new G4LogicalVolume(voxel, voxelMaterial, "voxel");
284
285 G4VisAttributes* vavoxel= new G4VisAttributes(G4Color(1.,0.,0.));
286 lvsub-> SetVisAttributes(vavoxel);
287
288 G4EzVoxelParameterization* voxelParam=
289 new G4EzVoxelParameterization(ddx, ddy, ddz, nx, ny, nz);
290 G4int nvoxel= nx*ny*nz;
291 new G4PVParameterised(name+"_voxel", lvsub, lv, kXAxis,
292 nvoxel, voxelParam);
293
294 return G4ThreeVector(ddx, ddy, ddz);
295}
G4Colour G4Color
Definition: G4Color.hh:41
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
@ kXAxis
Definition: geomdefs.hh:55

References G4cout, G4endl, GetMaterial(), kXAxis, lv, lvsub, name, and solid.

Referenced by BOOST_PYTHON_MODULE().

Field Documentation

◆ lv

G4LogicalVolume* G4EzVolume::lv
protected

◆ lvsub

G4LogicalVolume* G4EzVolume::lvsub
protected

Definition at line 57 of file G4EzVolume.hh.

Referenced by SetMaterial(), SetSensitiveDetector(), and VoxelizeIt().

◆ name

G4String G4EzVolume::name
protected

◆ nplacement

G4int G4EzVolume::nplacement
protected

Definition at line 59 of file G4EzVolume.hh.

Referenced by GetNofPlacements(), PlaceIt(), and ReplicateIt().

◆ solid

G4VSolid* G4EzVolume::solid
protected

◆ va

G4VisAttributes* G4EzVolume::va
protected

The documentation for this class was generated from the following files: