Geant4-11
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// ====================================================================
27// G4EzVolume.hh
28//
29// Utility class for supporting creating user geometry
30//
31// * wrapper of logical volume
32//
33// 2005 Q
34// ====================================================================
35#ifndef G4_EZ_VOLUME_H
36#define G4_EZ_VOLUME_H
37
38#include "G4LogicalVolume.hh"
39#include "G4VisAttributes.hh"
40#include "G4Transform3D.hh"
41
42// ====================================================================
43//
44// class definition
45//
46// ====================================================================
47class G4Material;
48class G4VSolid;
50
52protected:
53 // volume information
57 G4LogicalVolume* lvsub; // logical volume for voxels
59 G4int nplacement; // # of placements
60
61public:
62 G4EzVolume();
63 G4EzVolume(const G4String& aname);
65
66 // createing volume
67 void CreateBoxVolume(G4Material* amaterial,
68 G4double dx, G4double dy, G4double dz);
69
70 void CreateTubeVolume(G4Material* amaterial,
71 G4double rmin, G4double rmax,
72 G4double dz,
73 G4double phi0=0., G4double dphi=360*deg);
74
75 void CreateConeVolume(G4Material* amaterial,
76 G4double rmin1, G4double rmax1,
77 G4double rmin2, G4double rmax2,
78 G4double dz,
79 G4double phi0=0., G4double dphi=360.*deg);
80
81 void CreateSphereVolume(G4Material* amaterial,
82 G4double rmin, G4double rmax,
83 G4double phi0=0., G4double dphi=360.*deg,
84 G4double theta0=0., G4double dtheta=180.*deg);
85
86 void CreateOrbVolume(G4Material* amaterial, G4double rmax);
87
88
89 // placement
91 G4EzVolume* parent=0);
92
94 G4EzVolume* parent=0);
95 // replica
96 // parent volume should be exactly filled with replicated volumes.
98 EAxis pAxis, G4int nReplicas,
99 G4double width, G4double offset=0);
100 // voxelize
101 // volume should be "BOX". otherwise, error.
102 // returning voxel size in each dimension
104
105 // sensitivity
106 // in the case of voxelized, SD will be set to a voxel.
108
109 // direct access to properties
110 const G4String& GetName() const;
111
112 void SetSolid(G4VSolid* asolid);
113 const G4VSolid* GetSolid() const;
114
115 void SetMaterial(G4Material* amaterial);
116 G4Material* GetMaterial() const;
117
118 G4int GetNofPlacements() const;
119
120 void SetVisibility(G4bool qvisible);
121 void SetColor(const G4Color& color);
122 void SetColor(G4double red, G4double green, G4double blue);
123
124};
125
126// ====================================================================
127// inline functions
128// ====================================================================
129
130inline const G4String& G4EzVolume::GetName() const { return name; }
131
132inline void G4EzVolume::SetSolid(G4VSolid* asolid) { solid= asolid; }
133
134inline const G4VSolid* G4EzVolume::GetSolid() const { return solid; }
135
136inline void G4EzVolume::SetMaterial(G4Material* amaterial)
137{
138 if(lv!= 0) lv-> SetMaterial(amaterial);
139 if(lvsub!= 0) lvsub-> SetMaterial(amaterial);
140}
141
143{
144 if(lv!=0) return lv-> GetMaterial();
145 else return 0;
146}
147
149
151{
152 if(va!=0) va-> SetVisibility(qvisible);
153}
154
155inline void G4EzVolume::SetColor(const G4Color& color)
156{
157 if(va!=0) va-> SetColor(color);
158}
159
160inline void G4EzVolume::SetColor(G4double red, G4double green, G4double blue)
161{
162 if(va!=0) va-> SetColor(red, green, blue);
163}
164
165#endif
static const G4double pos
static constexpr double deg
Definition: G4SIunits.hh:132
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
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:145
void CreateConeVolume(G4Material *amaterial, G4double rmin1, G4double rmax1, G4double rmin2, G4double rmax2, G4double dz, G4double phi0=0., G4double dphi=360.*deg)
Definition: G4EzVolume.cc:121
const G4VSolid * GetSolid() const
Definition: G4EzVolume.hh:134
void SetSolid(G4VSolid *asolid)
Definition: G4EzVolume.hh:132
const G4String & GetName() const
Definition: G4EzVolume.hh:130
G4VPhysicalVolume * PlaceIt(const G4ThreeVector &pos, G4int ncopy=0, G4EzVolume *parent=0)
Definition: G4EzVolume.cc:186
G4int nplacement
Definition: G4EzVolume.hh:59
G4Material * GetMaterial() const
Definition: G4EzVolume.hh:142
void SetMaterial(G4Material *amaterial)
Definition: G4EzVolume.hh:136
void CreateTubeVolume(G4Material *amaterial, G4double rmin, G4double rmax, G4double dz, G4double phi0=0., G4double dphi=360 *deg)
Definition: G4EzVolume.cc:100
void CreateOrbVolume(G4Material *amaterial, G4double rmax)
Definition: G4EzVolume.cc:167
void SetSensitiveDetector(G4VSensitiveDetector *asd)
Definition: G4EzVolume.cc:300
void SetColor(const G4Color &color)
Definition: G4EzVolume.hh:155
G4LogicalVolume * lvsub
Definition: G4EzVolume.hh:57
G4VPhysicalVolume * ReplicateIt(G4EzVolume *parent, EAxis pAxis, G4int nReplicas, G4double width, G4double offset=0)
Definition: G4EzVolume.cc:236
G4String name
Definition: G4EzVolume.hh:54
G4VSolid * solid
Definition: G4EzVolume.hh:55
void CreateBoxVolume(G4Material *amaterial, G4double dx, G4double dy, G4double dz)
Definition: G4EzVolume.cc:80
G4ThreeVector VoxelizeIt(G4int nx, G4int ny, G4int nz)
Definition: G4EzVolume.cc:256
void SetVisibility(G4bool qvisible)
Definition: G4EzVolume.hh:150
G4VisAttributes * va
Definition: G4EzVolume.hh:58
G4LogicalVolume * lv
Definition: G4EzVolume.hh:56
G4int GetNofPlacements() const
Definition: G4EzVolume.hh:148
EAxis
Definition: geomdefs.hh:54
G4bool transform(G4String &input, const G4String &type)