Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * 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. *
// ********************************************************************
//
// $Id: B03App.cc,v 1.3 2002/12/13 11:26:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
#include "B03App.hh"
#include "g4std/iostream"
#include "CLHEP/Random/Random.h"
#include "G4RunManager.hh"
#include "G4VPhysicalVolume.hh"
#include "B03DetectorConstruction.hh"
#include "B03PhysicsList.hh"
#include "B03PrimaryGeneratorAction.hh"
B03AppBase *B03AppBase::fB03AppBase = 0;
B03AppBase &B03AppBase::GetB03AppBase() {
if (!fB03AppBase) {
fB03AppBase = new B03AppBase;
}
return *fB03AppBase;
}
B03AppBase::B03AppBase(){
G4long myseed = 345354;
HepRandom::setTheSeed(myseed);
frunMgr = new G4RunManager;
// create the "tracking" detector -----------------
fDetector = new B03DetectorConstruction;
frunMgr->SetUserInitialization(fDetector);
// ---------------------------------------------------
fPhysics = new B03PhysicsList;
frunMgr->SetUserInitialization(fPhysics);
fPrimary = new B03PrimaryGeneratorAction;
frunMgr->SetUserAction(fPrimary);
frunMgr->Initialize();
/*
// create the detector for the importances and scoring
fImportancedetector
= new B03ImportanceDetectorConstruction();
// the IStore is filled during detector construction
fIStore = fImportancedetector->GetIStore();
// create importance sampler to importance sample neutrons
// in the importance geometry
fCS_store =
&fImportancedetector->GetCellScorerStore();
fCS_scorer = new G4CellStoreScorer(*fCS_store);
fPmgr = new
G4ParallelImportanceScoreSampler(*fIStore, *fCS_scorer, "neutron");
fPmgr->Initialize();
*/
}
B03AppBase::~B03AppBase(){
delete fPrimary;
delete fPhysics;
delete fDetector;
delete frunMgr;
}
File diff suppressed because it is too large Load Diff
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: B03DetectorConstruction.cc,v 1.7 2002/04/19 10:54:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: B03DetectorConstruction.cc,v 1.10 2002/11/22 17:47:58 dressel Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "g4std/strstream"
@@ -40,21 +40,12 @@
#include "G4Colour.hh"
#include "PhysicalConstants.h"
// for importance biasing
#include "G4IStore.hh"
B03DetectorConstruction::B03DetectorConstruction()
{;}
B03DetectorConstruction::~B03DetectorConstruction()
{;}
G4VIStore* B03DetectorConstruction::GetIStore()
{
if (!fIStore) G4Exception("B03DetectorConstruction::fIStore empty!");
return fIStore;
}
G4VPhysicalVolume* B03DetectorConstruction::Construct()
{
char line[255];
@@ -92,7 +83,6 @@ G4VPhysicalVolume* B03DetectorConstruction::Construct()
A = 28.09*g/mole;
G4Element* elSi = new G4Element(name="Silicon", symbol="Si", Z=14, A);
A = 39.1*g/mole;
G4Element* elK = new G4Element(name="K" ,symbol="K" , Z=19 , A);
@@ -122,119 +112,72 @@ G4VPhysicalVolume* B03DetectorConstruction::Construct()
Concrete->AddElement(elFe , fractionmass= 0.014);
Concrete->AddElement(elC , fractionmass= 0.001);
density = 0.0203*g/cm3;
G4Material* LightConcrete = new G4Material("LightConcrete", density, 10);
LightConcrete->AddElement(elH , fractionmass= 0.01);
LightConcrete->AddElement(elO , fractionmass= 0.529);
LightConcrete->AddElement(elNa , fractionmass= 0.016);
LightConcrete->AddElement(elHg , fractionmass= 0.002);
LightConcrete->AddElement(elAl , fractionmass= 0.034);
LightConcrete->AddElement(elSi , fractionmass= 0.337);
LightConcrete->AddElement(elK , fractionmass= 0.013);
LightConcrete->AddElement(elCa , fractionmass= 0.044);
LightConcrete->AddElement(elFe , fractionmass= 0.014);
LightConcrete->AddElement(elC , fractionmass= 0.001);
G4Material *WorldMaterial = Galactic;
/////////////////////////////
// world cylinder volume
////////////////////////////
// world solid
G4double innerRadiusCylinder = 0*cm;
G4double outerRadiusCylinder = 100*cm;
G4double hightCylinder = 15.001*cm;
G4double outerRadiusCylinder = 101*cm; // dont't have scoring
// cells coinside eith world volume boundary
G4double hightCylinder = 105*cm;
G4double startAngleCylinder = 0*deg;
G4double spanningAngleCylinder = 360*cm;
G4double spanningAngleCylinder = 360*deg;
G4Tubs *worldCylinder = new G4Tubs("worldCylinder",
innerRadiusCylinder,
outerRadiusCylinder,
hightCylinder,
startAngleCylinder,
spanningAngleCylinder);
innerRadiusCylinder,
outerRadiusCylinder,
hightCylinder,
startAngleCylinder,
spanningAngleCylinder);
// logical world
G4LogicalVolume *worldCylinder_log =
new G4LogicalVolume(worldCylinder, WorldMaterial, "worldCylinder_log");
new G4LogicalVolume(worldCylinder, Galactic, "worldCylinder_log");
G4VisAttributes * WorldVisAtt
= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
WorldVisAtt->SetVisibility(true);
worldCylinder_log->SetVisAttributes(WorldVisAtt);
// physical world
name = "shieldWorld";
G4PVPlacement *pWorldVolume = new
G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log,
name, 0, false, 0);
name = "worldCylinder_phys";
G4VPhysicalVolume* worldCylinder_phys =
new G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log,
name, 0, false, 0);
G4std::vector< G4VPhysicalVolume * > physvolumes;
physvolumes.push_back(worldCylinder_phys);
///////////////////////////////////////////////
// shield cylinder for (cells 2-4)
////////////////////////////////////////////////
// creating 1 slobs of 180 cm thick concrete
G4double innerRadiusShield = 0*cm;
G4double outerRadiusShield = 100*cm;
G4double hightShield = 5*cm;
G4double hightShield = 90*cm;
G4double startAngleShield = 0*deg;
G4double spanningAngleShield = 360*cm;
G4double spanningAngleShield = 360*deg;
G4Tubs *aShield = new G4Tubs("aShield",
innerRadiusShield,
outerRadiusShield,
hightShield,
startAngleShield,
spanningAngleShield);
innerRadiusShield,
outerRadiusShield,
hightShield,
startAngleShield,
spanningAngleShield);
// logical shield
G4LogicalVolume *aShield_log =
new G4LogicalVolume(aShield, Concrete, "aShield_log");
// physical shield
G4VisAttributes * shieldVisAtt
= new G4VisAttributes(G4Colour(0.0,1.0,1.0));
shieldVisAtt->SetVisibility(true);
shieldVisAtt->SetForceSolid(false);
aShield_log->SetVisAttributes(shieldVisAtt);
// physical shields
// physical shields for cell 2 to 4
for(G4int i=0; i<3; i++) {
if (i+2<10) sprintf(line,"cell: 0%d, shield",i+2);
else sprintf(line,"cell: %d, shield",i+2);
G4String name(line);
pos_x = 0*cm;
pos_y = 0*cm;
pos_z = -10*cm+(10*cm)*i;
physvolumes.
push_back(new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log, name, worldCylinder_log,
false, 0));
}
fIStore = new G4IStore(*worldCylinder_phys);
// for the world volume repnum is -1 !!!!!!!!!!!!!!!!!!!!!!!
G4int n = 0;
for (G4std::vector<G4VPhysicalVolume *>::iterator it = physvolumes.begin();
it != physvolumes.end(); it++) {
G4double i = pow(2., n++);
G4cout << "Going to assign importance: " << i << ", to volume"
<< (*it)->GetName() << G4endl;
if (*it == worldCylinder_phys) {
// repnum -1
fIStore->AddImportanceRegion(i, **it, -1);
}
fIStore->AddImportanceRegion(i, **it);
}
name = "ConcreateBlock";
return worldCylinder_phys;
pos_x = 0*cm;
pos_y = 0*cm;
pos_z = 0*cm;
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log,
name,
worldCylinder_log,
false,
0);
return pWorldVolume;
}
@@ -0,0 +1,216 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * 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. *
// ********************************************************************
//
//
// $Id: B03ImportanceDetectorConstruction.cc,v 1.2 2002/11/22 17:47:58 dressel Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "globals.hh"
#include "g4std/strstream"
#include "B03ImportanceDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "PhysicalConstants.h"
B03ImportanceDetectorConstruction::B03ImportanceDetectorConstruction()
{
Construct();
}
B03ImportanceDetectorConstruction::~B03ImportanceDetectorConstruction()
{;}
void B03ImportanceDetectorConstruction::Construct()
{
G4String name;
G4double A, density, temperature, pressure;
G4int z;
G4Material *Galactic =
new G4Material(name="Galactic", z=1, A=1.01*g/mole, density,
kStateGas,temperature,pressure);
//////////////////////////////////
// parallel world cylinder volume
//////////////////////////////////
// parallel world solid larger than in the mass geometry
G4double innerRadiusCylinder = 0*cm;
G4double outerRadiusCylinder = 110*cm;
G4double hightCylinder = 110*cm;
G4double startAngleCylinder = 0*deg;
G4double spanningAngleCylinder = 360*deg;
G4Tubs *worldCylinder = new G4Tubs("worldCylinder",
innerRadiusCylinder,
outerRadiusCylinder,
hightCylinder,
startAngleCylinder,
spanningAngleCylinder);
// logical world
G4LogicalVolume *worldCylinder_log =
new G4LogicalVolume(worldCylinder, Galactic, "worldCylinder_log");
name = "parallelWorld";
fWorldVolume = new
G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log,
name, 0, false, 0);
fPVolumeStore.AddPVolume(G4GeometryCell(*fWorldVolume, -1));
// creating 18 slobs of 10 cm thicknes
G4double innerRadiusShield = 0*cm;
G4double outerRadiusShield = 100*cm;
G4double hightShield = 5*cm;
G4double startAngleShield = 0*deg;
G4double spanningAngleShield = 360*deg;
G4Tubs *aShield = new G4Tubs("aShield",
innerRadiusShield,
outerRadiusShield,
hightShield,
startAngleShield,
spanningAngleShield);
// logical parallel cells
G4LogicalVolume *aShield_log =
new G4LogicalVolume(aShield, Galactic, "aShield_log");
// physical parallel cells
G4int i = 1;
G4double startz = -85*cm;
for (i=1; i<=18; ++i) {
name = GetCellName(i);
G4double pos_x = 0*cm;
G4double pos_y = 0*cm;
G4double pos_z = startz + (i-1) * (2*hightShield);
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log,
name,
worldCylinder_log,
false,
0);
G4GeometryCell cell(*pvol, 0);
fPVolumeStore.AddPVolume(cell);
}
// filling the rest of the world volumr behind the concrete with
// another slob which should get the same importance value as the
// last slob
innerRadiusShield = 0*cm;
outerRadiusShield = 110*cm;
hightShield = 10*cm;
startAngleShield = 0*deg;
spanningAngleShield = 360*deg;
G4Tubs *aRest = new G4Tubs("Rest",
innerRadiusShield,
outerRadiusShield,
hightShield,
startAngleShield,
spanningAngleShield);
G4LogicalVolume *aRest_log =
new G4LogicalVolume(aRest, Galactic, "aRest_log");
name = GetCellName(19);
G4double pos_x = 0*cm;
G4double pos_y = 0*cm;
G4double pos_z = 100*cm;
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aRest_log,
name,
worldCylinder_log,
false,
0);
G4GeometryCell cell(*pvol, 0);
fPVolumeStore.AddPVolume(cell);
}
const G4VPhysicalVolume &B03ImportanceDetectorConstruction::
GetPhysicalVolumeByName(const G4String& name) const {
return *fPVolumeStore.GetPVolume(name);
}
G4String B03ImportanceDetectorConstruction::ListPhysNamesAsG4String(){
G4String names(fPVolumeStore.GetPNames());
return names;
}
G4String B03ImportanceDetectorConstruction::GetCellName(G4int i) {
char st[200];
G4std::ostrstream os(st,200);
os << "cell_";
if (i<10) {
os << "0";
}
os << i
<< '\0';
G4String name(st);
return name;
}
G4GeometryCell B03ImportanceDetectorConstruction::GetGeometryCell(G4int i){
G4String name(GetCellName(i));
const G4VPhysicalVolume *p=0;
p = fPVolumeStore.GetPVolume(name);
if (p) {
return G4GeometryCell(*p,0);
}
else {
G4cout << "B03ImportanceDetectorConstruction::GetGeometryCell: couldn't get G4GeometryCell" << G4endl;
return G4GeometryCell(*fWorldVolume,-2);
}
}
G4VPhysicalVolume &B03ImportanceDetectorConstruction::GetWorldVolume() const{
return *fWorldVolume;
}
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * 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. *
// ********************************************************************
//
//
// $Id: B03PVolumeStore.cc,v 1.1 2002/11/08 17:35:18 dressel Exp $
// GEANT4 tag
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// B03PVolumeStore.cc
//
// ----------------------------------------------------------------------
#include "B03PVolumeStore.hh"
#include "g4std/strstream"
#include "G4VPhysicalVolume.hh"
B03PVolumeStore::B03PVolumeStore(){}
B03PVolumeStore::~B03PVolumeStore(){}
void B03PVolumeStore::AddPVolume(const G4GeometryCell &cell){
B03SetGeometryCell::iterator it =
fSetGeometryCell.find(cell);
if (it != fSetGeometryCell.end()) {
G4cout << "B03PVolumeStore::AddPVolume: cell already stored"
<< G4endl;
return;
}
fSetGeometryCell.insert(cell);
}
const G4VPhysicalVolume *B03PVolumeStore::
GetPVolume(const G4String &name) const {
const G4VPhysicalVolume *pvol = 0;
for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
it != fSetGeometryCell.end(); ++it) {
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
if (vol.GetName() == name) {
pvol = &vol;
}
}
if (!pvol) {
G4cout << "B03PVolumeStore::GetPVolume: no physical volume named: "
<< name << ", found" << G4endl;
}
return pvol;
}
G4String B03PVolumeStore::GetPNames() const {
G4String NameString;
for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
it != fSetGeometryCell.end(); ++it) {
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
char st[200];
G4std::ostrstream os(st,200);
os << vol.GetName() << "_" << it->GetReplicaNumber()
<< "\n" << '\0';
G4String cellname(st);
// G4String cellname(vol.GetName());
// cellname += G4String("_");
// cellname += G4std::str(it->GetReplicaNumber());
NameString += cellname;
}
return NameString;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: B03PhysicsList.cc,v 1.2 2002/04/19 10:54:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: B03PhysicsList.cc,v 1.3 2002/11/08 17:35:19 dressel Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "globals.hh"
@@ -45,7 +45,7 @@
#include "G4Material.hh"
#include "G4MaterialTable.hh"
B03PhysicsList::B03PhysicsList(): G4VUserPhysicsList()
B03PhysicsList::B03PhysicsList() : G4VUserPhysicsList()
{
SetVerboseLevel(1);
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: B03PrimaryGeneratorAction.cc,v 1.4 2002/05/15 02:48:43 asaim Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: B03PrimaryGeneratorAction.cc,v 1.5 2002/11/08 17:35:19 dressel Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "globals.hh"
@@ -40,7 +40,7 @@ B03PrimaryGeneratorAction::B03PrimaryGeneratorAction()
particleGun = new G4ParticleGun(n_particle);
particleGun->SetParticleDefinition(G4Neutron::NeutronDefinition());
particleGun->SetParticleEnergy(10.0*MeV);
particleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -15.0005*cm));
particleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -90.0005*cm));
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0));
}