GEARS
Geant4 Example Application with Rich features and Small footprints
Public Member Functions | Public Attributes | List of all members
LineProcessor Class Reference

Extension to default text geometry file line processor. More...

Inheritance diagram for LineProcessor:

Public Member Functions

 LineProcessor ()
 
 ~LineProcessor ()
 
G4bool ProcessLine (const vector< G4String > &words)
 Overwrite G4tgrLineProcessor::ProcessLine to add new tags. More...
 

Public Attributes

BorderSurfaceBorder
 pointer to a BorderSurface object More...
 

Detailed Description

Extension to default text geometry file line processor.

Definition at line 160 of file gears.cc.

Constructor & Destructor Documentation

§ LineProcessor()

LineProcessor::LineProcessor ( )
inline

Definition at line 166 of file gears.cc.

166 : G4tgrLineProcessor(), Border(0) {};
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:186

§ ~LineProcessor()

LineProcessor::~LineProcessor ( )
inline

Definition at line 167 of file gears.cc.

167  {
168  while (Border) { // deleting G4OpticalSurface is done in Geant4
169  BorderSurface *next=Border->next;
170  delete Border;
171  Border=next;
172  }
173  }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:186
A link list of G4LogicalBorderSurface.
Definition: gears.cc:146
BorderSurface * next
link to next border surface
Definition: gears.cc:152

Member Function Documentation

§ ProcessLine()

G4bool LineProcessor::ProcessLine ( const vector< G4String > &  words)

Overwrite G4tgrLineProcessor::ProcessLine to add new tags.

Two new tags are added: ":PROP" and ":SURF" (case insensitive):

  • ":prop" is used to add optical properties to a material
  • ":surf" is used to define an optical surface

The function is called for each new line. Be sure to insert an end-of-line character by typing <Enter> at the end of the last line, otherwise, the last line will not be processed.

Definition at line 193 of file gears.cc.

194 {
195  // process default text geometry tags
196  G4bool processed = G4tgrLineProcessor::ProcessLine(words);
197  if (processed) return true; // no new tags involved
198 
199  // process added tags: prop & surf
200  G4String tag = words[0];
201  tag.toLower(); // to lower cases
202  if (tag.substr(0,5)==":prop") { // set optical properties of a material
203  G4NistManager *mgr = G4NistManager::Instance(); mgr->SetVerbose(2);
204  G4Material *m = mgr->FindOrBuildMaterial(words[1]);
205  if (m==NULL) // if not in NIST, then build in tgb
206  m=G4tgbMaterialMgr::GetInstance()->FindOrBuildG4Material(words[1]);
207  G4cout<<"GEARS: Set optical properties of "<<words[1]<<":"<<G4endl;
208  m->SetMaterialPropertiesTable(CreateMaterialPropertiesTable(words,2));
209  return true;
210  } else if (tag.substr(0,5)==":surf") { // define an optical surface
211  BorderSurface *bdr = new BorderSurface;
212  bdr->next=Border; // save current border pointer
213  Border=bdr; // overwrite current border pointer
214  bdr->name=words[1];
215  bdr->v1=words[2];
216  bdr->v2=words[3];
217  bdr->optic = new G4OpticalSurface(words[1]);
218  size_t i=4;
219  // loop over optical surface setup lines
220  while (i<words.size()) {
221  G4String setting = words[i], value = words[i+1];
222  setting.toLower(); value.toLower();
223  if (setting=="property") {
224  i++;
225  break;
226  } else if(setting=="type") {
227  if (value=="dielectric_metal")
228  bdr->optic->SetType(dielectric_metal);
229  else if(value=="dielectric_dielectric")
230  bdr->optic->SetType(dielectric_dielectric);
231  else if(value=="firsov") bdr->optic->SetType(firsov);
232  else if(value=="x_ray") bdr->optic->SetType(x_ray);
233  else G4cout<<"GERAS: Ignore unknown surface type "<<value<<G4endl;
234  } else if(setting=="model") {
235  if (value=="glisur") bdr->optic->SetModel(glisur);
236  else if(value=="unified") bdr->optic->SetModel(unified);
237  else G4cout<<"GERAS: Ignore unknown surface model "<<value<<G4endl;
238  } else if(setting=="finish") {
239  if(value=="polished") bdr->optic->SetFinish(polished);
240  else if(value=="polishedfrontpainted")
241  bdr->optic->SetFinish(polishedfrontpainted);
242  else if(value=="polishedbackpainted")
243  bdr->optic->SetFinish(polishedbackpainted);
244  else if(value=="ground") bdr->optic->SetFinish(ground);
245  else if(value=="groundfrontpainted")
246  bdr->optic->SetFinish(groundfrontpainted);
247  else if(value=="groundbackpainted")
248  bdr->optic->SetFinish(groundbackpainted);
249  else
250  G4cout<<"GERAS: Ignore unknown surface finish "<<value<<G4endl;
251  } else if(setting=="sigma_alpha") {
252  bdr->optic->SetSigmaAlpha(G4UIcommand::ConvertToInt(value));
253  } else
254  G4cout<<"GERAS: Ignore unknown surface setting "<<value<<G4endl;
255  i+=2;
256  }
257  if (i<words.size()) { // break while loop because of "property"
258  G4cout<<"GEARS: Set optical properties of "<<bdr->name<<":"<<G4endl;
259  bdr->optic->SetMaterialPropertiesTable(
260  CreateMaterialPropertiesTable(words,i));
261  }
262  return true;
263  } else
264  return false;
265 }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:186
G4String v1
name of volume 1
Definition: gears.cc:149
G4OpticalSurface * optic
point to G4OpticalSurface object
Definition: gears.cc:151
G4String v2
name of volume 2
Definition: gears.cc:150
A link list of G4LogicalBorderSurface.
Definition: gears.cc:146
G4String name
name of the surface
Definition: gears.cc:148
BorderSurface * next
link to next border surface
Definition: gears.cc:152

Member Data Documentation

§ Border

BorderSurface* LineProcessor::Border

pointer to a BorderSurface object

Definition at line 186 of file gears.cc.


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