Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
ExG4DetectorConstruction01 Class Reference

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

#include <ExG4DetectorConstruction01.hh>

Inheritance diagram for ExG4DetectorConstruction01:
G4VUserDetectorConstruction

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)
 
- 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 only a world volume.

Definition at line 48 of file ExG4DetectorConstruction01.hh.

Constructor & Destructor Documentation

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

Definition at line 43 of file ExG4DetectorConstruction01.cc.

47  fMessenger(this),
48  fMaterialName(materialName),
49  fDimensions(hx, hy, hz),
50  fWorldVolume(0)
51 {
52 }
ExG4DetectorConstruction01::~ExG4DetectorConstruction01 ( )

Definition at line 56 of file ExG4DetectorConstruction01.cc.

57 {
58 }

Member Function Documentation

G4VPhysicalVolume * ExG4DetectorConstruction01::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 62 of file ExG4DetectorConstruction01.cc.

References G4NistManager::FindOrBuildMaterial(), G4NistManager::Instance(), eplot::material, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

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 
79  fWorldVolume
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
double x() const
Definition: G4Box.hh:63
static G4NistManager * Instance()
double z() const
string material
Definition: eplot.py:19
double y() const
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 ExG4DetectorConstruction01.cc.

Referenced by ExG4DetectorConstruction01Messenger::SetNewValue().

121 {
122 /// Set world dimension (in half lengths).
123 /// This setting has effect only if called in PreInit> phase
124 
125  fDimensions = G4ThreeVector(hx, hy, hz);
126 }
CLHEP::Hep3Vector G4ThreeVector
void ExG4DetectorConstruction01::SetMaterial ( const G4String materialName)

Definition at line 100 of file ExG4DetectorConstruction01.cc.

References G4NistManager::FindOrBuildMaterial(), G4cerr, G4cout, G4endl, G4NistManager::Instance(), and G4LogicalVolume::SetMaterial().

Referenced by ExG4DetectorConstruction01Messenger::SetNewValue().

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

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