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:
Inheritance graph
[legend]
Collaboration diagram for LineProcessor:
Collaboration graph
[legend]

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 201 of file gears.cc.

Constructor & Destructor Documentation

◆ LineProcessor()

LineProcessor::LineProcessor ( )
inline

Definition at line 208 of file gears.cc.

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

◆ ~LineProcessor()

LineProcessor::~LineProcessor ( )
inline

Definition at line 209 of file gears.cc.

209  {
210  while (Border) { // deleting G4OpticalSurface is done in Geant4
211  BorderSurface *next = Border->next;
212  delete Border;
213  Border = next;
214  }
215  }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:228
A link list of G4LogicalBorderSurface.
Definition: gears.cc:188
BorderSurface * next
link to next border surface
Definition: gears.cc:193

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 235 of file gears.cc.

235  {
236  // process default text geometry tags
237  G4bool processed = G4tgrLineProcessor::ProcessLine(words);
238  if (processed)
239  return true; // no new tags involved
240 
241  // process added tags: prop & surf
242  G4String tag = words[0];
243  G4StrUtil::to_lower(tag); // to lower cases
244  if (tag.substr(0, 5) == ":prop") { // set optical properties of a material
245  G4NistManager *mgr = G4NistManager::Instance();
246  mgr->SetVerbose(2);
247  G4Material *m = mgr->FindOrBuildMaterial(words[1]);
248  if (m == NULL) // if not in NIST, then build in tgb
249  m = G4tgbMaterialMgr::GetInstance()->FindOrBuildG4Material(words[1]);
250  G4cout << "GEARS: Set optical properties of " << words[1] << ":" << G4endl;
251  m->SetMaterialPropertiesTable(CreateMaterialPropertiesTable(words, 2));
252  return true;
253  } else if (tag.substr(0, 5) == ":surf") { // define an optical surface
254  auto bdr = new BorderSurface;
255  bdr->next = Border; // save current border pointer
256  Border = bdr; // overwrite current border pointer
257  bdr->name = words[1];
258  bdr->v1 = words[2];
259  bdr->v2 = words[3];
260  bdr->optic = new G4OpticalSurface(words[1]);
261 
262  G4cout << "GEARS: Set optical properties of " << bdr->name << ":"<< G4endl;
263  size_t i = 4;
264  while (i < words.size()) { // loop over optical surface setup lines
265  G4String setting = words[i], value = words[i + 1];
266  G4StrUtil::to_lower(setting); G4StrUtil::to_lower(value);
267  if (setting == "property") {
268  i++;
269  break;
270  } else if (setting == "type") {
271  if (value == "dielectric_metal")
272  bdr->optic->SetType(dielectric_metal);
273  else if (value == "dielectric_dielectric")
274  bdr->optic->SetType(dielectric_dielectric);
275  else if (value == "dielectric_lut")
276  bdr->optic->SetType(dielectric_LUT);
277  else if (value == "dielectric_lutdavis")
278  bdr->optic->SetType(dielectric_LUTDAVIS);
279  else if (value == "dielectric_dichroic")
280  bdr->optic->SetType(dielectric_dichroic);
281  else if (value == "firsov")
282  bdr->optic->SetType(firsov);
283  else if (value == "x_ray")
284  bdr->optic->SetType(x_ray);
285  else if (value == "coated")
286  bdr->optic->SetType(coated);
287  else
288  G4cout << "GEARS: Ignore unknown surface type " << value << G4endl;
289  G4cout << "GEARS: type = " << value << G4endl;
290  } else if (setting == "model") {
291  if (value == "glisur")
292  bdr->optic->SetModel(glisur);
293  else if (value == "unified")
294  bdr->optic->SetModel(unified);
295  else if (value == "lut")
296  bdr->optic->SetModel(LUT);
297  else if (value == "davis")
298  bdr->optic->SetModel(DAVIS);
299  else if (value == "dichroic")
300  bdr->optic->SetModel(dichroic);
301  else
302  G4cout << "GEARS: Ignore unknown surface model " << value << G4endl;
303  G4cout << "GEARS: model = " << value << G4endl;
304  } else if (setting == "finish") {
305  if (value == "polished") bdr->optic->SetFinish(polished);
306  else if (value == "polishedfrontpainted") bdr->optic->SetFinish(polishedfrontpainted);
307  else if (value == "polishedbackpainted") bdr->optic->SetFinish(polishedbackpainted);
308  else if (value == "ground") bdr->optic->SetFinish(ground);
309  else if (value == "groundfrontpainted") bdr->optic->SetFinish(groundfrontpainted);
310  else if (value == "groundbackpainted") bdr->optic->SetFinish(groundbackpainted);
311  // --- LBNL LUT Model Finishes ---
312  else if (value == "polishedlumirrorair") bdr->optic->SetFinish(polishedlumirrorair);
313  else if (value == "polishedlumirrorglue") bdr->optic->SetFinish(polishedlumirrorglue);
314  else if (value == "polishedair") bdr->optic->SetFinish(polishedair);
315  else if (value == "polishedteflonair") bdr->optic->SetFinish(polishedteflonair);
316  else if (value == "polishedtioair") bdr->optic->SetFinish(polishedtioair);
317  else if (value == "polishedtyvekair") bdr->optic->SetFinish(polishedtyvekair);
318  else if (value == "polishedvm2000air") bdr->optic->SetFinish(polishedvm2000air);
319  else if (value == "polishedvm2000glue") bdr->optic->SetFinish(polishedvm2000glue);
320 
321  else if (value == "etchedlumirrorair") bdr->optic->SetFinish(etchedlumirrorair);
322  else if (value == "etchedlumirrorglue") bdr->optic->SetFinish(etchedlumirrorglue);
323  else if (value == "etchedair") bdr->optic->SetFinish(etchedair);
324  else if (value == "etchedteflonair") bdr->optic->SetFinish(etchedteflonair);
325  else if (value == "etchedtioair") bdr->optic->SetFinish(etchedtioair);
326  else if (value == "etchedtyvekair") bdr->optic->SetFinish(etchedtyvekair);
327  else if (value == "etchedvm2000air") bdr->optic->SetFinish(etchedvm2000air);
328  else if (value == "etchedvm2000glue") bdr->optic->SetFinish(etchedvm2000glue);
329 
330  else if (value == "groundlumirrorair") bdr->optic->SetFinish(groundlumirrorair);
331  else if (value == "groundlumirrorglue") bdr->optic->SetFinish(groundlumirrorglue);
332  else if (value == "groundair") bdr->optic->SetFinish(groundair);
333  else if (value == "groundteflonair") bdr->optic->SetFinish(groundteflonair);
334  else if (value == "groundtioair") bdr->optic->SetFinish(groundtioair);
335  else if (value == "groundtyvekair") bdr->optic->SetFinish(groundtyvekair);
336  else if (value == "groundvm2000air") bdr->optic->SetFinish(groundvm2000air);
337  else if (value == "groundvm2000glue") bdr->optic->SetFinish(groundvm2000glue);
338  // --- DAVIS Model Finishes (Lowercase Conversion) ---
339  else if (value == "rough_lut") bdr->optic->SetFinish(Rough_LUT);
340  else if (value == "roughteflon_lut") bdr->optic->SetFinish(RoughTeflon_LUT);
341  else if (value == "roughesr_lut") bdr->optic->SetFinish(RoughESR_LUT);
342  else if (value == "roughesrgrease_lut") bdr->optic->SetFinish(RoughESRGrease_LUT);
343  else if (value == "polished_lut") bdr->optic->SetFinish(Polished_LUT);
344  else if (value == "polishedteflon_lut") bdr->optic->SetFinish(PolishedTeflon_LUT);
345  else if (value == "polishedesr_lut") bdr->optic->SetFinish(PolishedESR_LUT);
346  else if (value == "polishedesrgrease_lut") bdr->optic->SetFinish(PolishedESRGrease_LUT);
347  else if (value == "detector_lut") bdr->optic->SetFinish(Detector_LUT);
348 
349  else {
350  G4cout << "GEARS: Unknown surface finish: " << value << "!" << G4endl;
351  abort();
352  }
353  G4cout << "GEARS: finish = " << value << G4endl;
354  } else if (setting == "sigma_alpha") {
355  bdr->optic->SetSigmaAlpha(G4UIcommand::ConvertToDouble(value));
356  G4cout<<"GEARS: sigma_alpha = "<<bdr->optic->GetSigmaAlpha()<<G4endl;
357  } else
358  G4cout << "GEARS: Ignore unknown surface setting " << value << G4endl;
359  i += 2;
360  }
361  if (i < words.size()) // break while loop because of "property"
362  bdr->optic->SetMaterialPropertiesTable(
363  CreateMaterialPropertiesTable(words, i));
364  return true;
365  } else
366  return false;
367 }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:228
A link list of G4LogicalBorderSurface.
Definition: gears.cc:188
G4String name
name of the surface
Definition: gears.cc:189
BorderSurface * next
link to next border surface
Definition: gears.cc:193

Member Data Documentation

◆ Border

BorderSurface* LineProcessor::Border

pointer to a BorderSurface object

Definition at line 228 of file gears.cc.


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