90 , theMaterialPropertiesTable(nullptr)
115 G4Exception(
"G4OpticalSurface::G4OpticalSurface()",
"mat309",
194 <<
" Surface parameter " <<
G4endl <<
" ----------------- "
258 readLUTFileName =
"PolishedLumirrorGlue.z";
261 readLUTFileName =
"PolishedLumirror.z";
264 readLUTFileName =
"PolishedTeflon.z";
267 readLUTFileName =
"PolishedTiO.z";
270 readLUTFileName =
"PolishedTyvek.z";
273 readLUTFileName =
"PolishedVM2000Glue.z";
276 readLUTFileName =
"PolishedVM2000.z";
279 readLUTFileName =
"EtchedLumirrorGlue.z";
282 readLUTFileName =
"EtchedLumirror.z";
285 readLUTFileName =
"EtchedTeflon.z";
288 readLUTFileName =
"EtchedTiO.z";
291 readLUTFileName =
"EtchedTyvek.z";
294 readLUTFileName =
"EtchedVM2000Glue.z";
297 readLUTFileName =
"EtchedVM2000.z";
300 readLUTFileName =
"GroundLumirrorGlue.z";
303 readLUTFileName =
"GroundLumirror.z";
306 readLUTFileName =
"GroundTeflon.z";
309 readLUTFileName =
"GroundTiO.z";
312 readLUTFileName =
"GroundTyvek.z";
315 readLUTFileName =
"GroundVM2000Glue.z";
318 readLUTFileName =
"GroundVM2000.z";
324 std::istringstream iss;
328 for(
size_t i = 0; i < idxmax; ++i)
332 G4cout <<
"LUT - data file: " << readLUTFileName <<
" read in! " <<
G4endl;
342 readLUTDAVISFileName =
"Rough_LUT.z";
345 readLUTDAVISFileName =
"RoughTeflon_LUT.z";
348 readLUTDAVISFileName =
"RoughESR_LUT.z";
351 readLUTDAVISFileName =
"RoughESRGrease_LUT.z";
354 readLUTDAVISFileName =
"Polished_LUT.z";
357 readLUTDAVISFileName =
"PolishedTeflon_LUT.z";
360 readLUTDAVISFileName =
"PolishedESR_LUT.z";
363 readLUTDAVISFileName =
"PolishedESRGrease_LUT.z";
366 readLUTDAVISFileName =
"Detector_LUT.z";
372 std::istringstream iss;
375 for(
size_t i = 0; i <
indexmax; ++i)
379 G4cout <<
"LUT DAVIS - data file: " << readLUTDAVISFileName <<
" read in! "
385 G4String readReflectivityLUTFileName;
390 readReflectivityLUTFileName =
"Rough_LUTR.z";
393 readReflectivityLUTFileName =
"RoughTeflon_LUTR.z";
396 readReflectivityLUTFileName =
"RoughESR_LUTR.z";
399 readReflectivityLUTFileName =
"RoughESRGrease_LUTR.z";
402 readReflectivityLUTFileName =
"Polished_LUTR.z";
405 readReflectivityLUTFileName =
"PolishedTeflon_LUTR.z";
408 readReflectivityLUTFileName =
"PolishedESR_LUTR.z";
411 readReflectivityLUTFileName =
"PolishedESRGrease_LUTR.z";
414 readReflectivityLUTFileName =
"Detector_LUTR.z";
420 std::istringstream iss;
423 for(
size_t i = 0; i <
RefMax; ++i)
427 G4cout <<
"LUT DAVIS - reflectivity data file: "
428 << readReflectivityLUTFileName <<
" read in! " <<
G4endl;
433 std::istringstream& iss)
436 G4String path = std::getenv(
"G4REALSURFACEDATA");
437 G4String compfilename = path +
"/" + filename;
439 std::ifstream in(compfilename, std::ios::binary | std::ios::ate);
443 int fileSize = in.tellg();
445 in.seekg(0, std::ios::beg);
447 Bytef* compdata =
new Bytef[fileSize];
450 in.read((
char*) compdata, fileSize);
453 uLongf complen = (uLongf)(fileSize * 4);
454 Bytef* uncompdata =
new Bytef[complen];
455 while(
Z_OK !=
uncompress(uncompdata, &complen, compdata, fileSize))
460 uncompdata =
new Bytef[complen];
465 dataString =
new G4String((
char*) uncompdata, (
long) complen);
472 ed <<
"Problem while trying to read " + compfilename +
" data file.\n";
473 G4Exception(
"G4OpticalSurface::ReadCompressedFile",
"mat316",
480 iss.str(*dataString);
483 G4cout <<
"G4OpticalSurface: data file " << compfilename
484 <<
" successfully read in." <<
G4endl;
490 const char* datadir = std::getenv(
"G4DICHROICDATA");
494 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat313",
496 "Environment variable G4DICHROICDATA not defined");
500 std::ostringstream ost;
502 std::ifstream fin(ost.str().c_str());
506 ed <<
"Dichroic surface data file <" << ost.str().c_str()
507 <<
"> is not opened!" <<
G4endl;
508 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat314",
516 ed <<
"Dichroic surface data file <" << ost.str().c_str()
517 <<
"> is not opened!" <<
G4endl;
518 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat315",
525 G4cout <<
" *** Dichroic surface data file *** " <<
G4endl;
530 G4cout <<
"numberOfXNodes: " << numberOfXNodes <<
G4endl;
531 G4cout <<
"numberOfYNodes: " << numberOfYNodes <<
G4endl;
533 if(0 > numberOfXNodes || numberOfXNodes >=
INT_MAX)
535 if(0 > numberOfYNodes || numberOfYNodes >=
INT_MAX)
541 xVector.resize(numberOfXNodes, 0.);
542 yVector.resize(numberOfYNodes, 0.);
544 for(
G4int i = 0; i < numberOfXNodes; ++i)
549 for(
G4int j = 0; j < numberOfYNodes; ++j)
555 for(
G4int j = 0; j < numberOfYNodes; ++j)
557 for(
G4int i = 0; i < numberOfXNodes; ++i)
559 G4cout <<
" i: " << i <<
" j: " << j <<
" "
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4double > G4PV2DDataVector
G4GLOB_DLL std::ostream G4cout
virtual ~G4OpticalSurface()
void ReadDichroicFile(void)
G4OpticalSurfaceFinish theFinish
void SetType(const G4SurfaceType &type) override
void ReadLUTDAVISFile(void)
G4int GetRefMax(void) const
static const G4int phiIndexMax
G4float * AngularDistribution
G4float * AngularDistributionLUT
static const G4int LUTbins
G4int GetThetaIndexMax(void) const
G4int GetPhiIndexMax(void) const
static const G4int incidentIndexMax
static const G4int indexmax
G4bool operator==(const G4OpticalSurface &right) const
G4OpticalSurface & operator=(const G4OpticalSurface &right)
G4OpticalSurface(const G4OpticalSurface &right)
void ReadReflectivityLUTFile(void)
static const G4int thetaIndexMax
G4OpticalSurfaceModel theModel
G4bool operator!=(const G4OpticalSurface &right) const
static const G4int RefMax
G4int GetLUTbins(void) const
void ReadCompressedFile(G4String, std::istringstream &)
void SetFinish(const G4OpticalSurfaceFinish)
G4Physics2DVector * DichroicVector
G4int GetInmax(void) const
G4MaterialPropertiesTable * theMaterialPropertiesTable
G4bool Retrieve(std::ifstream &fIn)
std::size_t GetLengthX() const
std::size_t GetLengthY() const
G4double GetValue(std::size_t idx, std::size_t idy) const
G4double GetX(std::size_t index) const
G4double GetY(std::size_t index) const
const char * name(G4int ptype)
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)