Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4EzVolume.hh
이 파일의 문서화 페이지로 가기
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 66892 2013-01-17 10:57:59Z gunter $
27 // ====================================================================
28 // G4EzVolume.hh
29 //
30 // Utility class for supporting creating user geometry
31 //
32 // * wrapper of logical volume
33 //
34 // 2005 Q
35 // ====================================================================
36 #ifndef G4_EZ_VOLUME_H
37 #define G4_EZ_VOLUME_H
38 
39 #include "G4LogicalVolume.hh"
40 #include "G4VisAttributes.hh"
41 #include "G4Transform3D.hh"
42 
43 // ====================================================================
44 //
45 // class definition
46 //
47 // ====================================================================
48 class G4Material;
49 class G4VSolid;
50 class G4VPhysicalVolume;
51 
52 class G4EzVolume {
53 protected:
54  // volume information
58  G4LogicalVolume* lvsub; // logical volume for voxels
60  G4int nplacement; // # of placements
61 
62 public:
63  G4EzVolume();
64  G4EzVolume(const G4String& aname);
65  ~G4EzVolume();
66 
67  // createing volume
68  void CreateBoxVolume(G4Material* amaterial,
69  G4double dx, G4double dy, G4double dz);
70 
71  void CreateTubeVolume(G4Material* amaterial,
72  G4double rmin, G4double rmax,
73  G4double dz,
74  G4double phi0=0., G4double dphi=360*deg);
75 
76  void CreateConeVolume(G4Material* amaterial,
77  G4double rmin1, G4double rmax1,
78  G4double rmin2, G4double rmax2,
79  G4double dz,
80  G4double phi0=0., G4double dphi=360.*deg);
81 
82  void CreateSphereVolume(G4Material* amaterial,
83  G4double rmin, G4double rmax,
84  G4double phi0=0., G4double dphi=360.*deg,
85  G4double theta0=0., G4double dtheta=180.*deg);
86 
87  void CreateOrbVolume(G4Material* amaterial, G4double rmax);
88 
89 
90  // placement
92  G4EzVolume* parent=0);
93 
94  G4VPhysicalVolume* PlaceIt(const G4Transform3D& transform, G4int ncopy=0,
95  G4EzVolume* parent=0);
96  // replica
97  // parent volume should be exactly filled with replicated volumes.
99  EAxis pAxis, G4int nReplicas,
100  G4double width, G4double offset=0);
101  // voxelize
102  // volume should be "BOX". otherwise, error.
103  // returning voxel size in each dimension
105 
106  // sensitivity
107  // in the case of voxelized, SD will be set to a voxel.
109 
110  // direct access to properties
111  const G4String& GetName() const;
112 
113  void SetSolid(G4VSolid* asolid);
114  const G4VSolid* GetSolid() const;
115 
116  void SetMaterial(G4Material* amaterial);
117  G4Material* GetMaterial() const;
118 
119  G4int GetNofPlacements() const;
120 
121  void SetVisibility(G4bool qvisible);
122  void SetColor(const G4Color& color);
123  void SetColor(G4double red, G4double green, G4double blue);
124 
125 };
126 
127 // ====================================================================
128 // inline functions
129 // ====================================================================
130 
131 inline const G4String& G4EzVolume::GetName() const { return name; }
132 
133 inline void G4EzVolume::SetSolid(G4VSolid* asolid) { solid= asolid; }
134 
135 inline const G4VSolid* G4EzVolume::GetSolid() const { return solid; }
136 
137 inline void G4EzVolume::SetMaterial(G4Material* amaterial)
138 {
139  if(lv!= 0) lv-> SetMaterial(amaterial);
140  if(lvsub!= 0) lvsub-> SetMaterial(amaterial);
141 }
142 
144 {
145  if(lv!=0) return lv-> GetMaterial();
146  else return 0;
147 }
148 
150 
151 inline void G4EzVolume::SetVisibility(G4bool qvisible)
152 {
153  if(va!=0) va-> SetVisibility(qvisible);
154 }
155 
156 inline void G4EzVolume::SetColor(const G4Color& color)
157 {
158  if(va!=0) va-> SetColor(color);
159 }
160 
162 {
163  if(va!=0) va-> SetColor(red, green, blue);
164 }
165 
166 #endif
G4int GetNofPlacements() const
Definition: G4EzVolume.hh:149
G4String name
Definition: G4EzVolume.hh:55
G4LogicalVolume * lv
Definition: G4EzVolume.hh:57
static const G4double pos
Definition: test07.cc:36
G4ThreeVector VoxelizeIt(G4int nx, G4int ny, G4int nz)
Definition: G4EzVolume.cc:257
void SetSensitiveDetector(G4VSensitiveDetector *asd)
Definition: G4EzVolume.cc:301
G4VSolid * solid
Definition: G4EzVolume.hh:56
void CreateTubeVolume(G4Material *amaterial, G4double rmin, G4double rmax, G4double dz, G4double phi0=0., G4double dphi=360 *deg)
Definition: G4EzVolume.cc:101
void CreateConeVolume(G4Material *amaterial, G4double rmin1, G4double rmax1, G4double rmin2, G4double rmax2, G4double dz, G4double phi0=0., G4double dphi=360.*deg)
Definition: G4EzVolume.cc:122
Definition: test07.cc:36
void CreateOrbVolume(G4Material *amaterial, G4double rmax)
Definition: G4EzVolume.cc:168
G4Material * GetMaterial() const
Definition: G4EzVolume.hh:143
void SetSolid(G4VSolid *asolid)
Definition: G4EzVolume.hh:133
void SetVisibility(G4bool qvisible)
Definition: G4EzVolume.hh:151
const G4VSolid * GetSolid() const
Definition: G4EzVolume.hh:135
G4int nplacement
Definition: G4EzVolume.hh:60
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
#define width
const G4String & GetName() const
Definition: G4EzVolume.hh:131
void CreateBoxVolume(G4Material *amaterial, G4double dx, G4double dy, G4double dz)
Definition: G4EzVolume.cc:81
static constexpr double deg
Definition: G4SIunits.hh:152
void CreateSphereVolume(G4Material *amaterial, G4double rmin, G4double rmax, G4double phi0=0., G4double dphi=360.*deg, G4double theta0=0., G4double dtheta=180.*deg)
Definition: G4EzVolume.cc:146
G4VisAttributes * va
Definition: G4EzVolume.hh:59
void SetMaterial(G4Material *amaterial)
Definition: G4EzVolume.hh:137
int G4int
Definition: G4Types.hh:78
EAxis
Definition: geomdefs.hh:54
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:58
void SetColor(const G4Color &color)
Definition: G4EzVolume.hh:156
G4VPhysicalVolume * ReplicateIt(G4EzVolume *parent, EAxis pAxis, G4int nReplicas, G4double width, G4double offset=0)
Definition: G4EzVolume.cc:237
G4VPhysicalVolume * PlaceIt(const G4ThreeVector &pos, G4int ncopy=0, G4EzVolume *parent=0)
Definition: G4EzVolume.cc:187