ATLAS Offline Software
Geo2G4OpticalSurfaceFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
9 
10 #include "G4OpticalSurface.hh"
11 
13 {
14 }
15 
16 G4OpticalSurface* Geo2G4OpticalSurfaceFactory::Build(const GeoOpticalSurface* geoOpticalSurface)
17 {
18  //
19  // Check if this surface has already been defined.
20  //
21  if(m_definedOptSurfaces.find(geoOpticalSurface) != m_definedOptSurfaces.end()) {
22  return m_definedOptSurfaces[geoOpticalSurface];
23  }
24 
25  // map enums
26  G4OpticalSurfaceModel g4Model;
27  G4OpticalSurfaceFinish g4Finish;
28  G4SurfaceType g4Type;
29 
30  switch(geoOpticalSurface->GetModel())
31  {
33  {
34  g4Model = glisur;
35  break;
36  }
38  {
39  g4Model = unified;
40  break;
41  }
42  default:
43  g4Model = glisur;
44  }
45 
46  switch(geoOpticalSurface->GetFinish())
47  {
49  {
50  g4Finish = polished;
51  break;
52  }
54  {
55  g4Finish = polishedfrontpainted;
56  break;
57  }
59  {
60  g4Finish = polishedbackpainted;
61  break;
62  }
64  {
65  g4Finish = ground;
66  break;
67  }
69  {
70  g4Finish = groundfrontpainted;
71  break;
72  }
74  {
75  g4Finish = groundbackpainted;
76  break;
77  }
78  default:
79  g4Finish = polished;
80  }
81 
82  switch(geoOpticalSurface->GetType())
83  {
85  {
86  g4Type = dielectric_metal;
87  break;
88  }
90  {
91  g4Type = dielectric_dielectric;
92  break;
93  }
95  {
96  g4Type = firsov;
97  break;
98  }
100  {
101  g4Type = x_ray;
102  break;
103  }
104  default:
105  g4Type = dielectric_dielectric;
106  }
107 
108 
109 
110  G4OpticalSurface* newG4Surface = new G4OpticalSurface(geoOpticalSurface->GetName(),
111  g4Model,
112  g4Finish,
113  g4Type,
114  geoOpticalSurface->GetParameter());
115 
116  // Create material properties table
117  const GeoMaterialPropertiesTable* geoPropTable = geoOpticalSurface->GetMaterialPropertiesTable();
118 
119  if(geoPropTable){
120  Geo2G4MatPropTableFactory tFactory;
121  G4MaterialPropertiesTable* g4PropTable = tFactory.Build(geoPropTable);
122  if(g4PropTable)
123  newG4Surface->SetMaterialPropertiesTable(g4PropTable);
124  }
125 
126  return newG4Surface;
127 }
GeoOpticalSurface::x_ray
@ x_ray
Definition: GeoOpticalSurface.h:27
GeoOpticalSurface.h
GeoOpticalSurface::dielectric_metal
@ dielectric_metal
Definition: GeoOpticalSurface.h:24
Geo2G4MatPropTableFactory
Definition: Geo2G4MatPropTableFactory.h:11
GeoOpticalSurface::polishedfrontpainted
@ polishedfrontpainted
Definition: GeoOpticalSurface.h:33
GeoOpticalSurface::dielectric_dielectric
@ dielectric_dielectric
Definition: GeoOpticalSurface.h:25
GeoOpticalSurface::ground
@ ground
Definition: GeoOpticalSurface.h:35
GeoOpticalSurface::GetType
GeoSurfaceType GetType() const
Definition: GeoOpticalSurface.h:57
GeoOpticalSurface::GetFinish
GeoOpticalSurfaceFinish GetFinish() const
Definition: GeoOpticalSurface.h:58
GeoOpticalSurface::firsov
@ firsov
Definition: GeoOpticalSurface.h:26
GeoOpticalSurface::GetParameter
double GetParameter() const
Definition: GeoOpticalSurface.h:60
GeoOpticalSurface::unified
@ unified
Definition: GeoOpticalSurface.h:43
Geo2G4OpticalSurfaceFactory::Geo2G4OpticalSurfaceFactory
Geo2G4OpticalSurfaceFactory()
Definition: Geo2G4OpticalSurfaceFactory.cxx:12
GeoOpticalSurface::GetName
std::string GetName() const
Definition: GeoOpticalSurface.h:56
GeoOpticalSurface
Ensure that the extensions for the Vector3D are properly loaded.
Definition: GeoOpticalSurface.h:19
GeoOpticalSurface::GetMaterialPropertiesTable
GeoMaterialPropertiesTable * GetMaterialPropertiesTable()
Definition: GeoOpticalSurface.h:65
GeoOpticalSurface::glisur
@ glisur
Definition: GeoOpticalSurface.h:42
GeoOpticalSurface::groundfrontpainted
@ groundfrontpainted
Definition: GeoOpticalSurface.h:36
GeoOpticalSurface::polishedbackpainted
@ polishedbackpainted
Definition: GeoOpticalSurface.h:34
Geo2G4MatPropTableFactory.h
Geo2G4MatPropTableFactory::Build
G4MaterialPropertiesTable * Build(const GeoMaterialPropertiesTable *)
Definition: Geo2G4MatPropTableFactory.cxx:21
GeoMaterialPropertiesTable
Definition: GeoMaterialPropertiesTable.h:20
GeoOpticalSurface::polished
@ polished
Definition: GeoOpticalSurface.h:32
Geo2G4OpticalSurfaceFactory.h
GeoOpticalSurface::GetModel
GeoOpticalSurfaceModel GetModel() const
Definition: GeoOpticalSurface.h:59
Geo2G4OpticalSurfaceFactory::m_definedOptSurfaces
Geo2G4OptSurfaceMap m_definedOptSurfaces
Definition: Geo2G4OpticalSurfaceFactory.h:22
GeoOpticalSurface::groundbackpainted
@ groundbackpainted
Definition: GeoOpticalSurface.h:37
Geo2G4OpticalSurfaceFactory::Build
G4OpticalSurface * Build(const GeoOpticalSurface *)
Definition: Geo2G4OpticalSurfaceFactory.cxx:16