Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
@@ -25,7 +25,7 @@
//
//
// $Id: G4CoupledTransportation.cc,v 1.12 2006/11/22 18:41:44 japost Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation
// =======================================================================
@@ -1,94 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MImportanceConfigurator.cc,v 1.7 2006/11/13 16:13:50 japost Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4MImportanceConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4MImportanceConfigurator.hh"
#include "G4MassImportanceProcess.hh"
#include "G4ProcessPlacer.hh"
#include "G4ImportanceAlgorithm.hh"
G4MImportanceConfigurator::
G4MImportanceConfigurator(const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg)
: fPlacer(particlename),
fIStore(istore),
fDeleteIalg( ( ! ialg) ),
fIalgorithm(( (fDeleteIalg) ?
new G4ImportanceAlgorithm : ialg)),
fMassImportanceProcess(0)
{
}
G4MImportanceConfigurator::~G4MImportanceConfigurator()
{
if (fMassImportanceProcess)
{
fPlacer.RemoveProcess(fMassImportanceProcess);
delete fMassImportanceProcess;
}
if (fDeleteIalg)
{
delete fIalgorithm;
}
}
void
G4MImportanceConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
fMassImportanceProcess =
new G4MassImportanceProcess(*fIalgorithm,
fIStore,
terminator);
if (!fMassImportanceProcess)
{
G4Exception("G4MImportanceConfigurator::Configure()",
"FatalError", FatalException,
"Failed allocation of G4MassImportanceProcess !");
}
fPlacer.AddProcessAsSecondDoIt(fMassImportanceProcess);
}
const G4VTrackTerminator *G4MImportanceConfigurator::
GetTrackTerminator() const
{
return fMassImportanceProcess;
}
@@ -1,75 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MScoreConfigurator.cc,v 1.9 2006/11/13 16:17:16 japost Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4MScoreConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4MScoreConfigurator.hh"
#include "G4VScorer.hh"
#include "G4VTrackTerminator.hh"
#include "G4MScoreProcess.hh"
G4MScoreConfigurator::
G4MScoreConfigurator(const G4String &particlename,
G4VScorer &scorer)
: fPlacer(particlename),
fScorer(scorer),
fMScoreProcess(0)
{
}
G4MScoreConfigurator::~G4MScoreConfigurator()
{
if (fMScoreProcess)
{
fPlacer.RemoveProcess(fMScoreProcess);
delete fMScoreProcess;
}
}
const G4VTrackTerminator *
G4MScoreConfigurator::GetTrackTerminator() const
{
return fMScoreProcess;
}
void G4MScoreConfigurator::Configure(G4VSamplerConfigurator *)
{
fMScoreProcess = new G4MScoreProcess(fScorer);
if (!fMScoreProcess)
{
G4Exception("G4MScoreConfigurator::Configure()",
"FatalError", FatalException,
"Failed allocation of G4MScoreProcess !");
}
fPlacer.AddProcessAsSecondDoIt(fMScoreProcess);
}
@@ -1,142 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MScoreProcess.cc,v 1.14 2006/11/13 16:19:14 japost Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MScoreProcess.cc
//
// ----------------------------------------------------------------------
#include "G4MScoreProcess.hh"
#include "G4VScorer.hh"
#include "G4GeometryCellStep.hh"
#include "G4VParallelStepper.hh"
G4MScoreProcess::G4MScoreProcess(G4VScorer &aScorer,
const G4String &aName)
: G4VProcess(aName),
fScorer(aScorer),
fKillTrack(false)
{
G4VProcess::pParticleChange = new G4ParticleChange;
if (!G4VProcess::pParticleChange)
{
G4Exception("G4MScoreProcess::G4MScoreProcess()", "Fatal Error",
FatalException, "Failed to allocate G4ParticleChange !");
}
}
G4MScoreProcess::~G4MScoreProcess()
{
delete pParticleChange;
}
G4double G4MScoreProcess::
PostStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4MScoreProcess::PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
{
pParticleChange->Initialize(aTrack);
if (aStep.GetStepLength() > kCarTolerance)
{
G4StepPoint *prepoint = aStep.GetPreStepPoint();
G4StepPoint *postpoint = aStep.GetPostStepPoint();
G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()),
prepoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()),
postpoint->GetTouchable()->GetReplicaNumber());
G4GeometryCellStep pstep(prekey, postkey);
pstep.SetCrossBoundary(false);
if (prekey != postkey)
{
pstep.SetCrossBoundary(true);
}
fScorer.Score(aStep, pstep);
}
if (fKillTrack)
{
fKillTrack = false;
pParticleChange->ProposeTrackStatus(fStopAndKill);
}
return G4VProcess::pParticleChange;
}
const G4String &G4MScoreProcess::GetName() const
{
return theProcessName;
}
G4double G4MScoreProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4MScoreProcess::
AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4MScoreProcess::AtRestDoIt(const G4Track&,
const G4Step&)
{
return 0;
}
G4VParticleChange* G4MScoreProcess::AlongStepDoIt(const G4Track&,
const G4Step&)
{
return 0;
}
void G4MScoreProcess::KillTrack() const
{
fKillTrack = true;
}
@@ -1,90 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MWeightWindowConfigurator.cc,v 1.6 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4MWeightWindowConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4MWeightWindowConfigurator.hh"
#include "G4WeightWindowAlgorithm.hh"
#include "G4MassWeightWindowProcess.hh"
G4MWeightWindowConfigurator::
G4MWeightWindowConfigurator(const G4String &particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
: fPlacer(particlename),
fWeightWindowStore(wwstore),
fDeleteWWalg( ( ! wwAlg) ),
fWWalgorithm(( (fDeleteWWalg) ?
new G4WeightWindowAlgorithm(5,3,5) : wwAlg)),
fMassWeightWindowProcess(0),
fPlaceOfAction(placeOfAction)
{
}
G4MWeightWindowConfigurator::~G4MWeightWindowConfigurator()
{
if (fMassWeightWindowProcess)
{
fPlacer.RemoveProcess(fMassWeightWindowProcess);
delete fMassWeightWindowProcess;
}
if (fDeleteWWalg)
{
delete fWWalgorithm;
}
}
void
G4MWeightWindowConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
fMassWeightWindowProcess =
new G4MassWeightWindowProcess(*fWWalgorithm,
fWeightWindowStore,
terminator,
fPlaceOfAction);
fPlacer.AddProcessAsSecondDoIt(fMassWeightWindowProcess);
}
const G4VTrackTerminator *
G4MWeightWindowConfigurator::GetTrackTerminator() const
{
return fMassWeightWindowProcess;
}
@@ -1,65 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MassGCellFinder.cc,v 1.5 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MassGCellFinder.cc
//
// ----------------------------------------------------------------------
#include "G4MassGCellFinder.hh"
#include "G4TouchableHandle.hh"
#include "G4Step.hh"
G4MassGCellFinder::G4MassGCellFinder()
{
}
G4MassGCellFinder::~G4MassGCellFinder()
{
}
G4GeometryCell
G4MassGCellFinder::GetPreGeometryCell(const G4Step &aStep) const
{
const G4TouchableHandle& th =
aStep.GetPreStepPoint()->GetTouchableHandle();
G4GeometryCell g(*th->GetVolume(), th->GetReplicaNumber());
return g;
}
G4GeometryCell
G4MassGCellFinder::GetPostGeometryCell(const G4Step &aStep) const
{
const G4TouchableHandle& th =
aStep.GetPostStepPoint()->GetTouchableHandle();
G4GeometryCell g(*th->GetVolume(), th->GetReplicaNumber());
return g;
}
@@ -1,216 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MassGeometrySampler.cc,v 1.13 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MassGeometrySampler.cc
//
// ----------------------------------------------------------------------
#include "G4MassGeometrySampler.hh"
#include "G4VIStore.hh"
#include "G4WeightWindowStore.hh"
#include "G4VScorer.hh"
#include "G4MScoreConfigurator.hh"
#include "G4MImportanceConfigurator.hh"
#include "G4MWeightWindowConfigurator.hh"
#include "G4WeightCutOffConfigurator.hh"
#include "G4MassGCellFinder.hh"
G4MassGeometrySampler::
G4MassGeometrySampler(const G4String &particlename)
: fParticleName(particlename),
fMImportanceConfigurator(0),
fMScoreConfigurator(0),
fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fMWeightWindowConfigurator(0),
fWWStore(0),
fIsConfigured(false)
{
}
G4MassGeometrySampler::~G4MassGeometrySampler()
{
ClearSampling();
}
void G4MassGeometrySampler::ClearSampling()
{
if (fMImportanceConfigurator)
{
delete fMImportanceConfigurator;
fMImportanceConfigurator = 0;
}
if (fMWeightWindowConfigurator)
{
delete fMWeightWindowConfigurator;
fMWeightWindowConfigurator = 0;
}
if (fMScoreConfigurator)
{
delete fMScoreConfigurator;
fMScoreConfigurator = 0;
}
if (fWeightCutOffConfigurator)
{
delete fWeightCutOffConfigurator;
fWeightCutOffConfigurator = 0;
}
if (fGCellFinder)
{
delete fGCellFinder;
fGCellFinder = 0;
}
fIStore = 0;
fConfigurators.clear();
fIsConfigured = false;
}
G4bool G4MassGeometrySampler::IsConfigured() const
{
G4bool isconf = false;
if (fIsConfigured)
{
G4cout << "WARNING - G4MassGeometrySampler::IsConfigured()"
<< " Some initalization exists, use ClearSampling()"
<< " before a new initialization !" << G4endl;
isconf = true;
}
return isconf;
}
void G4MassGeometrySampler::PrepareScoring(G4VScorer *scorer)
{
fMScoreConfigurator = new G4MScoreConfigurator(fParticleName, *scorer);
if (!fMScoreConfigurator)
{
G4Exception("G4MassGeometrySampler::PrepareScoring()",
"FatalError", FatalException,
"Failed allocation of G4MScoreConfigurator !");
}
}
void
G4MassGeometrySampler::PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm *ialg)
{
fIStore = istore;
fMImportanceConfigurator =
new G4MImportanceConfigurator(fParticleName, *fIStore, ialg);
if (!fMImportanceConfigurator)
{
G4Exception("G4MassGeometrySampler::PrepareImportanceSampling()",
"FatalError", FatalException,
"Failed allocation of G4MImportanceConfigurator !");
}
}
void
G4MassGeometrySampler::PrepareWeightRoulett(G4double wsurvive,
G4double wlimit,
G4double isource)
{
fGCellFinder = new G4MassGCellFinder;
if (!fGCellFinder)
{
G4Exception("G4MassGeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed allocation of G4MassGCellFinder !");
}
fWeightCutOffConfigurator =
new G4WeightCutOffConfigurator(fParticleName,
wsurvive,
wlimit,
isource,
fIStore,
*fGCellFinder);
if (!fWeightCutOffConfigurator)
{
G4Exception("G4MassGeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed allocation of G4WeightCutOffConfigurator !");
}
}
void
G4MassGeometrySampler::PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
{
fWWStore = wwstore;
fMWeightWindowConfigurator =
new G4MWeightWindowConfigurator(fParticleName,
*fWWStore,
wwAlg,
placeOfAction);
}
void G4MassGeometrySampler::Configure()
{
if (!IsConfigured())
{
fIsConfigured = true;
if (fMScoreConfigurator)
{
fConfigurators.push_back(fMScoreConfigurator);
}
if (fMImportanceConfigurator)
{
fConfigurators.push_back(fMImportanceConfigurator);
}
if (fMWeightWindowConfigurator)
{
fConfigurators.push_back(fMWeightWindowConfigurator);
}
G4VSamplerConfigurator *preConf = 0;
for (G4Configurators::iterator it = fConfigurators.begin();
it != fConfigurators.end(); it++)
{
G4VSamplerConfigurator *currConf =*it;
currConf->Configure(preConf);
preConf = *it;
}
if (fWeightCutOffConfigurator)
{
fWeightCutOffConfigurator->Configure(0);
}
}
return;
}
@@ -1,156 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MassImportanceProcess.cc,v 1.19 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MassImportanceProcess.cc
//
// ----------------------------------------------------------------------
#include "G4MassImportanceProcess.hh"
#include "G4VImportanceAlgorithm.hh"
#include "G4GeometryCell.hh"
#include "G4SamplingPostStepAction.hh"
#include "G4VTrackTerminator.hh"
#include "G4VIStore.hh"
G4MassImportanceProcess::
G4MassImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
const G4VIStore &aIstore,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fImportanceAlgorithm(aImportanceAlgorithm),
fIStore(aIstore),
fPostStepAction(0)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
if (!fParticleChange)
{
G4Exception("G4MassImportanceProcess::G4MassImportanceProcess()",
"FatalError", FatalException,
"Failed allocation of G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
}
G4MassImportanceProcess::~G4MassImportanceProcess()
{
delete fPostStepAction;
delete fParticleChange;
}
G4double G4MassImportanceProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4MassImportanceProcess::PostStepDoIt(const G4Track &aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
&& (aStep.GetStepLength() > kCarTolerance) )
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4MassImportanceProcess::PostStepDoIt()"
<< " StopAndKill track." << G4endl;
}
G4StepPoint *prepoint = aStep.GetPreStepPoint();
G4StepPoint *postpoint = aStep.GetPostStepPoint();
G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()),
prepoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()),
postpoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw = fImportanceAlgorithm.
Calculate(fIStore.GetImportance(prekey),
fIStore.GetImportance(postkey),
aTrack.GetWeight());
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
return fParticleChange;
}
void G4MassImportanceProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4MassImportanceProcess::GetName() const
{
return theProcessName;
}
G4double G4MassImportanceProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4MassImportanceProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4MassImportanceProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4MassImportanceProcess::
AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
@@ -1,156 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4MassWeightWindowProcess.cc,v 1.7 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MassWeightWindowProcess.cc
//
// ----------------------------------------------------------------------
#include "G4MassWeightWindowProcess.hh"
#include "G4VWeightWindowAlgorithm.hh"
#include "G4GeometryCell.hh"
#include "G4SamplingPostStepAction.hh"
#include "G4VTrackTerminator.hh"
#include "G4PlaceOfAction.hh"
#include "G4VWeightWindowStore.hh"
G4MassWeightWindowProcess::G4MassWeightWindowProcess(
const G4VWeightWindowAlgorithm &aWeightWindowAlgorithm,
const G4VWeightWindowStore &aWWStore,
const G4VTrackTerminator *TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String &aName)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fWeightWindowAlgorithm(aWeightWindowAlgorithm),
fWeightWindowStore(aWWStore),
fPostStepAction(0),
fPlaceOfAction(placeOfAction)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
if (!fParticleChange)
{
G4Exception("G4MassWeightWindowProcess::G4MassWeightWindowProcess()",
"FatalError", FatalException,
"Failed allocation of G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
}
G4MassWeightWindowProcess::~G4MassWeightWindowProcess()
{
delete fPostStepAction;
delete fParticleChange;
}
G4double G4MassWeightWindowProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4MassWeightWindowProcess::PostStepDoIt(const G4Track &aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
if (aStep.GetStepLength() > kCarTolerance)
{
if ( ( fPlaceOfAction == onBoundaryAndCollision)
|| ( (fPlaceOfAction == onBoundary) &&
(aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) )
|| ( (fPlaceOfAction == onCollision) &&
(aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) ) )
{
G4StepPoint *postpoint = aStep.GetPostStepPoint();
G4GeometryCell postCell(*(postpoint->GetPhysicalVolume()),
postpoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw =
fWeightWindowAlgorithm.Calculate(aTrack.GetWeight(),
fWeightWindowStore.GetLowerWeitgh(postCell,
aTrack.GetKineticEnergy()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
}
return fParticleChange;
}
void G4MassWeightWindowProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4MassWeightWindowProcess::GetName() const
{
return G4VProcess::GetProcessName();
}
G4double G4MassWeightWindowProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4MassWeightWindowProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4MassWeightWindowProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4MassWeightWindowProcess::
AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4NeutronKiller.cc,v 1.1 2006/11/17 15:53:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4NeutronKillerMessenger.cc,v 1.1 2006/11/17 15:53:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------------------
//
@@ -1,102 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4PImportanceConfigurator.cc,v 1.8 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4PImportanceConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4PImportanceConfigurator.hh"
#include "G4ParallelWorld.hh"
#include "G4ImportanceAlgorithm.hh"
#include "G4ParallelImportanceProcess.hh"
G4PImportanceConfigurator::
G4PImportanceConfigurator(const G4String &particlename,
G4ParallelWorld &parallelWorld,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg)
: fPlacer(particlename),
fPWorld(parallelWorld),
fDeleteIalg( ( ! ialg) ),
fIalgorithm(( (fDeleteIalg) ? new G4ImportanceAlgorithm : ialg)),
fExaminer(*fIalgorithm, parallelWorld.GetParallelStepper(), istore),
fParallelImportanceProcess(0)
{
if (!fIalgorithm)
{
G4Exception("G4PImportanceConfigurator::G4PImportanceConfigurator()",
"InvalidSetup", FatalException, "No algorithm specified !");
}
}
G4PImportanceConfigurator::~G4PImportanceConfigurator()
{
if (fParallelImportanceProcess)
{
fPlacer.RemoveProcess(fParallelImportanceProcess);
delete fParallelImportanceProcess;
}
if (fDeleteIalg)
{
delete fIalgorithm;
}
}
void
G4PImportanceConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
}
fParallelImportanceProcess =
new G4ParallelImportanceProcess(fExaminer,
fPWorld.GetGeoDriver(),
fPWorld.GetParallelStepper(),
terminator);
if (!fParallelImportanceProcess)
{
G4Exception("G4PImportanceConfigurator::Configure()",
"FatalError", FatalException,
"Failed to allocate G4ParallelImportanceProcess !");
}
fPlacer.AddProcessAsSecondDoIt(fParallelImportanceProcess);
}
const G4VTrackTerminator *
G4PImportanceConfigurator::GetTrackTerminator() const
{
return fParallelImportanceProcess;
}
@@ -1,77 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4PScoreConfigurator.cc,v 1.9 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4PScoreConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4PScoreConfigurator.hh"
#include "G4VTrackTerminator.hh"
#include "G4PScoreProcess.hh"
G4PScoreConfigurator::
G4PScoreConfigurator(const G4String &particlename,
G4VParallelStepper &pstepper,
G4VScorer &scorer)
: fPlacer(particlename),
fPStepper(pstepper),
fScorer(scorer),
fPScoreProcess(0)
{
}
G4PScoreConfigurator::~G4PScoreConfigurator()
{
if (fPScoreProcess)
{
fPlacer.RemoveProcess(fPScoreProcess);
delete fPScoreProcess;
}
}
void G4PScoreConfigurator::Configure(G4VSamplerConfigurator *)
{
fPScoreProcess = new G4PScoreProcess(fPStepper, fScorer);
if (!fPScoreProcess)
{
G4Exception("G4PScoreConfigurator::Configure()", "FatalError",
FatalException, "Failed to allocate G4PScoreProcess !");
}
fPlacer.AddProcessAsSecondDoIt(fPScoreProcess);
}
const G4VTrackTerminator *
G4PScoreConfigurator::GetTrackTerminator() const
{
return fPScoreProcess;
}
@@ -1,121 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4PScoreProcess.cc,v 1.11 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4PScoreProcess.cc
//
// ----------------------------------------------------------------------
#include "G4PScoreProcess.hh"
#include "G4VScorer.hh"
#include "G4GeometryCellStep.hh"
#include "G4VParallelStepper.hh"
G4PScoreProcess::G4PScoreProcess(G4VParallelStepper &astepper,
G4VScorer &aScorer,
const G4String &aName)
: G4VProcess(aName),
fPstepper(astepper),
fScorer(aScorer),
fKillTrack(false)
{
G4VProcess::pParticleChange = new G4ParticleChange;
if (!G4VProcess::pParticleChange)
{
G4Exception("G4PScoreProcess::G4PScoreProcess()", "FatalError",
FatalException, "Failed to allocate G4ParticleChange !");
}
}
G4PScoreProcess::~G4PScoreProcess()
{
delete pParticleChange;
}
G4double G4PScoreProcess::
PostStepGetPhysicalInteractionLength(const G4Track &,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4PScoreProcess::PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
{
pParticleChange->Initialize(aTrack);
fScorer.Score(aStep, fPstepper.GetPStep());
if (fKillTrack)
{
fKillTrack = false;
pParticleChange->ProposeTrackStatus(fStopAndKill);
}
return G4VProcess::pParticleChange;
}
void G4PScoreProcess::KillTrack() const
{
fKillTrack = true;
}
const G4String &G4PScoreProcess::GetName() const
{
return theProcessName;
}
G4double G4PScoreProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4PScoreProcess::
AtRestGetPhysicalInteractionLength(const G4Track& , G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4PScoreProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4PScoreProcess::
AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
@@ -1,113 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4PWeightWindowConfigurator.cc,v 1.6 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4PWeightWindowConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4PWeightWindowConfigurator.hh"
#include "G4ParallelWWnTransportProcess.hh"
#include "G4ParallelWeightWindowProcess.hh"
#include "G4WeightWindowAlgorithm.hh"
#include "G4ParallelWorld.hh"
#include "G4ParallelWeightWindowProcess.hh"
G4PWeightWindowConfigurator::
G4PWeightWindowConfigurator(const G4String &particlename,
G4ParallelWorld &parallelWorld,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
: fPlacer(particlename),
fPWorld(parallelWorld),
fDeleteWWalg( ( ! wwAlg) ),
fWWalgorithm(( (fDeleteWWalg) ? new G4WeightWindowAlgorithm(5,3,5)
: wwAlg)),
fExaminer(*fWWalgorithm, parallelWorld.GetParallelStepper(), wwstore),
fParallelWWProcess(0),
fPlaceOfAction(placeOfAction),
fTrackTerminator(0)
{
}
G4PWeightWindowConfigurator::~G4PWeightWindowConfigurator()
{
if (fParallelWWProcess)
{
fPlacer.RemoveProcess(fParallelWWProcess);
delete fParallelWWProcess;
fTrackTerminator = 0;
fParallelWWProcess = 0;
}
if (fDeleteWWalg)
{
delete fWWalgorithm;
}
}
void
G4PWeightWindowConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
}
if (fPlaceOfAction == onBoundary)
{
G4ParallelWWnTransportProcess *parallelWWnTransportProcess =
new G4ParallelWWnTransportProcess(fExaminer,
fPWorld.GetGeoDriver(),
fPWorld.GetParallelStepper(),
terminator);
fTrackTerminator = parallelWWnTransportProcess;
fParallelWWProcess = parallelWWnTransportProcess;
}
else
{
G4ParallelWeightWindowProcess *parallelWeightWindowProcess =
new G4ParallelWeightWindowProcess(fExaminer,
fPWorld.GetParallelStepper(),
terminator,
fPlaceOfAction);
fTrackTerminator = parallelWeightWindowProcess;
fParallelWWProcess = parallelWeightWindowProcess;
}
fPlacer.AddProcessAsSecondDoIt(fParallelWWProcess);
}
const G4VTrackTerminator *
G4PWeightWindowConfigurator::GetTrackTerminator() const
{
return fTrackTerminator;
}
@@ -1,62 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelGCellFinder.cc,v 1.5 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelGCellFinder.cc
//
// ----------------------------------------------------------------------
#include "G4ParallelGCellFinder.hh"
#include "G4VParallelStepper.hh"
G4ParallelGCellFinder::
G4ParallelGCellFinder(const G4VParallelStepper &astepper)
: fPStepper(astepper)
{
}
G4ParallelGCellFinder::~G4ParallelGCellFinder()
{
}
G4GeometryCell
G4ParallelGCellFinder::GetPreGeometryCell(const G4Step &) const
{
G4GeometryCell g(fPStepper.GetPStep().GetPreGeometryCell());
return g;
}
G4GeometryCell
G4ParallelGCellFinder::GetPostGeometryCell(const G4Step &) const
{
G4GeometryCell g(fPStepper.GetPStep().GetPostGeometryCell());
return g;
}
@@ -1,254 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelGeometrySampler.cc,v 1.12 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelGeometrySampler.cc
//
// ----------------------------------------------------------------------
#include "G4ParallelGeometrySampler.hh"
#include "G4VIStore.hh"
#include "G4WeightWindowStore.hh"
#include "G4VScorer.hh"
#include "G4ParallelTransportConfigurator.hh"
#include "G4PScoreConfigurator.hh"
#include "G4PImportanceConfigurator.hh"
#include "G4WeightCutOffConfigurator.hh"
#include "G4ParallelGCellFinder.hh"
#include "G4PWeightWindowConfigurator.hh"
G4ParallelGeometrySampler::
G4ParallelGeometrySampler(G4VPhysicalVolume &worldvolume,
const G4String &particlename)
: fParticleName(particlename),
fParallelWorld(worldvolume),
fParallelTransportConfigurator(0),
fPImportanceConfigurator(0),
fPScoreConfigurator(0),
fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fPWeightWindowConfigurator(0),
fWWStore(0),
fIsConfigured(false)
{
}
G4ParallelGeometrySampler::~G4ParallelGeometrySampler()
{
ClearSampling();
}
void G4ParallelGeometrySampler::ClearSampling()
{
if (fParallelTransportConfigurator)
{
delete fParallelTransportConfigurator;
fParallelTransportConfigurator = 0;
}
if (fPWeightWindowConfigurator)
{
delete fPWeightWindowConfigurator;
fPWeightWindowConfigurator = 0;
}
if (fPImportanceConfigurator)
{
delete fPImportanceConfigurator;
fPImportanceConfigurator = 0;
}
if (fPScoreConfigurator)
{
delete fPScoreConfigurator;
fPScoreConfigurator = 0;
}
if (fWeightCutOffConfigurator)
{
delete fWeightCutOffConfigurator;
fWeightCutOffConfigurator = 0;
}
if (fGCellFinder)
{
delete fGCellFinder;
fGCellFinder = 0;
}
fIStore = 0;
fConfigurators.clear();
fIsConfigured = false;
}
G4bool G4ParallelGeometrySampler::IsConfigured() const
{
G4bool isconf = false;
if (fIsConfigured)
{
G4cout << "WARNING - G4ParallelGeometrySampler::IsConfigured()"
<< " Some initalization exists already."
<< " Use ClearSampling() before a new initialization !"
<< G4endl;
isconf = true;
}
return isconf;
}
void G4ParallelGeometrySampler::
PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm *ialg)
{
fIStore = istore;
fPImportanceConfigurator = new G4PImportanceConfigurator(fParticleName,
fParallelWorld,
*istore, ialg);
if (!fPImportanceConfigurator)
{
G4Exception("G4ParallelGeometrySampler::PrepareImportanceSampling()",
"FatalError", FatalException,
"Failed to create G4PImportanceConfigurator !");
}
}
void G4ParallelGeometrySampler::PrepareScoring(G4VScorer *scorer)
{
fPScoreConfigurator =
new G4PScoreConfigurator(fParticleName,
fParallelWorld.
GetParallelStepper(),
*scorer);
if (!fPScoreConfigurator)
{
G4Exception("G4ParallelGeometrySampler::PrepareScoring()",
"FatalError", FatalException,
"Failed to create G4PScoreConfigurator !");
}
}
void
G4ParallelGeometrySampler::PrepareWeightRoulett(G4double wsuvive,
G4double wlimit,
G4double isource)
{
fGCellFinder = new G4ParallelGCellFinder(fParallelWorld.
GetParallelStepper());
if (!fGCellFinder)
{
G4Exception("G4ParallelGeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed to allocate G4ParallelGCellFinder !");
}
fWeightCutOffConfigurator =
new G4WeightCutOffConfigurator(fParticleName,
wsuvive,
wlimit,
isource,
fIStore,
*fGCellFinder);
if (!fWeightCutOffConfigurator)
{
G4Exception("G4ParallelGeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed to allocate G4WeightCutOffConfigurator !");
}
}
void
G4ParallelGeometrySampler::PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
{
if (placeOfAction != onBoundary)
{
// an additional paralel transport is needed
// to cause a step on parallel boundaries
fParallelTransportConfigurator =
new G4ParallelTransportConfigurator(fParticleName, fParallelWorld);
}
fWWStore = wwstore;
fPWeightWindowConfigurator =
new G4PWeightWindowConfigurator(fParticleName,
fParallelWorld,
*wwstore,
wwAlg,
placeOfAction);
}
void G4ParallelGeometrySampler::Configure()
{
if (!IsConfigured())
{
fIsConfigured = true;
if (fPScoreConfigurator)
{
fConfigurators.push_back(fPScoreConfigurator);
}
if (fPImportanceConfigurator)
{
fConfigurators.push_back(fPImportanceConfigurator);
}
else if (fPWeightWindowConfigurator)
{
fConfigurators.push_back(fPWeightWindowConfigurator);
if (fParallelTransportConfigurator)
{
fConfigurators.push_back(fParallelTransportConfigurator);
}
}
else
{
fParallelTransportConfigurator =
new G4ParallelTransportConfigurator(fParticleName, fParallelWorld);
if (!fParallelTransportConfigurator)
{
G4Exception("G4ParallelGeometrySampler::Configure()",
"FatalError", FatalException,
"Failed to allocate G4ParallelTransportConfigurator !");
}
fConfigurators.push_back(fParallelTransportConfigurator);
}
G4VSamplerConfigurator *preConf = 0;
for (G4Configurators::iterator it = fConfigurators.begin();
it != fConfigurators.end(); it++)
{
G4VSamplerConfigurator *currConf =*it;
currConf->Configure(preConf);
preConf = *it;
}
if (fWeightCutOffConfigurator)
{
fWeightCutOffConfigurator->Configure(0);
}
}
return;
}
@@ -1,101 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelImportanceProcess.cc,v 1.19 2006/06/29 21:12:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelImportanceProcess.cc
//
// ----------------------------------------------------------------------
#include "G4Types.hh"
#include "G4ParallelImportanceProcess.hh"
#include "G4VImportanceSplitExaminer.hh"
#include "G4VTrackTerminator.hh"
#include "G4SamplingPostStepAction.hh"
G4ParallelImportanceProcess::G4ParallelImportanceProcess(
const G4VImportanceSplitExaminer &aImportanceSplitExaminer,
G4VPGeoDriver &pgeodriver,
G4VParallelStepper &aStepper,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName)
: G4ParallelTransport(pgeodriver, aStepper, aName),
fParticleChange(G4ParallelTransport::fParticleChange),
fImportanceSplitExaminer(aImportanceSplitExaminer),
fPostStepAction(0)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
}
G4ParallelImportanceProcess::~G4ParallelImportanceProcess()
{
delete fPostStepAction;
}
G4VParticleChange *G4ParallelImportanceProcess::
PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ParallelImportanceProcess::PostStepDoIt()"
<< " StopAndKill track !" << G4endl;
}
G4ParallelTransport::PostStepDoIt(aTrack, aStep);
// get new weight and number of clones
G4Nsplit_Weight nw(fImportanceSplitExaminer.Examine(aTrack.GetWeight()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
return fParticleChange;
}
void G4ParallelImportanceProcess::Error(const G4String &m)
{
G4Exception("G4ParallelImportanceProcess::Error()",
"ProgramError", FatalException, m);
}
void G4ParallelImportanceProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4ParallelImportanceProcess::GetName() const
{
return G4ParallelTransport::GetProcessName();
}
@@ -1,178 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelTransport.cc,v 1.15 2006/06/29 21:12:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelTransport.cc
//
// ----------------------------------------------------------------------
#include "G4Types.hh"
#include "G4ParallelTransport.hh"
#include "G4VPGeoDriver.hh"
#include "G4VParallelStepper.hh"
#include <sstream>
G4ParallelTransport::G4ParallelTransport(G4VPGeoDriver &pgeodriver,
G4VParallelStepper &aStepper,
const G4String &aName)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fPgeodriver(pgeodriver),
fPStepper(aStepper),
fCrossBoundary(false),
fInitStep(false)
{
if (!fParticleChange)
{
G4Exception("G4ParallelTransport::G4ParallelTransport()",
"FatalError", FatalException,
"Failed to allocate G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
}
G4ParallelTransport::~G4ParallelTransport()
{
delete fParticleChange;
}
void G4ParallelTransport::StartTracking(G4Track*)
{
fInitStep = true;
}
void G4ParallelTransport::EndTracking()
{
}
G4double G4ParallelTransport::
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double ,
G4ForceCondition* condition)
{
G4double stepLength = 0;
// if this function is called on a new track let the navigator
// know about it
// G4bool initStep = (aTrack.GetCurrentStepNumber() == 1);
if (fInitStep)
{
fInitStep = false;
stepLength = fPgeodriver.
ComputeStepLengthInit(aTrack.GetPosition(),
aTrack.GetMomentumDirection());
fPStepper.Init(fPgeodriver.GetCurrentGeometryCell());
fCrossBoundary = false;
}
else if (fCrossBoundary)
{
stepLength = fPgeodriver.
ComputeStepLengthCrossBoundary(aTrack.GetPosition(),
aTrack.GetMomentumDirection());
fPStepper.UnSetCrossBoundary();
fCrossBoundary = false;
}
else
{
stepLength = fPgeodriver.
ComputeStepLengthInVolume(aTrack.GetPosition(),
aTrack.GetMomentumDirection());
}
*condition = NotForced;
return stepLength;
}
G4VParticleChange *
G4ParallelTransport::PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep)
{
if (!(aStep.GetStepLength() > 0.))
{
std::ostringstream os;
os << "G4PArallelTransport::InitPostDoIt: StepLength() == 0.\n"
<< "pos: " << aTrack.GetPosition() << ", "
<< "dir: " << aTrack.GetMomentumDirection() << "\n";
G4String m = os.str();
Warning(m);
}
fParticleChange->Initialize(aTrack);
fCrossBoundary = true;
fPgeodriver.LocateOnBoundary(aTrack.GetPosition(),
aTrack.GetMomentumDirection());
fPStepper.Update(fPgeodriver.GetCurrentGeometryCell());
return fParticleChange;
}
void G4ParallelTransport::Error(const G4String &m)
{
G4Exception("G4ParallelTransport::Error()",
"ProgramError", FatalException, m);
}
void G4ParallelTransport::Warning(const G4String &m)
{
G4Exception("G4ParallelTransport::Warning()",
"ProgramWarning", JustWarning, m);
}
G4double G4ParallelTransport::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4ParallelTransport::
AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange*
G4ParallelTransport::AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4ParallelTransport::
AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelTransportConfigurator.cc,v 1.7 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4ParallelTransportConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4ParallelTransportConfigurator.hh"
#include "G4ParallelWorld.hh"
G4ParallelTransportConfigurator::
G4ParallelTransportConfigurator(const G4String &particlename,
G4ParallelWorld &pworld)
: fPlacer(particlename),
fPWorld(pworld),
fParallelTransport(0)
{
}
G4ParallelTransportConfigurator::~G4ParallelTransportConfigurator()
{
if (fParallelTransport)
{
fPlacer.RemoveProcess(fParallelTransport);
delete fParallelTransport;
}
}
void G4ParallelTransportConfigurator::Configure(G4VSamplerConfigurator *)
{
fParallelTransport = new G4ParallelTransport(fPWorld.GetGeoDriver(),
fPWorld.GetParallelStepper());
if (!fParallelTransport)
{
G4Exception("G4ParallelTransportConfigurator::Configure()",
"FatalError", FatalException,
"Failed to allocate G4ParallelTransport !");
}
fPlacer.AddProcessAsSecondDoIt(fParallelTransport);
}
const G4VTrackTerminator *
G4ParallelTransportConfigurator::GetTrackTerminator() const
{
return 0;
}
@@ -1,104 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelWWnTransportProcess.cc,v 1.6 2006/06/29 21:12:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelWWnTransportProcess.cc
//
// ----------------------------------------------------------------------
#include "G4Types.hh"
#include "G4ParallelWWnTransportProcess.hh"
#include "G4VWeightWindowExaminer.hh"
#include "G4VTrackTerminator.hh"
#include "G4SamplingPostStepAction.hh"
G4ParallelWWnTransportProcess::G4ParallelWWnTransportProcess(
const G4VWeightWindowExaminer &aWeightWindowExaminer,
G4VPGeoDriver &pgeodriver,
G4VParallelStepper &aStepper,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName )
: G4ParallelTransport(pgeodriver, aStepper, aName),
fParticleChange(G4ParallelTransport::fParticleChange),
fWeightWindowExaminer(aWeightWindowExaminer),
fPostStepAction(0)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
}
G4ParallelWWnTransportProcess::~G4ParallelWWnTransportProcess()
{
delete fPostStepAction;
}
G4VParticleChange *
G4ParallelWWnTransportProcess::PostStepDoIt(const G4Track& aTrack,
const G4Step &aStep)
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ParallelWWnTransportProcess::PostStepDoIt()"
<< " StopAndKill track !"
<< G4endl;
}
G4ParallelTransport::PostStepDoIt(aTrack, aStep);
// get new weight and number of clones
G4Nsplit_Weight nw(fWeightWindowExaminer.Examine(aTrack.GetWeight(),
aTrack.
GetKineticEnergy()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
return fParticleChange;
}
void G4ParallelWWnTransportProcess::Error(const G4String &m)
{
G4Exception("G4ParallelWWnTransportProcess::Error()",
"ProgramError", FatalException, m);
}
void G4ParallelWWnTransportProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4ParallelWWnTransportProcess::GetName() const
{
return G4ParallelTransport::GetProcessName();
}
@@ -1,154 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ParallelWeightWindowProcess.cc,v 1.13 2006/06/29 21:12:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelWeightWindowProcess.cc
//
// ----------------------------------------------------------------------
#include "G4Types.hh"
#include "G4ParallelWeightWindowProcess.hh"
#include "G4VWeightWindowExaminer.hh"
#include "G4VTrackTerminator.hh"
#include "G4SamplingPostStepAction.hh"
#include "G4VParallelStepper.hh"
G4ParallelWeightWindowProcess::G4ParallelWeightWindowProcess(
const G4VWeightWindowExaminer &aWeightWindowExaminer,
G4VParallelStepper &aStepper,
const G4VTrackTerminator *TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String &aName)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fWeightWindowExaminer(aWeightWindowExaminer),
fStepper(aStepper),
fPostStepAction(0),
fPlaceOfAction(placeOfAction)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
}
G4ParallelWeightWindowProcess::~G4ParallelWeightWindowProcess()
{
delete fParticleChange;
delete fPostStepAction;
}
G4double G4ParallelWeightWindowProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4ParallelWeightWindowProcess::PostStepDoIt(const G4Track& aTrack,
const G4Step &aStep)
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ParallelWeightWindowProcess::PostStepDoIt()"
<< " StopAndKill track !" << G4endl;
}
fParticleChange->Initialize(aTrack);
if (aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary)
{
if (!( fStepper.GetPStep().GetCrossBoundary()
&& (fPlaceOfAction == onCollision) ) )
{
// get new weight and number of clones
G4Nsplit_Weight nw(fWeightWindowExaminer.
Examine(aTrack.GetWeight(),
aTrack.
GetKineticEnergy()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
}
return fParticleChange;
}
void G4ParallelWeightWindowProcess::Error(const G4String &m)
{
G4Exception("G4ParallelWeightWindowProcess::Error()",
"ProgramError", FatalException, m);
}
void G4ParallelWeightWindowProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4ParallelWeightWindowProcess::GetName() const
{
return theProcessName;
}
G4double G4ParallelWeightWindowProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4ParallelWeightWindowProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4ParallelWeightWindowProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4ParallelWeightWindowProcess::
AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
@@ -1,202 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4ProcessPlacer.cc,v 1.16 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ProcessPlacer.cc
//
// ----------------------------------------------------------------------
#include "G4ProcessPlacer.hh"
#include "G4ProcessManager.hh"
#include "G4VProcess.hh"
#include "G4ParticleTable.hh"
G4ProcessPlacer::G4ProcessPlacer(const G4String &particlename)
: fParticleName(particlename)
{
}
G4ProcessPlacer::~G4ProcessPlacer()
{
}
void G4ProcessPlacer::RemoveProcess(G4VProcess *process)
{
G4cout << "=== G4ProcessPlacer::RemoveProcess: for: " << fParticleName
<< G4endl;
G4cout << " ProcessName: " << process->GetProcessName()
<< ", will be removed!" << G4endl;
G4cout << " The initial Vectors: " << G4endl;
PrintPostStepGPILVec();
PrintPostStepDoItVec();
GetProcessManager()->RemoveProcess(process);
G4cout << " The final Vectors: " << G4endl;
PrintPostStepGPILVec();
PrintPostStepDoItVec();
G4cout << "================================================" << G4endl;
}
void G4ProcessPlacer::AddProcessAs(G4VProcess *process, SecondOrLast sol)
{
G4cout << " ProcessName: " << process->GetProcessName() << G4endl;
G4cout << "The initial Vectors: " << G4endl;
PrintPostStepGPILVec();
PrintPostStepDoItVec();
if (sol == eLast)
{
GetProcessManager()->AddProcess(process, ordInActive, ordInActive, ordLast);
}
else if (sol == eSecond)
{
// get transportation process
G4VProcess *transportation =
(* (GetProcessManager()->GetProcessList()))[0];
if (!transportation)
{
G4Exception(" G4ProcessPlacer:: could not get process id=0");
}
if (transportation->GetProcessName() != "Transportation")
{
G4cout << transportation->GetProcessName() << G4endl;
G4Exception(" G4ProcessPlacer:: process id=0 is not Transportation");
}
// place the given proces as first for the moment
GetProcessManager()->AddProcess(process);
GetProcessManager()->SetProcessOrderingToFirst(process,
idxPostStep);
// place transportation first again
GetProcessManager()->SetProcessOrderingToFirst(transportation,
idxPostStep);
}
// for verification inly
G4cout << "The final Vectors: " << G4endl;
PrintPostStepGPILVec();
PrintPostStepDoItVec();
G4cout << "================================================" << G4endl;
}
void G4ProcessPlacer::AddProcessAsSecondDoIt(G4VProcess *process)
{
G4cout << "=== G4ProcessPlacer::AddProcessAsSecondDoIt: for: "
<< fParticleName << G4endl;
AddProcessAs(process, eSecond);
}
void G4ProcessPlacer::AddProcessAsLastDoIt(G4VProcess *process)
{
G4cout << "=== G4ProcessPlacer::AddProcessAsLastDoIt: for: "
<< fParticleName << G4endl;
AddProcessAs(process, eLast);
}
G4ProcessManager *G4ProcessPlacer::GetProcessManager()
{
// get particle iterator to add processes ---------------------
G4ParticleTable* theParticleTable = 0;
G4ParticleTable::G4PTblDicIterator* theParticleIterator = 0;
theParticleTable = G4ParticleTable::GetParticleTable();
theParticleIterator = theParticleTable->GetIterator();
// -------------------------------------------------------
G4ProcessManager *processmanager = 0;
// find process manager ---------------------------
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
if (particle->GetParticleName() == fParticleName)
{
processmanager = particle->GetProcessManager();
break;
}
}
// ---------------------------------------------------------
if (!processmanager)
{
G4Exception("G4ProcessPlacer::GetProcessManager()", "InvalidSetup",
FatalException, "NULL pointer to Process Manager !");
}
return processmanager;
}
void G4ProcessPlacer::PrintPostStepGPILVec()
{
G4cout << "GPIL Vector: " << G4endl;
G4ProcessVector* processGPILVec =
GetProcessManager()->GetPostStepProcessVector(typeGPIL);
PrintProcVec(processGPILVec);
}
void G4ProcessPlacer::PrintPostStepDoItVec()
{
G4cout << "DoIt Vector: " << G4endl;
G4ProcessVector* processDoItVec =
GetProcessManager()->GetPostStepProcessVector(typeDoIt);
PrintProcVec(processDoItVec);
}
void G4ProcessPlacer::PrintProcVec(G4ProcessVector* processVec)
{
if (!processVec)
{
G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidArgument",
FatalException, "NULL pointer to process-vector !");
}
G4int len = processVec->length();
if (len==0)
{
G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidSetup",
FatalException, "Length of process-vector is zero !");
}
for (int pi=0; pi<len; pi++)
{
G4VProcess *p = (*processVec)[pi];
if (p)
{
G4cout << " " << p->GetProcessName() << G4endl;
}
else
{
G4cout << " " << "no process found for position: " << pi
<< ", in vector of length: " << len << G4endl;
}
}
}
@@ -1,111 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4SamplingPostStepAction.cc,v 1.4 2006/06/29 21:12:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4SamplingPostStepAction.cc
//
// ----------------------------------------------------------------------
#include "G4SamplingPostStepAction.hh"
#include "G4Track.hh"
#include "G4ParticleChange.hh"
#include "G4VImportanceSplitExaminer.hh"
#include "G4Nsplit_Weight.hh"
#include "G4VTrackTerminator.hh"
#include <sstream>
G4SamplingPostStepAction::
G4SamplingPostStepAction(const G4VTrackTerminator &TrackTerminator)
: fTrackTerminator(TrackTerminator)
{
}
G4SamplingPostStepAction::~G4SamplingPostStepAction()
{
}
void G4SamplingPostStepAction::DoIt(const G4Track& aTrack,
G4ParticleChange *aParticleChange,
const G4Nsplit_Weight &nw)
{
// evaluate results from sampler
if (nw.fN>1)
{
// split track
Split(aTrack, nw, aParticleChange);
}
else if (nw.fN==1)
{
// don't split, but weight may be changed !
aParticleChange->ProposeWeight(nw.fW);
}
else if (nw.fN==0)
{
// kill track
fTrackTerminator.KillTrack();
}
else
{
// wrong answer
std::ostringstream os;
os << "Sampler returned nw = "
<< nw
<< "\n";
G4String m = os.str();
G4Exception("G4SamplingPostStepAction::DoIt()",
"InvalidCondition", FatalException, m);
}
}
void G4SamplingPostStepAction::Split(const G4Track &aTrack,
const G4Nsplit_Weight &nw,
G4ParticleChange *aParticleChange)
{
aParticleChange->ProposeWeight(nw.fW);
aParticleChange->SetNumberOfSecondaries(nw.fN-1);
for (G4int i=1;i<nw.fN;i++)
{
G4Track *ptrack = new G4Track(aTrack);
// ptrack->SetCreatorProcess(aTrack.GetCreatorProcess());
ptrack->SetWeight(nw.fW);
if (ptrack->GetMomentumDirection() != aTrack.GetMomentumDirection())
{
G4Exception("G4SamplingPostStepAction::Split()", "InvalidCondition",
FatalException, "Track with same momentum !");
}
aParticleChange->AddSecondary(ptrack);
}
return;
}
@@ -25,7 +25,7 @@
//
//
// $Id: G4StepLimiter.cc,v 1.3 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// --------------------------------------------------------------
// History
@@ -25,7 +25,7 @@
//
//
// $Id: G4Transportation.cc,v 1.60.4.2 2007/02/15 19:02:57 japost Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
// ------------------------------------------------------------
// GEANT 4 include file implementation
@@ -25,7 +25,7 @@
//
//
// $Id: G4UserSpecialCuts.cc,v 1.16 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// --------------------------------------------------------------
// History
@@ -1,42 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4VProcessPlacer.cc,v 1.4 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VProcessPlacer.cc
//
// ----------------------------------------------------------------------
#include "G4VProcessPlacer.hh"
G4VProcessPlacer::G4VProcessPlacer()
{}
G4VProcessPlacer::~G4VProcessPlacer()
{}
@@ -1,43 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4VSampler.cc,v 1.4 2006/10/16 18:19:53 japost Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VSampler.cc
//
// ----------------------------------------------------------------------
#include "G4VSampler.hh"
G4VSampler::G4VSampler()
{}
G4VSampler::~G4VSampler()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4VSamplerConfigurator.cc,v 1.4 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VSamplerConfigurator.cc
//
// ----------------------------------------------------------------------
#include "G4VSamplerConfigurator.hh"
G4VSamplerConfigurator::G4VSamplerConfigurator()
{}
G4VSamplerConfigurator::~G4VSamplerConfigurator()
{}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VTrackTerminator.cc,v 1.5 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VTrackTerminator.cc,v 1.6 2007/05/11 14:13:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -35,9 +35,12 @@
// ----------------------------------------------------------------------
#include "G4VTrackTerminator.hh"
#include "G4GeometryTolerance.hh"
G4VTrackTerminator::G4VTrackTerminator()
{}
{
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
}
G4VTrackTerminator::~G4VTrackTerminator()
{}
@@ -1,79 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffConfigurator.cc,v 1.7 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4WeightCutOffConfigurator.hh"
#include "G4WeightCutOffProcess.hh"
G4WeightCutOffConfigurator::
G4WeightCutOffConfigurator(const G4String &particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellfinder)
: fPlacer(particlename),
fPlaced(false)
{
fWeightCutOffProcess =
new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,aGCellfinder);
if (!fWeightCutOffProcess)
{
G4Exception("G4WeightCutOffConfigurator::G4WeightCutOffConfigurator()",
"FatalError", FatalException,
"Failed to allocate G4WeightCutOffProcess !");
}
}
G4WeightCutOffConfigurator::~G4WeightCutOffConfigurator()
{
if (fPlaced)
{
fPlacer.RemoveProcess(fWeightCutOffProcess);
delete fWeightCutOffProcess;
}
}
void G4WeightCutOffConfigurator::Configure(G4VSamplerConfigurator *)
{
fPlacer.AddProcessAsLastDoIt(fWeightCutOffProcess);
fPlaced = true;
}
const G4VTrackTerminator
*G4WeightCutOffConfigurator::GetTrackTerminator() const
{
return 0;
}
@@ -1,147 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffProcess.cc,v 1.9 2006/11/14 09:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4WeightCutOffProcess.cc
//
// ----------------------------------------------------------------------
#include "G4WeightCutOffProcess.hh"
#include "G4VScorer.hh"
#include "G4GeometryCellStep.hh"
#include "G4ParallelGCellFinder.hh"
#include "G4MassGCellFinder.hh"
#include "G4TouchableHandle.hh"
#include "G4VIStore.hh"
G4WeightCutOffProcess::
G4WeightCutOffProcess(G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellFinder,
const G4String &aName)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fWeightSurvival(wsurvival),
fWeightLimit(wlimit),
fSourceImportance(isource),
fIStore(istore),
fGCellFinder(aGCellFinder)
{
if (!fParticleChange)
{
G4Exception("G4WeightCutOffProcess::G4WeightCutOffProcess()",
"FatalError", FatalException,
"Failed to allocate G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
}
G4WeightCutOffProcess::~G4WeightCutOffProcess()
{
delete fParticleChange;
}
G4double G4WeightCutOffProcess::
PostStepGetPhysicalInteractionLength(const G4Track &,
G4double, G4ForceCondition* condition)
{
*condition = Forced;
return kInfinity;
}
G4VParticleChange *
G4WeightCutOffProcess::PostStepDoIt(const G4Track& aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
G4double R = fSourceImportance;
if (fIStore)
{
G4double i = fIStore->GetImportance(postCell);
if (i>0)
{
R/=i;
}
}
G4double w = aTrack.GetWeight();
if (w<R*fWeightLimit)
{
G4double ws = fWeightSurvival*R;
G4double p = w/(ws);
if (G4UniformRand()<p)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
else
{
fParticleChange->ProposeWeight(ws);
}
}
return fParticleChange;
}
const G4String &G4WeightCutOffProcess::GetName() const
{
return theProcessName;
}
G4double G4WeightCutOffProcess::
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*)
{
return -1.0;
}
G4double G4WeightCutOffProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange*
G4WeightCutOffProcess::AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange*
G4WeightCutOffProcess::AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}