DetectorConstruction Class Reference

#include <DetectorConstruction.hh>

Collaboration diagram for DetectorConstruction:
Collaboration graph
[legend]

Public Member Functions

 DetectorConstruction ()
virtual ~DetectorConstruction ()
virtual G4VPhysicalVolume * Construct ()
void SetWorldMaterial (const G4String &)
void SetTargetMaterial (const G4String &)
void SetTargetRadius (G4double val)
void SetTargetLength (G4double val)
void UpdateGeometry ()

Private Member Functions

DetectorConstructionoperator= (const DetectorConstruction &right)
 DetectorConstruction (const DetectorConstruction &)

Private Attributes

G4double fRadius
G4double fLength
G4Material * fTargetMaterial
G4Material * fWorldMaterial
G4LogicalVolume * fLogicTarget
G4LogicalVolume * fLogicWorld
DetectorMessengerfDetectorMessenger

Detailed Description

Definition at line 54 of file DetectorConstruction.hh.


Constructor & Destructor Documentation

DetectorConstruction::DetectorConstruction (  ) 

Definition at line 69 of file DetectorConstruction.cc.

References fDetectorMessenger, fLength, fLogicTarget, fLogicWorld, fRadius, fTargetMaterial, and fWorldMaterial.

00070 {
00071   fLogicTarget = 0;
00072   fLogicWorld  = 0;
00073   fDetectorMessenger = new DetectorMessenger(this);
00074 
00075   fRadius = 5.*cm;
00076   fLength = 10.*cm;
00077 
00078   fTargetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
00079   fWorldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
00080 }

DetectorConstruction::~DetectorConstruction (  )  [virtual]

Definition at line 84 of file DetectorConstruction.cc.

References fDetectorMessenger.

00085 { 
00086   delete fDetectorMessenger;
00087 }

DetectorConstruction::DetectorConstruction ( const DetectorConstruction  )  [private]

Member Function Documentation

G4VPhysicalVolume * DetectorConstruction::Construct (  )  [virtual]

Definition at line 89 of file DetectorConstruction.cc.

References fLength, fLogicTarget, fLogicWorld, fRadius, fTargetMaterial, and fWorldMaterial.

Referenced by UpdateGeometry().

00090 {
00091   // Cleanup old geometry
00092 
00093   G4GeometryManager::GetInstance()->OpenGeometry();
00094   G4PhysicalVolumeStore::GetInstance()->Clean();
00095   G4LogicalVolumeStore::GetInstance()->Clean();
00096   G4SolidStore::GetInstance()->Clean();
00097 
00098   // Sizes
00099   G4double worldR  = fRadius + cm;
00100   G4double worldZ  = fLength + cm;
00101 
00102   //
00103   // World
00104   //
00105   G4Tubs* solidW = new G4Tubs("World", 0., worldR, 0.5*worldZ, 0., twopi);
00106   fLogicWorld = new G4LogicalVolume(solidW, fWorldMaterial,"World");
00107   G4VPhysicalVolume* world = new G4PVPlacement(0, G4ThreeVector(),
00108                                                fLogicWorld, "World", 
00109                                                0, false, 0);
00110 
00111   //
00112   // Target volume
00113   //
00114   G4Tubs* solidA = new G4Tubs("Target", 0., fRadius, 0.5*fLength, 0.,twopi);
00115   fLogicTarget = new G4LogicalVolume( solidA, fTargetMaterial, "Target");
00116   new G4PVPlacement(0, G4ThreeVector(), fLogicTarget, "Target",
00117                     fLogicWorld, false, 0);
00118 
00119   G4cout << "### Target consist of " 
00120          << fTargetMaterial->GetName() 
00121          << " disks with R(mm)= " << fRadius/mm
00122          << "  fLength(mm)= " << fLength/mm
00123          <<  "  ###" << G4endl;
00124 
00125   // colors
00126   fLogicWorld->SetVisAttributes(G4VisAttributes::Invisible);
00127 
00128   G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
00129   fLogicTarget->SetVisAttributes(regCcolor);
00130 
00131   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
00132 
00133   return world;
00134 }

Here is the caller graph for this function:

DetectorConstruction& DetectorConstruction::operator= ( const DetectorConstruction right  )  [private]
void DetectorConstruction::SetTargetLength ( G4double  val  ) 

Definition at line 183 of file DetectorConstruction.cc.

References fLength.

Referenced by DetectorMessenger::SetNewValue().

00184 {
00185   if(val > 0.0 && val != fLength) {
00186     fLength = val;
00187     G4RunManager::GetRunManager()->GeometryHasBeenModified();
00188   } 
00189 }

Here is the caller graph for this function:

void DetectorConstruction::SetTargetMaterial ( const G4String &  mat  ) 

Definition at line 138 of file DetectorConstruction.cc.

References fLogicTarget, and fTargetMaterial.

Referenced by DetectorMessenger::SetNewValue().

00139 {
00140   // search the material by its name
00141   G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
00142 
00143   if (material && material != fTargetMaterial) {
00144     fTargetMaterial = material;
00145     if(fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
00146     G4RunManager::GetRunManager()->PhysicsHasBeenModified();
00147   }
00148 }

Here is the caller graph for this function:

void DetectorConstruction::SetTargetRadius ( G4double  val  ) 

Definition at line 173 of file DetectorConstruction.cc.

References fRadius.

Referenced by DetectorMessenger::SetNewValue().

00174 {
00175   if(val > 0.0 && val != fRadius) {
00176     fRadius = val;
00177     G4RunManager::GetRunManager()->GeometryHasBeenModified();
00178   } 
00179 }

Here is the caller graph for this function:

void DetectorConstruction::SetWorldMaterial ( const G4String &  mat  ) 

Definition at line 152 of file DetectorConstruction.cc.

References fLogicWorld, and fWorldMaterial.

Referenced by DetectorMessenger::SetNewValue().

00153 {
00154   // search the material by its name
00155   G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
00156 
00157   if (material && material != fWorldMaterial) {
00158     fWorldMaterial = material;
00159     if(fLogicWorld) fLogicWorld->SetMaterial(fWorldMaterial);
00160     G4RunManager::GetRunManager()->PhysicsHasBeenModified();
00161   }
00162 }

Here is the caller graph for this function:

void DetectorConstruction::UpdateGeometry (  ) 

Definition at line 166 of file DetectorConstruction.cc.

References Construct().

Referenced by DetectorMessenger::SetNewValue().

00167 {
00168   G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
00169 }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

Definition at line 85 of file DetectorConstruction.hh.

Referenced by DetectorConstruction(), and ~DetectorConstruction().

G4double DetectorConstruction::fLength [private]

Definition at line 77 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetTargetLength().

G4LogicalVolume* DetectorConstruction::fLogicTarget [private]

Definition at line 82 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetTargetMaterial().

G4LogicalVolume* DetectorConstruction::fLogicWorld [private]

Definition at line 83 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetWorldMaterial().

G4double DetectorConstruction::fRadius [private]

Definition at line 76 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetTargetRadius().

Definition at line 79 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetTargetMaterial().

G4Material* DetectorConstruction::fWorldMaterial [private]

Definition at line 80 of file DetectorConstruction.hh.

Referenced by Construct(), DetectorConstruction(), and SetWorldMaterial().


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

Generated on 19 Feb 2017 for QwGeant4 by  doxygen 1.6.1