Geant4  10.02.p03
ExG4DetectorConstruction02 Class Reference

Simple detector construction with a box volume placed in a world. More...

#include <ExG4DetectorConstruction02.hh>

Inheritance diagram for ExG4DetectorConstruction02:
Collaboration diagram for ExG4DetectorConstruction02:

Public Member Functions

 ExG4DetectorConstruction02 (const G4String &boxMaterialName="G4_AIR", G4double boxHx=40 *CLHEP::cm, G4double boxHy=40 *CLHEP::cm, G4double boxHz=40 *CLHEP::cm, const G4String &worldMaterialName="G4_AIR", G4double worldSizeFactor=1.25)
 
 ~ExG4DetectorConstruction02 ()
 
virtual G4VPhysicalVolume * Construct ()
 
void SetBoxMaterial (const G4String &materialName)
 
void SetWorldMaterial (const G4String &materialName)
 
void SetBoxDimensions (G4double hx, G4double hy, G4double hz)
 
void SetWorldSizeFactor (G4double factor)
 
 ExG4DetectorConstruction02 (const G4String &boxMaterialName="G4_AIR", G4double boxHx=40 *CLHEP::cm, G4double boxHy=40 *CLHEP::cm, G4double boxHz=40 *CLHEP::cm, const G4String &worldMaterialName="G4_AIR", G4double worldSizeFactor=1.25)
 
 ~ExG4DetectorConstruction02 ()
 
virtual G4VPhysicalVolume * Construct ()
 
void SetBoxMaterial (const G4String &materialName)
 
void SetWorldMaterial (const G4String &materialName)
 
void SetBoxDimensions (G4double hx, G4double hy, G4double hz)
 
void SetWorldSizeFactor (G4double factor)
 
 ExG4DetectorConstruction02 (const G4String &boxMaterialName="G4_AIR", G4double boxHx=40 *CLHEP::cm, G4double boxHy=40 *CLHEP::cm, G4double boxHz=40 *CLHEP::cm, const G4String &worldMaterialName="G4_AIR", G4double worldSizeFactor=1.25)
 
 ~ExG4DetectorConstruction02 ()
 
virtual G4VPhysicalVolume * Construct ()
 
void SetBoxMaterial (const G4String &materialName)
 
void SetWorldMaterial (const G4String &materialName)
 
void SetBoxDimensions (G4double hx, G4double hy, G4double hz)
 
void SetWorldSizeFactor (G4double factor)
 
- 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
 
G4VUserParallelWorld * GetParallelWorld (G4int i) const
 

Private Attributes

ExG4DetectorConstruction02Messenger fMessenger
 
G4String fBoxMaterialName
 
G4String fWorldMaterialName
 
G4ThreeVector fBoxDimensions
 
G4double fWorldSizeFactor
 
G4LogicalVolume * fBoxVolume
 
G4LogicalVolume * fWorldVolume
 

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 a box volume placed in a world.

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

Constructor & Destructor Documentation

◆ ExG4DetectorConstruction02() [1/3]

ExG4DetectorConstruction02::ExG4DetectorConstruction02 ( const G4String &  boxMaterialName = "G4_AIR",
G4double  boxHx = 40*CLHEP::cm,
G4double  boxHy = 40*CLHEP::cm,
G4double  boxHz = 40*CLHEP::cm,
const G4String &  worldMaterialName = "G4_AIR",
G4double  worldSizeFactor = 1.25 
)

◆ ~ExG4DetectorConstruction02() [1/3]

ExG4DetectorConstruction02::~ExG4DetectorConstruction02 ( )

Definition at line 61 of file common/src/ExG4DetectorConstruction02.cc.

62 {
63 }

◆ ExG4DetectorConstruction02() [2/3]

ExG4DetectorConstruction02::ExG4DetectorConstruction02 ( const G4String &  boxMaterialName = "G4_AIR",
G4double  boxHx = 40 *CLHEP::cm,
G4double  boxHy = 40 *CLHEP::cm,
G4double  boxHz = 40 *CLHEP::cm,
const G4String &  worldMaterialName = "G4_AIR",
G4double  worldSizeFactor = 1.25 
)

◆ ~ExG4DetectorConstruction02() [2/3]

ExG4DetectorConstruction02::~ExG4DetectorConstruction02 ( )

◆ ExG4DetectorConstruction02() [3/3]

ExG4DetectorConstruction02::ExG4DetectorConstruction02 ( const G4String &  boxMaterialName = "G4_AIR",
G4double  boxHx = 40 *CLHEP::cm,
G4double  boxHy = 40 *CLHEP::cm,
G4double  boxHz = 40 *CLHEP::cm,
const G4String &  worldMaterialName = "G4_AIR",
G4double  worldSizeFactor = 1.25 
)

◆ ~ExG4DetectorConstruction02() [3/3]

ExG4DetectorConstruction02::~ExG4DetectorConstruction02 ( )

Member Function Documentation

◆ Construct() [1/3]

G4VPhysicalVolume * ExG4DetectorConstruction02::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 67 of file common/src/ExG4DetectorConstruction02.cc.

68 {
69  // Define materials via NIST manager
70  //
71  G4NistManager* nistManager = G4NistManager::Instance();
72 
73  G4Material* worldMaterial
75 
76  G4Material* boxMaterial
77  = nistManager->FindOrBuildMaterial(fBoxMaterialName);
78 
79  // Geometry parameters
80  //
81  G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
82 
83 
84  // World
85  //
86  G4Box* sWorld
87  = new G4Box("World", //name
88  worldDimensions.x(), //dimensions (half-lentghs)
89  worldDimensions.y(),
90  worldDimensions.z());
91 
93  = new G4LogicalVolume(sWorld, //shape
94  worldMaterial, //material
95  "World"); //name
96 
97  G4VPhysicalVolume* pWorld
98  = new G4PVPlacement(0, //no rotation
99  G4ThreeVector(), //at (0,0,0)
100  fWorldVolume, //logical volume
101  "World", //name
102  0, //mother volume
103  false, //no boolean operation
104  0); //copy number
105 
106  // Box
107  //
108  G4Box* sBox
109  = new G4Box("Box", //its name
110  fBoxDimensions.x(), //dimensions (half-lengths)
111  fBoxDimensions.y(),
112  fBoxDimensions.z());
113 
114  fBoxVolume
115  = new G4LogicalVolume(sBox, //its shape
116  boxMaterial, //its material
117  "Box"); //its name
118 
119  new G4PVPlacement(0, //no rotation
120  G4ThreeVector(), //at (0,0,0)
121  fBoxVolume, //its logical volume
122  "Box", //its name
123  fWorldVolume, //its mother volume
124  false, //no boolean operation
125  0); //copy number
126 
127  //always return the root volume
128  //
129  return pWorld;
130 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
static G4NistManager * Instance()
double x() const
double y() const
double z() const
Here is the call graph for this function:

◆ Construct() [2/3]

virtual G4VPhysicalVolume* ExG4DetectorConstruction02::Construct ( )
virtual

◆ Construct() [3/3]

virtual G4VPhysicalVolume* ExG4DetectorConstruction02::Construct ( )
virtual

◆ SetBoxDimensions() [1/3]

void ExG4DetectorConstruction02::SetBoxDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

◆ SetBoxDimensions() [2/3]

void ExG4DetectorConstruction02::SetBoxDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

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

Definition at line 172 of file common/src/ExG4DetectorConstruction02.cc.

174 {
177 
178  fBoxDimensions = G4ThreeVector(hx, hy, hz);
179 }
CLHEP::Hep3Vector G4ThreeVector
Here is the caller graph for this function:

◆ SetBoxDimensions() [3/3]

void ExG4DetectorConstruction02::SetBoxDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)

◆ SetBoxMaterial() [1/3]

void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String &  materialName)

Definition at line 134 of file common/src/ExG4DetectorConstruction02.cc.

135 {
136  G4NistManager* nistManager = G4NistManager::Instance();
137 
138  G4Material* newMaterial
139  = nistManager->FindOrBuildMaterial(materialName);
140 
141  if ( ! newMaterial ) {
142  G4cerr << "Material " << materialName << " not found." << G4endl;
143  G4cerr << "The box material was not changed." << G4endl;
144  return;
145  }
146 
147  if ( fBoxVolume ) fBoxVolume->SetMaterial(newMaterial);
148  G4cout << "Material of box changed to " << materialName << G4endl;
149 }
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:

◆ SetBoxMaterial() [2/3]

void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String &  materialName)

◆ SetBoxMaterial() [3/3]

void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String &  materialName)

◆ SetWorldMaterial() [1/3]

void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String &  materialName)

Definition at line 153 of file common/src/ExG4DetectorConstruction02.cc.

154 {
155  G4NistManager* nistManager = G4NistManager::Instance();
156 
157  G4Material* newMaterial
158  = nistManager->FindOrBuildMaterial(materialName);
159 
160  if ( ! newMaterial ) {
161  G4cerr << "Material " << materialName << " not found." << G4endl;
162  G4cerr << "The box material was not changed." << G4endl;
163  return;
164  }
165 
166  if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
167  G4cout << "Material of box changed to " << materialName << G4endl;
168 }
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:

◆ SetWorldMaterial() [2/3]

void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String &  materialName)

◆ SetWorldMaterial() [3/3]

void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String &  materialName)

◆ SetWorldSizeFactor() [1/3]

void ExG4DetectorConstruction02::SetWorldSizeFactor ( G4double  factor)

◆ SetWorldSizeFactor() [2/3]

void ExG4DetectorConstruction02::SetWorldSizeFactor ( G4double  factor)

◆ SetWorldSizeFactor() [3/3]

void ExG4DetectorConstruction02::SetWorldSizeFactor ( G4double  factor)

Set the multiplication factor from box dimensions to world dimensions. This setting has effect only if called in PreInit> phase

Definition at line 183 of file common/src/ExG4DetectorConstruction02.cc.

184 {
187 
189 }
static const G4double factor
Here is the caller graph for this function:

Member Data Documentation

◆ fBoxDimensions

G4ThreeVector ExG4DetectorConstruction02::fBoxDimensions
private

Definition at line 75 of file common/include/ExG4DetectorConstruction02.hh.

◆ fBoxMaterialName

G4String ExG4DetectorConstruction02::fBoxMaterialName
private

Definition at line 73 of file common/include/ExG4DetectorConstruction02.hh.

◆ fBoxVolume

G4LogicalVolume * ExG4DetectorConstruction02::fBoxVolume
private

Definition at line 77 of file common/include/ExG4DetectorConstruction02.hh.

◆ fMessenger

ExG4DetectorConstruction02Messenger ExG4DetectorConstruction02::fMessenger
private

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

◆ fWorldMaterialName

G4String ExG4DetectorConstruction02::fWorldMaterialName
private

Definition at line 74 of file common/include/ExG4DetectorConstruction02.hh.

◆ fWorldSizeFactor

G4double ExG4DetectorConstruction02::fWorldSizeFactor
private

Definition at line 76 of file common/include/ExG4DetectorConstruction02.hh.

◆ fWorldVolume

G4LogicalVolume * ExG4DetectorConstruction02::fWorldVolume
private

Definition at line 78 of file common/include/ExG4DetectorConstruction02.hh.


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