Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 25 26 ////////////////////////////////////////////// 26 //////////////////////////////////////////////////////////////////////// 27 // G4OpticalSurface Definition 27 // G4OpticalSurface Definition 28 ////////////////////////////////////////////// 28 //////////////////////////////////////////////////////////////////////// 29 // 29 // 30 // File: G4OpticalSurface.hh 30 // File: G4OpticalSurface.hh 31 // Description: A optical surface class for us 31 // Description: A optical surface class for use in G4OpBoundaryProcess 32 // Version: 2.0 32 // Version: 2.0 33 // Created: 1997-06-26 33 // Created: 1997-06-26 34 // Author: Peter Gumplinger 34 // Author: Peter Gumplinger 35 // Updated: 1999-10-29 add method and clas 35 // Updated: 1999-10-29 add method and class descriptors 36 // 2017-02-24 Mariele Stockhoff a 36 // 2017-02-24 Mariele Stockhoff add DAVIS model 37 // 37 // 38 // Class Description: 38 // Class Description: 39 // A optical surface class for use in the G4Op 39 // A optical surface class for use in the G4OpBoundaryProcess class. 40 // Contains the enumerations: G4OpticalSurface 40 // Contains the enumerations: G4OpticalSurfaceFinish, G4OpticalSurfaceType, 41 // and G4OpticalSurfaceModel. 41 // and G4OpticalSurfaceModel. 42 ////////////////////////////////////////////// 42 //////////////////////////////////////////////////////////////////////// 43 43 44 #ifndef G4OpticalSurface_h 44 #ifndef G4OpticalSurface_h 45 #define G4OpticalSurface_h 1 45 #define G4OpticalSurface_h 1 46 46 47 #include "G4Physics2DVector.hh" 47 #include "G4Physics2DVector.hh" 48 #include "G4SurfaceProperty.hh" 48 #include "G4SurfaceProperty.hh" 49 #include "G4Types.hh" 49 #include "G4Types.hh" 50 50 51 // clang-format off 51 // clang-format off 52 enum G4OpticalSurfaceFinish 52 enum G4OpticalSurfaceFinish 53 { 53 { 54 polished, // smooth perfectly p 54 polished, // smooth perfectly polished surface 55 polishedfrontpainted, // smooth top-layer ( 55 polishedfrontpainted, // smooth top-layer (front) paint 56 polishedbackpainted, // same is 'polished' 56 polishedbackpainted, // same is 'polished' but with a back-paint 57 57 58 ground, // rough surface 58 ground, // rough surface 59 groundfrontpainted, // rough top-layer (fro 59 groundfrontpainted, // rough top-layer (front) paint 60 groundbackpainted, // same as 'ground' but 60 groundbackpainted, // same as 'ground' but with a back-paint 61 61 62 // for LBNL LUT model 62 // for LBNL LUT model 63 polishedlumirrorair, // mechanically polis 63 polishedlumirrorair, // mechanically polished surface, with lumirror 64 polishedlumirrorglue, // mechanically polis 64 polishedlumirrorglue, // mechanically polished surface, with lumirror & 65 // meltmount 65 // meltmount 66 polishedair, // mechanically polis 66 polishedair, // mechanically polished surface 67 polishedteflonair, // mechanically polis 67 polishedteflonair, // mechanically polished surface, with teflon 68 polishedtioair, // mechanically polis 68 polishedtioair, // mechanically polished surface, with tio paint 69 polishedtyvekair, // mechanically polis 69 polishedtyvekair, // mechanically polished surface, with tyvek 70 polishedvm2000air, // mechanically polis 70 polishedvm2000air, // mechanically polished surface, with esr film 71 polishedvm2000glue, // mechanically polis 71 polishedvm2000glue, // mechanically polished surface, with esr film & 72 // meltmount 72 // meltmount 73 73 74 etchedlumirrorair, // chemically etched su 74 etchedlumirrorair, // chemically etched surface, with lumirror 75 etchedlumirrorglue, // chemically etched su 75 etchedlumirrorglue, // chemically etched surface, with lumirror & meltmount 76 etchedair, // chemically etched su 76 etchedair, // chemically etched surface 77 etchedteflonair, // chemically etched su 77 etchedteflonair, // chemically etched surface, with teflon 78 etchedtioair, // chemically etched su 78 etchedtioair, // chemically etched surface, with tio paint 79 etchedtyvekair, // chemically etched su 79 etchedtyvekair, // chemically etched surface, with tyvek 80 etchedvm2000air, // chemically etched su 80 etchedvm2000air, // chemically etched surface, with esr film 81 etchedvm2000glue, // chemically etched su 81 etchedvm2000glue, // chemically etched surface, with esr film & meltmount 82 82 83 groundlumirrorair, // rough-cut surface, w 83 groundlumirrorair, // rough-cut surface, with lumirror 84 groundlumirrorglue, // rough-cut surface, w 84 groundlumirrorglue, // rough-cut surface, with lumirror & meltmount 85 groundair, // rough-cut surface 85 groundair, // rough-cut surface 86 groundteflonair, // rough-cut surface, w 86 groundteflonair, // rough-cut surface, with teflon 87 groundtioair, // rough-cut surface, w 87 groundtioair, // rough-cut surface, with tio paint 88 groundtyvekair, // rough-cut surface, w 88 groundtyvekair, // rough-cut surface, with tyvek 89 groundvm2000air, // rough-cut surface, w 89 groundvm2000air, // rough-cut surface, with esr film 90 groundvm2000glue, // rough-cut surface, w 90 groundvm2000glue, // rough-cut surface, with esr film & meltmount 91 91 92 // for DAVIS model 92 // for DAVIS model 93 Rough_LUT, // rough surface 93 Rough_LUT, // rough surface 94 RoughTeflon_LUT, // rough surface wra 94 RoughTeflon_LUT, // rough surface wrapped in Teflon tape 95 RoughESR_LUT, // rough surface wra 95 RoughESR_LUT, // rough surface wrapped with ESR 96 RoughESRGrease_LUT, // rough surface wra 96 RoughESRGrease_LUT, // rough surface wrapped with ESR 97 // and coupled with 97 // and coupled with optical grease 98 Polished_LUT, // polished surface 98 Polished_LUT, // polished surface 99 PolishedTeflon_LUT, // polished surface 99 PolishedTeflon_LUT, // polished surface wrapped in Teflon tape 100 PolishedESR_LUT, // polished surface 100 PolishedESR_LUT, // polished surface wrapped with ESR 101 PolishedESRGrease_LUT, // polished surface 101 PolishedESRGrease_LUT, // polished surface wrapped with ESR 102 // and coupled with 102 // and coupled with optical grease 103 Detector_LUT // polished surface 103 Detector_LUT // polished surface with optical grease 104 }; 104 }; 105 105 106 enum G4OpticalSurfaceModel 106 enum G4OpticalSurfaceModel 107 { 107 { 108 glisur, // original GEANT3 model 108 glisur, // original GEANT3 model 109 unified, // UNIFIED model 109 unified, // UNIFIED model 110 LUT, // Look-Up-Table model (LBNL model 110 LUT, // Look-Up-Table model (LBNL model) 111 DAVIS, // DAVIS model 111 DAVIS, // DAVIS model 112 dichroic // dichroic filter 112 dichroic // dichroic filter 113 }; 113 }; 114 114 115 // clang-format on 115 // clang-format on 116 116 117 class G4MaterialPropertiesTable; 117 class G4MaterialPropertiesTable; 118 118 119 class G4OpticalSurface : public G4SurfacePrope 119 class G4OpticalSurface : public G4SurfaceProperty 120 { 120 { 121 public: 121 public: 122 // Constructor of an optical surface object. 122 // Constructor of an optical surface object. 123 G4OpticalSurface(const G4String& name, G4Opt 123 G4OpticalSurface(const G4String& name, G4OpticalSurfaceModel model = glisur, 124 G4OpticalSurfaceFinish finish = polished, 124 G4OpticalSurfaceFinish finish = polished, G4SurfaceType type = dielectric_dielectric, 125 G4double value = 1.0); 125 G4double value = 1.0); 126 126 127 ~G4OpticalSurface() override; 127 ~G4OpticalSurface() override; 128 128 129 G4OpticalSurface(const G4OpticalSurface& rig 129 G4OpticalSurface(const G4OpticalSurface& right); 130 G4OpticalSurface& operator=(const G4OpticalS 130 G4OpticalSurface& operator=(const G4OpticalSurface& right); 131 131 132 G4bool operator==(const G4OpticalSurface& ri 132 G4bool operator==(const G4OpticalSurface& right) const; 133 G4bool operator!=(const G4OpticalSurface& ri 133 G4bool operator!=(const G4OpticalSurface& right) const; 134 134 135 void SetType(const G4SurfaceType& type) over 135 void SetType(const G4SurfaceType& type) override; 136 136 137 // Returns the optical surface finish. 137 // Returns the optical surface finish. 138 inline G4OpticalSurfaceFinish GetFinish() co 138 inline G4OpticalSurfaceFinish GetFinish() const { return theFinish; } 139 139 140 // Sets the optical surface finish. 140 // Sets the optical surface finish. 141 void SetFinish(const G4OpticalSurfaceFinish) 141 void SetFinish(const G4OpticalSurfaceFinish); 142 142 143 // Returns the optical surface model used. 143 // Returns the optical surface model used. 144 inline G4OpticalSurfaceModel GetModel() cons 144 inline G4OpticalSurfaceModel GetModel() const { return theModel; } 145 145 146 // Sets the optical surface model to be foll 146 // Sets the optical surface model to be followed. 147 inline void SetModel(const G4OpticalSurfaceM 147 inline void SetModel(const G4OpticalSurfaceModel model) { theModel = model; } 148 148 149 // Returns an unified model surface paramete 149 // Returns an unified model surface parameter. 150 inline G4double GetSigmaAlpha() const { retu 150 inline G4double GetSigmaAlpha() const { return sigma_alpha; } 151 151 152 // Sets an unified model surface parameter. 152 // Sets an unified model surface parameter. 153 inline void SetSigmaAlpha(const G4double s_a 153 inline void SetSigmaAlpha(const G4double s_a) { sigma_alpha = s_a; } 154 154 155 // Returns the optical surface polish type. 155 // Returns the optical surface polish type. 156 G4double GetPolish() const { return polish; 156 G4double GetPolish() const { return polish; } 157 157 158 // Sets the optical surface polish type. 158 // Sets the optical surface polish type. 159 inline void SetPolish(const G4double plsh) { 159 inline void SetPolish(const G4double plsh) { polish = plsh; } 160 160 161 // Retrieves the pointer of the G4MaterialPr 161 // Retrieves the pointer of the G4MaterialPropertiesTable 162 // attached to optical surface. 162 // attached to optical surface. 163 inline G4MaterialPropertiesTable* GetMateria 163 inline G4MaterialPropertiesTable* GetMaterialPropertiesTable() const 164 { 164 { 165 return theMaterialPropertiesTable; 165 return theMaterialPropertiesTable; 166 } 166 } 167 167 168 // Attaches a G4MaterialPropertiesTable to t 168 // Attaches a G4MaterialPropertiesTable to the optical surface. 169 inline void SetMaterialPropertiesTable(G4Mat 169 inline void SetMaterialPropertiesTable(G4MaterialPropertiesTable* anMPT) 170 { 170 { 171 theMaterialPropertiesTable = anMPT; 171 theMaterialPropertiesTable = anMPT; 172 } 172 } 173 173 174 // Prints information about the optical surf 174 // Prints information about the optical surface. 175 void DumpInfo() const; 175 void DumpInfo() const; 176 176 177 // call the correct ReadXXXFile 177 // call the correct ReadXXXFile 178 void ReadDataFile(); 178 void ReadDataFile(); 179 179 180 // read a zlib-compressed file 180 // read a zlib-compressed file 181 void ReadCompressedFile(const G4String&, std 181 void ReadCompressedFile(const G4String&, std::istringstream&); 182 182 183 // Method to read the Look-Up-Table into arr 183 // Method to read the Look-Up-Table into array AngularDistribution 184 void ReadLUTFile(); 184 void ReadLUTFile(); 185 185 186 // for DAVIS model 186 // for DAVIS model 187 inline G4double GetAngularDistributionValue( 187 inline G4double GetAngularDistributionValue(G4int, G4int, G4int); 188 188 189 // Returns the AngularDistributionValue 189 // Returns the AngularDistributionValue 190 inline G4double GetAngularDistributionValueL 190 inline G4double GetAngularDistributionValueLUT(G4int); 191 191 192 // Method to read the Davis Look-Up-Table in 192 // Method to read the Davis Look-Up-Table into array AngularDistribution 193 void ReadLUTDAVISFile(); 193 void ReadLUTDAVISFile(); 194 194 195 // Method to read the Look-Up-Table for refl 195 // Method to read the Look-Up-Table for reflectivity 196 void ReadReflectivityLUTFile(); 196 void ReadReflectivityLUTFile(); 197 197 198 // Returns the reflectivity value from the D 198 // Returns the reflectivity value from the Davis Look-Up-Table 199 inline G4double GetReflectivityLUTValue(G4in 199 inline G4double GetReflectivityLUTValue(G4int); 200 200 201 // Returns the number of lines in the Davis 201 // Returns the number of lines in the Davis Look-Up-Table 202 G4int GetInmax() const; 202 G4int GetInmax() const; 203 203 204 // Returns the number of probability values 204 // Returns the number of probability values per incidentangle 205 G4int GetLUTbins() const; 205 G4int GetLUTbins() const; 206 206 207 // Returns the number of reflectivity values 207 // Returns the number of reflectivity values per angle 208 G4int GetRefMax() const; 208 G4int GetRefMax() const; 209 209 210 G4int GetThetaIndexMax() const; 210 G4int GetThetaIndexMax() const; 211 G4int GetPhiIndexMax() const; 211 G4int GetPhiIndexMax() const; 212 212 213 // Method to read the dichroic surface data 213 // Method to read the dichroic surface data file into Dichroic 214 void ReadDichroicFile(); 214 void ReadDichroicFile(); 215 215 216 inline G4Physics2DVector* GetDichroicVector( 216 inline G4Physics2DVector* GetDichroicVector(); 217 217 218 private: 218 private: 219 G4OpticalSurfaceModel theModel; // Surface 219 G4OpticalSurfaceModel theModel; // Surface model 220 G4OpticalSurfaceFinish theFinish; // Surfac 220 G4OpticalSurfaceFinish theFinish; // Surface finish 221 221 222 G4double sigma_alpha; // The sigma of micro 222 G4double sigma_alpha; // The sigma of micro-facet polar angle 223 G4double polish; // Polish parameter in gli 223 G4double polish; // Polish parameter in glisur model 224 224 225 G4MaterialPropertiesTable* theMaterialProper 225 G4MaterialPropertiesTable* theMaterialPropertiesTable{nullptr}; 226 226 227 static const G4int incidentIndexMax = 91; 227 static const G4int incidentIndexMax = 91; 228 static const G4int thetaIndexMax = 45; 228 static const G4int thetaIndexMax = 45; 229 static const G4int phiIndexMax = 37; 229 static const G4int phiIndexMax = 37; 230 230 231 G4float* AngularDistribution; 231 G4float* AngularDistribution; 232 G4Physics2DVector* DichroicVector; 232 G4Physics2DVector* DichroicVector; 233 233 234 // for DAVIS model 234 // for DAVIS model 235 static const G4int indexmax = 7280001; // 3 235 static const G4int indexmax = 7280001; // 3640001; 236 static const G4int RefMax = 90; 236 static const G4int RefMax = 90; 237 static const G4int LUTbins = 20000; 237 static const G4int LUTbins = 20000; 238 G4float* AngularDistributionLUT; 238 G4float* AngularDistributionLUT; 239 G4float* Reflectivity; 239 G4float* Reflectivity; 240 }; 240 }; 241 241 242 //////////////////// 242 //////////////////// 243 // Inline methods 243 // Inline methods 244 //////////////////// 244 //////////////////// 245 245 246 inline G4double G4OpticalSurface::GetAngularDi 246 inline G4double G4OpticalSurface::GetAngularDistributionValue( 247 G4int angleIncident, G4int thetaIndex, G4int 247 G4int angleIncident, G4int thetaIndex, G4int phiIndex) 248 { 248 { 249 G4int product = angleIncident * thetaIndex * 249 G4int product = angleIncident * thetaIndex * phiIndex; 250 if (product < 0 || product >= incidentIndexM 250 if (product < 0 || product >= incidentIndexMax * thetaIndexMax * phiIndexMax) { 251 G4ExceptionDescription ed; 251 G4ExceptionDescription ed; 252 ed << "Index angleIncident: " << angleInci 252 ed << "Index angleIncident: " << angleIncident << " thetaIndex: " << thetaIndex 253 << " phiIndex: " << phiIndex << " out o 253 << " phiIndex: " << phiIndex << " out of range!"; 254 G4Exception("G4OpticalSurface::GetAngularD 254 G4Exception("G4OpticalSurface::GetAngularDistributionValue", "mat317", FatalException, ed); 255 return 0.; 255 return 0.; 256 } 256 } 257 return (G4double)AngularDistribution[angleIn 257 return (G4double)AngularDistribution[angleIncident + thetaIndex * incidentIndexMax + 258 phiInde 258 phiIndex * thetaIndexMax * incidentIndexMax]; 259 } 259 } 260 260 261 inline G4double G4OpticalSurface::GetAngularDi 261 inline G4double G4OpticalSurface::GetAngularDistributionValueLUT(G4int i) 262 { 262 { 263 if (i < 0 || i >= indexmax) { 263 if (i < 0 || i >= indexmax) { 264 G4ExceptionDescription ed; 264 G4ExceptionDescription ed; 265 ed << "Index " << i << " out of range!"; 265 ed << "Index " << i << " out of range!"; 266 G4Exception("G4OpticalSurface::GetAngularD 266 G4Exception("G4OpticalSurface::GetAngularDistributionValueLUT", "mat318", FatalException, ed); 267 return 0.; 267 return 0.; 268 } 268 } 269 return (G4double)AngularDistributionLUT[i]; 269 return (G4double)AngularDistributionLUT[i]; 270 } 270 } 271 271 272 inline G4double G4OpticalSurface::GetReflectiv 272 inline G4double G4OpticalSurface::GetReflectivityLUTValue(G4int i) 273 { 273 { 274 if (i < 0 || i >= RefMax) { 274 if (i < 0 || i >= RefMax) { 275 G4ExceptionDescription ed; 275 G4ExceptionDescription ed; 276 ed << "Index " << i << " out of range!"; 276 ed << "Index " << i << " out of range!"; 277 G4Exception("G4OpticalSurface::GetReflecti 277 G4Exception("G4OpticalSurface::GetReflectivityLUTValue", "mat319", FatalException, ed); 278 return 0.; 278 return 0.; 279 } 279 } 280 return (G4double)Reflectivity[i]; 280 return (G4double)Reflectivity[i]; 281 } 281 } 282 282 283 inline G4Physics2DVector* G4OpticalSurface::Ge 283 inline G4Physics2DVector* G4OpticalSurface::GetDichroicVector() { return DichroicVector; } 284 284 285 #endif /* G4OpticalSurface_h */ 285 #endif /* G4OpticalSurface_h */ 286 286