Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EzVolume Class Reference

#include <G4EzVolume.hh>

Collaboration diagram for G4EzVolume:

Public Member Functions

 G4EzVolume ()
 
 G4EzVolume (const G4String &aname)
 
 ~G4EzVolume ()
 
void CreateBoxVolume (G4Material *amaterial, G4double dx, G4double dy, G4double dz)
 
void CreateTubeVolume (G4Material *amaterial, G4double rmin, G4double rmax, G4double dz, G4double phi0=0., G4double dphi=360 *deg)
 
void CreateConeVolume (G4Material *amaterial, G4double rmin1, G4double rmax1, G4double rmin2, G4double rmax2, G4double dz, G4double phi0=0., G4double dphi=360.*deg)
 
void CreateSphereVolume (G4Material *amaterial, G4double rmin, G4double rmax, G4double phi0=0., G4double dphi=360.*deg, G4double theta0=0., G4double dtheta=180.*deg)
 
void CreateOrbVolume (G4Material *amaterial, G4double rmax)
 
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)
 
G4ThreeVector VoxelizeIt (G4int nx, G4int ny, G4int nz)
 
void SetSensitiveDetector (G4VSensitiveDetector *asd)
 
const G4StringGetName () const
 
void SetSolid (G4VSolid *asolid)
 
const G4VSolidGetSolid () const
 
void SetMaterial (G4Material *amaterial)
 
G4MaterialGetMaterial () const
 
G4int GetNofPlacements () const
 
void SetVisibility (G4bool qvisible)
 
void SetColor (const G4Color &color)
 
void SetColor (G4double red, G4double green, G4double blue)
 

Protected Attributes

G4String name
 
G4VSolidsolid
 
G4LogicalVolumelv
 
G4LogicalVolumelvsub
 
G4VisAttributesva
 
G4int nplacement
 

Detailed Description

Definition at line 52 of file G4EzVolume.hh.

Constructor & Destructor Documentation

G4EzVolume::G4EzVolume ( )

Definition at line 54 of file G4EzVolume.cc.

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

Definition at line 65 of file G4EzVolume.cc.

66  : name(aname), solid(0), lv(0), lvsub(0),
67  nplacement(0)
69 {
70 }
G4String name
Definition: G4EzVolume.hh:55
G4int nplacement
Definition: G4EzVolume.hh:60
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:58
G4EzVolume::~G4EzVolume ( )

Definition at line 74 of file G4EzVolume.cc.

76 {
77 }

Member Function Documentation

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

Definition at line 81 of file G4EzVolume.cc.

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

Here is the caller graph for this function:

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 122 of file G4EzVolume.cc.

128 {
129  if(lv !=0 ) {
130  G4cout << "%%% Warning (G4EzVolume): volume is already created."
131  << G4endl;
132  return;
133  }
134 
135  solid= new G4Cons(name, rmin1, rmax1, rmin2, rmax2,
136  dz, phi0, dphi);
137  lv= new G4LogicalVolume(solid, amaterial, name);
138 
139  // vis. attributes
140  va= new G4VisAttributes();
141  lv-> SetVisAttributes(va);
142 }
const XML_Char * name
Definition: expat.h:151
G4VisAttributes * va
Definition: G4EzVolume.hh:59
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
Definition: G4Cons.hh:83
G4VSolid * solid
Definition: G4EzVolume.hh:56
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

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

Definition at line 168 of file G4EzVolume.cc.

170 {
171  if(lv !=0 ) {
172  G4cout << "%%% Warning (G4EzVolume): volume is already created."
173  << G4endl;
174  return;
175  }
176 
177  solid= new G4Orb(name, rmax);
178  lv= new G4LogicalVolume(solid, amaterial, name);
179 
180  // vis. attributes
181  va= new G4VisAttributes();
182  lv-> SetVisAttributes(va);
183 }
const XML_Char * name
Definition: expat.h:151
G4VisAttributes * va
Definition: G4EzVolume.hh:59
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
Definition: G4Orb.hh:61
G4VSolid * solid
Definition: G4EzVolume.hh:56
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

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 146 of file G4EzVolume.cc.

151 {
152  if(lv !=0 ) {
153  G4cout << "%%% Warning (G4EzVolume): volume is already created."
154  << G4endl;
155  return;
156  }
157 
158  solid= new G4Sphere(name, rmin, rmax, phi0, dphi, theta0, dtheta);
159  lv= new G4LogicalVolume(solid, amaterial, name);
160 
161  // vis. attributes
162  va= new G4VisAttributes();
163  lv-> SetVisAttributes(va);
164 }
const XML_Char * name
Definition: expat.h:151
G4VisAttributes * va
Definition: G4EzVolume.hh:59
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
G4VSolid * solid
Definition: G4EzVolume.hh:56
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

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

Definition at line 101 of file G4EzVolume.cc.

105 {
106  if(lv !=0 ) {
107  G4cout << "%%% Warning (G4EzVolume): volume is already created."
108  << G4endl;
109  return;
110  }
111 
112  solid= new G4Tubs(name, rmin, rmax, dz, phi0, dphi);
113  lv= new G4LogicalVolume(solid, amaterial, name);
114 
115  // vis. attributes
116  va= new G4VisAttributes();
117  lv-> SetVisAttributes(va);
118 }
const XML_Char * name
Definition: expat.h:151
G4VisAttributes * va
Definition: G4EzVolume.hh:59
Definition: G4Tubs.hh:85
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
G4VSolid * solid
Definition: G4EzVolume.hh:56
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

G4Material * G4EzVolume::GetMaterial ( ) const
inline

Definition at line 143 of file G4EzVolume.hh.

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

Here is the caller graph for this function:

const G4String & G4EzVolume::GetName ( ) const
inline

Definition at line 131 of file G4EzVolume.hh.

131 { return name; }
G4String name
Definition: G4EzVolume.hh:55
G4int G4EzVolume::GetNofPlacements ( ) const
inline

Definition at line 149 of file G4EzVolume.hh.

149 { return nplacement; }
G4int nplacement
Definition: G4EzVolume.hh:60
const G4VSolid * G4EzVolume::GetSolid ( ) const
inline

Definition at line 135 of file G4EzVolume.hh.

135 { return solid; }
G4VSolid * solid
Definition: G4EzVolume.hh:56

Here is the caller graph for this function:

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

Definition at line 187 of file G4EzVolume.cc.

191 {
192  if(lv==0) {
193  G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
194  << G4endl;
195  return 0;
196  }
197 
198  G4PVPlacement* pv;
199  if(parent==0) { // place it in the world
201  pv= new G4PVPlacement(0, pos, name, lv, world, false, ncopy);
202  } else {
203  pv= new G4PVPlacement(0, pos, lv, name, parent->lv, false, ncopy);
204  }
205 
206  nplacement++;
207  return pv;
208 }
const XML_Char * name
Definition: expat.h:151
G4int nplacement
Definition: G4EzVolume.hh:60
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:74
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

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

Definition at line 212 of file G4EzVolume.cc.

216 {
217  if(lv==0) {
218  G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
219  << G4endl;
220  return 0;
221  }
222 
223  G4PVPlacement* pv;
224  if(parent==0) { // place it in the world
226  pv= new G4PVPlacement(transform, name, lv, world, false, ncopy);
227  } else {
228  pv= new G4PVPlacement(transform, lv, name, parent->lv, false, ncopy);
229  }
230 
231  nplacement++;
232  return pv;
233 }
const XML_Char * name
Definition: expat.h:151
G4int nplacement
Definition: G4EzVolume.hh:60
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:74
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

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

Definition at line 237 of file G4EzVolume.cc.

241 {
242  if(lv==0) {
243  G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
244  << G4endl;
245  return 0;
246  }
247 
248  G4PVReplica* pv=
249  new G4PVReplica(name, lv, parent->lv, pAxis, nReplicas, width, offset);
250 
251  nplacement += nReplicas;
252  return pv;
253 }
const XML_Char * name
Definition: expat.h:151
G4int nplacement
Definition: G4EzVolume.hh:60
#define width
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4EzVolume::SetColor ( const G4Color color)
inline

Definition at line 156 of file G4EzVolume.hh.

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

Here is the caller graph for this function:

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

Definition at line 161 of file G4EzVolume.hh.

162 {
163  if(va!=0) va-> SetColor(red, green, blue);
164 }
G4VisAttributes * va
Definition: G4EzVolume.hh:59
Definition: test07.cc:36
Definition: test07.cc:36
void SetColor(const G4Color &color)
Definition: G4EzVolume.hh:156

Here is the call graph for this function:

void G4EzVolume::SetMaterial ( G4Material amaterial)
inline

Definition at line 137 of file G4EzVolume.hh.

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

Here is the caller graph for this function:

void G4EzVolume::SetSensitiveDetector ( G4VSensitiveDetector asd)

Definition at line 301 of file G4EzVolume.cc.

303 {
304  if(lvsub!=0) {
306  return;
307  }
308 
309  if(lv!=0) lv-> SetSensitiveDetector(asd);
310 
311 }
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
void SetSensitiveDetector(G4VSensitiveDetector *asd)
Definition: G4EzVolume.cc:301
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:58

Here is the caller graph for this function:

void G4EzVolume::SetSolid ( G4VSolid asolid)
inline

Definition at line 133 of file G4EzVolume.hh.

133 { solid= asolid; }
G4VSolid * solid
Definition: G4EzVolume.hh:56

Here is the caller graph for this function:

void G4EzVolume::SetVisibility ( G4bool  qvisible)
inline

Definition at line 151 of file G4EzVolume.hh.

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

Here is the caller graph for this function:

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

Definition at line 257 of file G4EzVolume.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

G4LogicalVolume* G4EzVolume::lv
protected

Definition at line 57 of file G4EzVolume.hh.

G4LogicalVolume* G4EzVolume::lvsub
protected

Definition at line 58 of file G4EzVolume.hh.

G4String G4EzVolume::name
protected

Definition at line 55 of file G4EzVolume.hh.

G4int G4EzVolume::nplacement
protected

Definition at line 60 of file G4EzVolume.hh.

G4VSolid* G4EzVolume::solid
protected

Definition at line 56 of file G4EzVolume.hh.

G4VisAttributes* G4EzVolume::va
protected

Definition at line 59 of file G4EzVolume.hh.


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