LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
G4EzVolume Class Reference

#include "G4EzVolume.hh"

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)
 
G4VPhysicalVolume * PlaceIt (const G4ThreeVector &pos, G4int ncopy=0, G4EzVolume *parent=0)
 
G4VPhysicalVolume * PlaceIt (const G4Transform3D &transform, G4int ncopy=0, G4EzVolume *parent=0)
 
G4VPhysicalVolume * ReplicateIt (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 G4VSolid * GetSolid () const
 
void SetMaterial (G4Material *amaterial)
 
G4Material * GetMaterial () 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
 
G4VSolid * solid
 
G4LogicalVolume * lv
 
G4LogicalVolume * lvsub
 
G4VisAttributes * va
 
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
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4int nplacement
Definition: G4EzVolume.hh:60
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
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4int nplacement
Definition: G4EzVolume.hh:60
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.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:59
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.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:59
void G4EzVolume::CreateOrbVolume ( G4Material *  amaterial,
G4double  rmax 
)

Definition at line 168 of file G4EzVolume.cc.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:59
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.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:59
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.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VisAttributes * va
Definition: G4EzVolume.hh:59
G4Material * G4EzVolume::GetMaterial ( ) const
inline

Definition at line 143 of file G4EzVolume.hh.

References lv.

Referenced by BOOST_PYTHON_MODULE(), and VoxelizeIt().

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
const G4String & G4EzVolume::GetName ( ) const
inline

Definition at line 131 of file G4EzVolume.hh.

References name.

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

Definition at line 149 of file G4EzVolume.hh.

References nplacement.

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

Definition at line 135 of file G4EzVolume.hh.

References solid.

Referenced by BOOST_PYTHON_MODULE().

135 { return solid; }
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4VPhysicalVolume * G4EzVolume::PlaceIt ( const G4ThreeVector &  pos,
G4int  ncopy = 0,
G4EzVolume parent = 0 
)

Definition at line 187 of file G4EzVolume.cc.

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

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
200  G4VPhysicalVolume* world= G4EzWorld::GetWorldVolume();
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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4int nplacement
Definition: G4EzVolume.hh:60
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:74
G4VPhysicalVolume * G4EzVolume::PlaceIt ( const G4Transform3D &  transform,
G4int  ncopy = 0,
G4EzVolume parent = 0 
)

Definition at line 212 of file G4EzVolume.cc.

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

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
225  G4VPhysicalVolume* world= G4EzWorld::GetWorldVolume();
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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4int nplacement
Definition: G4EzVolume.hh:60
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:74
G4VPhysicalVolume * G4EzVolume::ReplicateIt ( G4EzVolume parent,
EAxis  pAxis,
G4int  nReplicas,
G4double  width,
G4double  offset = 0 
)

Definition at line 237 of file G4EzVolume.cc.

References lv, name, and nplacement.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4int nplacement
Definition: G4EzVolume.hh:60
void G4EzVolume::SetColor ( const G4Color &  color)
inline

Definition at line 156 of file G4EzVolume.hh.

References va.

Referenced by SetColor().

157 {
158  if(va!=0) va-> SetColor(color);
159 }
G4VisAttributes * va
Definition: G4EzVolume.hh:59
std::size_t color(std::string const &procname)
void SetColor(const G4Color &color)
Definition: G4EzVolume.hh:156
void G4EzVolume::SetColor ( G4double  red,
G4double  green,
G4double  blue 
)
inline

Definition at line 161 of file G4EzVolume.hh.

References SetColor(), and va.

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

Definition at line 137 of file G4EzVolume.hh.

References lv, and lvsub.

Referenced by BOOST_PYTHON_MODULE().

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
void G4EzVolume::SetSensitiveDetector ( G4VSensitiveDetector *  asd)

Definition at line 301 of file G4EzVolume.cc.

References lv, and lvsub.

Referenced by BOOST_PYTHON_MODULE().

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
void G4EzVolume::SetSolid ( G4VSolid *  asolid)
inline

Definition at line 133 of file G4EzVolume.hh.

References solid.

Referenced by BOOST_PYTHON_MODULE().

133 { solid= asolid; }
G4VSolid * solid
Definition: G4EzVolume.hh:56
void G4EzVolume::SetVisibility ( G4bool  qvisible)
inline

Definition at line 151 of file G4EzVolume.hh.

References va.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 257 of file G4EzVolume.cc.

References GetMaterial(), lv, lvsub, name, and solid.

Referenced by BOOST_PYTHON_MODULE().

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 }
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
G4VSolid * solid
Definition: G4EzVolume.hh:56
G4Material * GetMaterial() const
Definition: G4EzVolume.hh:143
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:58

Member Data Documentation

G4LogicalVolume* G4EzVolume::lvsub
protected

Definition at line 58 of file G4EzVolume.hh.

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

G4int G4EzVolume::nplacement
protected

Definition at line 60 of file G4EzVolume.hh.

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

G4VSolid* G4EzVolume::solid
protected
G4VisAttributes* G4EzVolume::va
protected

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