Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4FastSimulationHelper.hh"
#include "G4ProcessManager.hh"
#include "G4FastSimulationManagerProcess.hh"
void G4FastSimulationHelper::ActivateFastSimulation(G4ProcessManager* pmanager)
{
G4FastSimulationManagerProcess* fastSimProcess = new G4FastSimulationManagerProcess("fastSimProcess_massGeom");
// -- For the mass geometry case, the G4FastSimulationManagerProcess
// -- is a PostStep process, and ordering does not matter:
pmanager-> AddDiscreteProcess(fastSimProcess);
}
void G4FastSimulationHelper::ActivateFastSimulation(G4ProcessManager* pmanager, G4String parallelGeometryName )
{
G4FastSimulationManagerProcess* fastSimProcess = new G4FastSimulationManagerProcess("fastSimProcess_parallelGeom",
parallelGeometryName);
// -- For the parallel geometry case, the G4FastSimulationManagerProcess
// -- is an Along+PostStep process, and ordering matters:
pmanager->AddProcess(fastSimProcess);
pmanager->SetProcessOrdering(fastSimProcess, idxAlongStep, 1);
pmanager->SetProcessOrdering(fastSimProcess, idxPostStep);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManager.cc 68056 2013-03-13 14:44:48Z gcosmo $
// $Id: G4FastSimulationManager.cc 100945 2016-11-03 11:26:19Z gcosmo $
//
//---------------------------------------------------------------
//
@@ -320,95 +320,96 @@ G4FastSimulationManager::ListModels() const
<< "(inactivated)\n";
}
void
G4FastSimulationManager::ListModels(const G4String& aName) const
void G4FastSimulationManager::ListModels(const G4String& modelName) const
{
size_t iModel;
G4int titled = 0;
G4ParticleTable* theParticleTable=
G4ParticleTable::GetParticleTable();
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
// Active Models
for (iModel=0; iModel<ModelList.size(); iModel++)
if(ModelList[iModel]->GetName() == aName ||
aName == "all" ) {
if(!(titled++)){
G4cout << "In the envelope ";
ListTitle();
G4cout << ",\n";
for ( iModel=0; iModel<ModelList.size(); iModel++ )
if( ModelList[iModel]->GetName() == modelName || modelName == "all" )
{
if( !(titled++) )
{
G4cout << "In the envelope ";
ListTitle();
G4cout << ",\n";
}
G4cout << " the model " << ModelList[iModel]->GetName()
<< " is applicable for :\n ";
G4int list_started=0;
for ( G4int iParticle = 0; iParticle<theParticleTable->entries(); iParticle++)
if( ModelList[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
{
if(list_started++) G4cout << ", ";
G4cout << theParticleTable->
GetParticle(iParticle)->GetParticleName();
}
G4cout <<G4endl;
}
G4cout << " the model " << ModelList[iModel]->GetName()
<< " is applicable for :\n ";
G4int list_started=0;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
if(ModelList[iModel]->
IsApplicable(*(theParticleTable->
GetParticle(iParticle)))) {
if(list_started++) G4cout << ", ";
G4cout << theParticleTable->
GetParticle(iParticle)->GetParticleName();
}
G4cout <<G4endl;
}
// Inactive Models
for (iModel=0; iModel<fInactivatedModels.size(); iModel++)
if(fInactivatedModels[iModel]->GetName() == aName ||
aName == "all" ) {
if(!(titled++)){
G4cout << "In the envelope ";
ListTitle();
G4cout << ",\n";
if(fInactivatedModels[iModel]->GetName() == modelName || modelName == "all" )
{
if( !(titled++) )
{
G4cout << "In the envelope ";
ListTitle();
G4cout << ",\n";
}
G4cout << " the model " << fInactivatedModels[iModel]->GetName()
<< " (inactivated) is applicable for :\n ";
G4int list_started=0;
for ( G4int iParticle=0; iParticle<theParticleTable->entries(); iParticle++ )
if( fInactivatedModels[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
{
if(list_started++) G4cout << ", ";
G4cout << theParticleTable->
GetParticle(iParticle)->GetParticleName();
}
G4cout <<G4endl;
}
G4cout << " the model " << fInactivatedModels[iModel]->GetName()
<< " (inactivated) is applicable for :\n ";
G4int list_started=0;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
if(fInactivatedModels[iModel]->
IsApplicable(*(theParticleTable->
GetParticle(iParticle)))) {
if(list_started++) G4cout << ", ";
G4cout << theParticleTable->
GetParticle(iParticle)->GetParticleName();
}
G4cout <<G4endl;
}
}
void
G4FastSimulationManager::ListModels(const G4ParticleDefinition* aPD) const
void G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const
{
size_t iModel;
G4bool unique=true;
G4bool unique = true;
// Active Models
for (iModel=0; iModel<ModelList.size(); iModel++)
if(ModelList[iModel]->IsApplicable(*aPD)) {
G4cout << "Envelope ";
ListTitle();
G4cout << ", Model "
<< ModelList[iModel]->GetName()
<< "." << G4endl;
}
// inactive Models
for (iModel=0; iModel<fInactivatedModels.size(); iModel++)
if(fInactivatedModels[iModel]->IsApplicable(*aPD)) {
G4cout << "Envelope ";
ListTitle();
G4cout << ", Model "
<< fInactivatedModels[iModel]->GetName()
<< " (inactivated)." << G4endl;
}
for ( iModel=0; iModel<ModelList.size(); iModel++ )
if ( ModelList[iModel]->IsApplicable(*particleDefinition) )
{
G4cout << "Envelope ";
ListTitle();
G4cout << ", Model "
<< ModelList[iModel]->GetName()
<< "." << G4endl;
// -- Verify unicity of model attached to particleDefinition:
for ( auto jModel = iModel + 1; jModel < ModelList.size(); jModel++ )
if ( ModelList[jModel]->IsApplicable(*particleDefinition) ) unique = false;
}
// Inactive Models
for ( iModel=0; iModel<fInactivatedModels.size(); iModel++ )
if( fInactivatedModels[iModel]->IsApplicable(*particleDefinition) )
{
G4cout << "Envelope ";
ListTitle();
G4cout << ", Model "
<< fInactivatedModels[iModel]->GetName()
<< " (inactivated)." << G4endl;
}
if( !unique )
{
G4ExceptionDescription ed;
ed << "Two or more Models are available for the same particle type, in the same envelope/region." << G4endl;
G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* aPD) const",
ed << "Two or more active Models are available for the same particle type, in the same envelope/region." << G4endl;
G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const",
"FastSim001",
JustWarning, ed,
"Models risk to exclude each other.");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManagerProcess.cc 68056 2013-03-13 14:44:48Z gcosmo $
// $Id: G4FastSimulationManagerProcess.cc 101152 2016-11-08 08:07:39Z gcosmo $
//
//
//---------------------------------------------------------------
@@ -54,15 +54,16 @@ G4FastSimulationManagerProcess::
G4FastSimulationManagerProcess(const G4String& processName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fGhostNavigator(0),
fGhostNavigatorIndex(-1),
fIsGhostGeometry(false),
fGhostSafety(-1.0),
fFieldTrack('0'),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
fWorldVolume ( nullptr ),
fIsTrackingTime ( false ),
fIsFirstStep ( false ),
fGhostNavigator ( nullptr ),
fGhostNavigatorIndex ( -1 ),
fIsGhostGeometry ( false ),
fGhostSafety ( -1.0 ),
fFieldTrack ( '0' ),
fFastSimulationManager( nullptr ),
fFastSimulationTrigger( false )
{
// -- set Process Sub Type
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
@@ -84,15 +85,16 @@ G4FastSimulationManagerProcess(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fGhostNavigator(0),
fGhostNavigatorIndex(-1),
fIsGhostGeometry(false),
fGhostSafety(-1.0),
fFieldTrack('0'),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
fWorldVolume ( nullptr ),
fIsTrackingTime ( false ),
fIsFirstStep ( false ),
fGhostNavigator ( nullptr ),
fGhostNavigatorIndex ( -1 ),
fIsGhostGeometry ( false ),
fGhostSafety ( -1.0 ),
fFieldTrack ( '0' ),
fFastSimulationManager( nullptr ),
fFastSimulationTrigger( false )
{
// -- set Process Sub Type
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
@@ -114,15 +116,16 @@ G4FastSimulationManagerProcess(const G4String& processName,
G4VPhysicalVolume* worldVolume,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fGhostNavigator(0),
fGhostNavigatorIndex(-1),
fIsGhostGeometry(false),
fGhostSafety(-1.0),
fFieldTrack('0'),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
fWorldVolume ( nullptr ),
fIsTrackingTime ( false ),
fIsFirstStep ( false ),
fGhostNavigator ( nullptr ),
fGhostNavigatorIndex ( -1 ),
fIsGhostGeometry ( false ),
fGhostSafety ( -1.0 ),
fFieldTrack ( '0' ),
fFastSimulationManager( nullptr ),
fFastSimulationTrigger( false )
{
// -- set Process Sub Type
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
@@ -205,9 +208,7 @@ void G4FastSimulationManagerProcess::SetWorldVolume(G4VPhysicalVolume* newWorld)
// --------------------
// Start/End tracking:
// --------------------
void
G4FastSimulationManagerProcess::
StartTracking(G4Track* track)
void G4FastSimulationManagerProcess::StartTracking(G4Track* track)
{
fIsTrackingTime = true;
fIsFirstStep = true;
@@ -308,8 +309,13 @@ AlongStepGetPhysicalInteractionLength(const G4Track& track,
// --------------------------------------------------
if ( fIsGhostGeometry )
{
static G4ThreadLocal G4FieldTrack *endTrack_G4MT_TLS_ = 0 ; if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ = new G4FieldTrack ('0') ; G4FieldTrack &endTrack = *endTrack_G4MT_TLS_;
static G4ThreadLocal ELimited *eLimited_G4MT_TLS_ = 0 ; if (!eLimited_G4MT_TLS_) eLimited_G4MT_TLS_ = new ELimited ; ELimited &eLimited = *eLimited_G4MT_TLS_;
static G4ThreadLocal G4FieldTrack *endTrack_G4MT_TLS_ = 0 ;
if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ = new G4FieldTrack ('0') ;
G4FieldTrack &endTrack = *endTrack_G4MT_TLS_;
static G4ThreadLocal ELimited *eLimited_G4MT_TLS_ = 0 ;
if (!eLimited_G4MT_TLS_) eLimited_G4MT_TLS_ = new ELimited ;
ELimited &eLimited = *eLimited_G4MT_TLS_;
if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
if (fGhostSafety < 0.) fGhostSafety = 0.0;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FastStep.cc 68056 2013-03-13 14:44:48Z gcosmo $
// $Id: G4FastStep.cc 100945 2016-11-03 11:26:19Z gcosmo $
//
//---------------------------------------------------------------
//
@@ -45,6 +45,7 @@
#include "G4FastStep.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4TrackFastVector.hh"
@@ -295,11 +296,16 @@ void G4FastStep::Initialize(const G4Track&)
}
G4FastStep::G4FastStep()
: G4VParticleChange()
: G4VParticleChange(),
theEnergyChange ( 0.0 ),
theTimeChange ( 0.0 ),
theProperTimeChange( 0.0 ),
fFastTrack ( nullptr ),
theWeightChange ( 0.0 )
{
if (verboseLevel>2)
{
G4cerr << "G4FastStep::G4FastStep() " << G4endl;
G4cerr << "G4FastStep::G4FastStep()" << G4endl;
}
}
@@ -307,7 +313,7 @@ G4FastStep::~G4FastStep()
{
if (verboseLevel>2)
{
G4cerr << "G4FastStep::~G4FastStep() " << G4endl;
G4cerr << "G4FastStep::~G4FastStep()" << G4endl;
}
}
@@ -331,12 +337,14 @@ G4FastStep & G4FastStep::operator=(const G4FastStep &right)
theMomentumChange = right.theMomentumChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theProperTimeChange = right.theProperTimeChange;
theTimeChange = right.theTimeChange;
theEnergyChange = right.theEnergyChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
theWeightChange = right.theWeightChange;
fFastTrack = right.fFastTrack;
}
return *this;
}
@@ -436,44 +444,23 @@ void G4FastStep::DumpInfo() const
{
// use base-class DumpInfo
G4VParticleChange::DumpInfo();
G4cout << " Position - x (mm) : " << G4BestUnit( thePositionChange.x(), "Length" ) << G4endl;
G4cout << " Position - y (mm) : " << G4BestUnit( thePositionChange.y(), "Length" ) << G4endl;
G4cout << " Position - z (mm) : " << G4BestUnit( thePositionChange.z(), "Length" ) << G4endl;
G4cout << " Time (ns) : " << G4BestUnit( theTimeChange, "Time" ) << G4endl;
G4cout << " Proper Time (ns) : " << G4BestUnit( theProperTimeChange, "Time" ) << G4endl;
G4int olprc = G4cout.precision(3);
G4cout << " Momentum Direct - x : " << std::setw(20) << theMomentumChange.x() << G4endl;
G4cout << " Momentum Direct - y : " << std::setw(20) << theMomentumChange.y() << G4endl;
G4cout << " Momentum Direct - z : " << std::setw(20) << theMomentumChange.z() << G4endl;
G4cout.precision(olprc);
G4cout << " Kinetic Energy (MeV): " << G4BestUnit( theEnergyChange, "Energy" ) << G4endl;
G4cout.precision(3);
G4cout << " Position - x (mm) : "
<< std::setw(20) << thePositionChange.x()/mm
<< G4endl;
G4cout << " Position - y (mm) : "
<< std::setw(20) << thePositionChange.y()/mm
<< G4endl;
G4cout << " Position - z (mm) : "
<< std::setw(20) << thePositionChange.z()/mm
<< G4endl;
G4cout << " Time (ns) : "
<< std::setw(20) << theTimeChange/ns
<< G4endl;
G4cout << " Proper Time (ns) : "
<< std::setw(20) << theProperTimeChange/ns
<< G4endl;
G4cout << " Momentum Direct - x : "
<< std::setw(20) << theMomentumChange.x()
<< G4endl;
G4cout << " Momentum Direct - y : "
<< std::setw(20) << theMomentumChange.y()
<< G4endl;
G4cout << " Momentum Direct - z : "
<< std::setw(20) << theMomentumChange.z()
<< G4endl;
G4cout << " Kinetic Energy (MeV): "
<< std::setw(20) << theEnergyChange/MeV
<< G4endl;
G4cout << " Polarization - x : "
<< std::setw(20) << thePolarizationChange.x()
<< G4endl;
G4cout << " Polarization - y : "
<< std::setw(20) << thePolarizationChange.y()
<< G4endl;
G4cout << " Polarization - z : "
<< std::setw(20) << thePolarizationChange.z()
<< G4endl;
G4cout << " Polarization - x : " << std::setw(20) << thePolarizationChange.x() << G4endl;
G4cout << " Polarization - y : " << std::setw(20) << thePolarizationChange.y() << G4endl;
G4cout << " Polarization - z : " << std::setw(20) << thePolarizationChange.z() << G4endl;
G4cout.precision(olprc);
}
G4bool G4FastStep::CheckIt(const G4Track& aTrack)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FastTrack.cc 68056 2013-03-13 14:44:48Z gcosmo $
// $Id: G4FastTrack.cc 100945 2016-11-03 11:26:19Z gcosmo $
//
//---------------------------------------------------------------
//
@@ -48,11 +48,14 @@
// Constructor
// -----------
//
G4FastTrack::G4FastTrack(G4Envelope *anEnvelope,
G4bool IsUnique) :
fAffineTransformationDefined(false), fEnvelope(anEnvelope),
fIsUnique(IsUnique), fEnvelopeLogicalVolume(0), fEnvelopePhysicalVolume(0),
fEnvelopeSolid(0)
G4FastTrack::G4FastTrack(G4Envelope *anEnvelope, G4bool IsUnique)
: fTrack ( nullptr ),
fAffineTransformationDefined( false ),
fEnvelope ( anEnvelope ),
fIsUnique ( IsUnique ),
fEnvelopeLogicalVolume ( nullptr ),
fEnvelopePhysicalVolume ( nullptr ),
fEnvelopeSolid ( nullptr )
{}
// -----------