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

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

Constructor & Destructor Documentation

◆ TextDetectorBuilder()

TextDetectorBuilder::TextDetectorBuilder ( )
inline

Definition at line 331 of file gears.cc.

331  :
332  G4tgbDetectorBuilder() { fLineProcessor = new LineProcessor(); }
Extension to default text geometry file line processor.
Definition: gears.cc:173

◆ ~TextDetectorBuilder()

TextDetectorBuilder::~TextDetectorBuilder ( )
inline

Definition at line 333 of file gears.cc.

333 { delete fLineProcessor; }

Member Function Documentation

◆ ConstructDetector()

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

Construct detector based on text geometry description.

Definition at line 360 of file gears.cc.

362 {
363  G4VPhysicalVolume *world = G4tgbDetectorBuilder::ConstructDetector(topVol);
364 
365  G4tgbVolumeMgr* tgbVolmgr = G4tgbVolumeMgr::GetInstance();
366  BorderSurface* border = fLineProcessor->Border;
367  while (border) {
368  G4String physV1 = border->v1.substr(0,border->v1.find(":"));
369  G4String physV2 = border->v2.substr(0,border->v2.find(":"));
370  int copyNo1 = atoi(border->v1.substr(border->v1.find(":")+1).data());
371  int copyNo2 = atoi(border->v2.substr(border->v2.find(":")+1).data());
372  G4LogicalVolume *m1=tgbVolmgr->FindG4PhysVol(physV1)->GetMotherLogical();
373  G4LogicalVolume *m2=tgbVolmgr->FindG4PhysVol(physV2)->GetMotherLogical();
374  // search for physics volumes on the sides of the border
375  G4VPhysicalVolume *v1=0, *v2=0;
376  for (int i=0; i<(int)m1->GetNoDaughters(); i++) {
377  v1 = m1->GetDaughter(i);
378  if (v1->GetCopyNo()==copyNo1) break;
379  }
380  for (int i=0; i<(int)m2->GetNoDaughters(); i++) {
381  v2 = m2->GetDaughter(i);
382  if (v2->GetCopyNo()==copyNo2) break;
383  }
384  if (v1 && v2) {
385  new G4LogicalBorderSurface(border->name,v1,v2,border->optic);
386  G4cout<<"Border surface "<<border->name<<" in between "
387  <<physV1<<":"<<copyNo1<<" and "<<physV2<<":"<<copyNo2
388  <<" added"<<G4endl;
389  }
390  border=border->next;
391  }
392  return world;
393 }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:199
G4String v1
name of volume 1
Definition: gears.cc:162
G4OpticalSurface * optic
point to G4OpticalSurface object
Definition: gears.cc:164
G4String v2
name of volume 2
Definition: gears.cc:163
A link list of G4LogicalBorderSurface.
Definition: gears.cc:159
G4String name
name of the surface
Definition: gears.cc:161
BorderSurface * next
link to next border surface
Definition: gears.cc:165

◆ ReadDetector()

const G4tgrVolume * TextDetectorBuilder::ReadDetector ( )

Read text geometry input.

Definition at line 348 of file gears.cc.

349 {
350  G4tgrFileReader* reader = G4tgrFileReader::GetInstance();
351  reader->SetLineProcessor(fLineProcessor);
352  reader->ReadFiles();
353  G4tgrVolumeMgr* mgr = G4tgrVolumeMgr::GetInstance();
354  const G4tgrVolume* world = mgr->GetTopVolume();
355  return world;
356 }

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