Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpticalSurface Class Reference

#include <G4OpticalSurface.hh>

Inheritance diagram for G4OpticalSurface:
Collaboration diagram for G4OpticalSurface:

Public Member Functions

 G4OpticalSurface (const G4OpticalSurface &right)
 
G4OpticalSurfaceoperator= (const G4OpticalSurface &right)
 
G4int operator== (const G4OpticalSurface &right) const
 
G4int operator!= (const G4OpticalSurface &right) const
 
 G4OpticalSurface (const G4String &name, G4OpticalSurfaceModel model=glisur, G4OpticalSurfaceFinish finish=polished, G4SurfaceType type=dielectric_dielectric, G4double value=1.0)
 
virtual ~G4OpticalSurface ()
 
void SetType (const G4SurfaceType &type)
 
G4OpticalSurfaceFinish GetFinish () const
 
void SetFinish (const G4OpticalSurfaceFinish)
 
G4OpticalSurfaceModel GetModel () const
 
void SetModel (const G4OpticalSurfaceModel model)
 
G4double GetSigmaAlpha () const
 
void SetSigmaAlpha (const G4double s_a)
 
G4double GetPolish () const
 
void SetPolish (const G4double plsh)
 
G4MaterialPropertiesTableGetMaterialPropertiesTable () const
 
void SetMaterialPropertiesTable (G4MaterialPropertiesTable *anMPT)
 
void DumpInfo () const
 
void ReadLUTFile (void)
 
G4double GetAngularDistributionValue (G4int, G4int, G4int)
 
G4int GetThetaIndexMax (void) const
 
G4int GetPhiIndexMax (void) const
 
void ReadDichroicFile (void)
 
G4Physics2DVectorGetDichroicVector ()
 
- Public Member Functions inherited from G4SurfaceProperty
 G4SurfaceProperty (const G4String &name, G4SurfaceType type=x_ray)
 
 G4SurfaceProperty ()
 
virtual ~G4SurfaceProperty ()
 
const G4StringGetName () const
 
void SetName (const G4String &name)
 
const G4SurfaceTypeGetType () const
 
void SetType (const G4SurfaceType &type)
 

Additional Inherited Members

- Static Public Member Functions inherited from G4SurfaceProperty
static void CleanSurfacePropertyTable ()
 
static const
G4SurfacePropertyTable
GetSurfacePropertyTable ()
 
static size_t GetNumberOfSurfaceProperties ()
 
static void DumpTableInfo ()
 
- Protected Attributes inherited from G4SurfaceProperty
G4String theName
 
G4SurfaceType theType
 
- Static Protected Attributes inherited from G4SurfaceProperty
static G4SurfacePropertyTable theSurfacePropertyTable
 

Detailed Description

Definition at line 113 of file G4OpticalSurface.hh.

Constructor & Destructor Documentation

G4OpticalSurface::G4OpticalSurface ( const G4OpticalSurface right)

Definition at line 136 of file G4OpticalSurface.cc.

137  : G4SurfaceProperty(right.theName,right.theType)
138 {
139  *this = right;
140  this->theName = right.theName;
141  this->theType = right.theType;
142  this->theModel = right.theModel;
143  this->theFinish = right.theFinish;
144  this->sigma_alpha = right.sigma_alpha;
145  this->polish = right.polish;
146  this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
147  if (this->AngularDistribution) delete [] AngularDistribution;
148  this->AngularDistribution =
149  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
150  *(this->AngularDistribution) = *(right.AngularDistribution);
151  if (this->DichroicVector) delete DichroicVector;
152  this->DichroicVector = new G4Physics2DVector();
153  *(this->DichroicVector) = *(right.DichroicVector);
154 }
float G4float
Definition: G4Types.hh:77
G4OpticalSurface::G4OpticalSurface ( const G4String name,
G4OpticalSurfaceModel  model = glisur,
G4OpticalSurfaceFinish  finish = polished,
G4SurfaceType  type = dielectric_dielectric,
G4double  value = 1.0 
)

Definition at line 83 of file G4OpticalSurface.cc.

88  : G4SurfaceProperty(name,type),
89  theModel(model),
90  theFinish(finish),
91  theMaterialPropertiesTable(0)
92 {
93  if (model == glisur ){
94  polish = value;
95  sigma_alpha = 0.0;
96  }
97  else if ( model == unified ) {
98  sigma_alpha = value;
99  polish = 0.0;
100  }
101  else if ( model == LUT ) {
102  sigma_alpha = value;
103  polish = 0.0;
104  }
105  else if ( model == dichroic ) {
106  sigma_alpha = value;
107  polish = 0.0;
108  }
109  else {
110  G4Exception("G4OpticalSurface::G4OpticalSurface()", "mat309",
112  "Constructor called with INVALID model.");
113  }
114 
115  AngularDistribution = NULL;
116  DichroicVector = NULL;
117 
118  if (type == dielectric_LUT) {
119  AngularDistribution =
120  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
121  ReadLUTFile();
122  }
123 
124  if (type == dielectric_dichroic) {
125  DichroicVector = new G4Physics2DVector();
127  }
128 }
float G4float
Definition: G4Types.hh:77
const XML_Char int const XML_Char * value
Definition: expat.h:331
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void ReadDichroicFile(void)
const XML_Char XML_Content * model
Definition: expat.h:151

Here is the call graph for this function:

G4OpticalSurface::~G4OpticalSurface ( )
virtual

Definition at line 130 of file G4OpticalSurface.cc.

131 {
132  if (AngularDistribution) delete [] AngularDistribution;
133  if (DichroicVector) delete DichroicVector;
134 }

Member Function Documentation

void G4OpticalSurface::DumpInfo ( ) const

Definition at line 169 of file G4OpticalSurface.cc.

170 {
171 
172  // Dump info for surface
173 
174  G4cout <<
175  " Surface type = " << G4int(theType) << G4endl <<
176  " Surface finish = " << G4int(theFinish) << G4endl <<
177  " Surface model = " << G4int(theModel) << G4endl;
178 
179  G4cout << G4endl;
180 
181  G4cout << " Surface parameter " << G4endl;
182  G4cout << " ----------------- " << G4endl;
183  if (theModel == glisur ){
184  G4cout << polish << G4endl;
185  }
186  else if (theModel == LUT ){
187  G4cout << sigma_alpha << G4endl;
188  }
189  else {
190  G4cout << sigma_alpha << G4endl;
191  }
192  G4cout << G4endl;
193 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

G4double G4OpticalSurface::GetAngularDistributionValue ( G4int  angleIncident,
G4int  thetaIndex,
G4int  phiIndex 
)
inline

Definition at line 230 of file G4OpticalSurface.hh.

233 {
234  return AngularDistribution[angleIncident+
235  thetaIndex*incidentIndexMax+
236  phiIndex*thetaIndexMax*incidentIndexMax];
237 }
G4Physics2DVector * G4OpticalSurface::GetDichroicVector ( )
inline

Definition at line 240 of file G4OpticalSurface.hh.

241 {
242  return DichroicVector;
243 }
G4OpticalSurfaceFinish G4OpticalSurface::GetFinish ( ) const
inline

Definition at line 155 of file G4OpticalSurface.hh.

155 { return theFinish; }

Here is the caller graph for this function:

G4MaterialPropertiesTable* G4OpticalSurface::GetMaterialPropertiesTable ( ) const
inline

Definition at line 176 of file G4OpticalSurface.hh.

177  { return theMaterialPropertiesTable; }
G4OpticalSurfaceModel G4OpticalSurface::GetModel ( ) const
inline

Definition at line 160 of file G4OpticalSurface.hh.

160 { return theModel; }

Here is the caller graph for this function:

G4int G4OpticalSurface::GetPhiIndexMax ( void  ) const
inline

Definition at line 194 of file G4OpticalSurface.hh.

194 { return phiIndexMax; }
G4double G4OpticalSurface::GetPolish ( ) const
inline

Definition at line 171 of file G4OpticalSurface.hh.

171 { return polish; }

Here is the caller graph for this function:

G4double G4OpticalSurface::GetSigmaAlpha ( ) const
inline

Definition at line 166 of file G4OpticalSurface.hh.

166 { return sigma_alpha; }

Here is the caller graph for this function:

G4int G4OpticalSurface::GetThetaIndexMax ( void  ) const
inline

Definition at line 193 of file G4OpticalSurface.hh.

193 { return thetaIndexMax; }
G4int G4OpticalSurface::operator!= ( const G4OpticalSurface right) const

Definition at line 161 of file G4OpticalSurface.cc.

162 {
163  return (this != (G4OpticalSurface *) &right);
164 }
G4OpticalSurface & G4OpticalSurface::operator= ( const G4OpticalSurface right)

Definition at line 57 of file G4OpticalSurface.cc.

58 {
59  if (this != &right)
60  {
61  theName = right.theName;
62  theType = right.theType;
63  theModel = right.theModel;
64  theFinish = right.theFinish;
65  sigma_alpha = right.sigma_alpha;
66  polish = right.polish;
67  theMaterialPropertiesTable = right.theMaterialPropertiesTable;
68  if (AngularDistribution) delete [] AngularDistribution;
69  AngularDistribution =
70  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
71  *(AngularDistribution) = *(right.AngularDistribution);
72  if (DichroicVector) delete DichroicVector;
73  DichroicVector = new G4Physics2DVector();
74  *DichroicVector = *(right.DichroicVector);
75  }
76  return *this;
77 }
float G4float
Definition: G4Types.hh:77
G4int G4OpticalSurface::operator== ( const G4OpticalSurface right) const

Definition at line 156 of file G4OpticalSurface.cc.

157 {
158  return (this == (G4OpticalSurface *) &right);
159 }
void G4OpticalSurface::ReadDichroicFile ( void  )

Definition at line 332 of file G4OpticalSurface.cc.

333 {
334  const char* datadir = getenv("G4DICHROICDATA");
335 
336  if(!datadir) {
337  G4Exception("G4OpticalSurface::ReadDichroicFile()","mat313",
338  FatalException,"Environment variable G4DICHROICDATA not defined");
339  return;
340  }
341 
342  std::ostringstream ost;
343  ost << datadir;
344  std::ifstream fin(ost.str().c_str());
345  if( !fin.is_open()) {
347  ed << "Dichroic surface data file <" << ost.str().c_str()
348  << "> is not opened!" << G4endl;
349  G4Exception("G4OpticalSurface::ReadDichroicFile()","mat314",
350  FatalException,ed," ");
351  return;
352  }
353 
354  if( !(DichroicVector->Retrieve(fin)) ) {
356  ed << "Dichroic surface data file <" << ost.str().c_str()
357  << "> is not opened!" << G4endl;
358  G4Exception("G4OpticalSurface::ReadDichroicFile()","mat315",
359  FatalException,ed," ");
360  return;
361  }
362 
363 // DichroicVector->SetBicubicInterpolation(true);
364 
365  G4cout << " *** Dichroic surface data file *** " << G4endl;
366 
367  G4int numberOfXNodes = DichroicVector->GetLengthX();
368  G4int numberOfYNodes = DichroicVector->GetLengthY();
369 
370  G4cout << "numberOfXNodes: " << numberOfXNodes << G4endl;
371  G4cout << "numberOfYNodes: " << numberOfYNodes << G4endl;
372 
373  if (0 > numberOfXNodes || numberOfXNodes >= INT_MAX) numberOfXNodes = 0;
374  if (0 > numberOfYNodes || numberOfYNodes >= INT_MAX) numberOfYNodes = 0;
375 
376  G4PV2DDataVector xVector;
377  G4PV2DDataVector yVector;
378 
379  xVector.resize(numberOfXNodes,0.);
380  yVector.resize(numberOfYNodes,0.);
381 
382  for(G4int i = 0; i<numberOfXNodes; ++i) {
383  G4cout << "i: " << DichroicVector->GetX(i) << G4endl;
384  xVector[i] = DichroicVector->GetX(i);
385  }
386  for(G4int j = 0; j<numberOfYNodes; ++j) {
387  G4cout << "j: " << DichroicVector->GetY(j) << G4endl;
388  yVector[j] = DichroicVector->GetY(j);
389  }
390 
391  for(G4int j = 0; j<numberOfYNodes; ++j) {
392  for(G4int i = 0; i<numberOfXNodes; ++i) {
393  G4cout << " i: " << i << " j: " << j << " "
394  << DichroicVector->GetValue(i,j) << G4endl;
395  }
396  }
397 
398 // G4int idx, idy;
399 
400 // for(G4int j = 0; j<numberOfYNodes-1; ++j) {
401 // G4double y = (yVector[j] + yVector[j+1])/2.;
402 // for(G4int i = 0; i<numberOfXNodes-1; ++i) {
403 // G4double x = (xVector[i] + xVector[i+1])/2.;
404 // G4cout << " x: " << x << " y: " << y << " "
405 // << DichroicVector->Value(x,y,idx,idy) << G4endl;
406 // }
407 // }
408 
409 }
std::vector< G4double > G4PV2DDataVector
G4double GetValue(size_t idx, size_t idy) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
size_t GetLengthY() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
size_t GetLengthX() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define INT_MAX
Definition: templates.hh:111
G4bool Retrieve(std::ifstream &fIn)
G4double GetY(size_t index) const
#define G4endl
Definition: G4ios.hh:61
G4double GetX(size_t index) const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4OpticalSurface::ReadLUTFile ( void  )

Definition at line 223 of file G4OpticalSurface.cc.

224 {
225  G4String readLUTFileName = " ";
226 
227  if (theFinish == polishedlumirrorglue) {
228  readLUTFileName = "PolishedLumirrorGlue.dat";
229  }
230  else if (theFinish == polishedlumirrorair) {
231  readLUTFileName = "PolishedLumirror.dat";
232  }
233  else if (theFinish == polishedteflonair) {
234  readLUTFileName = "PolishedTeflon.dat";
235  }
236  else if (theFinish == polishedtioair) {
237  readLUTFileName = "PolishedTiO.dat";
238  }
239  else if (theFinish == polishedtyvekair) {
240  readLUTFileName = "PolishedTyvek.dat";
241  }
242  else if (theFinish == polishedvm2000glue) {
243  readLUTFileName = "PolishedVM2000Glue.dat";
244  }
245  else if (theFinish == polishedvm2000air) {
246  readLUTFileName = "PolishedVM2000.dat";
247  }
248  else if (theFinish == etchedlumirrorglue) {
249  readLUTFileName = "EtchedLumirrorGlue.dat";
250  }
251  else if (theFinish == etchedlumirrorair) {
252  readLUTFileName = "EtchedLumirror.dat";
253  }
254  else if (theFinish == etchedteflonair) {
255  readLUTFileName = "EtchedTeflon.dat";
256  }
257  else if (theFinish == etchedtioair) {
258  readLUTFileName = "EtchedTiO.dat";
259  }
260  else if (theFinish == etchedtyvekair) {
261  readLUTFileName = "EtchedTyvek.dat";
262  }
263  else if (theFinish == etchedvm2000glue) {
264  readLUTFileName = "EtchedVM2000Glue.dat";
265  }
266  else if (theFinish == etchedvm2000air) {
267  readLUTFileName = "EtchedVM2000.dat";
268  }
269  else if (theFinish == groundlumirrorglue) {
270  readLUTFileName = "GroundLumirrorGlue.dat";
271  }
272  else if (theFinish == groundlumirrorair) {
273  readLUTFileName = "GroundLumirror.dat";
274  }
275  else if (theFinish == groundteflonair) {
276  readLUTFileName = "GroundTeflon.dat";
277  }
278  else if (theFinish == groundtioair) {
279  readLUTFileName = "GroundTiO.dat";
280  }
281  else if (theFinish == groundtyvekair) {
282  readLUTFileName = "GroundTyvek.dat";
283  }
284  else if (theFinish == groundvm2000glue) {
285  readLUTFileName = "GroundVM2000Glue.dat";
286  }
287  else if (theFinish == groundvm2000air) {
288  readLUTFileName = "GroundVM2000.dat";
289  }
290 
291  if (readLUTFileName == " ") return;
292 
293  char* path = getenv("G4REALSURFACEDATA");
294  if (!path) {
295  G4String excep =
296  "G4OpBoundaryProcess - G4REALSURFACEDATA environment variable not set";
297  G4Exception("G4OpticalSurface::ReadLUTFile()", "mat310",
298  FatalException, excep);
299  return;
300  }
301  G4String pathString(path);
302 
303  readLUTFileName = pathString + "/" + readLUTFileName;
304 
305  std::ifstream readLUTFileHandle(readLUTFileName, std::ios::in);
306 
307  if (readLUTFileHandle) {
308  G4int idxmax = incidentIndexMax*thetaIndexMax*phiIndexMax;
309  for (G4int i = 0; i<idxmax; i++) {
310  if (readLUTFileHandle.eof()) break;
311  readLUTFileHandle >> AngularDistribution[i];
312  }
313  if (!readLUTFileHandle.bad()) {
314  G4cout <<"LUT - data file: "<< readLUTFileName <<" read in! "<< G4endl;
315  }
316  else {
317  G4String excep="LUT - data file: "+readLUTFileName+" not read propery";
318  G4Exception("G4OpticalSurface::ReadLUTFile()", "mat312",
319  FatalException, excep);
320  return;
321  }
322  }
323  else {
324  G4String excep ="LUT - data file: "+readLUTFileName+" not found";
325  G4Exception("G4OpticalSurface::ReadLUTFile()", "mat311",
326  FatalException, excep);
327  return;
328  }
329  readLUTFileHandle.close();
330 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4OpticalSurface::SetFinish ( const G4OpticalSurfaceFinish  finish)

Definition at line 209 of file G4OpticalSurface.cc.

210 {
211  theFinish = finish;
212  if (theType == dielectric_LUT) {
213  if (!AngularDistribution) AngularDistribution =
214  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
215  ReadLUTFile();
216  }
217  if (theType == dielectric_dichroic) {
218  if (!DichroicVector) DichroicVector = new G4Physics2DVector();
220  }
221 }
float G4float
Definition: G4Types.hh:77
void ReadDichroicFile(void)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4OpticalSurface::SetMaterialPropertiesTable ( G4MaterialPropertiesTable anMPT)
inline

Definition at line 181 of file G4OpticalSurface.hh.

182  { theMaterialPropertiesTable = anMPT; }

Here is the caller graph for this function:

void G4OpticalSurface::SetModel ( const G4OpticalSurfaceModel  model)
inline

Definition at line 162 of file G4OpticalSurface.hh.

163  { theModel = model; }
const XML_Char XML_Content * model
Definition: expat.h:151

Here is the caller graph for this function:

void G4OpticalSurface::SetPolish ( const G4double  plsh)
inline

Definition at line 173 of file G4OpticalSurface.hh.

173 { polish=plsh; }
void G4OpticalSurface::SetSigmaAlpha ( const G4double  s_a)
inline

Definition at line 168 of file G4OpticalSurface.hh.

168 { sigma_alpha = s_a; }
void G4OpticalSurface::SetType ( const G4SurfaceType type)

Definition at line 195 of file G4OpticalSurface.cc.

196 {
197  theType = type;
198  if (type == dielectric_LUT) {
199  if (!AngularDistribution) AngularDistribution =
200  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
201  ReadLUTFile();
202  }
203  if (type == dielectric_dichroic) {
204  if (!DichroicVector) DichroicVector = new G4Physics2DVector();
206  }
207 }
float G4float
Definition: G4Types.hh:77
void ReadDichroicFile(void)

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: