Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4OpticalSurface Class Reference

#include <G4OpticalSurface.hh>

Inheritance diagram for G4OpticalSurface:
G4SurfaceProperty

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 135 of file G4OpticalSurface.cc.

References right, G4SurfaceProperty::theName, and G4SurfaceProperty::theType.

136  : G4SurfaceProperty(right.theName,right.theType)
137 {
138  *this = right;
139  this->theName = right.theName;
140  this->theType = right.theType;
141  this->theModel = right.theModel;
142  this->theFinish = right.theFinish;
143  this->sigma_alpha = right.sigma_alpha;
144  this->polish = right.polish;
145  this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
146  this->AngularDistribution = right.AngularDistribution;
147  this->readLUTFileHandle = right.readLUTFileHandle;
148  this->DichroicVector = right.DichroicVector;
149 }
G4OpticalSurface::G4OpticalSurface ( const G4String name,
G4OpticalSurfaceModel  model = glisur,
G4OpticalSurfaceFinish  finish = polished,
G4SurfaceType  type = dielectric_dielectric,
G4double  value = 1.0 
)

Definition at line 78 of file G4OpticalSurface.cc.

References dichroic, dielectric_dichroic, dielectric_LUT, FatalException, G4Exception(), glisur, LUT, ReadDichroicFile(), ReadLUTFile(), and unified.

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

Definition at line 127 of file G4OpticalSurface.cc.

128 {
129  if (AngularDistribution) delete AngularDistribution;
130  if (DichroicVector) delete DichroicVector;
131 
132  if (readLUTFileHandle) delete readLUTFileHandle;
133 }

Member Function Documentation

void G4OpticalSurface::DumpInfo ( ) const

Definition at line 164 of file G4OpticalSurface.cc.

References G4cout, G4endl, glisur, LUT, and G4SurfaceProperty::theType.

Referenced by OpNoviceDetectorConstruction::Construct().

165 {
166 
167  // Dump info for surface
168 
169  G4cout <<
170  " Surface type = " << G4int(theType) << G4endl <<
171  " Surface finish = " << G4int(theFinish) << G4endl <<
172  " Surface model = " << G4int(theModel) << G4endl;
173 
174  G4cout << G4endl;
175 
176  G4cout << " Surface parameter " << G4endl;
177  G4cout << " ----------------- " << G4endl;
178  if (theModel == glisur ){
179  G4cout << polish << G4endl;
180  }
181  else if (theModel == LUT ){
182  G4cout << sigma_alpha << G4endl;
183  }
184  else {
185  G4cout << sigma_alpha << G4endl;
186  }
187  G4cout << G4endl;
188 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4double G4OpticalSurface::GetAngularDistributionValue ( G4int  angleIncident,
G4int  thetaIndex,
G4int  phiIndex 
)
inline

Definition at line 233 of file G4OpticalSurface.hh.

236 {
237  return AngularDistribution[angleIncident+
238  thetaIndex*incidentIndexMax+
239  phiIndex*thetaIndexMax*incidentIndexMax];
240 }
G4Physics2DVector * G4OpticalSurface::GetDichroicVector ( )
inline

Definition at line 243 of file G4OpticalSurface.hh.

244 {
245  return DichroicVector;
246 }
G4OpticalSurfaceFinish G4OpticalSurface::GetFinish ( ) const
inline

Definition at line 155 of file G4OpticalSurface.hh.

Referenced by G4GDMLWriteSolids::OpticalSurfaceWrite(), and G4OpBoundaryProcess::PostStepDoIt().

155 { return theFinish; }
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.

Referenced by G4GDMLWriteSolids::OpticalSurfaceWrite(), and G4OpBoundaryProcess::PostStepDoIt().

160 { return theModel; }
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.

Referenced by G4GDMLWriteSolids::OpticalSurfaceWrite().

171 { return polish; }
G4double G4OpticalSurface::GetSigmaAlpha ( ) const
inline

Definition at line 166 of file G4OpticalSurface.hh.

Referenced by G4GDMLWriteSolids::OpticalSurfaceWrite().

166 { return sigma_alpha; }
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 156 of file G4OpticalSurface.cc.

157 {
158  return (this != (G4OpticalSurface *) &right);
159 }
G4OpticalSurface & G4OpticalSurface::operator= ( const G4OpticalSurface right)

Definition at line 54 of file G4OpticalSurface.cc.

References G4SurfaceProperty::theName, G4SurfaceProperty::theSurfacePropertyTable, and G4SurfaceProperty::theType.

55 {
56  if (this != &right)
57  {
58  theName = right.theName;
59  theType = right.theType;
60  theModel = right.theModel;
61  theFinish = right.theFinish;
62  sigma_alpha = right.sigma_alpha;
63  polish = right.polish;
64  theMaterialPropertiesTable = right.theMaterialPropertiesTable;
65  AngularDistribution = right.AngularDistribution;
66  readLUTFileHandle = right.readLUTFileHandle;
67  DichroicVector = right.DichroicVector;
68 
70  }
71  return *this;
72 }
static G4SurfacePropertyTable theSurfacePropertyTable
G4int G4OpticalSurface::operator== ( const G4OpticalSurface right) const

Definition at line 151 of file G4OpticalSurface.cc.

152 {
153  return (this == (G4OpticalSurface *) &right);
154 }
void G4OpticalSurface::ReadDichroicFile ( void  )

Definition at line 328 of file G4OpticalSurface.cc.

References FatalException, G4cout, G4endl, G4Exception(), G4Physics2DVector::GetLengthX(), G4Physics2DVector::GetLengthY(), G4Physics2DVector::GetValue(), G4Physics2DVector::GetX(), G4Physics2DVector::GetY(), and G4Physics2DVector::Retrieve().

Referenced by G4OpticalSurface(), SetFinish(), and SetType().

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

Definition at line 218 of file G4OpticalSurface.cc.

References etchedlumirrorair, etchedlumirrorglue, etchedteflonair, etchedtioair, etchedtyvekair, etchedvm2000air, etchedvm2000glue, FatalException, G4cout, G4endl, G4Exception(), groundlumirrorair, groundlumirrorglue, groundteflonair, groundtioair, groundtyvekair, groundvm2000air, groundvm2000glue, polishedlumirrorair, polishedlumirrorglue, polishedteflonair, polishedtioair, polishedtyvekair, polishedvm2000air, and polishedvm2000glue.

Referenced by G4OpticalSurface(), SetFinish(), and SetType().

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

Definition at line 204 of file G4OpticalSurface.cc.

References dielectric_dichroic, dielectric_LUT, ReadDichroicFile(), ReadLUTFile(), and G4SurfaceProperty::theType.

Referenced by OpNoviceDetectorConstruction::Construct().

205 {
206  theFinish = finish;
207  if (theType == dielectric_LUT) {
208  if (!AngularDistribution) AngularDistribution =
209  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
210  ReadLUTFile();
211  }
212  if (theType == dielectric_dichroic) {
213  if (!DichroicVector) DichroicVector = new G4Physics2DVector();
215  }
216 }
float G4float
Definition: G4Types.hh:77
void ReadDichroicFile(void)
void G4OpticalSurface::SetMaterialPropertiesTable ( G4MaterialPropertiesTable anMPT)
inline

Definition at line 181 of file G4OpticalSurface.hh.

Referenced by OpNoviceDetectorConstruction::Construct(), and DMXDetectorConstruction::Construct().

182  { theMaterialPropertiesTable = anMPT; }
void G4OpticalSurface::SetModel ( const G4OpticalSurfaceModel  model)
inline

Definition at line 162 of file G4OpticalSurface.hh.

Referenced by OpNoviceDetectorConstruction::Construct().

163  { theModel = model; }
const XML_Char XML_Content * model
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 190 of file G4OpticalSurface.cc.

References dielectric_dichroic, dielectric_LUT, ReadDichroicFile(), ReadLUTFile(), and G4SurfaceProperty::theType.

Referenced by OpNoviceDetectorConstruction::Construct().

191 {
192  theType = type;
193  if (type == dielectric_LUT) {
194  if (!AngularDistribution) AngularDistribution =
195  new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
196  ReadLUTFile();
197  }
198  if (type == dielectric_dichroic) {
199  if (!DichroicVector) DichroicVector = new G4Physics2DVector();
201  }
202 }
float G4float
Definition: G4Types.hh:77
void ReadDichroicFile(void)

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