ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EzVolume.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 // ====================================================================
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 // ====================================================================
47 class G4Material;
48 class G4VSolid;
49 class G4VPhysicalVolume;
50 
51 class G4EzVolume {
52 protected:
53  // volume information
57  G4LogicalVolume* lvsub; // logical volume for voxels
59  G4int nplacement; // # of placements
60 
61 public:
62  G4EzVolume();
63  G4EzVolume(const G4String& aname);
64  ~G4EzVolume();
65 
66  // createing volume
67  void CreateBoxVolume(G4Material* amaterial,
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 
130 inline const G4String& G4EzVolume::GetName() const { return name; }
131 
132 inline void G4EzVolume::SetSolid(G4VSolid* asolid) { solid= asolid; }
133 
134 inline const G4VSolid* G4EzVolume::GetSolid() const { return solid; }
135 
136 inline 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 
148 inline G4int G4EzVolume::GetNofPlacements() const { return nplacement; }
149 
150 inline void G4EzVolume::SetVisibility(G4bool qvisible)
151 {
152  if(va!=0) va-> SetVisibility(qvisible);
153 }
154 
155 inline void G4EzVolume::SetColor(const G4Color& color)
156 {
157  if(va!=0) va-> SetColor(color);
158 }
159 
160 inline void G4EzVolume::SetColor(G4double red, G4double green, G4double blue)
161 {
162  if(va!=0) va-> SetColor(red, green, blue);
163 }
164 
165 #endif