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

Constructor & Destructor Documentation

◆ TextDetectorBuilder()

TextDetectorBuilder::TextDetectorBuilder ( )
inline

Definition at line 421 of file gears.cc.

421  : G4tgbDetectorBuilder() {
422  fLineProcessor = new LineProcessor();
423  }
Extension to default text geometry file line processor.
Definition: gears.cc:201

◆ ~TextDetectorBuilder()

TextDetectorBuilder::~TextDetectorBuilder ( )
inline

Definition at line 424 of file gears.cc.

424 { delete fLineProcessor; }

Member Function Documentation

◆ ConstructDetector()

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

Construct detector based on text geometry description.

Definition at line 451 of file gears.cc.

451  {
452  G4VPhysicalVolume *world = G4tgbDetectorBuilder::ConstructDetector(topVol);
453 
454  G4tgbVolumeMgr *tgbVolmgr = G4tgbVolumeMgr::GetInstance();
455  BorderSurface *border = fLineProcessor->Border;
456  while (border) {
457  G4String physV1 = border->v1.substr(0, border->v1.find(":"));
458  G4String physV2 = border->v2.substr(0, border->v2.find(":"));
459  int copyNo1 = atoi(border->v1.substr(border->v1.find(":") + 1).data());
460  int copyNo2 = atoi(border->v2.substr(border->v2.find(":") + 1).data());
461  G4LogicalVolume *m1 = tgbVolmgr->FindG4PhysVol(physV1)->GetMotherLogical();
462  G4LogicalVolume *m2 = tgbVolmgr->FindG4PhysVol(physV2)->GetMotherLogical();
463  // search for physics volumes on the sides of the border
464  G4VPhysicalVolume *v1 = 0, *v2 = 0;
465  for (int i = 0; i < (int)m1->GetNoDaughters(); i++) {
466  v1 = m1->GetDaughter(i);
467  if (v1->GetCopyNo() == copyNo1)
468  break;
469  }
470  for (int i = 0; i < (int)m2->GetNoDaughters(); i++) {
471  v2 = m2->GetDaughter(i);
472  if (v2->GetCopyNo() == copyNo2)
473  break;
474  }
475  if (v1 && v2) {
476  new G4LogicalBorderSurface(border->name, v1, v2, border->optic);
477  G4cout << "Border surface " << border->name << " in between " << physV1
478  << ":" << copyNo1 << " and " << physV2 << ":" << copyNo2
479  << " added" << G4endl;
480  }
481  border = border->next;
482  }
483  return world;
484 }
BorderSurface * Border
pointer to a BorderSurface object
Definition: gears.cc:228
G4String v1
name of volume 1
Definition: gears.cc:190
G4OpticalSurface * optic
point to G4OpticalSurface object
Definition: gears.cc:192
G4String v2
name of volume 2
Definition: gears.cc:191
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

◆ ReadDetector()

const G4tgrVolume * TextDetectorBuilder::ReadDetector ( )

Read text geometry input.

Definition at line 439 of file gears.cc.

439  {
440  G4tgrFileReader *reader = G4tgrFileReader::GetInstance();
441  reader->SetLineProcessor(fLineProcessor);
442  reader->ReadFiles();
443  G4tgrVolumeMgr *mgr = G4tgrVolumeMgr::GetInstance();
444  const G4tgrVolume *world = mgr->GetTopVolume();
445  return world;
446 }

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