Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-18 Gabriele Cosmo (proc-biasimp-V11-02-00)
- Fixed reported Coverity defects, to use 'const G4String&' for avoiding
implicit copies.
- Some code cleanup.
## 2023-11-21 Alexander Howard (proc-biasimp-V11-01-01)
- Put in protection against on world boundary in PostStepDoIt of
G4ImportanceProces - addresses bug #1991.
@@ -23,20 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometrySampler
//
// Class description:
//
// This class inherits from G4VSampler. It is used for scoring and
// importance sampling in the tracking (mass) geometry.
// See also the description in G4VSampler.hh.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
//
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4GeometrySampler_hh
#define G4GeometrySampler_hh G4GeometrySampler_hh
#define G4GeometrySampler_hh 1
#include "G4Types.hh"
#include "G4String.hh"
@@ -45,19 +43,20 @@
class G4ImportanceConfigurator;
class G4WeightWindowConfigurator;
//class G4ScoreConfigurator;
class G4WeightCutOffConfigurator;
//class G4VGCellFinder;
class G4GeometrySampler : public G4VSampler
{
public: // with description
public:
explicit G4GeometrySampler(G4VPhysicalVolume *worldvolume, const G4String &particlename);
explicit G4GeometrySampler(G4String worldvolumeName, const G4String &particlename);
explicit G4GeometrySampler(const G4String& worldvolumeName, const G4String &particlename);
virtual ~G4GeometrySampler();
G4GeometrySampler(const G4GeometrySampler &) = delete;
G4GeometrySampler& operator=(const G4GeometrySampler &) = delete;
// virtual void PrepareScoring(G4VScorer *Scorer);
virtual void PrepareImportanceSampling(G4VIStore* istore,
const G4VImportanceAlgorithm
@@ -80,32 +79,21 @@ public: // with description
void SetWorld(const G4VPhysicalVolume* world);
void SetParticle(const G4String &particlename);
inline G4String GetParticleName(){return fParticleName;};
inline const G4String& GetParticleName() { return fParticleName; }
private:
G4GeometrySampler(const G4GeometrySampler &);
G4GeometrySampler &
operator=(const G4GeometrySampler &);
private:
private:
G4String fParticleName;
const G4VPhysicalVolume* fWorld;
const G4VPhysicalVolume* fWorld = nullptr;
G4String fWorldName;
G4ImportanceConfigurator *fImportanceConfigurator;
// G4ScoreConfigurator *fScoreConfigurator;
// G4VGCellFinder *fGCellFinder;
G4WeightCutOffConfigurator *fWeightCutOffConfigurator;
G4VIStore* fIStore;
G4WeightWindowConfigurator *fWeightWindowConfigurator;
G4VWeightWindowStore *fWWStore;
G4bool fIsConfigured;
G4ImportanceConfigurator* fImportanceConfigurator = nullptr;
G4WeightCutOffConfigurator* fWeightCutOffConfigurator = nullptr;
G4VIStore* fIStore = nullptr;
G4WeightWindowConfigurator* fWeightWindowConfigurator = nullptr;
G4VWeightWindowStore* fWWStore = nullptr;
G4bool fIsConfigured = false;
G4Configurators fConfigurators;
G4bool paraflag;
G4bool paraflag = false;
};
#endif
@@ -23,21 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4ImportanceConfigurator
//
// Class description:
//
// This class builds and places the G4ImportanceProcess.
// If the object is deleted the process is removed from the
// process list.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
//
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4ImportanceConfigurator_hh
#define G4ImportanceConfigurator_hh G4ImportanceConfigurator_hh
#define G4ImportanceConfigurator_hh 1
#include "G4Types.hh"
#include "G4ProcessPlacer.hh"
@@ -51,44 +48,40 @@ class G4VPhysicalVolume;
class G4ImportanceConfigurator : public G4VSamplerConfigurator
{
public: // with description
public:
G4ImportanceConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg,
G4bool paraflag);
const G4String& particlename,
G4VIStore& istore,
const G4VImportanceAlgorithm* ialg,
G4bool paraflag);
G4ImportanceConfigurator(const G4String &worldvolumeName,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg,
G4bool paraflag);
G4ImportanceConfigurator(const G4String& worldvolumeName,
const G4String& particlename,
G4VIStore& istore,
const G4VImportanceAlgorithm* ialg,
G4bool paraflag);
virtual ~G4ImportanceConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const;
G4ImportanceConfigurator(const G4ImportanceConfigurator&) = delete;
G4ImportanceConfigurator& operator=(const G4ImportanceConfigurator&) = delete;
virtual void Configure(G4VSamplerConfigurator* preConf);
virtual const G4VTrackTerminator* GetTrackTerminator() const;
void SetWorldName(const G4String& Name);
private:
private:
G4ImportanceConfigurator(const G4ImportanceConfigurator &);
G4ImportanceConfigurator &
operator=(const G4ImportanceConfigurator &);
const G4VPhysicalVolume* fWorld;
const G4VPhysicalVolume* fWorld = nullptr;
G4String fWorldName;
G4ProcessPlacer fPlacer;
G4VIStore &fIStore;
G4bool fDeleteIalg;
const G4VImportanceAlgorithm *fIalgorithm;
G4ImportanceProcess *fImportanceProcess;
G4bool paraflag;
G4VIStore& fIStore;
G4bool fDeleteIalg = false;
const G4VImportanceAlgorithm* fIalgorithm = nullptr;
G4ImportanceProcess* fImportanceProcess = nullptr;
G4bool paraflag = false;
};
#endif
@@ -57,7 +57,7 @@ class G4PathFinder;
class G4ImportanceProcess : public G4VProcess, public G4VTrackTerminator
{
public: // with description
public:
G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
const G4VIStore &aIstore,
@@ -69,13 +69,14 @@ public: // with description
virtual ~G4ImportanceProcess();
// delete the G4ParticleChange
G4ImportanceProcess(const G4ImportanceProcess &) = delete;
G4ImportanceProcess &operator=(const G4ImportanceProcess &) = delete;
//--------------------------------------------------------------
// Set Parallel World
//--------------------------------------------------------------
void SetParallelWorld(const G4String &parallelWorldName);
// void SetParallelWorld(const G4VPhysicalVolume* parallelWorld);
void SetParallelWorld(const G4String& parallelWorldName);
//--------------------------------------------------------------
// Process interface
@@ -86,19 +87,17 @@ public: // with description
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double previousStepSize,
G4double previousStepSize,
G4ForceCondition* condition);
// make process beeing forced
virtual G4VParticleChange *PostStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// manage the importance sampling in the "mass" geometry
virtual void KillTrack() const;
// used in case no scoring process follows that does the killing
virtual const G4String &GetName() const;
public: // without description
virtual const G4String& GetName() const;
// no operation in AtRestDoIt and AlongStepDoIt
@@ -112,21 +111,12 @@ public: // without description
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*);
virtual G4VParticleChange*
AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange*
AlongStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
private:
G4ImportanceProcess(const G4ImportanceProcess &);
G4ImportanceProcess &operator=(const G4ImportanceProcess &);
private:
private:
void CopyStep(const G4Step & step);
void CopyStep(const G4Step& step);
G4Step* fGhostStep = nullptr;
G4StepPoint* fGhostPreStepPoint = nullptr;
@@ -138,7 +128,7 @@ private:
G4SamplingPostStepAction* fPostStepAction = nullptr;
G4TransportationManager* fTransportationManager = nullptr;
G4PathFinder* fPathFinder = nullptr;
G4PathFinder* fPathFinder = nullptr;
// -------------------------------
// Navigation in the Ghost World:
@@ -156,7 +146,6 @@ private:
G4bool fParaflag = false;
G4FieldTrack fEndTrack = '0';
ELimited feLimited = kDoNot;
};
#endif
@@ -23,61 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffConfigurator
//
// Class description:
//
// This class builds and places the G4WeightCutOffProcess.
// If the object is deleted the process is removed from the
// process list.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
//
// Author: Michael Dressel, CERN
// ----------------------------------------------------------------------
#ifndef G4WeightCutOffConfigurator_hh
#define G4WeightCutOffConfigurator_hh G4WeightCutOffConfigurator_hh
#define G4WeightCutOffConfigurator_hh 1
#include "G4Types.hh"
#include "G4VSamplerConfigurator.hh"
#include "G4ProcessPlacer.hh"
class G4WeightCutOffProcess;
//class G4VGCellFinder;
class G4VIStore;
class G4VPhysicalVolume;
class G4WeightCutOffConfigurator : public G4VSamplerConfigurator
{
public: // with description
public:
G4WeightCutOffConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
//const G4VGCellFinder &aGCellFinder,
G4bool paraflag);
const G4String& particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore* istore,
G4bool paraflag);
virtual ~G4WeightCutOffConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const ;
G4WeightCutOffConfigurator(const G4WeightCutOffConfigurator&) = delete;
G4WeightCutOffConfigurator& operator=(const G4WeightCutOffConfigurator&) = delete;
virtual void Configure(G4VSamplerConfigurator* preConf);
virtual const G4VTrackTerminator* GetTrackTerminator() const;
private:
private:
G4WeightCutOffConfigurator(const G4WeightCutOffConfigurator&);
G4WeightCutOffConfigurator &
operator=(const G4WeightCutOffConfigurator&);
const G4VPhysicalVolume* fWorld;
const G4VPhysicalVolume* fWorld = nullptr;
G4ProcessPlacer fPlacer;
G4WeightCutOffProcess *fWeightCutOffProcess;
G4bool fPlaced;
G4bool paraflag;
G4WeightCutOffProcess* fWeightCutOffProcess = nullptr;
G4bool fPlaced = false;
G4bool paraflag = false;
};
#endif
@@ -23,19 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4WeightWindowConfigurator
// G4WeightWindowConfigurator
//
// Class description:
//
// Configuration of weight window processes.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
//
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4WeightWindowConfigurator_hh
#define G4WeightWindowConfigurator_hh G4WeightWindowConfigurator_hh
#define G4WeightWindowConfigurator_hh 1
#include "G4Types.hh"
#include "G4ProcessPlacer.hh"
@@ -50,36 +47,33 @@ class G4VPhysicalVolume;
class G4WeightWindowConfigurator : public G4VSamplerConfigurator
{
public: // with description
public:
G4WeightWindowConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction,
G4bool paraflag);
const G4String& particlename,
G4VWeightWindowStore& wwstore,
const G4VWeightWindowAlgorithm* wwAlg,
G4PlaceOfAction placeOfAction,
G4bool paraflag);
virtual ~G4WeightWindowConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const;
private:
G4WeightWindowConfigurator(const G4WeightWindowConfigurator &) = delete;
G4WeightWindowConfigurator& operator=(const G4WeightWindowConfigurator &) = delete;
G4WeightWindowConfigurator(const G4WeightWindowConfigurator &);
G4WeightWindowConfigurator &
operator=(const G4WeightWindowConfigurator &);
virtual void Configure(G4VSamplerConfigurator* preConf);
virtual const G4VTrackTerminator* GetTrackTerminator() const;
const G4VPhysicalVolume* fWorld;
private:
const G4VPhysicalVolume* fWorld = nullptr;
G4ProcessPlacer fPlacer;
G4VWeightWindowStore &fWeightWindowStore;
G4bool fDeleteWWalg;
const G4VWeightWindowAlgorithm *fWWalgorithm;
G4WeightWindowProcess *fWeightWindowProcess;
G4VWeightWindowStore& fWeightWindowStore;
G4bool fDeleteWWalg = false;
const G4VWeightWindowAlgorithm* fWWalgorithm = nullptr;
G4WeightWindowProcess* fWeightWindowProcess = nullptr;
G4PlaceOfAction fPlaceOfAction;
G4bool paraflag;
G4bool paraflag = false;
};
#endif
@@ -31,7 +31,7 @@
// This process is a forced post step process. It will apply
// weight window biasing on boundaries, collisions
// or both according to the G4PlaceOfAction argument.
//
// Author: Michael Dressel, 2002
// --------------------------------------------------------------------
#ifndef G4WeightWindowProcess_hh
@@ -58,26 +58,28 @@ class G4PathFinder;
class G4WeightWindowProcess : public G4VProcess, public G4VTrackTerminator
{
public: // with description
public:
G4WeightWindowProcess(const G4VWeightWindowAlgorithm &
aWeightWindowAlgorithm,
const G4VWeightWindowStore &aWWStore,
const G4VTrackTerminator *TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String &aName = "WeightWindowProcess",
G4bool para = false);
G4WeightWindowProcess(const G4VWeightWindowAlgorithm&
aWeightWindowAlgorithm,
const G4VWeightWindowStore &aWWStore,
const G4VTrackTerminator* TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String& aName = "WeightWindowProcess",
G4bool para = false);
// creates a G4ParticleChange
virtual ~G4WeightWindowProcess();
// delete the G4ParticleChange
G4WeightWindowProcess(const G4WeightWindowProcess &) = delete;
G4WeightWindowProcess &operator=(const G4WeightWindowProcess &) = delete;
//--------------------------------------------------------------
// Set Parallel World
//--------------------------------------------------------------
void SetParallelWorld(const G4String &parallelWorldName);
void SetParallelWorld(const G4String& parallelWorldName);
void SetParallelWorld(G4VPhysicalVolume* parallelWorld);
//--------------------------------------------------------------
@@ -85,12 +87,10 @@ public: // with description
//--------------------------------------------------------------
void StartTracking(G4Track*);
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double previousStepSize,
G4double previousStepSize,
G4ForceCondition* condition);
// make process beeing forced
virtual G4VParticleChange *PostStepDoIt(const G4Track&, const G4Step&);
@@ -99,38 +99,22 @@ public: // with description
virtual void KillTrack() const;
// used in case no scoring process follows that does the killing
virtual const G4String &GetName() const;
public: // without description
virtual const G4String& GetName() const;
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*);
AlongStepGetPhysicalInteractionLength(const G4Track&, G4double, G4double,
G4double&, G4GPILSelection*);
virtual G4double
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*);
AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*);
virtual G4VParticleChange*
AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
private:
virtual G4VParticleChange*
AlongStepDoIt(const G4Track&, const G4Step&);
private:
G4WeightWindowProcess(const G4WeightWindowProcess &);
G4WeightWindowProcess &operator=(const G4WeightWindowProcess &);
private:
void CopyStep(const G4Step & step);
void CopyStep(const G4Step& step);
G4Step* fGhostStep = nullptr;
G4StepPoint* fGhostPreStepPoint = nullptr;
@@ -143,7 +127,7 @@ private:
G4PlaceOfAction fPlaceOfAction;
G4TransportationManager* fTransportationManager = nullptr;
G4PathFinder* fPathFinder = nullptr;
G4PathFinder* fPathFinder = nullptr;
// -------------------------------
// Navigation in the Ghost World:
@@ -23,66 +23,33 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4GeometrySampler.cc
//
// G4GeometrySampler
// ----------------------------------------------------------------------
#include "G4GeometrySampler.hh"
#include "G4VIStore.hh"
#include "G4WeightWindowStore.hh"
//#include "G4VScorer.hh"
#include "G4VPhysicalVolume.hh"
//#include "G4ScoreConfigurator.hh"
#include "G4ImportanceConfigurator.hh"
#include "G4WeightWindowConfigurator.hh"
#include "G4WeightCutOffConfigurator.hh"
//#include "G4GCellFinder.hh"
#include "G4TransportationManager.hh"
G4GeometrySampler::
G4GeometrySampler(G4VPhysicalVolume *world, const G4String &particlename)
G4GeometrySampler(G4VPhysicalVolume *world, const G4String& particlename)
: fParticleName(particlename),
fWorld(world),
fImportanceConfigurator(0),
// fScoreConfigurator(0),
// fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fWeightWindowConfigurator(0),
fWWStore(0),
fIsConfigured(false)
fWorld(world)
{
paraflag = false;
// fWorldName = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetName();
// if(fWorld == G4TransportationManager::GetTransportationManager()->GetParallelWorld(fWorld->GetName())) paraflag = true;
// G4cout << "G4GeometrySampler:: Making geometry sampler with world: " << fWorld->GetName() << G4endl;
}
G4GeometrySampler::
G4GeometrySampler(G4String worldName, const G4String &particlename)
G4GeometrySampler(const G4String& worldName, const G4String &particlename)
: fParticleName(particlename),
fWorldName(worldName),
fImportanceConfigurator(0),
// fScoreConfigurator(0),
// fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fWeightWindowConfigurator(0),
fWWStore(0),
fIsConfigured(false)
fWorldName(worldName)
{
paraflag = false;
fWorld = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
// fWorld = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
// G4cout << "G4GeometrySampler:: Making geometry sampler with world: " << fWorld->GetName() << G4endl;
//G4TransportationManager::GetTransportationManager()->GetParallelWorld(parallelworldName)
}
G4GeometrySampler::~G4GeometrySampler()
@@ -92,32 +59,10 @@ G4GeometrySampler::~G4GeometrySampler()
void G4GeometrySampler::ClearSampling()
{
if (fImportanceConfigurator)
{
delete fImportanceConfigurator;
fImportanceConfigurator = 0;
}
if (fWeightWindowConfigurator)
{
delete fWeightWindowConfigurator;
fWeightWindowConfigurator = 0;
}
// if (fScoreConfigurator)
// {
// delete fScoreConfigurator;
// fScoreConfigurator = 0;
// }
if (fWeightCutOffConfigurator)
{
delete fWeightCutOffConfigurator;
fWeightCutOffConfigurator = 0;
}
// if (fGCellFinder)
// {
// delete fGCellFinder;
// fGCellFinder = 0;
// }
fIStore = 0;
delete fImportanceConfigurator; fImportanceConfigurator = nullptr;
delete fWeightWindowConfigurator; fWeightWindowConfigurator = nullptr;
delete fWeightCutOffConfigurator; fWeightCutOffConfigurator = nullptr;
fIStore = nullptr;
fConfigurators.clear();
fIsConfigured = false;
}
@@ -178,8 +123,8 @@ G4GeometrySampler::PrepareImportanceSampling(G4VIStore* istore,
void
G4GeometrySampler::PrepareWeightRoulett(G4double wsurvive,
G4double wlimit,
G4double isource)
G4double wlimit,
G4double isource)
{
// fGCellFinder = new G4GCellFinder(fWorld);
G4cout << "G4GeometrySampler:: preparing weight roulette" << G4endl;
@@ -209,8 +154,8 @@ G4GeometrySampler::PrepareWeightRoulett(G4double wsurvive,
void
G4GeometrySampler::PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
{
G4cout << "G4GeometrySampler:: preparing weight window" << G4endl;
@@ -222,13 +167,6 @@ G4GeometrySampler::PrepareWeightWindow(G4VWeightWindowStore *wwstore,
*fWWStore,
wwAlg,
placeOfAction, paraflag);
// fWeightWindowConfigurator =
// new G4WeightWindowConfigurator(fWorld, fParticleName,
// *fWWStore,
// wwAlg,
// placeOfAction, paraflag);
}
void G4GeometrySampler::Configure()
@@ -237,12 +175,6 @@ void G4GeometrySampler::Configure()
{
fIsConfigured = true;
// if (fScoreConfigurator)
// {
// G4cout << " score configurator push_back " << G4endl;
// fConfigurators.push_back(fScoreConfigurator);
// G4cout << " pushed " << G4endl;
// }
if (fImportanceConfigurator)
{
fConfigurators.push_back(fImportanceConfigurator);
@@ -251,27 +183,6 @@ void G4GeometrySampler::Configure()
{
fConfigurators.push_back(fWeightWindowConfigurator);
}
// G4cout << " vsampler configurator loop " << G4endl;
// G4VSamplerConfigurator *preConf = 0;
// G4int i = 0;
// for (G4Configurators::iterator it = fConfigurators.begin();
// it != fConfigurators.end(); it++)
// {
// i++;
// G4cout << " looping " << i << G4endl;
// G4VSamplerConfigurator *currConf =*it;
// G4cout << " sampler configurator " << G4endl;
// currConf->Configure(preConf);
// G4cout << " configure preconf " << G4endl;
// preConf = *it;
// }
// if (fWeightCutOffConfigurator)
// {
// G4cout << " NEW weight window configure " << G4endl;
// fWeightCutOffConfigurator->Configure(0);
// G4cout << " configured " << G4endl;
// }
}
#ifdef G4MULTITHREADED
@@ -312,8 +223,7 @@ void G4GeometrySampler::SetWorld(const G4VPhysicalVolume* World)
fWorld = World;
}
void G4GeometrySampler::SetParticle(const G4String &particlename)
void G4GeometrySampler::SetParticle(const G4String& particlename)
{
fParticleName = particlename;
}
@@ -23,12 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ImportanceConfigurator
//
//
// ----------------------------------------------------------------------
// Class G4ImportanceConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel, CERN
// ----------------------------------------------------------------------
#include "G4ImportanceConfigurator.hh"
@@ -41,39 +38,36 @@
#include "G4AutoLock.hh"
#ifdef G4MULTITHREADED
namespace {
G4Mutex BiasConfigMutex = G4MUTEX_INITIALIZER;
namespace
{
G4Mutex BiasConfigMutex = G4MUTEX_INITIALIZER;
}
#endif
G4ImportanceConfigurator::
G4ImportanceConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg, G4bool para)
const G4String& particlename,
G4VIStore& istore,
const G4VImportanceAlgorithm* ialg, G4bool para)
: fWorld(worldvolume),
fWorldName(worldvolume->GetName()),
fPlacer(particlename),
fIStore(istore),
fDeleteIalg( ( ! ialg) ),
fIalgorithm(( (fDeleteIalg) ?
new G4ImportanceAlgorithm : ialg)),
fImportanceProcess(0),
fIalgorithm(( (fDeleteIalg == true) ? new G4ImportanceAlgorithm : ialg )),
paraflag(para)
{;}
G4ImportanceConfigurator::
G4ImportanceConfigurator(const G4String &worldvolumeName,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg, G4bool para)
G4ImportanceConfigurator(const G4String& worldvolumeName,
const G4String& particlename,
G4VIStore& istore,
const G4VImportanceAlgorithm* ialg, G4bool para)
: fWorldName(worldvolumeName),
fPlacer(particlename),
fIStore(istore),
fDeleteIalg( ( ! ialg) ),
fIalgorithm(( (fDeleteIalg) ?
new G4ImportanceAlgorithm : ialg)),
fImportanceProcess(0),
fIalgorithm(( (fDeleteIalg == true) ? new G4ImportanceAlgorithm : ialg )),
paraflag(para)
{
fWorld = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
@@ -94,15 +88,14 @@ G4ImportanceConfigurator::~G4ImportanceConfigurator()
}
void
G4ImportanceConfigurator::Configure(G4VSamplerConfigurator *preConf)
G4ImportanceConfigurator::Configure(G4VSamplerConfigurator* preConf)
{
G4cout << "G4ImportanceConfigurator:: entering importance configure, paraflag " << paraflag << G4endl;
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
}
#ifdef G4MULTITHREADED
G4AutoLock l(&BiasConfigMutex);
@@ -119,20 +112,15 @@ G4ImportanceConfigurator::Configure(G4VSamplerConfigurator *preConf)
"Failed allocation of G4ImportanceProcess !");
}
// G4cout << "G4ImportanceConfigurator:: setting parallel World " << paraflag << G4endl;
if(paraflag) fImportanceProcess->SetParallelWorld(fWorld->GetName());
#ifdef G4MULTITHREADED
l.unlock();
// G4MUTEXUNLOCK(&G4ImportanceConfigurator::BiasConfigMutex);
#endif
// if(paraflag) fImportanceProcess->SetParallelWorld(fWorldName);
// G4cout << "G4ImportanceConfigurator:: set " << paraflag << " name: " << fWorld->GetName() << G4endl;
// getchar();
fPlacer.AddProcessAsSecondDoIt(fImportanceProcess);
}
const G4VTrackTerminator *G4ImportanceConfigurator::
GetTrackTerminator() const
const G4VTrackTerminator*
G4ImportanceConfigurator::GetTrackTerminator() const
{
return fImportanceProcess;
}
@@ -48,9 +48,9 @@
G4ImportanceProcess::
G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
const G4VIStore &aIstore,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName, G4bool para)
const G4VIStore &aIstore,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName, G4bool para)
: G4VProcess(aName, fParallel),
fParticleChange(new G4ParticleChange),
fImportanceAlgorithm(aImportanceAlgorithm),
@@ -93,24 +93,16 @@ G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
G4ImportanceProcess::~G4ImportanceProcess()
{
delete fPostStepAction;
delete fParticleChange;
// delete fGhostStep;
// delete fGhostWorld;
// delete fGhostNavigator;
}
//------------------------------------------------------
//
// SetParallelWorld
//
//------------------------------------------------------
void G4ImportanceProcess::
SetParallelWorld(const G4String &parallelWorldName)
void G4ImportanceProcess::SetParallelWorld(const G4String& parallelWorldName)
{
G4cout << G4endl << G4endl << G4endl;
G4cout << "G4ImportanceProcess:: SetParallelWorld name = " << parallelWorldName << G4endl;
@@ -123,22 +115,6 @@ SetParallelWorld(const G4String &parallelWorldName)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
// void G4ImportanceProcess::
// SetParallelWorld(const G4VPhysicalVolume* parallelWorld)
// {
// //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// // Get pointer of navigator
// //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// // G4cout << " G4ImportanceProcess:: Got here 1 " << G4endl;
// // fGhostWorldName = parallelWorld->GetName();
// // G4cout << " G4ImportanceProcess:: Got here 2 ghostName:" << fGhostWorldName << G4endl;
// fGhostWorld = parallelWorld;
// G4cout << " G4ImportanceProcess:: Got here 3 " << G4endl;
// fGhostNavigator = fTransportationManager->GetNavigator(parallelWorld);
// G4cout << " G4ImportanceProcess:: Got here 4 " << G4endl;
// //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// }
//------------------------------------------------------
//
// StartTracking
@@ -149,25 +125,24 @@ void G4ImportanceProcess::StartTracking(G4Track* trk)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Activate navigator and get the navigator ID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
if(fParaflag) {
if(fParaflag)
{
if(fGhostNavigator != nullptr)
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
{
fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator);
}
else
{
G4Exception("G4ImportanceProcess::StartTracking",
"ProcParaWorld000",FatalException,
"G4ImportanceProcess is used for tracking without having a parallel world assigned");
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{
G4Exception("G4ImportanceProcess::StartTracking",
"ProcParaWorld000",FatalException,
"G4ImportanceProcess is used for tracking without having a parallel world assigned");
}
// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Let PathFinder initialize
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Setup initial touchables for the first step
@@ -181,19 +156,12 @@ void G4ImportanceProcess::StartTracking(G4Track* trk)
fGhostSafety = -1.;
fOnBoundary = false;
}
}
G4double G4ImportanceProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
PostStepGetPhysicalInteractionLength(const G4Track&, G4double,
G4ForceCondition* condition)
{
// *condition = Forced;
// return kInfinity;
// *condition = StronglyForced;
*condition = Forced;
return DBL_MAX;
}
@@ -204,136 +172,82 @@ G4ImportanceProcess::PostStepDoIt(const G4Track &aTrack,
{
fParticleChange->Initialize(aTrack);
if(aTrack.GetNextVolume() == nullptr) {
if(aTrack.GetNextVolume() == nullptr)
{
return fParticleChange;
}
if(fParaflag) {
if(fParaflag)
{
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
//xbug? fOnBoundary = false;
CopyStep(aStep);
if(fOnBoundary)
{
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Locate the point and get new touchable
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
//?? step.GetPostStepPoint()->GetMomentumDirection());
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
//AH G4cout << " on boundary " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
}
else
{
// Do I need this ??????????????????????????????????????????????????????????
// fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
// ?????????????????????????????????????????????????????????????????????????
// fPathFinder->ReLocate(track.GetPosition());
// reuse the touchable
fNewGhostTouchable = fOldGhostTouchable;
//AH G4cout << " NOT on boundary " << G4endl;
}
{
// reuse the touchable
fNewGhostTouchable = fOldGhostTouchable;
}
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
// if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
// && (aStep.GetStepLength() > kCarTolerance) )
// {
// if (aTrack.GetTrackStatus()==fStopAndKill)
// {
// G4cout << "WARNING - G4ImportanceProcess::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());
if ( (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary)
&& (aStep.GetStepLength() > kCarTolerance) )
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary" << G4endl;
}
G4GeometryCell prekey(*(fGhostPreStepPoint->GetPhysicalVolume()),
fGhostPreStepPoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(fGhostPostStepPoint->GetPhysicalVolume()),
fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
//AH
/*
G4cout << G4endl;
G4cout << G4endl;
G4cout << " inside parallel importance process " << aTrack.GetCurrentStepNumber() << G4endl;
G4cout << G4endl;
G4cout << G4endl;
G4cout << " prekey: " << fGhostPreStepPoint->GetPhysicalVolume()->GetName() << " replica:"
<< fGhostPreStepPoint->GetTouchable()->GetReplicaNumber() << G4endl;
G4cout << " prekey ISTORE: " << fIStore.GetImportance(prekey) << G4endl;
G4cout << " postkey: " << G4endl;
G4cout << " postkey ISTORE: " << fIStore.GetImportance(postkey) << G4endl;
*/
//AH
G4Nsplit_Weight nw = fImportanceAlgorithm.
Calculate(fIStore.GetImportance(prekey),
fIStore.GetImportance(postkey),
aTrack.GetWeight());
//AH
/*
G4cout << " prekey weight: " << fIStore.GetImportance(prekey)
<< " postkey weight: " << fIStore.GetImportance(postkey)
<< " split weight: " << nw << G4endl;
G4cout << " before poststepaction " << G4endl;
*/
//AH
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
//AH G4cout << " after post step do it " << G4endl;
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary" << G4endl;
}
} else {
G4GeometryCell prekey(*(fGhostPreStepPoint->GetPhysicalVolume()),
fGhostPreStepPoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(fGhostPostStepPoint->GetPhysicalVolume()),
fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw =
fImportanceAlgorithm.Calculate(fIStore.GetImportance(prekey),
fIStore.GetImportance(postkey),
aTrack.GetWeight());
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
}
else
{
if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
&& (aStep.GetStepLength() > kCarTolerance) )
&& (aStep.GetStepLength() > kCarTolerance) )
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
//AH G4cout << " inside non-parallel importance process " << G4endl;
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary non-parallel" << 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());
//AH
/*
G4cout << " prekey weight: " << fIStore.GetImportance(prekey)
<< " postkey weight: " << fIStore.GetImportance(postkey)
<< " split weight: " << nw << G4endl;
G4cout << " before poststepaction 2 " << G4endl;
*/
//AH
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
//AH G4cout << " after poststepaction 2 " << G4endl;
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary non-parallel"
<< 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;
}
@@ -343,17 +257,19 @@ void G4ImportanceProcess::KillTrack() const
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4ImportanceProcess::GetName() const
const G4String& G4ImportanceProcess::GetName() const
{
return theProcessName;
}
G4double G4ImportanceProcess::
AlongStepGetPhysicalInteractionLength(
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
G4double& proposedSafety, G4GPILSelection* selection)
const G4Track& track, G4double previousStepSize,
G4double currentMinimumStep,
G4double& proposedSafety, G4GPILSelection* selection)
{
if(fParaflag) {
if(fParaflag)
{
*selection = NotCandidateForSelection;
G4double returnedStep = DBL_MAX;
@@ -361,67 +277,63 @@ AlongStepGetPhysicalInteractionLength(
{ fGhostSafety -= previousStepSize; }
// else
// { fGhostSafety = -1.; }
if (fGhostSafety < 0.) fGhostSafety = 0.0;
if (fGhostSafety < 0.) { fGhostSafety = 0.0; }
// ------------------------------------------
// Determination of the proposed STEP LENGTH:
// ------------------------------------------
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
{
// I have no chance to limit
returnedStep = currentMinimumStep;
fOnBoundary = false;
proposedSafety = fGhostSafety - currentMinimumStep;
//AH G4cout << " step not limited, why? " << G4endl;
}
{
// I have no chance to limit
returnedStep = currentMinimumStep;
fOnBoundary = false;
proposedSafety = fGhostSafety - currentMinimumStep;
}
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
{
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ComputeStep
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
returnedStep
{
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ComputeStep
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
returnedStep
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
track.GetCurrentStepNumber(),fGhostSafety,feLimited,
fEndTrack,track.GetVolume());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(feLimited == kDoNot)
{
//AH G4cout << " computestep came back with not-boundary " << G4endl;
// Track is not on the boundary
fOnBoundary = false;
fGhostSafety = fGhostNavigator->ComputeSafety(fEndTrack.GetPosition());
}
else
{
// Track is on the boundary
//AH G4cout << " FOUND A BOUNDARY ! " << track.GetCurrentStepNumber() << G4endl;
fOnBoundary = true;
// proposedSafety = fGhostSafety;
}
proposedSafety = fGhostSafety;
if(feLimited == kUnique || feLimited == kSharedOther) {
*selection = CandidateForSelection;
}else if (feLimited == kSharedTransport) {
returnedStep *= (1.0 + 1.0e-9);
// Expand to disable its selection in Step Manager comparison
}
track.GetCurrentStepNumber(),fGhostSafety,feLimited,
fEndTrack,track.GetVolume());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(feLimited == kDoNot)
{
// Track is not on the boundary
fOnBoundary = false;
fGhostSafety = fGhostNavigator->ComputeSafety(fEndTrack.GetPosition());
}
else
{
// Track is on the boundary
fOnBoundary = true;
}
proposedSafety = fGhostSafety;
if(feLimited == kUnique || feLimited == kSharedOther)
{
*selection = CandidateForSelection;
}
else if (feLimited == kSharedTransport)
{
returnedStep *= (1.0 + 1.0e-9);
// Expand to disable its selection in Step Manager comparison
}
}
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
return returnedStep;
} else {
return DBL_MAX;
}
else
{
return DBL_MAX;
}
}
G4double G4ImportanceProcess::
@@ -442,12 +354,11 @@ AlongStepDoIt(const G4Track& aTrack, const G4Step& )
{
// Dummy ParticleChange ie: does nothing
// Expecting G4Transportation to move the track
//AH G4cout << " along step do it " << G4endl;
pParticleChange->Initialize(aTrack);
return pParticleChange;
}
void G4ImportanceProcess::CopyStep(const G4Step & step)
void G4ImportanceProcess::CopyStep(const G4Step& step)
{
fGhostStep->SetTrack(step.GetTrack());
fGhostStep->SetStepLength(step.GetStepLength());
@@ -23,34 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4WeightCutOffConfigurator
//
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#include "G4WeightCutOffConfigurator.hh"
#include "G4WeightCutOffProcess.hh"
G4WeightCutOffConfigurator::
G4WeightCutOffConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
const G4String& particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
G4bool para)
// const G4VGCellFinder &aGCellfinder, G4bool para)
G4VIStore* istore,
G4bool para)
: fWorld(worldvolume),
fPlacer(particlename),
fPlaced(false),
paraflag(para)
{
fWeightCutOffProcess =
new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,"WeightCutOffProcess",paraflag);
// new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,aGCellfinder,"WeightCutOffProcess",paraflag);
if (!fWeightCutOffProcess)
{
G4Exception("G4WeightCutOffConfigurator::G4WeightCutOffConfigurator()",
@@ -72,15 +66,14 @@ void G4WeightCutOffConfigurator::Configure(G4VSamplerConfigurator *)
{
G4cout << " entering new weight window configure " << G4endl;
if(paraflag) fWeightCutOffProcess->SetParallelWorld(fWorld->GetName());
if(paraflag) { fWeightCutOffProcess->SetParallelWorld(fWorld->GetName()); }
fPlacer.AddProcessAsLastDoIt(fWeightCutOffProcess);
fPlaced = true;
}
const G4VTrackTerminator
*G4WeightCutOffConfigurator::GetTrackTerminator() const
const G4VTrackTerminator*
G4WeightCutOffConfigurator::GetTrackTerminator() const
{
return 0;
return nullptr;
}
@@ -23,13 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4WeightWindowConfigurator
//
//
// ----------------------------------------------------------------------
// Class G4WeightWindowConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#include "G4WeightWindowConfigurator.hh"
#include "G4WeightWindowAlgorithm.hh"
@@ -37,17 +34,16 @@
G4WeightWindowConfigurator::
G4WeightWindowConfigurator(const G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction, G4bool para)
const G4String& particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm* wwAlg,
G4PlaceOfAction placeOfAction,
G4bool para)
: fWorld(worldvolume),
fPlacer(particlename),
fWeightWindowStore(wwstore),
fDeleteWWalg( ( ! wwAlg) ),
fWWalgorithm(( (fDeleteWWalg) ?
new G4WeightWindowAlgorithm(5,3,5) : wwAlg)),
fWeightWindowProcess(0),
fWWalgorithm(( (fDeleteWWalg == false) ? new G4WeightWindowAlgorithm(5,3,5) : wwAlg)),
fPlaceOfAction(placeOfAction)
{
paraflag = para;
@@ -66,30 +62,25 @@ G4WeightWindowConfigurator::~G4WeightWindowConfigurator()
}
}
void
G4WeightWindowConfigurator::Configure(G4VSamplerConfigurator *preConf)
void G4WeightWindowConfigurator::Configure(G4VSamplerConfigurator* preConf)
{
G4cout << " entering weight window configure " << G4endl;
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
}
fWeightWindowProcess =
new G4WeightWindowProcess(*fWWalgorithm,
fWeightWindowStore,
terminator,
fPlaceOfAction,"WeightWindowProcess",paraflag);
new G4WeightWindowProcess(*fWWalgorithm, fWeightWindowStore, terminator,
fPlaceOfAction, "WeightWindowProcess", paraflag);
if(paraflag) fWeightWindowProcess->SetParallelWorld(fWorld->GetName());
if(paraflag) { fWeightWindowProcess->SetParallelWorld(fWorld->GetName()); }
fPlacer.AddProcessAsSecondDoIt(fWeightWindowProcess);
}
const G4VTrackTerminator *
G4WeightWindowConfigurator::GetTrackTerminator() const
const G4VTrackTerminator* G4WeightWindowConfigurator::GetTrackTerminator() const
{
return fWeightWindowProcess;
}