Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 G4VPhysicalVolumeConstruct ()
 
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 G4VPhysicalVolumeConstruct ()
 
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 G4VPhysicalVolumeConstruct ()
 
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
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

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 ExG4DetectorConstruction02.hh.

Constructor & Destructor Documentation

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 
)

Definition at line 42 of file ExG4DetectorConstruction02.cc.

48  fMessenger(this),
49  fBoxMaterialName(boxMaterialName),
50  fWorldMaterialName(worldMaterialName),
51  fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
52  fWorldSizeFactor(worldSizeFactor),
53  fBoxVolume(0),
54  fWorldVolume(0)
55 {
56 }
ExG4DetectorConstruction02::~ExG4DetectorConstruction02 ( )

Definition at line 60 of file ExG4DetectorConstruction02.cc.

61 {
62 }
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::~ExG4DetectorConstruction02 ( )
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::~ExG4DetectorConstruction02 ( )

Member Function Documentation

G4VPhysicalVolume * ExG4DetectorConstruction02::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 66 of file ExG4DetectorConstruction02.cc.

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

Here is the call graph for this function:

virtual G4VPhysicalVolume* ExG4DetectorConstruction02::Construct ( )
virtual
virtual G4VPhysicalVolume* ExG4DetectorConstruction02::Construct ( )
virtual
void ExG4DetectorConstruction02::SetBoxDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)
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 171 of file ExG4DetectorConstruction02.cc.

173 {
176 
177  fBoxDimensions = G4ThreeVector(hx, hy, hz);
178 }
CLHEP::Hep3Vector G4ThreeVector

Here is the caller graph for this function:

void ExG4DetectorConstruction02::SetBoxDimensions ( G4double  hx,
G4double  hy,
G4double  hz 
)
void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String materialName)

Definition at line 133 of file ExG4DetectorConstruction02.cc.

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

void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String materialName)
void ExG4DetectorConstruction02::SetBoxMaterial ( const G4String materialName)
void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String materialName)

Definition at line 152 of file ExG4DetectorConstruction02.cc.

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

void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String materialName)
void ExG4DetectorConstruction02::SetWorldMaterial ( const G4String materialName)
void ExG4DetectorConstruction02::SetWorldSizeFactor ( G4double  factor)
void ExG4DetectorConstruction02::SetWorldSizeFactor ( G4double  factor)
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 182 of file ExG4DetectorConstruction02.cc.

183 {
186 
187  fWorldSizeFactor = factor;
188 }

Here is the caller graph for this function:


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