Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -23,11 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointPrimaryGeneratorAction.cc,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4AdjointPrimaryGeneratorAction.cc,v 1.3 2010/07/21 14:21:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
/////////////////////////////////////////////////////////////////////////////
// Class Name: G4AdjointCrossSurfChecker
// Class Name: G4AdjointPrimaryGeneratorAction
// Author: L. Desorgher
// Organisation: SpaceIT GmbH
// Contract: ESA contract 21435/08/NL/AT
@@ -44,6 +44,10 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
G4AdjointPrimaryGeneratorAction::G4AdjointPrimaryGeneratorAction()
: Emin(0.), Emax(0.), EminIon(0.), EmaxIon(0.), NbOfAdjointPrimaryTypes(0),
index_particle(100000), last_generated_part_was_adjoint(false),
radius_spherical_source(0.), fwd_ion(0), adj_ion(0),
ion_name("not_defined")
{
theAdjointPrimaryGenerator= new G4AdjointPrimaryGenerator();
@@ -54,13 +58,6 @@ G4AdjointPrimaryGeneratorAction::G4AdjointPrimaryGeneratorAction()
ListOfPrimaryFwdParticles.clear();
ListOfPrimaryAdjParticles.clear();
last_generated_part_was_adjoint=false;
index_particle=100000;
ion_name="not_defined";
fwd_ion = 0;
adj_ion = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
+4 -2
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointSimMessenger.cc,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4AdjointSimMessenger.cc,v 1.3 2010/09/03 15:24:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
/////////////////////////////////////////////////////////////////////////////
// Class Name: G4AdjointCrossSurfChecker
@@ -34,6 +34,8 @@
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////
#include <sstream>
#include "G4AdjointSimMessenger.hh"
#include "G4AdjointSimManager.hh"
#include "G4UIdirectory.hh"
+42 -16
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RunManager.cc,v 1.108 2007/11/09 13:57:39 asaim Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4RunManager.cc,v 1.114 2010/11/24 19:39:15 asaim Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
@@ -76,7 +76,10 @@ G4RunManager::G4RunManager()
currentWorld(0),nParallelWorlds(0)
{
if(fRunManager)
{ G4Exception("G4RunManager constructed twice."); }
{
G4Exception("G4RunManager::G4RunManager()", "Run0001",
FatalException, "G4RunManager constructed twice.");
}
fRunManager = this;
kernel = new G4RunManagerKernel();
@@ -247,7 +250,7 @@ void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_selec
G4cout << "Run terminated." << G4endl;
G4cout << "Run Summary" << G4endl;
if(runAborted)
{ G4cout << " Run Aborted after " << i_event << " events processed." << G4endl; }
{ G4cout << " Run Aborted after " << i_event + 1 << " events processed." << G4endl; }
else
{ G4cout << " Number of events processed : " << n_event << G4endl; }
G4cout << " " << *timer << G4endl;
@@ -258,8 +261,9 @@ G4Event* G4RunManager::GenerateEvent(G4int i_event)
{
if(!userPrimaryGeneratorAction)
{
G4Exception
("G4RunManager::BeamOn - G4VUserPrimaryGeneratorAction is not defined.");
G4Exception("G4RunManager::GenerateEvent()", "Run0002", FatalException,
"G4VUserPrimaryGeneratorAction is not defined!");
return 0;
}
G4Event* anEvent = new G4Event(i_event);
@@ -330,7 +334,7 @@ void G4RunManager::Initialize()
if(currentState!=G4State_PreInit && currentState!=G4State_Idle)
{
G4cerr << "Illegal application state - "
<< "G4RunManager::Initialize() ignored." << G4endl;
<< "G4RunManager::Initialize() ignored." << G4endl;
return;
}
@@ -343,8 +347,9 @@ void G4RunManager::InitializeGeometry()
{
if(!userDetector)
{
G4Exception
("G4RunManager::InitializeGeometry - G4VUserDetectorConstruction is not defined.");
G4Exception("G4RunManager::InitializeGeometry", "Run0003",
FatalException, "G4VUserDetectorConstruction is not defined!");
return;
}
if(verboseLevel>1) G4cout << "userDetector->Construct() start." << G4endl;
@@ -363,7 +368,8 @@ void G4RunManager::InitializePhysics()
}
else
{
G4Exception("G4VUserPhysicsList is not defined");
G4Exception("G4RunManager::InitializePhysics()", "Run0004",
FatalException, "G4VUserPhysicsList is not defined!");
}
physicsInitialized = true;
}
@@ -453,7 +459,7 @@ void G4RunManager::rndmSaveThisEvent()
if(verboseLevel>0) G4cout << "currentEvent.rndm is copied to file: " << fileOut << G4endl;
}
void G4RunManager::RestoreRandomNumberStatus(G4String fileN)
void G4RunManager::RestoreRandomNumberStatus(const G4String& fileN)
{
G4String fileNameWithDirectory;
if(fileN.index("/")==std::string::npos)
@@ -467,7 +473,7 @@ void G4RunManager::RestoreRandomNumberStatus(G4String fileN)
HepRandom::showEngineStatus();
}
void G4RunManager::DumpRegion(G4String rname) const
void G4RunManager::DumpRegion(const G4String& rname) const
{
kernel->UpdateRegion();
kernel->DumpRegion(rname);
@@ -518,10 +524,13 @@ void G4RunManager::ConstructScoringWorlds()
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
pmanager->AddProcess(theParallelWorldScoringProcess);
pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
pmanager->SetProcessOrderingToSecond(theParallelWorldScoringProcess, idxAlongStep);
pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
if(pmanager)
{
pmanager->AddProcess(theParallelWorldScoringProcess);
pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
pmanager->SetProcessOrderingToSecond(theParallelWorldScoringProcess, idxAlongStep);
pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
}
}
}
mesh->Construct(pWorld);
@@ -546,4 +555,21 @@ void G4RunManager::UpdateScoring()
}
}
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4SmartVoxelHeader.hh"
void G4RunManager::ReOptimizeMotherOf(G4VPhysicalVolume* pPhys)
{
G4LogicalVolume* pMotherL = pPhys->GetMotherLogical();
if(pMotherL) ReOptimize(pMotherL);
}
void G4RunManager::ReOptimize(G4LogicalVolume* pLog)
{
G4SmartVoxelHeader* header = pLog->GetVoxelHeader();
delete header;
header = new G4SmartVoxelHeader(pLog);
pLog->SetVoxelHeader(header);
}
+72 -21
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RunManagerKernel.cc,v 1.47 2009/11/13 23:13:40 asaim Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4RunManagerKernel.cc,v 1.54 2010/12/05 12:12:43 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
@@ -257,8 +257,7 @@ void G4RunManagerKernel::InitializePhysics()
if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
{
G4Exception("G4RunManagerKernel::InitializePhysics",
"InitializePhysicsAtIncorrectState",
JustWarning,
"InitializePhysicsAtIncorrectState", JustWarning,
"Geant4 kernel is not PreInit or Idle state : Method ignored.");
return;
}
@@ -266,14 +265,11 @@ void G4RunManagerKernel::InitializePhysics()
if(!physicsList)
{
G4Exception("G4RunManagerKernel::InitializePhysics",
"PhysicsListIsNotDefined",
FatalException,
"PhysicsListIsNotDefined", FatalException,
"G4VUserPhysicsList is not defined");
return;
}
//if(verboseLevel>1) G4cout << "physicsList->ConstructParticle() start." << G4endl;
//physicsList->ConstructParticle();
if(verboseLevel>1) G4cout << "physicsList->Construct() start." << G4endl;
if(numberOfParallelWorld>0) physicsList->UseCoupledTransportation();
physicsList->Construct();
@@ -329,7 +325,14 @@ G4bool G4RunManagerKernel::RunInitialization()
UpdateRegion();
BuildPhysicsTables();
if(geometryNeedsToBeClosed) ResetNavigator();
if(geometryNeedsToBeClosed)
{
ResetNavigator();
CheckRegularGeometry();
// Notify the VisManager as well
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager) pVVisManager->GeometryHasChanged();
}
GetPrimaryTransformer()->CheckUnknown();
@@ -430,7 +433,7 @@ void G4RunManagerKernel::CheckRegions()
}
}
void G4RunManagerKernel::DumpRegion(G4String rname) const
void G4RunManagerKernel::DumpRegion(const G4String& rname) const
{
G4Region* region = G4RegionStore::GetInstance()->GetRegion(rname);
if(region) DumpRegion(region);
@@ -491,15 +494,39 @@ void G4RunManagerKernel::DumpRegion(G4Region* region) const
region->SetProductionCuts(
G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
}
G4cout << " Production cuts : "
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
<< " proton " << G4BestUnit(cuts->GetProductionCut("proton"),"Length")
<< G4endl;
else
{
G4cout << " Production cuts : "
<< " gamma "
<< G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
<< " e- "
<< G4BestUnit(cuts->GetProductionCut("e-"),"Length")
<< " e+ "
<< G4BestUnit(cuts->GetProductionCut("e+"),"Length")
<< " proton "
<< G4BestUnit(cuts->GetProductionCut("proton"),"Length")
<< G4endl;
}
}
}
#include "G4LogicalVolumeStore.hh"
void G4RunManagerKernel::CheckRegularGeometry()
{
G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance();
for(G4LogicalVolumeStore::iterator pos=store->begin(); pos!=store->end(); pos++)
{
if((*pos)&&((*pos)->GetNoDaughters()==1))
{
if((*pos)->GetDaughter(0)->IsRegularStructure())
{
SetScoreSplitter();
return;
}
}
}
}
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
@@ -510,14 +537,38 @@ G4bool G4RunManagerKernel::ConfirmCoupledTransportation()
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4ParticleTable::G4PTblDicIterator* theParticleIterator = theParticleTable->GetIterator();
theParticleIterator->reset();
if((*theParticleIterator)())
while((*theParticleIterator)())
{
G4ParticleDefinition* pd = theParticleIterator->value();
G4ProcessManager* pm = pd->GetProcessManager();
G4ProcessVector* pv = pm->GetAlongStepProcessVector(typeDoIt);
G4VProcess* p = (*pv)[0];
return ( (p->GetProcessName()) == "CoupledTransportation" );
if(pm)
{
G4ProcessVector* pv = pm->GetAlongStepProcessVector(typeDoIt);
G4VProcess* p = (*pv)[0];
return ( (p->GetProcessName()) == "CoupledTransportation" );
}
}
return false;
}
#include "G4ScoreSplittingProcess.hh"
void G4RunManagerKernel::SetScoreSplitter()
{
G4ScoreSplittingProcess* pSplitter = new G4ScoreSplittingProcess();
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4ParticleTable::G4PTblDicIterator* theParticleIterator = theParticleTable->GetIterator();
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if(pmanager)
{ pmanager->AddDiscreteProcess(pSplitter); }
}
if(verboseLevel>0)
{
G4cout << "G4RunManagerKernel -- G4ScoreSplittingProcess is appended to all particles." << G4endl;
}
}
+11 -4
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VUserPhysicsList.cc,v 1.71 2009/08/09 14:31:46 kurasige Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VUserPhysicsList.cc,v 1.72 2010/07/21 14:21:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// ------------------------------------------------------------
@@ -343,7 +343,8 @@ void G4VUserPhysicsList::RemoveProcessManager()
void G4VUserPhysicsList::AddTransportation()
{
G4int verboseLevelTransport = 0;
G4VProcess* theTransportationProcess = 0;
G4VProcess* theTransportationProcess = 0; // Pointer ownership handled to
// G4ProcessManager !
G4int nParaWorld = G4RunManagerKernel::GetRunManagerKernel()->GetNumberOfParallelWorld();
if(nParaWorld || useCoupledTransportation || G4ScoringManager::GetScoringManagerIfExist())
@@ -354,7 +355,9 @@ void G4VUserPhysicsList::AddTransportation()
<< "#############################################################################" << G4endl;
}
else
{ theTransportationProcess = new G4Transportation(verboseLevelTransport); }
{
theTransportationProcess = new G4Transportation(verboseLevelTransport);
}
#ifdef G4VERBOSE
if (verboseLevel >2){
@@ -610,6 +613,7 @@ void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
G4Exception("G4VUserPhysicsList::BuildPhysicsTable","No process manager",
FatalException, particle->GetParticleName() );
return;
}
G4ProcessVector* pVector = pManager->GetProcessList();
if (!pVector) {
@@ -618,6 +622,7 @@ void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
G4Exception("G4VUserPhysicsList::BuildPhysicsTable","No process Vector",
FatalException, particle->GetParticleName() );
return;
}
for (G4int j=0; j < pVector->size(); ++j) {
(*pVector)[j]->BuildPhysicsTable(*particle);
@@ -638,6 +643,7 @@ void G4VUserPhysicsList::PreparePhysicsTable(G4ParticleDefinition* particle)
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
G4Exception("G4VUserPhysicsList::PreparePhysicsTable","No process manager",
FatalException, particle->GetParticleName() );
return;
}
G4ProcessVector* pVector = pManager->GetProcessList();
@@ -647,6 +653,7 @@ void G4VUserPhysicsList::PreparePhysicsTable(G4ParticleDefinition* particle)
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
G4Exception("G4VUserPhysicsList::PreparePhysicsTable","No process Vector",
FatalException, particle->GetParticleName() );
return;
}
for (G4int j=0; j < pVector->size(); ++j) {
(*pVector)[j]->PreparePhysicsTable(*particle);