Geant4 VMC Version 6.8
Loading...
Searching...
No Matches
TG4GeometryServices.h
Go to the documentation of this file.
1#ifndef TG4_GEOMETRY_SERVICES_H
2#define TG4_GEOMETRY_SERVICES_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2014 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
17
18#include "TG4Globals.h"
19#include "TG4MediumMap.h"
20#include "TG4OpSurfaceMap.h"
21#include "TG4Verbose.h"
22
23#include <G4OpticalSurface.hh>
24#include <G4SurfaceProperty.hh>
25#include <G4Transform3D.hh>
26#include <G4Version.hh>
27#include <globals.hh>
28
29#include <Rtypes.h>
30#include <TMCOptical.h>
31
32#include <map>
33#include <vector>
34
35class TG4MediumMap;
36class TG4NameMap;
37class TG4Limits;
38class TG4G3CutVector;
40
41class G4Material;
42class G4LogicalVolume;
43class G4VPhysicalVolume;
44class G4UserLimits;
45class G4OpticalSurface;
46
47class TGeoHMatrix;
48
58{
59 std::vector<G4String> fNames;
60 std::vector<G4int> fCopyNos;
61};
62
70
72{
73 public:
75 virtual ~TG4GeometryServices();
76
77 // static access method
79
80 // methods
82 const TG4AssemblyLevels& GetAssemblyLevels(const G4VPhysicalVolume* pv) const;
83 // utilities
84 G4double* CreateG4doubleArray(Float_t* array, G4int size, G4bool copyValues = true) const;
85 G4double* CreateG4doubleArray(Double_t* array, G4int size, G4bool copyValues = true) const;
86 G4String CutName(const char* name) const;
87 G4String CutMaterialName(const char* name) const;
88 G4String CutVolumePath(
89 const G4String& volumePath, G4String& volName, G4int& copyNo) const;
90 const G4String& UserVolumeName(const G4String& name) const;
91
92 G4OpticalSurfaceModel SurfaceModel(EMCOpSurfaceModel model) const;
93 G4SurfaceType SurfaceType(EMCOpSurfaceType surfType) const;
94 G4OpticalSurfaceFinish SurfaceFinish(EMCOpSurfaceFinish finish) const;
95 void Convert(const G4Transform3D& transform, TGeoHMatrix& matrix) const;
96
97 G4Material* MixMaterials(G4String name, G4double density,
98 const TG4StringVector& matNames, const TG4doubleVector& matWeights);
99 // printing
100 void PrintLimits(const G4String& name) const;
101 void PrintVolumeLimits(const G4String& volumeName) const;
102 void PrintStatistics(G4bool open, G4bool close) const;
103 void PrintLogicalVolumeStore() const;
104 void PrintPhysicalVolumeStore() const;
105 void PrintElementTable() const;
106 void PrintMaterials() const;
107 void PrintMaterialsProperties() const;
108 void PrintMedia() const;
109 void PrintCuts(const G4String& cutName) const;
110 void PrintControls(const G4String& controlName) const;
111
112 // set methods
113 void SetWorld(G4VPhysicalVolume* world);
114 void SetIsG3toG4(G4bool isG3toG4);
115 void SetG3toG4Separator(char separator);
116 void SetAccountAssemblyLevels(G4bool option);
117
118 // get methods
119 // volumes
120 Int_t NofG3Volumes() const;
121 Int_t NofG4LogicalVolumes() const;
122 Int_t NofG4PhysicalVolumes() const;
123 G4VPhysicalVolume* GetWorld() const;
124
125 TG4Limits* GetLimits(G4UserLimits* limits) const;
126 TG4Limits* GetLimits(G4UserLimits* limits, const TG4G3CutVector& cuts,
127 const TG4G3ControlVector& controls) const;
128
129 G4LogicalVolume* FindLogicalVolume(
130 const G4String& name, G4bool silent = false) const;
131 G4VPhysicalVolume* FindPhysicalVolume(
132 const G4String& name, G4int copyNo, G4bool silent = false) const;
133 G4VPhysicalVolume* FindDaughter(const G4String& name, G4int copyNo,
134 G4LogicalVolume* mlv, G4bool silent = false) const;
135 TG4Limits* FindLimits(const G4String& name, G4bool silent = false) const;
136 TG4Limits* FindLimits2(const G4String& name, G4bool silent = false) const;
137 TG4Limits* FindLimits(const G4Material*, G4bool silent = false) const;
138
139 // materials
140 G4int GetMediumId(G4LogicalVolume* lv) const;
141 G4double GetEffA(G4Material* material) const;
142 G4double GetEffZ(G4Material* material) const;
143 G4Material* FindMaterial(G4double a, G4double z, G4double density) const;
144 G4Material* FindMaterial(G4double* a, G4double* z, G4double density,
145 G4int nmat, G4double* wmat) const;
146
147 TG4MediumMap* GetMediumMap() const;
149
150 private:
155
156 // methods
157 G4bool IsG3Volume(const G4String& lvName) const;
158 G4bool CompareElement(G4double a, G4double z, const G4Element* elem) const;
159 G4bool CompareMaterial(
160 G4int nofElements, G4double density, const G4Material* material) const;
161 G4double* ConvertAtomWeight(G4int nmat, G4double* a, G4double* wmat) const;
162
163 // static data members
165 static G4String fgBuffer;
166 static const G4double fgkAZTolerance;
167 static const G4double fgkDensityTolerance;
168
169 //
170 // data members
171
173 G4bool fIsG3toG4;
174
177
180
182 G4VPhysicalVolume* fWorld;
183
186
188 std::vector<TG4AssemblyLevels> fAssemblyLevels;
189
192};
193
194// inline methods
195
201
202inline void TG4GeometryServices::SetWorld(G4VPhysicalVolume* world)
203{
205 fWorld = world;
206}
207
208inline void TG4GeometryServices::SetIsG3toG4(G4bool isG3toG4)
209{
211 fIsG3toG4 = isG3toG4;
212}
213
215{
217 fAccountAssemblyLevels = option;
218}
219
220inline G4VPhysicalVolume* TG4GeometryServices::GetWorld() const
221{
223 return fWorld;
224}
225
227{
229 return fMediumMap;
230}
231
237
238#endif // TG4_GEOMETRY_SERVICES_H
Definition of the TG4Globals class and basic container types.
Definition of the TG4MediumMap class.
Definition of the TG4OpSurfaceMap typedef.
Definition of the TG4Verbose class.
Vector of control process values with convenient set/get methods.
Vector of kinetic energy cut values with convenient set/get methods.
void PrintControls(const G4String &controlName) const
G4VPhysicalVolume * GetWorld() const
G4String CutVolumePath(const G4String &volumePath, G4String &volName, G4int &copyNo) const
static const G4double fgkDensityTolerance
density tolerance (percentual)
static TG4GeometryServices * fgInstance
this instance
TG4OpSurfaceMap * fOpSurfaceMap
map of optical surfaces names to their objects
void PrintPhysicalVolumeStore() const
TG4MediumMap * fMediumMap
map of madia
TG4Limits * FindLimits(const G4String &name, G4bool silent=false) const
G4Material * FindMaterial(G4double a, G4double z, G4double density) const
void SetAccountAssemblyLevels(G4bool option)
G4OpticalSurfaceFinish SurfaceFinish(EMCOpSurfaceFinish finish) const
G4double * ConvertAtomWeight(G4int nmat, G4double *a, G4double *wmat) const
G4int GetMediumId(G4LogicalVolume *lv) const
G4Material * MixMaterials(G4String name, G4double density, const TG4StringVector &matNames, const TG4doubleVector &matWeights)
G4bool IsG3Volume(const G4String &lvName) const
G4double * CreateG4doubleArray(Float_t *array, G4int size, G4bool copyValues=true) const
void SetWorld(G4VPhysicalVolume *world)
TG4GeometryServices & operator=(const TG4GeometryServices &right)
Not implemented.
void PrintStatistics(G4bool open, G4bool close) const
G4LogicalVolume * FindLogicalVolume(const G4String &name, G4bool silent=false) const
const G4String & UserVolumeName(const G4String &name) const
G4String CutName(const char *name) const
static TG4GeometryServices * Instance()
G4SurfaceType SurfaceType(EMCOpSurfaceType surfType) const
TG4Limits * FindLimits2(const G4String &name, G4bool silent=false) const
G4bool CompareElement(G4double a, G4double z, const G4Element *elem) const
std::vector< TG4AssemblyLevels > fAssemblyLevels
assembly levels per placement, indexed by its Geant4 instance id
void PrintLimits(const G4String &name) const
void PrintMaterialsProperties() const
G4bool fAccountAssemblyLevels
option to account assembly levels in the volume level hierarchy
G4VPhysicalVolume * FindPhysicalVolume(const G4String &name, G4int copyNo, G4bool silent=false) const
TG4Limits * GetLimits(G4UserLimits *limits) const
G4bool fIsG3toG4
info if user geometry is defined via G3toG4
G4VPhysicalVolume * FindDaughter(const G4String &name, G4int copyNo, G4LogicalVolume *mlv, G4bool silent=false) const
void SetG3toG4Separator(char separator)
void SetIsG3toG4(G4bool isG3toG4)
G4VPhysicalVolume * fWorld
top physical volume (world)
G4bool fAssemblyLevelsBuilt
whether fAssemblyLevels has been filled
static const G4double fgkAZTolerance
A,Z tolerance.
TG4GeometryServices(const TG4GeometryServices &right)
Not implemented.
G4double GetEffA(G4Material *material) const
G4bool CompareMaterial(G4int nofElements, G4double density, const G4Material *material) const
G4String CutMaterialName(const char *name) const
void PrintVolumeLimits(const G4String &volumeName) const
G4OpticalSurfaceModel SurfaceModel(EMCOpSurfaceModel model) const
TG4MediumMap * GetMediumMap() const
void PrintCuts(const G4String &cutName) const
const TG4AssemblyLevels & GetAssemblyLevels(const G4VPhysicalVolume *pv) const
TG4OpSurfaceMap * GetOpSurfaceMap() const
void Convert(const G4Transform3D &transform, TGeoHMatrix &matrix) const
G4double GetEffZ(G4Material *material) const
static G4String fgBuffer
string buffer
Extended G4UserLimits class.
Definition TG4Limits.h:38
The map of media to logical volumes.
The map container for associated names.
Definition TG4NameMap.h:31
TG4Verbose(const G4String &cmdName)
std::map< G4String, G4OpticalSurface * > TG4OpSurfaceMap
The map between optical surfaces names and their objects.
std::vector< G4String > TG4StringVector
Definition TG4Globals.h:49
std::vector< G4double > TG4doubleVector
Definition TG4Globals.h:45
std::vector< G4int > fCopyNos
-1 where the Geant4 copy number applies
std::vector< G4String > fNames
outermost first; last is the placed volume