Geant4  10.02.p03
ExG4DetectorConstruction01 Class Reference

Simple detector construction with only a world volume. More...

#include <ExG4DetectorConstruction01.hh>

Inheritance diagram for ExG4DetectorConstruction01:
Collaboration diagram for ExG4DetectorConstruction01:

Public Member Functions

 ExG4DetectorConstruction01 (const G4String &materialName="G4_AIR", G4double hx=50 *CLHEP::cm, G4double hy=50 *CLHEP::cm, G4double hz=50 *CLHEP::cm)
 
 ~ExG4DetectorConstruction01 ()
 
virtual G4VPhysicalVolumeConstruct ()
 
void SetMaterial (const G4String &materialName)
 
void SetDimensions (G4double hx, G4double hy, G4double hz)
 
 ExG4DetectorConstruction01 (const G4String &materialName="G4_AIR", G4double hx=50 *CLHEP::cm, G4double hy=50 *CLHEP::cm, G4double hz=50 *CLHEP::cm)
 
 ~ExG4DetectorConstruction01 ()
 
virtual G4VPhysicalVolumeConstruct ()
 
void SetMaterial (const G4String &materialName)
 
void SetDimensions (G4double hx, G4double hy, G4double hz)
 
 ExG4DetectorConstruction01 (const G4String &materialName="G4_AIR", G4double hx=50 *CLHEP::cm, G4double hy=50 *CLHEP::cm, G4double hz=50 *CLHEP::cm)
 
 ~ExG4DetectorConstruction01 ()
 
virtual G4VPhysicalVolumeConstruct ()
 
void SetMaterial (const G4String &materialName)
 
void SetDimensions (G4double hx, G4double hy, G4double hz)
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void ConstructSDandField ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Private Attributes

ExG4DetectorConstruction01Messenger fMessenger
 
G4String fMaterialName
 
G4ThreeVector fDimensions
 
G4LogicalVolumefWorldVolume
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Simple detector construction with only a world volume.

Definition at line 48 of file common/include/ExG4DetectorConstruction01.hh.

Constructor & Destructor Documentation

◆ ExG4DetectorConstruction01() [1/3]

ExG4DetectorConstruction01::ExG4DetectorConstruction01 ( const G4String materialName = "G4_AIR",
G4double  hx = 50*CLHEP::cm,
G4double  hy = 50*CLHEP::cm,
G4double  hz = 50*CLHEP::cm 
)

◆ ~ExG4DetectorConstruction01() [1/3]

ExG4DetectorConstruction01::~ExG4DetectorConstruction01 ( )

Definition at line 56 of file common/src/ExG4DetectorConstruction01.cc.

57 {
58 }

◆ ExG4DetectorConstruction01() [2/3]

ExG4DetectorConstruction01::ExG4DetectorConstruction01 ( const G4String materialName = "G4_AIR",
G4double  hx = 50 *CLHEP::cm,
G4double  hy = 50 *CLHEP::cm,
G4double  hz = 50 *CLHEP::cm 
)

◆ ~ExG4DetectorConstruction01() [2/3]

ExG4DetectorConstruction01::~ExG4DetectorConstruction01 ( )

◆ ExG4DetectorConstruction01() [3/3]

ExG4DetectorConstruction01::ExG4DetectorConstruction01 ( const G4String materialName = "G4_AIR",
G4double  hx = 50 *CLHEP::cm,
G4double  hy = 50 *CLHEP::cm,
G4double  hz = 50 *CLHEP::cm 
)

◆ ~ExG4DetectorConstruction01() [3/3]

ExG4DetectorConstruction01::~ExG4DetectorConstruction01 ( )

Member Function Documentation

◆ Construct() [1/3]

G4VPhysicalVolume * ExG4DetectorConstruction01::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 62 of file common/src/ExG4DetectorConstruction01.cc.

63 {
64  // Define materials via NIST manager
65  //
66  G4NistManager* nistManager = G4NistManager::Instance();
67 
69  = nistManager->FindOrBuildMaterial(fMaterialName);
70 
71  // World
72  //
73  G4Box* sWorld
74  = new G4Box("World", //name
75  fDimensions.x(), //dimensions (half-lentghs)
76  fDimensions.y(),
77  fDimensions.z());
78 
80  = new G4LogicalVolume(sWorld, //shape
81  material, //material
82  "World"); //name
83 
84  G4VPhysicalVolume* pWorld
85  = new G4PVPlacement(0, //no rotation
86  G4ThreeVector(), //at (0,0,0)
87  fWorldVolume, //logical volume
88  "World", //name
89  0, //mother volume
90  false, //no boolean operation
91  0); //copy number
92 
93  //always return the root volume
94  //
95  return pWorld;
96 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
static G4NistManager * Instance()
string material
Definition: eplot.py:19
double x() const
double y() const
double z() const
Here is the call graph for this function:

◆ Construct() [2/3]

virtual G4VPhysicalVolume* ExG4DetectorConstruction01::Construct ( )
virtual

◆ Construct() [3/3]

virtual G4VPhysicalVolume* ExG4DetectorConstruction01::Construct ( )
virtual

◆ SetDimensions() [1/3]

void ExG4DetectorConstruction01::SetDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

Set world dimension (in half lengths). This setting has effect only if called in PreInit> phase

Definition at line 119 of file common/src/ExG4DetectorConstruction01.cc.

121 {
124 
125  fDimensions = G4ThreeVector(hx, hy, hz);
126 }
CLHEP::Hep3Vector G4ThreeVector
Here is the caller graph for this function:

◆ SetDimensions() [2/3]

void ExG4DetectorConstruction01::SetDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

◆ SetDimensions() [3/3]

void ExG4DetectorConstruction01::SetDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

◆ SetMaterial() [1/3]

void ExG4DetectorConstruction01::SetMaterial ( const G4String materialName)

Definition at line 100 of file common/src/ExG4DetectorConstruction01.cc.

101 {
102  G4NistManager* nistManager = G4NistManager::Instance();
103 
104  G4Material* newMaterial
105  = nistManager->FindOrBuildMaterial(materialName);
106 
107  if ( ! newMaterial ) {
108  G4cerr << "Material " << materialName << " not found." << G4endl;
109  G4cerr << "The box material was not changed." << G4endl;
110  return;
111  }
112 
113  if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
114  G4cout << "Material of box changed to " << materialName << G4endl;
115 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void SetMaterial(G4Material *pMaterial)
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMaterial() [2/3]

void ExG4DetectorConstruction01::SetMaterial ( const G4String materialName)

◆ SetMaterial() [3/3]

void ExG4DetectorConstruction01::SetMaterial ( const G4String materialName)

Member Data Documentation

◆ fDimensions

G4ThreeVector ExG4DetectorConstruction01::fDimensions
private

Definition at line 70 of file common/include/ExG4DetectorConstruction01.hh.

◆ fMaterialName

G4String ExG4DetectorConstruction01::fMaterialName
private

Definition at line 69 of file common/include/ExG4DetectorConstruction01.hh.

◆ fMessenger

ExG4DetectorConstruction01Messenger ExG4DetectorConstruction01::fMessenger
private

Definition at line 67 of file common/include/ExG4DetectorConstruction01.hh.

◆ fWorldVolume

G4LogicalVolume * ExG4DetectorConstruction01::fWorldVolume
private

Definition at line 71 of file common/include/ExG4DetectorConstruction01.hh.


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