DetectorConstruction Class Reference

#include <DetectorConstruction.hh>

Inheritance diagram for DetectorConstruction:

Inheritance graph
[legend]
Collaboration diagram for DetectorConstruction:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 DetectorConstruction ()
 ~DetectorConstruction ()
G4VPhysicalVolume * Construct ()
G4Material * GetSpacecraftMaterial ()
G4Material * GetCabinMaterial ()
G4Material * GetFloorMaterial ()
G4Material * GetAstronautMaterial ()
G4double GetWorldSizeXY ()
G4double GetWorldSizeZ ()
void PrintParameters ()

Private Member Functions

void DefineMaterials ()
G4VPhysicalVolume * ConstructVolumes ()

Private Attributes

G4Material * m_worldMaterial
G4Material * m_spacecraftMaterial
G4Material * m_cabinMaterial
G4Material * m_floorMaterial
G4Material * m_astronautMaterial
G4VPhysicalVolume * m_physiWorld
G4double m_worldSizeXY
G4double m_worldSizeZ


Detailed Description

Definition at line 18 of file DetectorConstruction.hh.


Constructor & Destructor Documentation

DetectorConstruction::DetectorConstruction (  ) 

Definition at line 22 of file DetectorConstruction.cc.

00023 {  
00024   DefineMaterials();
00025 }

DetectorConstruction::~DetectorConstruction (  ) 

Definition at line 29 of file DetectorConstruction.cc.

00030 { }


Member Function Documentation

G4VPhysicalVolume * DetectorConstruction::Construct (  ) 

Definition at line 34 of file DetectorConstruction.cc.

00035 {
00036   return ConstructVolumes();
00037 }

G4Material* DetectorConstruction::GetSpacecraftMaterial (  )  [inline]

Definition at line 31 of file DetectorConstruction.hh.

00031 {return m_spacecraftMaterial;};

G4Material* DetectorConstruction::GetCabinMaterial (  )  [inline]

Definition at line 32 of file DetectorConstruction.hh.

00032 {return m_cabinMaterial;};     

G4Material* DetectorConstruction::GetFloorMaterial (  )  [inline]

Definition at line 33 of file DetectorConstruction.hh.

00033 {return m_floorMaterial;};

G4Material* DetectorConstruction::GetAstronautMaterial (  )  [inline]

Definition at line 34 of file DetectorConstruction.hh.

00034 {return m_astronautMaterial;};

G4double DetectorConstruction::GetWorldSizeXY (  )  [inline]

Definition at line 36 of file DetectorConstruction.hh.

00036 {return m_worldSizeXY;};

G4double DetectorConstruction::GetWorldSizeZ (  )  [inline]

Definition at line 37 of file DetectorConstruction.hh.

00037 {return m_worldSizeZ;};

void DetectorConstruction::PrintParameters (  ) 

Definition at line 273 of file DetectorConstruction.cc.

Referenced by ConstructVolumes().

00274 {
00275   G4cout << "\n---------------------------------------------------------\n";
00276   G4cout 
00277     << "---> The world is in " << m_worldMaterial->GetName()           << "\n"
00278     << "---> The spacecraft is in " << m_spacecraftMaterial->GetName() << "\n"
00279     << "---> The cabin is in " << m_cabinMaterial->GetName()           << "\n"
00280     << "---> The floor is in " << m_floorMaterial->GetName()           << "\n"     
00281     << "---> The astronaut is in " << m_astronautMaterial->GetName();
00282   G4cout << "\n---------------------------------------------------------\n";
00283   G4cout << G4endl;
00284 }

void DetectorConstruction::DefineMaterials (  )  [private]

Definition at line 41 of file DetectorConstruction.cc.

Referenced by DetectorConstruction().

00042 { 
00043   //
00044   // define simple materials
00045   //
00046   G4double Z,A,density;
00047   
00048   G4Material* Al =
00049   new G4Material("Aluminium", Z=13., A=26.98*g/mole, density=2.700*g/cm3);
00050   
00051   //
00052   // build compounds from Elements
00053   //
00054   G4Element* H  = new G4Element("Hydrogen" ,"H" , Z=1., A= 1.01*g/mole);  
00055   G4Element* N  = new G4Element("Nitrogen" ,"N" , Z=7., A=14.01*g/mole);
00056   G4Element* O  = new G4Element("Oxygen"   ,"O" , Z=8., A=16.00*g/mole);
00057 
00058   G4int ncomponents, natoms;
00059   G4double fractionmass;  
00060   
00061   G4Material* Air = 
00062   new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
00063   Air->AddElement(N, fractionmass=70.*perCent);
00064   Air->AddElement(O, fractionmass=30.*perCent);
00065 
00066   G4Material* H2O = 
00067   new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
00068   H2O->AddElement(H, natoms=2);
00069   H2O->AddElement(O, natoms=1);
00070         
00071   // Vacuum standard definition...
00072   //
00073   G4Material* Vacuum =
00074   new G4Material("Galactic", Z=1., A=1.01*g/mole, density= 1.e-10*g/cm3,
00075                            kStateGas, 2.73*kelvin, 3.e-18*pascal);
00076                            
00077   //associate materials
00078   //
00079   m_worldMaterial = Vacuum;
00080   m_spacecraftMaterial = m_floorMaterial = Al;
00081   m_cabinMaterial = Air;
00082   m_astronautMaterial = H2O;
00083                              
00084   // Print
00085   //
00086   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
00087 }

G4VPhysicalVolume * DetectorConstruction::ConstructVolumes (  )  [private]

Definition at line 91 of file DetectorConstruction.cc.

Referenced by Construct().

00092 {  
00093   //define geometrical parameters
00094   //
00095   G4double cabinRadius = 50*cm;       
00096   G4double cabinLength = 80*cm;
00097   
00098   G4double spacecraftThickness = 2*cm;    
00099   G4double spacecraftRadius = cabinRadius + spacecraftThickness;       
00100   G4double spacecraftLength = cabinLength + 2*spacecraftThickness;
00101   
00102   G4double floorThickness = 2*cm;
00103   G4double floorYcenter   = - 0.5*cabinRadius;
00104   G4double floorYtop      = floorYcenter + 0.5*floorThickness;
00105   G4double floorYbottom   = floorYcenter - 0.5*floorThickness;      
00106   G4double floorWidth =
00107           2*std::sqrt(cabinRadius*cabinRadius - floorYbottom*floorYbottom);
00108   G4double floorLength    = cabinLength;
00109     
00110   m_worldSizeXY = 2.2*spacecraftRadius;
00111   m_worldSizeZ  = 1.1*spacecraftLength;
00112     
00113   G4double astronautHeight = 50*cm; 
00114   G4double astronautTopWidth = 40*cm; 
00115   G4double astronautBottomWidth = 60*cm;
00116   G4double astronautPosition = floorYtop + 0.5*astronautHeight;
00117   
00118     
00119   // World volume
00120   //
00121 
00122   G4Box*
00123   solidWorld = new G4Box("World",                                  //its name
00124                  m_worldSizeXY/2,m_worldSizeXY/2,m_worldSizeZ/2);  //its size
00125   
00126   G4LogicalVolume*  
00127   logicWorld = new G4LogicalVolume(solidWorld,          //its solid
00128                                    m_worldMaterial,     //its material
00129                                    "World");            //its name
00130 
00131   m_physiWorld = new G4PVPlacement(0,                   //no rotation
00132                                  G4ThreeVector(),       //at (0,0,0)
00133                                  logicWorld,            //its logical volume
00134                                  "World",               //its name
00135                                  0,                     //its mother  volume
00136                                  false,                 //no boolean operation
00137                                  0);                    //copy number
00138                                  
00139   // SpaceCraft volume
00140   //
00141   G4Tubs*
00142   solidSpacecraft = new G4Tubs("Spacecraft",            //name
00143                          0*cm, spacecraftRadius,        //r1, r2
00144                          0.5*spacecraftLength,          //half-length 
00145                          0., twopi);                    //teta1, teta2
00146                          
00147   G4LogicalVolume*    
00148   logicSpacecraft = new G4LogicalVolume(solidSpacecraft,   //solid
00149                                     m_spacecraftMaterial,  //material
00150                                         "Spacecraft");     //name
00151   
00152                     new G4PVPlacement(0,                //no rotation
00153                                   G4ThreeVector(0,0,0), //position
00154                                   logicSpacecraft,      //logicalVolume
00155                                   "Spacecraft",         //name
00156                                    logicWorld,          //mother
00157                                    false,               //no boolean
00158                                    0);                  //copy nb
00159   
00160   // Cabin
00161   //
00162   G4Tubs*
00163   solidCabin = new G4Tubs("Cabin",                      //name
00164                          0*cm, cabinRadius,             //r1, r2
00165                          0.5*cabinLength,               //half-length 
00166                          0., 360*deg);                  //teta1, teta2
00167                          
00168   G4LogicalVolume*    
00169   logicCabin = new G4LogicalVolume(solidCabin,          //solid
00170                                    m_cabinMaterial,     //material
00171                                    "Cabin");            //name
00172                                           
00173                new G4PVPlacement(0,                     //no rotation
00174                                  G4ThreeVector(0,0,0),  //position
00175                                  logicCabin,            //logicalVolume
00176                                  "Cabin",               //name
00177                                   logicSpacecraft,      //mother
00178                                   false,                //no boolean
00179                                   0);                   //copy nb
00180   
00181 
00182   // Floor
00183   //
00184   G4Box*
00185   solidFloor = new G4Box("Floor",                                    //name
00186                     floorWidth/2,floorLength/2,floorThickness/2);    //size
00187                     
00188   G4LogicalVolume*  
00189   logicFloor = new G4LogicalVolume(solidFloor, m_floorMaterial, "Floor");
00190   
00191   //rotation matrix to place the floor within cabin
00192   G4RotationMatrix* rotm1 = new G4RotationMatrix();
00193   rotm1->rotateX(90*deg);
00194 
00195               new G4PVPlacement(rotm1,                  //rotation
00196                                  G4ThreeVector(0,floorYcenter,0), //position 
00197                                  logicFloor,            //logicalVolume 
00198                                  "Floor",               //name 
00199                                  logicCabin,            //mother
00200                                  false,                 //no boolean
00201                                  0);                    //copy nb
00202                                  
00203   // Astronaut
00204   //
00205    G4Trd*
00206    solidAstronaut = new G4Trd("Astronaut",              //name                            
00207                0.5 * astronautBottomWidth,              //dx1
00208                0.5 * astronautTopWidth,                 //dx2
00209                0.5 * astronautBottomWidth,              //dy1
00210                0.5 * astronautTopWidth,                 //dy2
00211                0.5 * astronautHeight);                  //dz
00212 
00213                          
00214   G4LogicalVolume*    
00215   logicAstronaut = new G4LogicalVolume(solidAstronaut,  //solid
00216                                    m_astronautMaterial, //material
00217                                    "Astronaut");        //name
00218                                    
00219   //rotation matrix to place astronaut within cabin
00220   G4RotationMatrix* rotm2 = new G4RotationMatrix();
00221   rotm2->rotateX(90*deg);
00222   
00223   //translation vector to place astronaut within cabin
00224   G4ThreeVector position = G4ThreeVector(0.,astronautPosition,0.);                                 
00225                                           
00226                new G4PVPlacement(rotm2,                 //no rotation
00227                                  position,              //position
00228                                  logicAstronaut,        //logicalVolume
00229                                  "Astronaut",           //name
00230                                   logicCabin,           //mother
00231                                   false,                //no boolean
00232                                   0);                   //copy nb
00233   //colour attributes
00234   //
00235   
00236   G4VisAttributes* colourWhite= new G4VisAttributes(G4Colour(1.,1.,1.)); 
00237   colourWhite->SetVisibility(true);
00238   colourWhite->SetForceSolid(false);
00239   
00240   G4VisAttributes* colourGrey= new G4VisAttributes(G4Colour(0.5,0.5,0.5)); 
00241   colourGrey->SetVisibility(true);
00242   colourGrey->SetForceSolid(false);
00243   
00244   G4VisAttributes* colourCyan= new G4VisAttributes(G4Colour(0.,1.,1.)); 
00245   colourCyan->SetVisibility(true);
00246   colourCyan->SetForceSolid(false);
00247 
00248   G4VisAttributes* colourMagenta= new G4VisAttributes(G4Colour(1.,0.,1.)); 
00249   colourMagenta->SetVisibility(true);
00250   colourMagenta->SetForceSolid(true);
00251 
00252   G4VisAttributes* colourBlue= new G4VisAttributes(G4Colour(0.,0.,1.)); 
00253   colourBlue->SetVisibility(true);
00254   colourBlue->SetForceSolid(false);
00255   
00256   logicWorld->SetVisAttributes(colourGrey);
00257   logicSpacecraft->SetVisAttributes(colourCyan);
00258   logicCabin->SetVisAttributes(colourCyan);
00259   logicFloor->SetVisAttributes(colourWhite);
00260   logicAstronaut->SetVisAttributes(colourBlue);
00261     
00262   //print parameters
00263   //
00264   PrintParameters();
00265   
00266   // always return Physical World
00267   //
00268   return m_physiWorld;
00269 }


Member Data Documentation

Definition at line 48 of file DetectorConstruction.hh.

Referenced by ConstructVolumes(), DefineMaterials(), and PrintParameters().

G4VPhysicalVolume* DetectorConstruction::m_physiWorld [private]

Definition at line 54 of file DetectorConstruction.hh.

Referenced by ConstructVolumes().

Definition at line 55 of file DetectorConstruction.hh.

Referenced by ConstructVolumes(), and GetWorldSizeXY().

Definition at line 55 of file DetectorConstruction.hh.

Referenced by ConstructVolumes(), and GetWorldSizeZ().


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

Generated on Fri Nov 21 10:19:49 2008 for jour1b by  doxygen 1.5.7.1