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....
@@ -27,7 +27,6 @@
/// \brief Implementation of the MCTruthConfig class
//
//
// $Id: MCTruthConfig.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,18 +37,18 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "MCTruthConfig.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthConfig::MCTruthConfig()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthConfig::~MCTruthConfig()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -27,7 +27,6 @@
/// \brief Implementation of the MCTruthEventAction class
//
//
// $Id: MCTruthEventAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,21 +37,21 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "MCTruthEventAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthEventAction::MCTruthEventAction() : G4UserEventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthEventAction::~MCTruthEventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthEventAction::BeginOfEventAction(const G4Event*)
{
@@ -60,7 +59,7 @@ void MCTruthEventAction::BeginOfEventAction(const G4Event*)
MCTruthManager::GetInstance()->NewEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthEventAction::EndOfEventAction(const G4Event*)
{
@@ -68,4 +67,4 @@ void MCTruthEventAction::EndOfEventAction(const G4Event*)
MCTruthManager::GetInstance()->PrintEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -27,7 +27,6 @@
/// \brief Implementation of the MCTruthManager class
//
//
// $Id: MCTruthManager.cc 103182 2017-03-21 10:36:09Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,25 +37,25 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "MCTruthManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
static MCTruthManager* instance = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthManager::MCTruthManager() : fEvent(0), fConfig(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthManager::~MCTruthManager()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthManager* MCTruthManager::GetInstance()
{
@@ -67,7 +66,7 @@ MCTruthManager* MCTruthManager::GetInstance()
return instance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthManager::NewEvent()
{
@@ -77,7 +76,7 @@ void MCTruthManager::NewEvent()
fEvent = new HepMC::GenEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthManager::AddParticle(G4LorentzVector& momentum,
G4LorentzVector& prodpos,
@@ -260,7 +259,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthManager::PrintEvent()
{
@@ -275,7 +274,7 @@ void MCTruthManager::PrintEvent()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MCTruthManager::PrintTree(HepMC::GenParticle* particle, G4String offset)
{
@@ -306,4 +305,4 @@ void MCTruthManager::PrintTree(HepMC::GenParticle* particle, G4String offset)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -27,7 +27,6 @@
/// \brief Implementation of the MCTruthTrackInformation class
//
//
// $Id: MCTruthTrackInformation.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,21 +37,22 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "MCTruthTrackInformation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthTrackInformation::MCTruthTrackInformation()
: G4VUserTrackInformation(),
fDirectParent(true)
{
fDirectParent = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MCTruthTrackInformation::~MCTruthTrackInformation()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -27,7 +27,6 @@
/// \brief Implementation of the MCTruthTrackingAction class
//
//
// $Id: MCTruthTrackingAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -50,7 +49,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
MCTruthTrackingAction::MCTruthTrackingAction()
MCTruthTrackingAction::MCTruthTrackingAction() :
G4UserTrackingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -27,7 +27,6 @@
/// \brief Implementation of the PrimaryGeneratorAction class
//
//
// $Id: PrimaryGeneratorAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -38,7 +37,7 @@
//
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "PrimaryGeneratorAction.hh"
@@ -49,38 +48,39 @@
#include "globals.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PrimaryGeneratorAction::PrimaryGeneratorAction()
PrimaryGeneratorAction::PrimaryGeneratorAction() :
G4VUserPrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle = particleTable->FindParticle("kaon0S");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(3.0*GeV);
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(3.0*GeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4double position = 0.0;
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....