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 // Snapshot reflection provenance on the master for worker name lookups.
84 const TG4AssemblyLevels& GetAssemblyLevels(const G4VPhysicalVolume* pv) const;
85 // utilities
86 G4double* CreateG4doubleArray(Float_t* array, G4int size, G4bool copyValues = true) const;
87 G4double* CreateG4doubleArray(Double_t* array, G4int size, G4bool copyValues = true) const;
88 G4String CutName(const char* name) const;
89 G4String CutMaterialName(const char* name) const;
90 G4String CutVolumePath(
91 const G4String& volumePath, G4String& volName, G4int& copyNo) const;
92 const G4String& UserVolumeName(const G4String& name) const;
93 // Reflection provenance, without guessing from a name suffix.
94 const G4String& GetConstituentVolumeName(G4LogicalVolume* lv) const;
95 // VMC source name: constituent name followed by Gsposp normalization.
96 G4String UserVolumeName(G4LogicalVolume* lv) const;
97
98 G4OpticalSurfaceModel SurfaceModel(EMCOpSurfaceModel model) const;
99 G4SurfaceType SurfaceType(EMCOpSurfaceType surfType) const;
100 G4OpticalSurfaceFinish SurfaceFinish(EMCOpSurfaceFinish finish) const;
101 void Convert(const G4Transform3D& transform, TGeoHMatrix& matrix) const;
102
103 G4Material* MixMaterials(G4String name, G4double density,
104 const TG4StringVector& matNames, const TG4doubleVector& matWeights);
105 // printing
106 void PrintLimits(const G4String& name) const;
107 void PrintVolumeLimits(const G4String& volumeName) const;
108 void PrintStatistics(G4bool open, G4bool close) const;
109 void PrintLogicalVolumeStore() const;
110 void PrintPhysicalVolumeStore() const;
111 void PrintElementTable() const;
112 void PrintMaterials() const;
113 void PrintMaterialsProperties() const;
114 void PrintMedia() const;
115 void PrintCuts(const G4String& cutName) const;
116 void PrintControls(const G4String& controlName) const;
117
118 // set methods
119 void SetWorld(G4VPhysicalVolume* world);
120 void SetIsG3toG4(G4bool isG3toG4);
121 void SetG3toG4Separator(char separator);
122 void SetAccountAssemblyLevels(G4bool option);
123
124 // get methods
125 // volumes
126 Int_t NofG3Volumes() const;
127 Int_t NofG4LogicalVolumes() const;
128 Int_t NofG4PhysicalVolumes() const;
129 G4VPhysicalVolume* GetWorld() const;
130
131 TG4Limits* GetLimits(G4UserLimits* limits) const;
132 TG4Limits* GetLimits(G4UserLimits* limits, const TG4G3CutVector& cuts,
133 const TG4G3ControlVector& controls) const;
134
135 // All Geant4 representations of a VMC source volume.
136 std::vector<G4LogicalVolume*> FindLogicalVolumes(
137 const G4String& name, G4bool silent = false) const;
138 // Representative only; use the plural form for assignments.
139 G4LogicalVolume* FindLogicalVolume(
140 const G4String& name, G4bool silent = false) const;
141 G4VPhysicalVolume* FindPhysicalVolume(
142 const G4String& name, G4int copyNo, G4bool silent = false) const;
143 G4VPhysicalVolume* FindDaughter(const G4String& name, G4int copyNo,
144 G4LogicalVolume* mlv, G4bool silent = false) const;
145 TG4Limits* FindLimits(const G4String& name, G4bool silent = false) const;
146 TG4Limits* FindLimits2(const G4String& name, G4bool silent = false) const;
147 TG4Limits* FindLimits(const G4Material*, G4bool silent = false) const;
148
149 // materials
150 G4int GetMediumId(G4LogicalVolume* lv) const;
151 G4double GetEffA(G4Material* material) const;
152 G4double GetEffZ(G4Material* material) const;
153 G4Material* FindMaterial(G4double a, G4double z, G4double density) const;
154 G4Material* FindMaterial(G4double* a, G4double* z, G4double density,
155 G4int nmat, G4double* wmat) const;
156
157 TG4MediumMap* GetMediumMap() const;
159
160 private:
165
166 // methods
167 G4bool IsG3Volume(const G4String& lvName) const;
168 G4bool CompareElement(G4double a, G4double z, const G4Element* elem) const;
169 G4bool CompareMaterial(
170 G4int nofElements, G4double density, const G4Material* material) const;
171 G4double* ConvertAtomWeight(G4int nmat, G4double* a, G4double* wmat) const;
172
173 // static data members
175 static thread_local G4String fgBuffer;
176 static const G4double fgkAZTolerance;
177 static const G4double fgkDensityTolerance;
178
179 //
180 // data members
181
183 G4bool fIsG3toG4;
184
186 std::map<G4LogicalVolume*, G4LogicalVolume*> fConstituentVolumes;
187
190
193
195 G4VPhysicalVolume* fWorld;
196
199
201 std::vector<TG4AssemblyLevels> fAssemblyLevels;
202
205};
206
207// inline methods
208
214
215inline void TG4GeometryServices::SetWorld(G4VPhysicalVolume* world)
216{
218 fWorld = world;
219}
220
221inline void TG4GeometryServices::SetIsG3toG4(G4bool isG3toG4)
222{
224 fIsG3toG4 = isG3toG4;
225}
226
228{
230 fAccountAssemblyLevels = option;
231}
232
233inline G4VPhysicalVolume* TG4GeometryServices::GetWorld() const
234{
236 return fWorld;
237}
238
240{
242 return fMediumMap;
243}
244
250
251#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
std::map< G4LogicalVolume *, G4LogicalVolume * > fConstituentVolumes
Master-built reflection provenance, read-only during tracking.
G4VPhysicalVolume * FindDaughter(const G4String &name, G4int copyNo, G4LogicalVolume *mlv, G4bool silent=false) const
void SetG3toG4Separator(char separator)
const G4String & GetConstituentVolumeName(G4LogicalVolume *lv) const
void SetIsG3toG4(G4bool isG3toG4)
G4VPhysicalVolume * fWorld
top physical volume (world)
std::vector< G4LogicalVolume * > FindLogicalVolumes(const G4String &name, G4bool silent=false) const
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