LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 51 of file G4EzVolume.hh.

Constructor & Destructor Documentation

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 }
G4String name
Definition: G4EzVolume.hh:54
G4LogicalVolume * lv
Definition: G4EzVolume.hh:56
G4VSolid * solid
Definition: G4EzVolume.hh:55
G4int nplacement
Definition: G4EzVolume.hh:59
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:57
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 }
G4String name
Definition: G4EzVolume.hh:54
G4LogicalVolume * lv
Definition: G4EzVolume.hh:56
G4VSolid * solid
Definition: G4EzVolume.hh:55
G4int nplacement
Definition: G4EzVolume.hh:59
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:57
G4EzVolume::~G4EzVolume ( )

Definition at line 73 of file G4EzVolume.cc.

75 {
76 }

Member Function Documentation

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

Definition at line 80 of file G4EzVolume.cc.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 167 of file G4EzVolume.cc.

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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

References lv, name, solid, and va.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 142 of file G4EzVolume.hh.

References lv.

Referenced by BOOST_PYTHON_MODULE(), and VoxelizeIt().

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

Definition at line 130 of file G4EzVolume.hh.

References name.

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

Definition at line 148 of file G4EzVolume.hh.

References nplacement.

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

Definition at line 134 of file G4EzVolume.hh.

References solid.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 186 of file G4EzVolume.cc.

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

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
199  G4VPhysicalVolume* world= G4EzWorld::GetWorldVolume();
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 }
G4String name
Definition: G4EzVolume.hh:54
G4LogicalVolume * lv
Definition: G4EzVolume.hh:56
G4int nplacement
Definition: G4EzVolume.hh:59
static G4VPhysicalVolume * GetWorldVolume()
Definition: G4EzWorld.hh:73
G4VPhysicalVolume * G4EzVolume::PlaceIt ( const G4Transform3D &  transform,
G4int  ncopy = 0,
G4EzVolume parent = 0 
)

Definition at line 211 of file G4EzVolume.cc.

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

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

Definition at line 236 of file G4EzVolume.cc.

References lv, name, and nplacement.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 155 of file G4EzVolume.hh.

References va.

Referenced by SetColor().

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

Definition at line 160 of file G4EzVolume.hh.

References SetColor(), and va.

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

Definition at line 136 of file G4EzVolume.hh.

References lv, and lvsub.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 300 of file G4EzVolume.cc.

References lv, and lvsub.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 132 of file G4EzVolume.hh.

References solid.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 150 of file G4EzVolume.hh.

References va.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 256 of file G4EzVolume.cc.

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

Referenced by BOOST_PYTHON_MODULE().

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

Member Data Documentation

G4LogicalVolume* G4EzVolume::lvsub
protected

Definition at line 57 of file G4EzVolume.hh.

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

G4int G4EzVolume::nplacement
protected

Definition at line 59 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: