File indexing completed on 2025-01-18 09:58:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef G4OpticalSurface_h
0045 #define G4OpticalSurface_h 1
0046
0047 #include "G4Physics2DVector.hh"
0048 #include "G4SurfaceProperty.hh"
0049 #include "G4Types.hh"
0050
0051
0052 enum G4OpticalSurfaceFinish
0053 {
0054 polished,
0055 polishedfrontpainted,
0056 polishedbackpainted,
0057
0058 ground,
0059 groundfrontpainted,
0060 groundbackpainted,
0061
0062
0063 polishedlumirrorair,
0064 polishedlumirrorglue,
0065
0066 polishedair,
0067 polishedteflonair,
0068 polishedtioair,
0069 polishedtyvekair,
0070 polishedvm2000air,
0071 polishedvm2000glue,
0072
0073
0074 etchedlumirrorair,
0075 etchedlumirrorglue,
0076 etchedair,
0077 etchedteflonair,
0078 etchedtioair,
0079 etchedtyvekair,
0080 etchedvm2000air,
0081 etchedvm2000glue,
0082
0083 groundlumirrorair,
0084 groundlumirrorglue,
0085 groundair,
0086 groundteflonair,
0087 groundtioair,
0088 groundtyvekair,
0089 groundvm2000air,
0090 groundvm2000glue,
0091
0092
0093 Rough_LUT,
0094 RoughTeflon_LUT,
0095 RoughESR_LUT,
0096 RoughESRGrease_LUT,
0097
0098 Polished_LUT,
0099 PolishedTeflon_LUT,
0100 PolishedESR_LUT,
0101 PolishedESRGrease_LUT,
0102
0103 Detector_LUT
0104 };
0105
0106 enum G4OpticalSurfaceModel
0107 {
0108 glisur,
0109 unified,
0110 LUT,
0111 DAVIS,
0112 dichroic
0113 };
0114
0115
0116
0117 class G4MaterialPropertiesTable;
0118
0119 class G4OpticalSurface : public G4SurfaceProperty
0120 {
0121 public:
0122
0123 G4OpticalSurface(const G4String& name, G4OpticalSurfaceModel model = glisur,
0124 G4OpticalSurfaceFinish finish = polished, G4SurfaceType type = dielectric_dielectric,
0125 G4double value = 1.0);
0126
0127 ~G4OpticalSurface() override;
0128
0129 G4OpticalSurface(const G4OpticalSurface& right);
0130 G4OpticalSurface& operator=(const G4OpticalSurface& right);
0131
0132 G4bool operator==(const G4OpticalSurface& right) const;
0133 G4bool operator!=(const G4OpticalSurface& right) const;
0134
0135 void SetType(const G4SurfaceType& type) override;
0136
0137
0138 inline G4OpticalSurfaceFinish GetFinish() const { return theFinish; }
0139
0140
0141 void SetFinish(const G4OpticalSurfaceFinish);
0142
0143
0144 inline G4OpticalSurfaceModel GetModel() const { return theModel; }
0145
0146
0147 inline void SetModel(const G4OpticalSurfaceModel model) { theModel = model; }
0148
0149
0150 inline G4double GetSigmaAlpha() const { return sigma_alpha; }
0151
0152
0153 inline void SetSigmaAlpha(const G4double s_a) { sigma_alpha = s_a; }
0154
0155
0156 G4double GetPolish() const { return polish; }
0157
0158
0159 inline void SetPolish(const G4double plsh) { polish = plsh; }
0160
0161
0162
0163 inline G4MaterialPropertiesTable* GetMaterialPropertiesTable() const
0164 {
0165 return theMaterialPropertiesTable;
0166 }
0167
0168
0169 inline void SetMaterialPropertiesTable(G4MaterialPropertiesTable* anMPT)
0170 {
0171 theMaterialPropertiesTable = anMPT;
0172 }
0173
0174
0175 void DumpInfo() const;
0176
0177
0178 void ReadDataFile();
0179
0180
0181 void ReadCompressedFile(const G4String&, std::istringstream&);
0182
0183
0184 void ReadLUTFile();
0185
0186
0187 inline G4double GetAngularDistributionValue(G4int, G4int, G4int);
0188
0189
0190 inline G4double GetAngularDistributionValueLUT(G4int);
0191
0192
0193 void ReadLUTDAVISFile();
0194
0195
0196 void ReadReflectivityLUTFile();
0197
0198
0199 inline G4double GetReflectivityLUTValue(G4int);
0200
0201
0202 G4int GetInmax() const;
0203
0204
0205 G4int GetLUTbins() const;
0206
0207
0208 G4int GetRefMax() const;
0209
0210 G4int GetThetaIndexMax() const;
0211 G4int GetPhiIndexMax() const;
0212
0213
0214 void ReadDichroicFile();
0215
0216 inline G4Physics2DVector* GetDichroicVector();
0217
0218 private:
0219 G4OpticalSurfaceModel theModel;
0220 G4OpticalSurfaceFinish theFinish;
0221
0222 G4double sigma_alpha;
0223 G4double polish;
0224
0225 G4MaterialPropertiesTable* theMaterialPropertiesTable{nullptr};
0226
0227 static const G4int incidentIndexMax = 91;
0228 static const G4int thetaIndexMax = 45;
0229 static const G4int phiIndexMax = 37;
0230
0231 G4float* AngularDistribution;
0232 G4Physics2DVector* DichroicVector;
0233
0234
0235 static const G4int indexmax = 7280001;
0236 static const G4int RefMax = 90;
0237 static const G4int LUTbins = 20000;
0238 G4float* AngularDistributionLUT;
0239 G4float* Reflectivity;
0240 };
0241
0242
0243
0244
0245
0246 inline G4double G4OpticalSurface::GetAngularDistributionValue(
0247 G4int angleIncident, G4int thetaIndex, G4int phiIndex)
0248 {
0249 G4int product = angleIncident * thetaIndex * phiIndex;
0250 if (product < 0 || product >= incidentIndexMax * thetaIndexMax * phiIndexMax) {
0251 G4ExceptionDescription ed;
0252 ed << "Index angleIncident: " << angleIncident << " thetaIndex: " << thetaIndex
0253 << " phiIndex: " << phiIndex << " out of range!";
0254 G4Exception("G4OpticalSurface::GetAngularDistributionValue", "mat317", FatalException, ed);
0255 return 0.;
0256 }
0257 return (G4double)AngularDistribution[angleIncident + thetaIndex * incidentIndexMax +
0258 phiIndex * thetaIndexMax * incidentIndexMax];
0259 }
0260
0261 inline G4double G4OpticalSurface::GetAngularDistributionValueLUT(G4int i)
0262 {
0263 if (i < 0 || i >= indexmax) {
0264 G4ExceptionDescription ed;
0265 ed << "Index " << i << " out of range!";
0266 G4Exception("G4OpticalSurface::GetAngularDistributionValueLUT", "mat318", FatalException, ed);
0267 return 0.;
0268 }
0269 return (G4double)AngularDistributionLUT[i];
0270 }
0271
0272 inline G4double G4OpticalSurface::GetReflectivityLUTValue(G4int i)
0273 {
0274 if (i < 0 || i >= RefMax) {
0275 G4ExceptionDescription ed;
0276 ed << "Index " << i << " out of range!";
0277 G4Exception("G4OpticalSurface::GetReflectivityLUTValue", "mat319", FatalException, ed);
0278 return 0.;
0279 }
0280 return (G4double)Reflectivity[i];
0281 }
0282
0283 inline G4Physics2DVector* G4OpticalSurface::GetDichroicVector() { return DichroicVector; }
0284
0285 #endif