53 theModel = right.theModel;
54 theFinish = right.theFinish;
55 sigma_alpha = right.sigma_alpha;
56 polish = right.polish;
57 theMaterialPropertiesTable = right.theMaterialPropertiesTable;
59 delete[] AngularDistribution;
61 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
62 *(AngularDistribution) = *(right.AngularDistribution);
64 delete[] AngularDistributionLUT;
65 AngularDistributionLUT =
new G4float[indexmax];
66 *(AngularDistributionLUT) = *(right.AngularDistributionLUT);
68 delete[] Reflectivity;
69 Reflectivity =
new G4float[RefMax];
70 *(Reflectivity) = *(right.Reflectivity);
72 delete DichroicVector;
74 *DichroicVector = *(right.DichroicVector);
86 , theMaterialPropertiesTable(nullptr)
88 AngularDistribution =
nullptr;
90 AngularDistributionLUT =
nullptr;
91 Reflectivity =
nullptr;
93 DichroicVector =
nullptr;
111 G4Exception(
"G4OpticalSurface::G4OpticalSurface()",
"mat309",
118 delete[] AngularDistribution;
120 delete[] AngularDistributionLUT;
122 delete[] Reflectivity;
124 delete DichroicVector;
133 this->theModel = right.theModel;
134 this->theFinish = right.theFinish;
135 this->sigma_alpha = right.sigma_alpha;
136 this->polish = right.polish;
137 this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
139 delete[] AngularDistribution;
140 this->AngularDistribution =
141 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
142 *(this->AngularDistribution) = *(right.AngularDistribution);
144 delete[] AngularDistributionLUT;
145 this->AngularDistributionLUT =
new G4float[indexmax];
146 *(this->AngularDistributionLUT) = *(right.AngularDistributionLUT);
148 delete[] Reflectivity;
149 this->Reflectivity =
new G4float[RefMax];
150 *(this->Reflectivity) = *(right.Reflectivity);
152 delete DichroicVector;
154 *(this->DichroicVector) = *(right.DichroicVector);
182 <<
" Surface finish = " <<
G4int(theFinish) <<
G4endl
184 <<
" Surface parameter " <<
G4endl <<
" ----------------- "
217 if(AngularDistribution ==
nullptr)
219 AngularDistribution =
220 new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
225 if(AngularDistributionLUT ==
nullptr)
227 AngularDistributionLUT =
new G4float[indexmax];
231 if(Reflectivity ==
nullptr)
233 Reflectivity =
new G4float[RefMax];
238 if(DichroicVector ==
nullptr)
256 readLUTFileName =
"PolishedLumirrorGlue.z";
259 readLUTFileName =
"PolishedLumirror.z";
262 readLUTFileName =
"PolishedTeflon.z";
265 readLUTFileName =
"PolishedTiO.z";
268 readLUTFileName =
"PolishedTyvek.z";
271 readLUTFileName =
"PolishedVM2000Glue.z";
274 readLUTFileName =
"PolishedVM2000.z";
277 readLUTFileName =
"EtchedLumirrorGlue.z";
280 readLUTFileName =
"EtchedLumirror.z";
283 readLUTFileName =
"EtchedTeflon.z";
286 readLUTFileName =
"EtchedTiO.z";
289 readLUTFileName =
"EtchedTyvek.z";
292 readLUTFileName =
"EtchedVM2000Glue.z";
295 readLUTFileName =
"EtchedVM2000.z";
298 readLUTFileName =
"GroundLumirrorGlue.z";
301 readLUTFileName =
"GroundLumirror.z";
304 readLUTFileName =
"GroundTeflon.z";
307 readLUTFileName =
"GroundTiO.z";
310 readLUTFileName =
"GroundTyvek.z";
313 readLUTFileName =
"GroundVM2000Glue.z";
316 readLUTFileName =
"GroundVM2000.z";
322 std::istringstream iss;
325 size_t idxmax = incidentIndexMax * thetaIndexMax * phiIndexMax;
326 for(
size_t i = 0; i < idxmax; ++i)
328 iss >> AngularDistribution[i];
330 G4cout <<
"LUT - data file: " << readLUTFileName <<
" read in! " <<
G4endl;
340 readLUTDAVISFileName =
"Rough_LUT.z";
343 readLUTDAVISFileName =
"RoughTeflon_LUT.z";
346 readLUTDAVISFileName =
"RoughESR_LUT.z";
349 readLUTDAVISFileName =
"RoughESRGrease_LUT.z";
352 readLUTDAVISFileName =
"Polished_LUT.z";
355 readLUTDAVISFileName =
"PolishedTeflon_LUT.z";
358 readLUTDAVISFileName =
"PolishedESR_LUT.z";
361 readLUTDAVISFileName =
"PolishedESRGrease_LUT.z";
364 readLUTDAVISFileName =
"Detector_LUT.z";
370 std::istringstream iss;
373 for(
size_t i = 0; i < indexmax; ++i)
375 iss >> AngularDistributionLUT[i];
377 G4cout <<
"LUT DAVIS - data file: " << readLUTDAVISFileName <<
" read in! "
383 G4String readReflectivityLUTFileName;
388 readReflectivityLUTFileName =
"Rough_LUTR.z";
391 readReflectivityLUTFileName =
"RoughTeflon_LUTR.z";
394 readReflectivityLUTFileName =
"RoughESR_LUTR.z";
397 readReflectivityLUTFileName =
"RoughESRGrease_LUTR.z";
400 readReflectivityLUTFileName =
"Polished_LUTR.z";
403 readReflectivityLUTFileName =
"PolishedTeflon_LUTR.z";
406 readReflectivityLUTFileName =
"PolishedESR_LUTR.z";
409 readReflectivityLUTFileName =
"PolishedESRGrease_LUTR.z";
412 readReflectivityLUTFileName =
"Detector_LUTR.z";
418 std::istringstream iss;
421 for(
size_t i = 0; i < RefMax; ++i)
423 iss >> Reflectivity[i];
425 G4cout <<
"LUT DAVIS - reflectivity data file: "
426 << readReflectivityLUTFileName <<
" read in! " <<
G4endl;
431 std::istringstream& iss)
435 G4String compfilename = path +
"/" + filename;
437 std::ifstream in(compfilename, std::ios::binary | std::ios::ate);
443 in.seekg(0, std::ios::beg);
445 Bytef* compdata =
new Bytef[fileSize];
448 in.read((
char*) compdata, fileSize);
451 uLongf complen = (uLongf)(fileSize * 4);
452 Bytef* uncompdata =
new Bytef[complen];
453 while(
Z_OK !=
uncompress(uncompdata, &complen, compdata, fileSize))
458 uncompdata =
new Bytef[complen];
463 dataString =
new G4String((
char*) uncompdata, (
long) complen);
470 ed <<
"Problem while trying to read " + compfilename +
" data file.\n";
471 G4Exception(
"G4OpticalSurface::ReadCompressedFile",
"mat316",
476 if(dataString !=
nullptr)
478 iss.str(*dataString);
481 G4cout <<
"G4OpticalSurface: data file " << compfilename
482 <<
" successfully read in." <<
G4endl;
490 if(datadir ==
nullptr)
492 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat313",
494 "Environment variable G4DICHROICDATA not defined");
498 std::ostringstream ost;
500 std::ifstream fin(ost.str().c_str());
504 ed <<
"Dichroic surface data file <" << ost.str().c_str()
505 <<
"> is not opened!" <<
G4endl;
506 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat314",
511 if(!(DichroicVector->
Retrieve(fin)))
514 ed <<
"Dichroic surface data file <" << ost.str().c_str()
515 <<
"> is not opened!" <<
G4endl;
516 G4Exception(
"G4OpticalSurface::ReadDichroicFile()",
"mat315",
523 G4cout <<
" *** Dichroic surface data file *** " <<
G4endl;
528 G4cout <<
"numberOfXNodes: " << numberOfXNodes <<
G4endl;
529 G4cout <<
"numberOfYNodes: " << numberOfYNodes <<
G4endl;
531 if(0 > numberOfXNodes || numberOfXNodes >=
INT_MAX)
535 if(0 > numberOfYNodes || numberOfYNodes >=
INT_MAX)
543 xVector.resize(numberOfXNodes, 0.);
544 yVector.resize(numberOfYNodes, 0.);
546 for(
G4int i = 0; i < numberOfXNodes; ++i)
549 xVector[i] = DichroicVector->
GetX(i);
551 for(
G4int j = 0; j < numberOfYNodes; ++j)
554 yVector[j] = DichroicVector->
GetY(j);
557 for(
G4int j = 0; j < numberOfYNodes; ++j)
559 for(
G4int i = 0; i < numberOfXNodes; ++i)
561 G4cout <<
" i: " << i <<
" j: " << j <<
" "
const char * G4FindDataDir(const char *)
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
void SetType(const G4SurfaceType &type) override
G4int GetThetaIndexMax() const
G4bool operator==(const G4OpticalSurface &right) const
G4OpticalSurface & operator=(const G4OpticalSurface &right)
void ReadCompressedFile(const G4String &, std::istringstream &)
G4OpticalSurface(const G4OpticalSurface &right)
G4int GetPhiIndexMax() const
G4bool operator!=(const G4OpticalSurface &right) const
~G4OpticalSurface() override
void SetFinish(const G4OpticalSurfaceFinish)
void ReadReflectivityLUTFile()
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)