53 theModel = right.theModel;
54 theFinish = right.theFinish;
55 sigma_alpha = right.sigma_alpha;
56 polish = right.polish;
57 theMaterialPropertiesTable = right.theMaterialPropertiesTable;
59 if(AngularDistribution)
60 delete[] AngularDistribution;
62 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
63 *(AngularDistribution) = *(right.AngularDistribution);
65 if(AngularDistributionLUT)
66 delete[] AngularDistributionLUT;
67 AngularDistributionLUT =
new G4float[indexmax];
68 *(AngularDistributionLUT) = *(right.AngularDistributionLUT);
71 delete[] Reflectivity;
72 Reflectivity =
new G4float[RefMax];
73 *(Reflectivity) = *(right.Reflectivity);
76 delete DichroicVector;
78 *DichroicVector = *(right.DichroicVector);
90 , theMaterialPropertiesTable(nullptr)
92 AngularDistribution =
nullptr;
94 AngularDistributionLUT =
nullptr;
95 Reflectivity =
nullptr;
97 DichroicVector =
nullptr;
115 G4Exception(
"G4OpticalSurface::G4OpticalSurface()",
"mat309",
122 if(AngularDistribution)
123 delete[] AngularDistribution;
125 if(AngularDistributionLUT)
126 delete[] AngularDistributionLUT;
128 delete[] Reflectivity;
131 delete DichroicVector;
140 this->theModel = right.theModel;
141 this->theFinish = right.theFinish;
142 this->sigma_alpha = right.sigma_alpha;
143 this->polish = right.polish;
144 this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
146 if(this->AngularDistribution)
147 delete[] AngularDistribution;
148 this->AngularDistribution =
149 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
150 *(this->AngularDistribution) = *(right.AngularDistribution);
152 if(this->AngularDistributionLUT)
153 delete[] AngularDistributionLUT;
154 this->AngularDistributionLUT =
new G4float[indexmax];
155 *(this->AngularDistributionLUT) = *(right.AngularDistributionLUT);
156 if(this->Reflectivity)
157 delete[] Reflectivity;
158 this->Reflectivity =
new G4float[RefMax];
159 *(this->Reflectivity) = *(right.Reflectivity);
161 if(this->DichroicVector)
162 delete DichroicVector;
164 *(this->DichroicVector) = *(right.DichroicVector);
192 <<
" Surface finish = " <<
G4int(theFinish) <<
G4endl
194 <<
" Surface parameter " <<
G4endl <<
" ----------------- "
227 if(!AngularDistribution)
228 AngularDistribution =
229 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
233 if(!AngularDistributionLUT)
234 AngularDistributionLUT =
new G4float[indexmax];
238 Reflectivity =
new G4float[RefMax];
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;
327 size_t idxmax = incidentIndexMax * thetaIndexMax * phiIndexMax;
328 for(
size_t i = 0; i < idxmax; ++i)
330 iss >> AngularDistribution[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)
377 iss >> AngularDistributionLUT[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)
425 iss >> Reflectivity[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",
513 if(!(DichroicVector->
Retrieve(fin)))
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)
547 xVector[i] = DichroicVector->
GetX(i);
549 for(
G4int j = 0; j < numberOfYNodes; ++j)
552 yVector[j] = DichroicVector->
GetY(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)
void SetType(const G4SurfaceType &type) override
void ReadLUTDAVISFile(void)
G4int GetRefMax(void) const
G4int GetThetaIndexMax(void) const
G4int GetPhiIndexMax(void) const
G4bool operator==(const G4OpticalSurface &right) const
G4OpticalSurface & operator=(const G4OpticalSurface &right)
G4OpticalSurface(const G4OpticalSurface &right)
void ReadReflectivityLUTFile(void)
G4bool operator!=(const G4OpticalSurface &right) const
G4int GetLUTbins(void) const
void ReadCompressedFile(G4String, std::istringstream &)
void SetFinish(const G4OpticalSurfaceFinish)
G4int GetInmax(void) const
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
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)