Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EzVolume.hh
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 //
26 // $Id: G4EzVolume.hh,v 1.1 2008-12-01 07:07:34 kmura Exp $
27 // $Name: not supported by cvs2svn $
28 // ====================================================================
29 // G4EzVolume.hh
30 //
31 // Utility class for supporting creating user geometry
32 //
33 // * wrapper of logical volume
34 //
35 // 2005 Q
36 // ====================================================================
37 #ifndef G4_EZ_VOLUME_H
38 #define G4_EZ_VOLUME_H
39 
40 #include "G4LogicalVolume.hh"
41 #include "G4VisAttributes.hh"
42 #include "G4Transform3D.hh"
43 
44 // ====================================================================
45 //
46 // class definition
47 //
48 // ====================================================================
49 class G4Material;
50 class G4VSolid;
51 class G4VPhysicalVolume;
52 
53 class G4EzVolume {
54 protected:
55  // volume information
59  G4LogicalVolume* lvsub; // logical volume for voxels
61  G4int nplacement; // # of placements
62 
63 public:
64  G4EzVolume();
65  G4EzVolume(const G4String& aname);
66  ~G4EzVolume();
67 
68  // createing volume
69  void CreateBoxVolume(G4Material* amaterial,
70  G4double dx, G4double dy, G4double dz);
71 
72  void CreateTubeVolume(G4Material* amaterial,
73  G4double rmin, G4double rmax,
74  G4double dz,
75  G4double phi0=0., G4double dphi=360*deg);
76 
77  void CreateConeVolume(G4Material* amaterial,
78  G4double rmin1, G4double rmax1,
79  G4double rmin2, G4double rmax2,
80  G4double dz,
81  G4double phi0=0., G4double dphi=360.*deg);
82 
83  void CreateSphereVolume(G4Material* amaterial,
84  G4double rmin, G4double rmax,
85  G4double phi0=0., G4double dphi=360.*deg,
86  G4double theta0=0., G4double dtheta=180.*deg);
87 
88  void CreateOrbVolume(G4Material* amaterial, G4double rmax);
89 
90 
91  // placement
92  G4VPhysicalVolume* PlaceIt(const G4ThreeVector& pos, G4int ncopy=0,
93  G4EzVolume* parent=0);
94 
95  G4VPhysicalVolume* PlaceIt(const G4Transform3D& transform, G4int ncopy=0,
96  G4EzVolume* parent=0);
97  // replica
98  // parent volume should be exactly filled with replicated volumes.
100  EAxis pAxis, G4int nReplicas,
101  G4double width, G4double offset=0);
102  // voxelize
103  // volume should be "BOX". otherwise, error.
104  // returning voxel size in each dimension
106 
107  // sensitivity
108  // in the case of voxelized, SD will be set to a voxel.
110 
111  // direct access to properties
112  const G4String& GetName() const;
113 
114  void SetSolid(G4VSolid* asolid);
115  const G4VSolid* GetSolid() const;
116 
117  void SetMaterial(G4Material* amaterial);
118  G4Material* GetMaterial() const;
119 
120  G4int GetNofPlacements() const;
121 
122  void SetVisibility(G4bool qvisible);
123  void SetColor(const G4Color& color);
124  void SetColor(G4double red, G4double green, G4double blue);
125 
126 };
127 
128 // ====================================================================
129 // inline functions
130 // ====================================================================
131 
132 inline const G4String& G4EzVolume::GetName() const { return name; }
133 
134 inline void G4EzVolume::SetSolid(G4VSolid* asolid) { solid= asolid; }
135 
136 inline const G4VSolid* G4EzVolume::GetSolid() const { return solid; }
137 
138 inline void G4EzVolume::SetMaterial(G4Material* amaterial)
139 {
140  if(lv!= 0) lv-> SetMaterial(amaterial);
141  if(lvsub!= 0) lvsub-> SetMaterial(amaterial);
142 }
143 
145 {
146  if(lv!=0) return lv-> GetMaterial();
147  else return 0;
148 }
149 
151 
152 inline void G4EzVolume::SetVisibility(G4bool qvisible)
153 {
154  if(va!=0) va-> SetVisibility(qvisible);
155 }
156 
157 inline void G4EzVolume::SetColor(const G4Color& color)
158 {
159  if(va!=0) va-> SetColor(color);
160 }
161 
163 {
164  if(va!=0) va-> SetColor(red, green, blue);
165 }
166 
167 #endif