Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,264 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
#include "ExN06DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4PVPlacement.hh"
#include "G4OpBoundaryProcess.hh"
ExN06DetectorConstruction::ExN06DetectorConstruction()
{
expHall_x = 10.*m;
expHall_y = 10.*m;
expHall_z = 10.*m;
tank_x = 5.*m;
tank_y = 5.*m;
tank_z = 5.*m;
bubble_x = 0.5*m;
bubble_y = 0.5*m;
bubble_z = 0.5*m;
}
ExN06DetectorConstruction::~ExN06DetectorConstruction(){;}
G4VPhysicalVolume* ExN06DetectorConstruction::Construct()
{
// ------------- Materials -------------
G4double a, z, density;
G4String name, symbol;
G4int nel;
// Air
// ---
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
density = 1.29e-03*g/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
// Water
// -----
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen", symbol="H", z=1., a);
density = 1.0*g/cm3;
G4Material* Water = new G4Material(name="Water", density, nel=2);
Water->AddElement(elH, 2);
Water->AddElement(elO, 1);
/////////////////////////////////////////////
// Generate & Add Material Properties Table
/////////////////////////////////////////////
const G4int NUMENTRIES = 32;
G4double PPCKOV[NUMENTRIES] =
{ 2.038E-9*GeV, 2.072E-9*GeV, 2.107E-9*GeV, 2.143E-9*GeV,
2.181E-9*GeV, 2.220E-9*GeV, 2.260E-9*GeV, 2.302E-9*GeV,
2.346E-9*GeV, 2.391E-9*GeV, 2.438E-9*GeV, 2.486E-9*GeV,
2.537E-9*GeV, 2.590E-9*GeV, 2.645E-9*GeV, 2.702E-9*GeV,
2.763E-9*GeV, 2.825E-9*GeV, 2.891E-9*GeV, 2.960E-9*GeV,
3.032E-9*GeV, 3.108E-9*GeV, 3.188E-9*GeV, 3.271E-9*GeV,
3.360E-9*GeV, 3.453E-9*GeV, 3.552E-9*GeV, 3.656E-9*GeV,
3.767E-9*GeV, 3.884E-9*GeV, 4.010E-9*GeV, 4.144E-9*GeV };
G4double RINDEX1[NUMENTRIES] =
{ 1.33, 1.33, 1.33, 1.33, 1.33, 1.33, 1.33,
1.33, 1.33, 1.34, 1.34, 1.34, 1.34, 1.34,
1.34, 1.34, 1.34, 1.34, 1.34, 1.34, 1.34,
1.34, 1.34, 1.35, 1.35, 1.35, 1.35, 1.35,
1.35, 1.35, 1.35, 1.35 };
G4double RINDEX2[NUMENTRIES] =
{ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00 };
G4double ABSORPTION1[NUMENTRIES] =
{344.8*cm, 408.2*cm, 632.9*cm, 917.4*cm, 1234.6*cm, 1388.9*cm,
1515.2*cm, 1724.1*cm, 1886.8*cm, 2000.0*cm, 2631.6*cm, 3571.4*cm,
4545.5*cm, 4761.9*cm, 5263.2*cm, 5263.2*cm, 5555.6*cm, 5263.2*cm,
5263.2*cm, 4761.9*cm, 4545.5*cm, 4166.7*cm, 3703.7*cm, 3333.3*cm,
3000.0*cm, 2850.0*cm, 2700.0*cm, 2450.0*cm, 2200.0*cm, 1950.0*cm,
1750.0*cm, 1450.0*cm };
G4MaterialPropertiesTable *myMPT1 = new G4MaterialPropertiesTable();
myMPT1->AddProperty("RINDEX", PPCKOV, RINDEX1, NUMENTRIES);
myMPT1->AddProperty("ABSLENGTH",PPCKOV, ABSORPTION1, NUMENTRIES);
Water->SetMaterialPropertiesTable(myMPT1);
G4MaterialPropertiesTable *myMPT2 = new G4MaterialPropertiesTable();
myMPT2->AddProperty("RINDEX", PPCKOV, RINDEX2, NUMENTRIES);
Air->SetMaterialPropertiesTable(myMPT2);
// ------------- Volumes --------------
// The experimental Hall
// ---------------------
G4Box * expHall_box
= new G4Box("World",expHall_x,expHall_y,expHall_z);
G4LogicalVolume * expHall_log
= new G4LogicalVolume(expHall_box,Air,"World",0,0,0);
G4VPhysicalVolume * expHall_phys
= new G4PVPlacement(0,G4ThreeVector(),"World",expHall_log,0,false,0);
// The Water Tank
// --------------
G4Box * waterTank_box
= new G4Box("Tank",tank_x,tank_y,tank_z);
G4LogicalVolume * waterTank_log
= new G4LogicalVolume(waterTank_box,Water,"Tank",0,0,0);
G4RotationMatrix *rot1=new G4RotationMatrix();
rot1->rotateZ(M_PI*0.125);
// G4VPhysicalVolume * waterTank_phys
// = new G4PVPlacement(rot1,G4ThreeVector(),"Tank",
// waterTank_log,expHall_phys,false,0);
G4VPhysicalVolume * waterTank_phys
= new G4PVPlacement(0,G4ThreeVector(),"Tank",
waterTank_log,expHall_phys,false,0);
// The Air Bubble
// --------------
G4Box * bubbleAir_box
= new G4Box("Bubble",bubble_x,bubble_y,bubble_z);
G4LogicalVolume * bubbleAir_log
= new G4LogicalVolume(bubbleAir_box,Air,"Bubble",0,0,0);
G4RotationMatrix *rot2=new G4RotationMatrix();
rot2->rotateZ(M_PI*0.25);
// G4VPhysicalVolume * bubbleAir_phys
// = new G4PVPlacement(rot2,G4ThreeVector(0,2.5*m,0),"Bubble",
// bubbleAir_log,waterTank_phys,false,0);
G4VPhysicalVolume * bubbleAir_phys
= new G4PVPlacement(0,G4ThreeVector(0,2.5*m,0),"Bubble",
bubbleAir_log,waterTank_phys,false,0);
// ------------- Surfaces --------------
G4OpticalSurface * OpWaterSurface =
new G4OpticalSurface("WaterSurface");
G4LogicalBorderSurface * WaterSurface =
new G4LogicalBorderSurface("WaterSurface",
waterTank_phys,expHall_phys,
OpWaterSurface);
OpWaterSurface->SetType(dielectric_metal);
OpWaterSurface->SetFinish(polished);
OpWaterSurface->SetModel(glisur);
if( WaterSurface->GetVolume1() == waterTank_phys ) G4cout << " Equal " << endl;
if( WaterSurface->GetVolume2() == expHall_phys ) G4cout << " Equal " << endl;
G4OpticalSurface * OpAirSurface =
new G4OpticalSurface("AirSurface");
G4LogicalSkinSurface * AirSurface =
new G4LogicalSkinSurface("AirSurface",
bubbleAir_log,
OpAirSurface);
OpAirSurface->SetType(dielectric_dielectric);
OpAirSurface->SetFinish(ground);
OpAirSurface->SetModel(unified);
if( AirSurface->GetLogicalVolume() == bubbleAir_log ) G4cout << " Equal " << endl;
G4LogicalBorderSurface * Tmp1Surface = WaterSurface->
GetSurface(waterTank_phys,expHall_phys);
// if (Tmp1Surface == *WaterSurface) G4cout << " Equal " << endl;
G4LogicalSkinSurface * Tmp2Surface = AirSurface->GetSurface(bubbleAir_log);
// if (Tmp2Surface == *AirSurface ) G4cout << " Equal " << endl;
G4OpticalSurface * TmpOpSurface = Tmp2Surface->GetOpticalSurface();
TmpOpSurface->DumpInfo();
/////////////////////////////////////////////
// Generate & Add Material Properties Table
/////////////////////////////////////////////
const G4int NUM = 2;
G4double PP[NUM] =
{ 2.038E-9*GeV, 4.144E-9*GeV };
G4double RINDEX[NUM] =
{ 1.35, 1.40 };
G4double SPECULARLOBECONSTANT[NUM] =
{ 0.3, 0.3 };
G4double SPECULARSPIKECONSTANT[NUM] =
{ 0.2, 0.2 };
G4double BACKSCATTERCONSTANT[NUM] =
{ 0.2, 0.2 };
G4MaterialPropertiesTable *myST1 = new G4MaterialPropertiesTable();
myST1->AddProperty("RINDEX", PP, RINDEX, NUM);
myST1->
AddProperty("SPECULARLOBECONSTANT", PP, SPECULARLOBECONSTANT, NUM);
myST1->
AddProperty("SPECULARSPIKECONSTANT", PP, SPECULARSPIKECONSTANT, NUM);
myST1->
AddProperty("BACKSCATTERCONSTANT", PP, BACKSCATTERCONSTANT, NUM);
OpWaterSurface->SetMaterialPropertiesTable(myST1);
G4double REFLECTIVITY[NUM] =
{ 0.3, 0.5 };
G4double EFFICIENCY[NUM] =
{ 0.8, 1.0 };
G4MaterialPropertiesTable *myST2 = new G4MaterialPropertiesTable();
myST2->AddProperty("REFLECTIVITY", PP, REFLECTIVITY, NUM);
myST2->AddProperty("EFFICIENCY", PP, EFFICIENCY, NUM);
OpAirSurface->SetMaterialPropertiesTable(myST2);
return expHall_phys;
}
+246
View File
@@ -0,0 +1,246 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
#include "G4ios.hh"
#include <iomanip.h>
#include "globals.hh"
#include "ExN06PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
ExN06PhysicsList::ExN06PhysicsList() : G4VUserPhysicsList() {}
ExN06PhysicsList::~ExN06PhysicsList() {}
void ExN06PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
}
void ExN06PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void ExN06PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void ExN06PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
}
void ExN06PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void ExN06PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructGeneral();
ConstructEM();
ConstructOp();
}
#include "G4Decay.hh"
void ExN06PhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddDiscreteProcess(theDecayProcess);
}
}
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
void ExN06PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
// Construct processes for gamma
// pmanager->AddDiscreteProcess(new G4GammaConversion());
// pmanager->AddDiscreteProcess(new G4ComptonScattering());
// pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for electron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
} else if (particleName == "e+") {
//positron
// Construct processes for positron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
// Construct processes for muon
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
} else {
if ((particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4hIonisation(),-1,2,2);
}
}
}
}
#include "G4Cerenkov.hh"
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4OpBoundaryProcess.hh"
void ExN06PhysicsList::ConstructOp()
{
G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
G4OpRayleigh* theRayleighScatteringProcess = new G4OpRayleigh();
G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
// theCerenkovProcess->DumpPhysicsTable();
// theAbsorptionProcess->DumpPhysicsTable();
// theRayleighScatteringProcess->DumpPhysicsTable();
theCerenkovProcess->SetVerboseLevel(1);
theAbsorptionProcess->SetVerboseLevel(1);
theRayleighScatteringProcess->SetVerboseLevel(1);
theBoundaryProcess->SetVerboseLevel(1);
G4int MaxNumPhotons = 300;
theCerenkovProcess->SetTrackSecondariesFirst(true);
theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumPhotons);
G4OpticalSurfaceModel themodel = unified;
theBoundaryProcess->SetModel(themodel);
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (theCerenkovProcess->IsApplicable(*particle)) {
pmanager->AddContinuousProcess(theCerenkovProcess);
}
if (particleName == "opticalphoton") {
G4cout << " AddDiscreteProcess to OpticalPhoton " << endl;
pmanager->AddDiscreteProcess(theAbsorptionProcess);
pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
pmanager->AddDiscreteProcess(theBoundaryProcess);
}
}
}
void ExN06PhysicsList::SetCuts(G4double cut)
{
if (verboseLevel >0){
G4cout << "ExN06PhysicsList::SetCuts:";
G4cout << "CutLength : " << cut/mm << " (mm)" << endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cut, "gamma");
SetCutValue(cut, "e-");
SetCutValue(cut, "e+");
// set cut values for proton
SetCutValue(cut, "proton");
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(GetDefaultCutValue());
if (verboseLevel>1) {
DumpCutValuesTable();
}
}
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
#include "ExN06PrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
ExN06PrimaryGeneratorAction::ExN06PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
}
ExN06PrimaryGeneratorAction::~ExN06PrimaryGeneratorAction()
{
delete particleGun;
}
void ExN06PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e+");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleTime(0.0*ns);
G4ThreeVector position(0.0*cm,0.0*cm,0.0*cm);
particleGun->SetParticlePosition(position);
G4ThreeVector direction(1.0,0.0,0.0);
particleGun->SetParticleMomentumDirection(direction.unit());
G4double energy = 10.0*MeV;
particleGun->SetParticleEnergy(energy);
particleGun->GeneratePrimaryVertex(anEvent);
}
+44
View File
@@ -0,0 +1,44 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
#include "ExN06RunAction.hh"
#include "G4ios.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
ExN06RunAction::ExN06RunAction()
{
timer = new G4Timer;
runIDcounter = 0;
}
ExN06RunAction::~ExN06RunAction()
{
delete timer;
}
void ExN06RunAction::BeginOfRunAction(G4Run* aRun)
{
aRun->SetRunID(runIDcounter++);
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/event/verbose 1");
UI->ApplyCommand("/tracking/verbose 1");
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
timer->Start();
}
void ExN06RunAction::EndOfRunAction(G4Run* aRun)
{
timer->Stop();
G4cout << "number of event = " << aRun->GetNumberOfEvent()
<< " " << *timer << endl;
}