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

Construct detector based on text geometry description. More...

Inheritance diagram for TextDetectorBuilder:

Public Member Functions

 TextDetectorBuilder ()
 
 ~TextDetectorBuilder ()
 
const G4tgrVolume * ReadDetector ()
 Read text geometry input. More...
 
G4VPhysicalVolume * ConstructDetector (const G4tgrVolume *topVol)
 Construct detector based on text geometry description. More...
 

Detailed Description

Construct detector based on text geometry description.

Definition at line 316 of file gears.cc.

Constructor & Destructor Documentation

§ TextDetectorBuilder()

TextDetectorBuilder::TextDetectorBuilder ( )
inline

Definition at line 319 of file gears.cc.

319  :
320  G4tgbDetectorBuilder() { fLineProcessor = new LineProcessor(); }
Extension to default text geometry file line processor.
Definition: gears.cc:160

§ ~TextDetectorBuilder()

TextDetectorBuilder::~TextDetectorBuilder ( )
inline

Definition at line 321 of file gears.cc.

321 { delete fLineProcessor; }

Member Function Documentation

§ ConstructDetector()

G4VPhysicalVolume * TextDetectorBuilder::ConstructDetector ( const G4tgrVolume *  topVol)

Construct detector based on text geometry description.

Definition at line 348 of file gears.cc.

350 {
351  G4VPhysicalVolume *world = G4tgbDetectorBuilder::ConstructDetector(topVol);
352 
353  G4tgbVolumeMgr* tgbVolmgr = G4tgbVolumeMgr::GetInstance();
354  BorderSurface* border = fLineProcessor->Border;
355  while (border) {
356  G4String physV1 = border->v1.substr(0,border->v1.find(":"));
357  G4String physV2 = border->v2.substr(0,border->v2.find(":"));
358  int copyNo1 = atoi(border->v1.substr(border->v1.find(":")+1).data());
359  int copyNo2 = atoi(border->v2.substr(border->v2.find(":")+1).data());
360  G4LogicalVolume *m1=tgbVolmgr->FindG4PhysVol(physV1)->GetMotherLogical();
361  G4LogicalVolume *m2=tgbVolmgr->FindG4PhysVol(physV2)->GetMotherLogical();
362  // search for phyiscs volumes on the sides of the border
363  G4VPhysicalVolume *v1=0, *v2=0;
364  for (int i=0; i<(int)m1->GetNoDaughters(); i++) {
365  v1 = m1->GetDaughter(i);
366  if (v1->GetCopyNo()==copyNo1) break;
367  }
368  for (int i=0; i<(int)m2->GetNoDaughters(); i++) {
369  v2 = m2->GetDaughter(i);
370  if (v2->GetCopyNo()==copyNo2) break;
371  }
372  if (v1 && v2) {
373  new G4LogicalBorderSurface(border->name,v1,v2,border->optic);
374  G4cout<<"Border surface "<<border->name<<" in between "
375  <<physV1<<":"<<copyNo1<<" and "<<physV2<<":"<<copyNo2
376  <<" added"<<G4endl;
377  }
378  border=border->next;
379  }
380  return world;
381 }
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

§ ReadDetector()

const G4tgrVolume * TextDetectorBuilder::ReadDetector ( )

Read text geometry input.

Definition at line 336 of file gears.cc.

337 {
338  G4tgrFileReader* reader = G4tgrFileReader::GetInstance();
339  reader->SetLineProcessor(fLineProcessor);
340  reader->ReadFiles();
341  G4tgrVolumeMgr* mgr = G4tgrVolumeMgr::GetInstance();
342  const G4tgrVolume* world = mgr->GetTopVolume();
343  return world;
344 }

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