Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
@@ -27,7 +27,6 @@
/// \brief Implementation of the DetectorConstruction class
//
//
// $Id: DetectorConstruction.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,10 +37,11 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
@@ -50,112 +50,82 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::DetectorConstruction() :
Iron(0), Copper(0), Tungsten(0), Lead(0), Uranium(0), PbWO4(0),
Polystyrene(0), LiquidArgon(0),
theAbsorberMaterial(0),
logicAbsorber(0), physiAbsorber(0) {}
DetectorConstruction::DetectorConstruction() :
G4VUserDetectorConstruction(),
fAbsorberMaterial(0) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::~DetectorConstruction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DetectorConstruction::Construct()
{
//------------------- materials ------------------------
G4double a; // atomic mass
G4double z; // atomic number
G4double density, pressure, temperature, fractionmass;
G4String name, symbol;
G4int nel, natoms;
//--- elements
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen", symbol="H2", z=1., a);
a = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N2", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen", symbol="O2", z=8., a);
a = 183.85*g/mole;
G4Element* elW = new G4Element(name="Tungsten", symbol="W", z=74., a);
a = 207.19*g/mole;
G4Element* elPb = new G4Element(name="Lead", symbol="Pb", z=82., a);
//--- simple materials
G4NistManager* nistManager = G4NistManager::Instance();
// Iron has a X0 = 1.7585 cm and lambda_I = 16.760 cm.
density = 7.87*g/cm3;
a = 55.85*g/mole;
Iron = new G4Material(name="Iron", z=26., a, density);
G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
// Copper has a X0 = 1.4353 cm and lambda_I = 15.056 cm.
density = 8.96*g/cm3;
a = 63.55*g/mole;
Copper = new G4Material(name="Copper", z=29., a, density);
G4Material* copper = nistManager->FindOrBuildMaterial("G4_Cu");
// Tungsten has a X0 = 0.35 cm and lambda_I = 9.5855 cm.
density = 19.30*g/cm3;
a = 183.85*g/mole;
Tungsten = new G4Material(name="Tungsten", z=74., a, density);
G4Material* tungsten = nistManager->FindOrBuildMaterial("G4_W");
// Lead has a X0 = 0.56120 cm and lambda_I = 17.092 cm.
density = 11.35*g/cm3;
a = 207.19*g/mole;
Lead = new G4Material(name="Lead", z=82., a, density);
G4Material* lead = nistManager->FindOrBuildMaterial("G4_Pb");
// Uranium has a X0 = 0.31662 cm and lambda_I = 10.501 cm.
density = 18.95*g/cm3;
a = 238.03*g/mole;
Uranium = new G4Material(name="Uranium", z=92., a, density);
G4Material* uranium = nistManager->FindOrBuildMaterial("G4_U");
// Liquid Argon has a X0 = 10.971 cm and lambda_I = 65.769 cm.
G4double a, z, density;
density = 1.4*g/cm3;
a = 39.95*g/mole;
LiquidArgon = new G4Material(name="LiquidArgon", z=18., a, density);
G4Material* liquidArgon = new G4Material("LiquidArgon", z=18., a, density);
//--- mixtures
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, 0.7);
Air->AddElement(elO, 0.3);
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
// 4-May-2006 : We rename "Vacuum" as "G4vacuum" to avoid
// problems with Flugg.
G4double pressure, temperature, fractionMass;
G4int nel;
density = 1.e-5*g/cm3;
pressure = 2.e-2*bar;
temperature = STP_Temperature; // From PhysicalConstants.h .
G4Material* G4vacuum = new G4Material(name="G4vacuum", density, nel=1,
kStateGas, temperature, pressure);
G4vacuum->AddMaterial(Air, fractionmass=1.);
G4Material* vacuum = new G4Material("G4vacuum", density, nel=1,
kStateGas, temperature, pressure);
vacuum->AddMaterial(air, fractionMass=1.);
// Plastic scintillator tiles (used both in CMS hadron calorimeter
// and ATLAS hadron barrel calorimeter):
// X0 = 42.4 cm and lambda_I = 79.360 cm.
G4int natoms;
G4Element* elH = nistManager->FindOrBuildElement("H");
G4Element* elC = nistManager->FindOrBuildElement("C");
density = 1.032*g/cm3;
Polystyrene = new G4Material(name="Polystyrene", density, nel=2);
Polystyrene->AddElement(elC, natoms=19);
Polystyrene->AddElement(elH, natoms=21);
G4Material* polystyrene = new G4Material("Polystyrene", density, nel=2);
polystyrene->AddElement(elC, natoms=19);
polystyrene->AddElement(elH, natoms=21);
// PbWO4 CMS crystals. It has a X0 = 0.89 cm and lambda_I = 22.4 cm.
G4Element* elPb = nistManager->FindOrBuildElement("Pb");
G4Element* elW = nistManager->FindOrBuildElement("W");
G4Element* elO = nistManager->FindOrBuildElement("O");
density = 8.28*g/cm3;
PbWO4 = new G4Material(name="PbWO4", density, nel=3);
PbWO4->AddElement(elPb, natoms=1);
PbWO4->AddElement(elW, natoms=1);
PbWO4->AddElement(elO, natoms=4);
G4Material* pbWO4 = new G4Material("PbWO4", density, nel=3);
pbWO4->AddElement(elPb, natoms=1);
pbWO4->AddElement(elW, natoms=1);
pbWO4->AddElement(elO, natoms=4);
//------------------- volumes --------------------------
@@ -173,20 +143,22 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4Box* experimentalHall_box
= new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
experimentalHall_log = new G4LogicalVolume(experimentalHall_box, // solid
G4vacuum, // material
"expHall_log", // name
0, // field manager
0, // sensitive detector
0); // user limits
G4LogicalVolume* experimentalHallLog
= new G4LogicalVolume(experimentalHall_box, // solid
vacuum, // material
"expHall_log", // name
0, // field manager
0, // sensitive detector
0); // user limits
experimentalHall_phys = new G4PVPlacement(0, // rotation
G4ThreeVector(), // translation
"expHall", // name
experimentalHall_log, // logical volume
0, // mother physical volume
false, // boolean operation
0); // copy number
G4VPhysicalVolume* experimentalHallPhys
= new G4PVPlacement(0, // rotation
G4ThreeVector(), // translation
"expHall", // name
experimentalHallLog, // logical volume
0, // mother physical volume
false, // boolean operation
0); // copy number
// --- Detector
@@ -200,47 +172,54 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4Box* solidAbsorber = new G4Box("solidAbsorber", xAbsorber, yAbsorber, zAbsorber);
logicAbsorber = new G4LogicalVolume(solidAbsorber, // solid
theAbsorberMaterial, // material
"logicAbsorber", // name
0, // field manager
0, // sensitive detector
0); // user limits
G4LogicalVolume* logicAbsorber
= new G4LogicalVolume(solidAbsorber, // solid
fAbsorberMaterial, // material
"logicAbsorber", // name
0, // field manager
0, // sensitive detector
0); // user limits
physiAbsorber = new G4PVPlacement(0, // rotation
G4ThreeVector(), // translation
"physiAbsorber", // its name
logicAbsorber, // logical volume
experimentalHall_phys, // mother physical volume
false, // boolean operation
100); // copy number
new G4PVPlacement(0, // rotation
G4ThreeVector(), // translation
"physiAbsorber", // its name
logicAbsorber, // logical volume
experimentalHallPhys, // mother physical volume
false, // boolean operation
100); // copy number
// --- Check if all materials were built
if ( (! iron) || (! copper) || (! tungsten) || (! lead) || (! uranium) ||
(! pbWO4) || (! polystyrene) || (! liquidArgon) ) {
G4cerr << "Failure in building materials." << G4endl;
}
// --- Set default values ***LOOKHERE***
theAbsorberMaterial = Iron;
//theAbsorberMaterial = Copper;
//theAbsorberMaterial = Tungsten;
//theAbsorberMaterial = Lead;
//theAbsorberMaterial = Uranium;
//theAbsorberMaterial = PbWO4;
//theAbsorberMaterial = Polystyrene;
//theAbsorberMaterial = LiquidArgon;
fAbsorberMaterial = iron;
//fAbsorberMaterial = copper;
//fAbsorberMaterial = tungsten;
//fAbsorberMaterial = lead;
//fAbsorberMaterial = uranium;
//fAbsorberMaterial = pbWO4;
//fAbsorberMaterial = polystyrene;
//fAbsorberMaterial = liquidArgon;
logicAbsorber->SetMaterial( theAbsorberMaterial );
logicAbsorber->SetMaterial( fAbsorberMaterial );
PrintParameters();
return experimentalHall_phys;
return experimentalHallPhys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DetectorConstruction::PrintParameters()
{
G4cout << G4endl << G4endl
<< " ------ DetectorConstruction::PrintParameters() ------ " << G4endl
<< " Absorber Material = ";
if ( theAbsorberMaterial ) {
G4cout << theAbsorberMaterial->GetName();
if ( fAbsorberMaterial ) {
G4cout << fAbsorberMaterial->GetName();
} else {
G4cout << " UNDEFINED ";
}
@@ -248,4 +227,4 @@ void DetectorConstruction::PrintParameters()
<< G4endl << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....