Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes
G4VUserParallelWorld Class Referenceabstract

#include <G4VUserParallelWorld.hh>

Public Member Functions

virtual void Construct ()=0
 
virtual void ConstructSD ()
 
 G4VUserParallelWorld (const G4String &worldName)
 
const G4StringGetName ()
 
virtual ~G4VUserParallelWorld ()
 

Protected Member Functions

G4VPhysicalVolumeGetWorld ()
 
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Protected Attributes

G4String fWorldName = "ParallelWorld"
 

Detailed Description

Definition at line 47 of file G4VUserParallelWorld.hh.

Constructor & Destructor Documentation

◆ G4VUserParallelWorld()

G4VUserParallelWorld::G4VUserParallelWorld ( const G4String worldName)

Definition at line 41 of file G4VUserParallelWorld.cc.

42{
43 fWorldName = worldName;
44}

References fWorldName.

◆ ~G4VUserParallelWorld()

G4VUserParallelWorld::~G4VUserParallelWorld ( )
virtual

Definition at line 47 of file G4VUserParallelWorld.cc.

48{
49}

Member Function Documentation

◆ Construct()

virtual void G4VUserParallelWorld::Construct ( )
pure virtual

◆ ConstructSD()

void G4VUserParallelWorld::ConstructSD ( )
virtual

Definition at line 52 of file G4VUserParallelWorld.cc.

53{
54}

◆ GetName()

const G4String & G4VUserParallelWorld::GetName ( )
inline

Definition at line 57 of file G4VUserParallelWorld.hh.

57{ return fWorldName; }

References fWorldName.

Referenced by G4VUserDetectorConstruction::RegisterParallelWorld().

◆ GetWorld()

G4VPhysicalVolume * G4VUserParallelWorld::GetWorld ( )
protected

◆ SetSensitiveDetector() [1/2]

void G4VUserParallelWorld::SetSensitiveDetector ( const G4String logVolName,
G4VSensitiveDetector aSD,
G4bool  multi = false 
)
protected

Definition at line 67 of file G4VUserParallelWorld.cc.

70{
71 G4bool found = false;
73 auto volmap = store->GetMap();
74 auto pos = volmap.find(logVolName);
75 if(pos != volmap.cend())
76 {
77 if ((pos->second.size()>1) && !multi)
78 {
79 G4String eM = "More than one logical volumes of name <";
80 eM += pos->first;
81 eM += "> are found and thus the sensitive detector <";
82 eM += aSD->GetName();
83 eM += "> cannot be uniquely assigned.";
84 G4Exception("G4VUserParallelWorld::SetSensitiveDetector()",
85 "Run0052", FatalErrorInArgument, eM);
86 }
87 found = true;
88 for (std::size_t i = 0; i < pos->second.size(); ++i)
89 {
90 SetSensitiveDetector(pos->second[i], aSD);
91 }
92 }
93 if(!found)
94 {
95 G4String eM2 = "No logical volume of name <";
96 eM2 += logVolName;
97 eM2 += "> is found. The specified sensitive detector <";
98 eM2 += aSD->GetName();
99 eM2 += "> couldn't be assigned to any volume.";
100 G4Exception("G4VUserParallelWorld::SetSensitiveDetector()",
101 "Run0053", FatalErrorInArgument, eM2);
102 }
103}
static const G4double pos
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
bool G4bool
Definition: G4Types.hh:86
const std::map< G4String, std::vector< G4LogicalVolume * > > & GetMap() const
static G4LogicalVolumeStore * GetInstance()
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)

References FatalErrorInArgument, G4Exception(), G4LogicalVolumeStore::GetInstance(), G4LogicalVolumeStore::GetMap(), G4VSensitiveDetector::GetName(), pos, and SetSensitiveDetector().

Referenced by SetSensitiveDetector().

◆ SetSensitiveDetector() [2/2]

void G4VUserParallelWorld::SetSensitiveDetector ( G4LogicalVolume logVol,
G4VSensitiveDetector aSD 
)
protected

Definition at line 106 of file G4VUserParallelWorld.cc.

108{
110 logVol->SetSensitiveDetector(aSD);
111}
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:38
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:70

References G4SDManager::AddNewDetector(), G4SDManager::GetSDMpointer(), and G4LogicalVolume::SetSensitiveDetector().

Field Documentation

◆ fWorldName

G4String G4VUserParallelWorld::fWorldName = "ParallelWorld"
protected

Definition at line 70 of file G4VUserParallelWorld.hh.

Referenced by G4VUserParallelWorld(), GetName(), and GetWorld().


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