52 theModel = right.theModel;
53 theFinish = right.theFinish;
54 sigma_alpha = right.sigma_alpha;
55 polish = right.polish;
56 theMaterialPropertiesTable = right.theMaterialPropertiesTable;
58 delete[] AngularDistribution;
59 AngularDistribution =
new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
60 *(AngularDistribution) = *(right.AngularDistribution);
62 delete[] AngularDistributionLUT;
63 AngularDistributionLUT =
new G4float[indexmax];
64 *(AngularDistributionLUT) = *(right.AngularDistributionLUT);
66 delete[] Reflectivity;
67 Reflectivity =
new G4float[RefMax];
68 *(Reflectivity) = *(right.Reflectivity);
70 delete DichroicVector;
72 *DichroicVector = *(right.DichroicVector);
81 AngularDistribution =
nullptr;
83 AngularDistributionLUT =
nullptr;
84 Reflectivity =
nullptr;
86 DichroicVector =
nullptr;
104 "Constructor called with INVALID model.");
110 delete[] AngularDistribution;
112 delete[] AngularDistributionLUT;
114 delete[] Reflectivity;
116 delete DichroicVector;
125 this->theModel = right.theModel;
126 this->theFinish = right.theFinish;
127 this->sigma_alpha = right.sigma_alpha;
128 this->polish = right.polish;
129 this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
131 delete[] AngularDistribution;
132 this->AngularDistribution =
new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
133 *(this->AngularDistribution) = *(right.AngularDistribution);
135 delete[] AngularDistributionLUT;
136 this->AngularDistributionLUT =
new G4float[indexmax];
137 *(this->AngularDistributionLUT) = *(right.AngularDistributionLUT);
139 delete[] Reflectivity;
140 this->Reflectivity =
new G4float[RefMax];
141 *(this->Reflectivity) = *(right.Reflectivity);
143 delete DichroicVector;
145 *(this->DichroicVector) = *(right.DichroicVector);
173 <<
" Surface finish = " <<
G4int(theFinish) <<
G4endl
174 <<
" Surface model = " <<
G4int(theModel) <<
G4endl <<
G4endl <<
" Surface parameter "
204 if (AngularDistribution ==
nullptr) {
205 AngularDistribution =
new G4float[incidentIndexMax * thetaIndexMax * phiIndexMax];
210 if (AngularDistributionLUT ==
nullptr) {
211 AngularDistributionLUT =
new G4float[indexmax];
215 if (Reflectivity ==
nullptr) {
216 Reflectivity =
new G4float[RefMax];
221 if (DichroicVector ==
nullptr) {
237 readLUTFileName =
"PolishedLumirrorGlue.z";
240 readLUTFileName =
"PolishedLumirror.z";
243 readLUTFileName =
"PolishedTeflon.z";
246 readLUTFileName =
"PolishedTiO.z";
249 readLUTFileName =
"PolishedTyvek.z";
252 readLUTFileName =
"PolishedVM2000Glue.z";
255 readLUTFileName =
"PolishedVM2000.z";
258 readLUTFileName =
"EtchedLumirrorGlue.z";
261 readLUTFileName =
"EtchedLumirror.z";
264 readLUTFileName =
"EtchedTeflon.z";
267 readLUTFileName =
"EtchedTiO.z";
270 readLUTFileName =
"EtchedTyvek.z";
273 readLUTFileName =
"EtchedVM2000Glue.z";
276 readLUTFileName =
"EtchedVM2000.z";
279 readLUTFileName =
"GroundLumirrorGlue.z";
282 readLUTFileName =
"GroundLumirror.z";
285 readLUTFileName =
"GroundTeflon.z";
288 readLUTFileName =
"GroundTiO.z";
291 readLUTFileName =
"GroundTyvek.z";
294 readLUTFileName =
"GroundVM2000Glue.z";
297 readLUTFileName =
"GroundVM2000.z";
303 std::istringstream iss;
306 size_t idxmax = incidentIndexMax * thetaIndexMax * phiIndexMax;
307 for (
size_t i = 0; i < idxmax; ++i) {
308 iss >> AngularDistribution[i];
310 G4cout <<
"LUT - data file: " << readLUTFileName <<
" read in! " <<
G4endl;
319 readLUTDAVISFileName =
"Rough_LUT.z";
322 readLUTDAVISFileName =
"RoughTeflon_LUT.z";
325 readLUTDAVISFileName =
"RoughESR_LUT.z";
328 readLUTDAVISFileName =
"RoughESRGrease_LUT.z";
331 readLUTDAVISFileName =
"Polished_LUT.z";
334 readLUTDAVISFileName =
"PolishedTeflon_LUT.z";
337 readLUTDAVISFileName =
"PolishedESR_LUT.z";
340 readLUTDAVISFileName =
"PolishedESRGrease_LUT.z";
343 readLUTDAVISFileName =
"Detector_LUT.z";
349 std::istringstream iss;
352 for (
size_t i = 0; i < indexmax; ++i) {
353 iss >> AngularDistributionLUT[i];
355 G4cout <<
"LUT DAVIS - data file: " << readLUTDAVISFileName <<
" read in! " <<
G4endl;
360 G4String readReflectivityLUTFileName;
364 readReflectivityLUTFileName =
"Rough_LUTR.z";
367 readReflectivityLUTFileName =
"RoughTeflon_LUTR.z";
370 readReflectivityLUTFileName =
"RoughESR_LUTR.z";
373 readReflectivityLUTFileName =
"RoughESRGrease_LUTR.z";
376 readReflectivityLUTFileName =
"Polished_LUTR.z";
379 readReflectivityLUTFileName =
"PolishedTeflon_LUTR.z";
382 readReflectivityLUTFileName =
"PolishedESR_LUTR.z";
385 readReflectivityLUTFileName =
"PolishedESRGrease_LUTR.z";
388 readReflectivityLUTFileName =
"Detector_LUTR.z";
394 std::istringstream iss;
397 for (
size_t i = 0; i < RefMax; ++i) {
398 iss >> Reflectivity[i];
400 G4cout <<
"LUT DAVIS - reflectivity data file: " << readReflectivityLUTFileName <<
" read in! "
409 G4String compfilename = path +
"/" + filename;
411 std::ifstream in(compfilename, std::ios::binary | std::ios::ate);
416 in.seekg(0, std::ios::beg);
418 auto compdata =
new Bytef[fileSize];
420 in.read((
char*)compdata, fileSize);
423 auto complen = (uLongf)(fileSize * 4);
424 auto uncompdata =
new Bytef[complen];
425 while (
Z_OK !=
uncompress(uncompdata, &complen, compdata, fileSize)) {
429 uncompdata =
new Bytef[complen];
434 dataString =
new G4String((
char*)uncompdata, (
long)complen);
440 ed <<
"Problem while trying to read " + compfilename +
" data file.\n";
445 if (dataString !=
nullptr) {
446 iss.str(*dataString);
449 G4cout <<
"G4OpticalSurface: data file " << compfilename <<
" successfully read in." <<
G4endl;
457 if (datadir ==
nullptr) {
459 "Environment variable G4DICHROICDATA not defined");
463 std::ostringstream ost;
465 std::ifstream fin(ost.str().c_str());
466 if (! fin.is_open()) {
468 ed <<
"Dichroic surface data file <" << ost.str().c_str() <<
"> is not opened!" <<
G4endl;
473 if (! (DichroicVector->
Retrieve(fin))) {
475 ed <<
"Dichroic surface data file <" << ost.str().c_str() <<
"> is not opened!" <<
G4endl;
482 G4cout <<
" *** Dichroic surface data file *** " <<
G4endl;
487 G4cout <<
"numberOfXNodes: " << numberOfXNodes <<
G4endl;
488 G4cout <<
"numberOfYNodes: " << numberOfYNodes <<
G4endl;
490 if (0 > numberOfXNodes || numberOfXNodes >=
INT_MAX) {
493 if (0 > numberOfYNodes || numberOfYNodes >=
INT_MAX) {
500 xVector.resize(numberOfXNodes, 0.);
501 yVector.resize(numberOfYNodes, 0.);
503 for (
G4int i = 0; i < numberOfXNodes; ++i) {
505 xVector[i] = DichroicVector->
GetX(i);
507 for (
G4int j = 0; j < numberOfYNodes; ++j) {
509 yVector[j] = DichroicVector->
GetY(j);
512 for (
G4int j = 0; j < numberOfYNodes; ++j) {
513 for (
G4int i = 0; i < numberOfXNodes; ++i) {
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 &)
G4int GetPhiIndexMax() const
G4bool operator!=(const G4OpticalSurface &right) const
~G4OpticalSurface() override
void SetFinish(const G4OpticalSurfaceFinish)
G4OpticalSurface(const G4String &name, G4OpticalSurfaceModel model=glisur, G4OpticalSurfaceFinish finish=polished, G4SurfaceType type=dielectric_dielectric, G4double value=1.0)
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)