Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -23,23 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometryCell
// G4GeometryCell
//
// Class description:
//
// This class is usde by scoring and importance sampling.
// It serves to address a "cell". A "cell" is somewhat
// related to a touchable in Geant4. It is identified by a reference
// to a G4VPhysicalVolume and a number (replica number).
// Only simple replicas are supported.
// This class is used by scoring and importance sampling.
// It serves to address a "cell". A "cell" is somewhat related to a
// touchable. It is identified by a reference to a G4VPhysicalVolume
// and a number (replica number). Only simple replicas are supported.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCell_hh
#define G4GeometryCell_hh G4GeometryCell_hh
#ifndef G4GEOMETRYCELL_HH
#define G4GEOMETRYCELL_HH 1
#include "globals.hh"
@@ -47,34 +43,34 @@ class G4VPhysicalVolume;
class G4GeometryCell
{
public: // with description
public: // with description
G4GeometryCell(const G4VPhysicalVolume &aVolume, G4int RepNum);
G4GeometryCell(const G4VPhysicalVolume& aVolume, G4int RepNum);
// initialise volume and replica number
G4GeometryCell(const G4GeometryCell &rhs);
// initialise volume and replica number
G4GeometryCell(const G4GeometryCell& rhs);
G4GeometryCell& operator=(const G4GeometryCell& rhs);
// copy constructor and assignment operator
~G4GeometryCell();
// simple destruction
~G4GeometryCell();
// simple destruction
const G4VPhysicalVolume &GetPhysicalVolume() const;
// return the physical volume of the cell
const G4VPhysicalVolume& GetPhysicalVolume() const;
// return the physical volume of the cell
G4int GetReplicaNumber() const;
// returns the replica number of the cell
G4int GetReplicaNumber() const;
// returns the replica number of the cell
private:
G4GeometryCell &operator=(const G4GeometryCell &rhs);
private:
const G4VPhysicalVolume *fVPhysicalVolume;
// pointer to the G4VPhysicalVolume of the "cell"
// it is treated as identifyer
const G4VPhysicalVolume* fVPhysicalVolume = nullptr;
// pointer to the G4VPhysicalVolume of the "cell"; treated as identifyer
G4int fRepNum;
// replica number of the "cell"
G4int fRepNum = 0;
// replica number of the "cell"
};
G4bool operator==(const G4GeometryCell &k1, const G4GeometryCell &k2);
G4bool operator!=(const G4GeometryCell &k1, const G4GeometryCell &k2);
G4bool operator==(const G4GeometryCell& k1, const G4GeometryCell& k2);
G4bool operator!=(const G4GeometryCell& k1, const G4GeometryCell& k2);
#endif
@@ -23,19 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometryCellComp
// G4GeometryCellComp
//
// Class description:
//
// A class needed for comparing G4GeometryCell e.g. in stl containers.
// A class needed for comparing G4GeometryCell e.g. in STL containers.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCellComp_hh
#define G4GeometryCellComp_hh G4GeometryCellComp_hh
#ifndef G4GEOMETRYCELLCOMP_HH
#define G4GEOMETRYCELLCOMP_HH 1
#include "globals.hh"
@@ -43,14 +40,13 @@ class G4GeometryCell;
class G4GeometryCellComp
{
public:
public: // without description
G4GeometryCellComp();
G4GeometryCellComp();
G4bool operator() (const G4GeometryCell &g1,
const G4GeometryCell &g2) const;
// returns true if g1 < g2
G4bool operator() (const G4GeometryCell& g1,
const G4GeometryCell& g2) const;
// returns true if g1 < g2
};
#endif
@@ -23,29 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometryCellImportance
// G4GeometryCellImportance
//
// Class description:
//
// Used internally by importance sampling.
// It is acontainer for "cell" importance value pairs.
// It is a container for "cell" importance value pairs.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCellImportance_hh
#define G4GeometryCellImportance_hh G4GeometryCellImportance_hh
#ifndef GEOMETRYCELLIMPORTANCE_HH
#define GEOMETRYCELLIMPORTANCE_HH 1
#include <map>
#include "globals.hh"
#include "G4GeometryCell.hh"
#include "G4GeometryCellComp.hh"
typedef std::map<G4GeometryCell, G4double, G4GeometryCellComp> G4GeometryCellImportance;
using G4GeometryCellImportance = std::map<G4GeometryCell,
G4double, G4GeometryCellComp>;
// implement container G4GeometryCellImportance as map
std::ostream& operator<<(std::ostream &out, const G4GeometryCellImportance &gCelli);
std::ostream& operator<<(std::ostream& out,
const G4GeometryCellImportance& gCelli);
#endif
@@ -23,94 +23,96 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometryCellStep
// G4GeometryCellStep
//
// Class description:
//
// This class serves to address the "cell" a track previously
// touched and a "cell" a track is currently in. It is used
// for scoring and importance sampling in the "mass" geometry as well
// as in a "parallel" geometry.
// The "cell" information is available with the GetPreGeometryCell and
// the GetPostGeometryCell functions.
// The GetCrossBoundary finction returns true in case the step
// This class serves to address the "cell" a track previously touched
// and a "cell" a track is currently in. It is used for scoring and
// importance sampling in the "mass" geometry as well as in a "parallel"
// geometry.
// The "cell" information is available with the GetPreGeometryCell() and
// the GetPostGeometryCell() functions.
// The GetCrossBoundary() function returns true in case the step
// crosses a boundary in the geometry this G4GeometryCellStep
// refers to.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCellStep_hh
#define G4GeometryCellStep_hh G4GeometryCellStep_hh
#ifndef G4GEOMETRYCELLSTEP_HH
#define G4GEOMETRYCELLSTEP_HH 1
#include "G4GeometryCell.hh"
class G4GeometryCellStep
{
public: // with description
G4GeometryCellStep(const G4GeometryCell &preCell,
const G4GeometryCell &postCell);
// initialise pre and post G4GeometryCell
public: // with description
~G4GeometryCellStep();
G4GeometryCellStep(const G4GeometryCell& preCell,
const G4GeometryCell& postCell);
// initialise pre and post G4GeometryCell
const G4GeometryCell &GetPreGeometryCell() const;
// addressing the "cell" the track previously touched
~G4GeometryCellStep();
const G4GeometryCell &GetPostGeometryCell() const;
// addressing the current "cell"
inline const G4GeometryCell& GetPreGeometryCell() const;
// addressing the "cell" the track previously touched
G4bool GetCrossBoundary() const;
// returns true if step crosses boundary of the geometry it refers to
inline const G4GeometryCell& GetPostGeometryCell() const;
// addressing the current "cell"
// the following functions are used by the scoring and importance
// system to set the cell information.
void SetPreGeometryCell(const G4GeometryCell &preCell);
void SetPostGeometryCell(const G4GeometryCell &postCell);
void SetCrossBoundary(G4bool b);
inline G4bool GetCrossBoundary() const;
// returns true if step crosses boundary of the geometry it refers to
private:
G4GeometryCell fPreGeometryCell;
G4GeometryCell fPostGeometryCell;
G4bool fCrossBoundary;
// the following functions are used by the scoring and importance
// system to set the cell information.
//
inline void SetPreGeometryCell(const G4GeometryCell& preCell);
inline void SetPostGeometryCell(const G4GeometryCell& postCell);
inline void SetCrossBoundary(G4bool b);
private:
G4GeometryCell fPreGeometryCell;
G4GeometryCell fPostGeometryCell;
G4bool fCrossBoundary = false;
};
// Inline methods
inline void G4GeometryCellStep::SetPreGeometryCell(const G4GeometryCell &preCell)
inline void
G4GeometryCellStep::SetPreGeometryCell(const G4GeometryCell& preCell)
{
fPreGeometryCell = preCell;
}
inline void G4GeometryCellStep::SetPostGeometryCell(const G4GeometryCell &postCell)
inline void
G4GeometryCellStep::SetPostGeometryCell(const G4GeometryCell& postCell)
{
fPostGeometryCell = postCell;
}
inline void G4GeometryCellStep::SetCrossBoundary(G4bool b)
inline void
G4GeometryCellStep::SetCrossBoundary(G4bool b)
{
fCrossBoundary = b;
}
inline const G4GeometryCell &G4GeometryCellStep::GetPreGeometryCell() const
inline const G4GeometryCell&
G4GeometryCellStep::GetPreGeometryCell() const
{
return fPreGeometryCell;
}
inline const G4GeometryCell &G4GeometryCellStep::GetPostGeometryCell() const
inline const G4GeometryCell&
G4GeometryCellStep::GetPostGeometryCell() const
{
return fPostGeometryCell;
}
inline G4bool G4GeometryCellStep::GetCrossBoundary() const
inline G4bool
G4GeometryCellStep::GetCrossBoundary() const
{
return fCrossBoundary;
}
#endif
@@ -23,24 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Declarations
//
// Declaration description:
//
// declarations of streams for G4GeometryCell and G4GeometryCellStep
// Declarations of streams for G4GeometryCell and G4GeometryCellStep
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCellStepStream_hh
#define G4GeometryCellStepStream_hh G4GeometryCellStepStream_hh
#ifndef G4GEOMETRYCELLSTEPSTREAM_HH
#define G4GEOMETRYCELLSTEPSTREAM_HH 1
#include "G4GeometryCell.hh"
#include "G4GeometryCellStep.hh"
std::ostream& operator<<(std::ostream &out, const G4GeometryCell &tk);
std::ostream& operator<<(std::ostream &out, const G4GeometryCellStep &ps);
std::ostream& operator<<(std::ostream& out, const G4GeometryCell& tk);
std::ostream& operator<<(std::ostream& out, const G4GeometryCellStep& ps);
#endif
@@ -23,27 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4GeometryCellWeight
// G4GeometryCellWeight
//
// Class description:
//
// Used internally by weight window tehnique sampling.
// Used internally by weight window technique sampling.
// It is a map of geometry cells to maps of upper energy
// to lower weight bounds.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4GeometryCellWeight_hh
#define G4GeometryCellWeight_hh G4GeometryCellWeight_hh
#ifndef G4GEOMETRYCELLWEIGHT_HH
#define G4GEOMETRYCELLWEIGHT_HH 1
#include <map>
#include "globals.hh"
#include "G4GeometryCell.hh"
#include "G4GeometryCellComp.hh"
typedef std::map<G4double, G4double, std::less<G4double> > G4UpperEnergyToLowerWeightMap;
typedef std::map<G4GeometryCell, G4UpperEnergyToLowerWeightMap, G4GeometryCellComp> G4GeometryCellWeight;
using G4UpperEnergyToLowerWeightMap =
std::map<G4double, G4double, std::less<G4double> >;
using G4GeometryCellWeight =
std::map<G4GeometryCell, G4UpperEnergyToLowerWeightMap, G4GeometryCellComp>;
#endif
+61 -89
View File
@@ -23,36 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4IStore
// G4IStore
//
// Class description:
//
// An implementation of a "importance store" with the interface
// An implementation of an "importance store" with the interface
// G4VIStore. See description in G4VIStore.
// This implementation uses G4GeometryCellImportance as the container
// to store the "cells" together with the importance values.
// Giving a cell the importance 0 is allowed as
// a flagging that no biasing should happen between this
// cell and it's neighbors
// If a cell is not known by the importance store no biasing
// should be applied between this cell and it's nighbors.
// Giving a cell the importance 0 is allowed as a flagging that no biasing
// should happen between this cell and its neighbors.
// If a cell is not known by the importance store no biasing should be
// applied between this cell and its nighbors.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
//
// Alex Howard (alexander.howard@cern.ch):
// Changed class to a `singleton', with access via the static method
// G4IStore::GetInstance().
//
// Member data:
//
// static G4IStore* fInstance
// - Ptr to the unique instance of class
// Author: Michael Dressel (CERN), 2002
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
// ----------------------------------------------------------------------
#ifndef G4IStore_hh
#define G4IStore_hh G4IStore_hh
#ifndef G4ISTORE_HH
#define G4ISTORE_HH 1
#include "G4VIStore.hh"
#include "G4GeometryCellImportance.hh"
@@ -60,92 +48,76 @@
class G4IStore : public G4VIStore
{
public:
public:
static G4IStore* GetInstance();
// return ptr to singleton instance of the class.
// static G4ThreadLocal G4IStore* GetInstance();
static G4IStore* GetInstance();
// Return ptr to singleton instance of the class.
// static G4ThreadLocal G4IStore* GetInstance(G4String ParallelWorldName);
static G4IStore* GetInstance(const G4String& ParallelWorldName);
// Return ptr to singleton instance of the class.
static G4IStore* GetInstance(const G4String& ParallelWorldName);
// return ptr to singleton instance of the class.
protected:
virtual G4double GetImportance(const G4GeometryCell& gCell) const;
// derive an importance value of a "cell" addressed by a
// G4GeometryCell from the store.
explicit G4IStore();
// initialise the importance store for the given geometry
explicit G4IStore(const G4String& ParallelWorldName);
// initialise the importance store for the given geometry
virtual G4bool IsKnown(const G4GeometryCell& gCell) const;
// returns true if the gCell is in the store, else false
~G4IStore();
// destruct
void Clear();
public: // with description
void SetWorldVolume();
// set a reference to the world volume of the "importance" geometry
virtual G4double GetImportance(const G4GeometryCell &gCell) const;
// derive an importance value of a "cell" addressed by a G4GeometryCell
// from the store.
void SetParallelWorldVolume(const G4String& paraName);
// set a reference to parallel world volume of the "importance" geometry
virtual G4bool IsKnown(const G4GeometryCell &gCell) const;
// returns true if the gCell is in the store, else false
virtual const G4VPhysicalVolume& GetWorldVolume() const;
// return a reference to the world volume of the "importance" geometry
void Clear();
virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
// return a pointer to the world volume of the "importance" geometry
void SetWorldVolume();
// set a reference to the world volume of the
// "importance" geometry
void AddImportanceGeometryCell(G4double importance,
const G4GeometryCell &gCell);
void AddImportanceGeometryCell(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0);
// add a "cell" together with a importance value to the store.
void SetParallelWorldVolume(G4String paraName);
// set a reference to the parallel world volume of the
// "importance" geometry
void ChangeImportance(G4double importance, const G4GeometryCell& gCell);
void ChangeImportance(G4double importance, const G4VPhysicalVolume&,
G4int aRepNum = 0);
// change a importance value of a "cell".
virtual const G4VPhysicalVolume& GetWorldVolume() const;
// return a reference to the world volume of the
// "importance" geometry
// virtual const G4VPhysicalVolume& GetParallelWorldVolume() const;
// // return a reference to the world volume of the
// // "importance" geometry
virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
// return a pointer to the world volume of the
// "importance" geometry
void AddImportanceGeometryCell(G4double importance,
const G4GeometryCell &gCell);
void AddImportanceGeometryCell(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0);
// Add a "cell" together with a importance value to the store.
void ChangeImportance(G4double importance,
const G4GeometryCell &gCell);
void ChangeImportance(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0);
// Change a importance value of a "cell".
G4double GetImportance(const G4VPhysicalVolume &,
G4int aRepNum = 0) const ;
G4double GetImportance(const G4VPhysicalVolume&, G4int aRepNum = 0) const;
private:
protected:
G4bool IsInWorld(const G4VPhysicalVolume &) const;
void SetInternalIterator(const G4GeometryCell &gCell) const;
void Error(const G4String &m) const;
private:
explicit G4IStore();
// initialise the importance store for the given geometry
explicit G4IStore(const G4String& ParallelWorldName);
// initialise the importance store for the given geometry
~G4IStore();
// destructor
private:
G4bool IsInWorld(const G4VPhysicalVolume&) const;
void SetInternalIterator(const G4GeometryCell& gCell) const;
void Error(const G4String& m) const;
private:
const G4VPhysicalVolume* fWorldVolume;
// const G4VPhysicalVolume* fParallelWorldVolume;
// G4bool fParaFlag;
G4GeometryCellImportance fGeometryCelli;
const G4VPhysicalVolume* fWorldVolume = nullptr;
G4GeometryCellImportance fGeometryCelli;
mutable G4GeometryCellImportance::const_iterator fCurrentIterator;
mutable G4GeometryCellImportance::const_iterator fCurrentIterator;
static G4ThreadLocal G4IStore* fInstance;
static G4ThreadLocal G4IStore* fInstance;
#ifdef G4MULTITHREADED
static G4Mutex IStoreMutex;
static G4Mutex IStoreMutex;
#endif
};
@@ -23,51 +23,47 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4ImportanceAlgorithm
// G4ImportanceAlgorithm
//
// Class description:
//
// An implementation of a G4VImportanceAlgorithm (see description in
// G4VImportanceAlgorithm.hh).
// G4VImportanceAlgorithm header).
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4ImportanceAlgorithm_hh
#define G4ImportanceAlgorithm_hh G4ImportanceAlgorithm_hh
#ifndef G4IMPORTANCEALGORITHM_HH
#define G4IMPORTANCEALGORITHM_HH 1
#include "G4VImportanceAlgorithm.hh"
class G4ImportanceAlgorithm : public G4VImportanceAlgorithm
{
public: // with description
public: // with description
G4ImportanceAlgorithm();
// simple construction
G4ImportanceAlgorithm();
// simple construction
virtual ~G4ImportanceAlgorithm();
// repeate warning if triggered
virtual ~G4ImportanceAlgorithm();
// repeate warning if triggered
virtual G4Nsplit_Weight Calculate(G4double ipre,
G4double ipost,
G4double init_w) const;
// calculate the number of tracks and their weight according to the
// pre and post importance value and the weight of the mother track
virtual G4Nsplit_Weight Calculate(G4double ipre,
G4double ipost,
G4double init_w) const;
// calculate the number of tracks and their weight according
// to the pre and post importance value and the weight of
// the mother track.
private:
private:
void Error(const G4String &m) const;
void Warning(const G4String &m) const;
void Error(const G4String& m) const;
void Warning(const G4String& m) const;
private:
private:
mutable G4bool fWorned;
mutable G4bool fWarned = false;
#ifdef G4MULTITHREADED
static G4Mutex ImportanceMutex;
static G4Mutex ImportanceMutex;
#endif
};
@@ -23,20 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4Nsplit_Weight
// G4Nsplit_Weight
//
// Class description:
//
// A class (struct) used by importance sampling. It contains the number
// of tracks a mother track should be split into and their weight.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4Nsplit_Weight_hh
#define G4Nsplit_Weight_hh G4Nsplit_Weight_hh
#ifndef G4NSPLIT_WEIGHT_HH
#define G4NSPLIT_WEIGHT_HH 1
#include "globals.hh"
@@ -44,26 +41,14 @@ class G4Nsplit_Weight
{
public:
G4int fN;
// number of tracks a mother track should be split into
// including the mother track
G4int fN = 0;
// number of tracks a mother track should be split into
// including the mother track
G4double fW;
// the weight to be given to the tracks
G4double fW = 0.0;
// the weight to be given to the tracks
};
std::ostream& operator<<(std::ostream &out,
const G4Nsplit_Weight &nw);
std::ostream& operator<<(std::ostream& out, const G4Nsplit_Weight& nw);
#endif
@@ -23,23 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VGCellFinder
// G4VGCellFinder
//
// Class description:
//
// An interface of an GCellFinder. The G4GeometryCell is obtained
// in the parallel geometry from G4VParallelStepper and in the
// mass geometry form G4Step. This interface allows to implement
// mass geometry from G4Step. This interface allows to implement
// the two different ways to get a G4GeometryCell used by a process.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4VGCellFinder_hh
#define G4VGCellFinder_hh G4VGCellFinder_hh
#ifndef G4VGCELLFINDER_HH
#define G4VGCELLFINDER_HH 1
#include "globals.hh"
#include "G4GeometryCell.hh"
@@ -48,17 +44,13 @@ class G4Step;
class G4VGCellFinder
{
public: // with description
public: // with description
G4VGCellFinder();
virtual ~G4VGCellFinder();
G4VGCellFinder();
virtual ~G4VGCellFinder();
virtual G4GeometryCell
GetPreGeometryCell(const G4Step &aStep) const=0;
virtual G4GeometryCell
GetPostGeometryCell(const G4Step &aStep) const=0;
virtual G4GeometryCell GetPreGeometryCell(const G4Step& aStep) const = 0;
virtual G4GeometryCell GetPostGeometryCell(const G4Step& aStep) const = 0;
};
#endif
+13 -17
View File
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VIStore
// G4VIStore
//
// Class description:
//
@@ -37,10 +34,10 @@
// from the "importance store".
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4VIStore_hh
#define G4VIStore_hh G4VIStore_hh
#ifndef G4VISTORE_HH
#define G4VISTORE_HH 1
#include "globals.hh"
@@ -49,20 +46,19 @@ class G4VPhysicalVolume;
class G4VIStore
{
public: // with description
public: // with description
G4VIStore();
virtual ~G4VIStore();
G4VIStore();
virtual ~G4VIStore();
virtual G4double GetImportance(const G4GeometryCell& gCell) const = 0;
// derive a importance value of a "cell" addressed by a G4GeometryCell
// from the store
virtual G4double GetImportance(const G4GeometryCell &gCell) const = 0;
// derive a importance value of a "cell" addresed by a G4GeometryCell
// from the store.
virtual G4bool IsKnown(const G4GeometryCell& gCell) const = 0;
// returns true if the gCell is in the store, else false
virtual G4bool IsKnown(const G4GeometryCell &gCell) const = 0;
// returns true if the gCell is in the store, else false
virtual const G4VPhysicalVolume &GetWorldVolume() const = 0;
virtual const G4VPhysicalVolume& GetWorldVolume() const = 0;
};
#endif
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VImportanceAlgorithm
// G4VImportanceAlgorithm
//
// Class description:
//
@@ -40,26 +37,24 @@
// A user defined algorithm deriving from this interface may be used
// by the importance sampling.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4VImportanceAlgorithm_hh
#define G4VImportanceAlgorithm_hh G4VImportanceAlgorithm_hh
#ifndef G4VIMPORTANCEALGORITHM_HH
#define G4VIMPORTANCEALGORITHM_HH 1
#include "G4Nsplit_Weight.hh"
class G4VImportanceAlgorithm
{
public: // with description
public: // with description
G4VImportanceAlgorithm();
virtual ~G4VImportanceAlgorithm();
virtual G4Nsplit_Weight Calculate(G4double ipre,
G4double ipost,
G4double init_w) const = 0;
// calculate the number of tracks and their weight according
// to the pre and post importance value and the weight of
// the mother track.
G4VImportanceAlgorithm();
virtual ~G4VImportanceAlgorithm();
virtual G4Nsplit_Weight Calculate(G4double ipre,
G4double ipost,
G4double init_w) const = 0;
// calculate the number of tracks and their weight according to the
// pre and post importance value and the weight of the mother track
};
#endif
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VImportanceSplitExaminer
// G4VImportanceSplitExaminer
//
// Class description:
//
@@ -36,22 +33,22 @@
// remaining necessary information about the ratio of importances
// in the pre and post "cell".
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2002
// ----------------------------------------------------------------------
#ifndef G4VImportanceSplitExaminer_hh
#define G4VImportanceSplitExaminer_hh G4VImportanceSplitExaminer_hh
#ifndef G4VIMPORTANCESPLITEXAMINER_HH
#define G4VIMPORTANCESPLITEXAMINER_HH 1
#include "globals.hh"
#include "G4Nsplit_Weight.hh"
class G4VImportanceSplitExaminer
{
public: // with description
public: // with description
G4VImportanceSplitExaminer();
virtual ~G4VImportanceSplitExaminer();
virtual G4Nsplit_Weight Examine(G4double w) const = 0;
// Get G4Nsplit_Weight for a given mother track weight.
G4VImportanceSplitExaminer();
virtual ~G4VImportanceSplitExaminer();
virtual G4Nsplit_Weight Examine(G4double w) const = 0;
// Get G4Nsplit_Weight for a given mother track weight
};
#endif
@@ -23,40 +23,33 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VWeightWindowAlgorithm
// G4VWeightWindowAlgorithm
//
// Class description:
//
// Interface class for an weight window algorithm. It calculates
// Interface class for a weight window algorithm. It calculates
// the number of tracks and their weight according to the inital
// track weight and the lower energy bound in the energy-space
// cell.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2003
// ----------------------------------------------------------------------
#ifndef G4VWeightWindowAlgorithm_hh
#define G4VWeightWindowAlgorithm_hh G4VWeightWindowAlgorithm_hh
#ifndef G4VWEIGHTWINDOWALGORITHM_HH
#define G4VWEIGHTWINDOWALGORITHM_HH 1
#include "G4Nsplit_Weight.hh"
class G4VWeightWindowAlgorithm
{
public: // with description
public: // with description
G4VWeightWindowAlgorithm();
virtual ~G4VWeightWindowAlgorithm();
virtual G4Nsplit_Weight Calculate(G4double init_w,
G4double lowerWeightBound) const = 0;
// calculate number of tracks and their weight according
// to the initial track weight and the lower energy bound
G4VWeightWindowAlgorithm();
virtual ~G4VWeightWindowAlgorithm();
virtual G4Nsplit_Weight Calculate(G4double init_w,
G4double lowerWeightBound) const = 0;
// calculate number of tracks and their weight according
// to the initial track weight and the lower energy bound
};
#endif
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4VWeightWindowStore
// G4VWeightWindowStore
//
// Class description:
//
@@ -34,36 +31,33 @@
// weight window bound can be obtained from a weight window store.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2003
// ----------------------------------------------------------------------
#ifndef G4VWeightWindowStore_hh
#define G4VWeightWindowStore_hh G4VWeightWindowStore_hh
#ifndef G4VWEIGHTWINDOWSTORE_HH
#define G4VWEIGHTWINDOWSTORE_HH 1
#include "globals.hh"
class G4GeometryCell;
class G4VPhysicalVolume;
class G4VWeightWindowStore
class G4VWeightWindowStore
{
public: // with description
public: // with description
G4VWeightWindowStore();
virtual ~G4VWeightWindowStore();
G4VWeightWindowStore();
virtual ~G4VWeightWindowStore();
virtual G4double GetLowerWeight(const G4GeometryCell& gCell,
G4double partEnergy) const = 0;
// derive a lower weight bound value of a "cell" addresed by a
// G4GeometryCell and the coresponding energy from the store.
virtual G4double GetLowerWeight(const G4GeometryCell &gCell,
G4double partEnergy) const = 0;
// derive a lower weight bound value of a "cell" addresed by a
// G4GeometryCell and the coresponding energy from the store.
virtual G4bool IsKnown(const G4GeometryCell& gCell) const = 0;
// returns true if the gCell is in the store, else false
virtual G4bool IsKnown(const G4GeometryCell &gCell) const = 0;
// returns true if the gCell is in the store, else false
virtual const G4VPhysicalVolume &GetWorldVolume() const = 0;
// return a reference to the wolrd volume of the
// geometry
virtual const G4VPhysicalVolume &GetWorldVolume() const = 0;
// return a reference to the wolrd volume of the geometry
};
#endif
@@ -23,57 +23,53 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4WeightWindowAlgorithm
// G4WeightWindowAlgorithm
//
// Class description:
//
// Implementation of a weight window algorithm.
// The arguments in the constructor configure the algorithm:
// - upperLimitFaktor: the factor defining the upper weight limit
// W_u = upperLimitFaktor * W_l (W_l lower weight bound)
// - survivalFaktor: used in calculating the survival weight
// W_s = survivalFaktor * W_l
// - upperLimitFactor: the factor defining the upper weight limit
// W_u = upperLimitFactor * W_l (W_l lower weight bound)
// - survivalFactor: used in calculating the survival weight
// W_s = survivalFactor * W_l
// - maxNumberOfSplits: the maximal number of splits allowed
// to be created in one go, and the reciprocal of the minimal
// survival probability in case of Russian roulette
//
// In case of upperLimitFaktor=survivalFaktor=1 the algorithm
// becomes the expected weight algorithm of the importance sampling
// technique.
//
// see also G4VWeightWindowAlgorithm.
// In case of upperLimitFactor=survivalFactor=1 the algorithm becomes
// the expected weight algorithm of the importance sampling technique.
//
// See also G4VWeightWindowAlgorithm.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// Author: Michael Dressel (CERN), 2003
// ----------------------------------------------------------------------
#ifndef G4WeightWindowAlgorithm_hh
#define G4WeightWindowAlgorithm_hh G4WeightWindowAlgorithm_hh
#ifndef G4WEIGHTWINDOWALGORITHM_HH
#define G4WEIGHTWINDOWALGORITHM_HH 1
#include "G4Nsplit_Weight.hh"
#include "G4VWeightWindowAlgorithm.hh"
class G4WeightWindowAlgorithm : public G4VWeightWindowAlgorithm
{
public: // with description
public: // with description
G4WeightWindowAlgorithm(G4double upperLimitFaktor = 5,
G4double survivalFaktor = 3,
G4int maxNumberOfSplits = 5);
G4WeightWindowAlgorithm(G4double upperLimitFactor = 5,
G4double survivalFactor = 3,
G4int maxNumberOfSplits = 5);
virtual ~G4WeightWindowAlgorithm();
virtual ~G4WeightWindowAlgorithm();
virtual G4Nsplit_Weight Calculate(G4double init_w,
G4double lowerWeightBound) const;
// calculate number of tracks and their weight according
// to the initial track weight and the lower energy bound
virtual G4Nsplit_Weight Calculate(G4double init_w,
G4double lowerWeightBound) const;
// calculate number of tracks and their weight according
// to the initial track weight and the lower energy bound
private:
G4double fUpperLimitFaktor;
G4double fSurvivalFaktor;
G4int fMaxNumberOfSplits;
private:
G4double fUpperLimitFactor = 0.0;
G4double fSurvivalFactor = 0.0;
G4int fMaxNumberOfSplits = 0;
};
#endif
@@ -23,31 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4WeightWindowStore
// G4WeightWindowStore
//
// Class description:
//
// Implementation of a weight window store according to the
// G4VWeightWindowStore interface.
// See G4VWeightWindowStore.
// See also G4VWeightWindowStore.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
//
// Alex Howard (alexander.howard@cern.ch):
// Changed class to a `singleton', with access via the static method
// G4WeightWindowStore::GetInstance().
//
// Member data:
//
// static G4WeightWindowStore* fInstance
// - Ptr to the unique instance of class
//
// Author: Michael Dressel (CERN), 2003
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
// ----------------------------------------------------------------------
#ifndef G4WeightWindowStore_hh
#define G4WeightWindowStore_hh G4WeightWindowStore_hh
#ifndef G4WEIGHTWINDOWSTORE_HH
#define G4WEIGHTWINDOWSTORE_HH 1
#include "G4VWeightWindowStore.hh"
#include "G4GeometryCellWeight.hh"
@@ -56,81 +44,69 @@
class G4WeightWindowStore: public G4VWeightWindowStore
{
public: // with description
public: // with description
static G4WeightWindowStore* GetInstance();
// return ptr to singleton instance of the class
static G4WeightWindowStore* GetInstance();
// Return ptr to singleton instance of the class.
static G4WeightWindowStore* GetInstance(const G4String& ParallelWorldName);
// return ptr to singleton instance of the class
static G4WeightWindowStore* GetInstance(const G4String& ParallelWorldName);
// Return ptr to singleton instance of the class.
virtual G4double GetLowerWeight(const G4GeometryCell& gCell,
G4double partEnergy) const;
// derive a lower weight bound value of a "cell" addressed by a
// G4GeometryCell and the corresponding energy from the store
protected:
virtual G4bool IsKnown(const G4GeometryCell &gCell) const;
// returns true if the gCell is in the store, else false
explicit G4WeightWindowStore();
// initialise the weight window store for the given geometry
explicit G4WeightWindowStore(const G4String& ParallelWorldName);
// initialise the weight window store for the given geometry
void Clear();
~G4WeightWindowStore();
// destructor
void SetWorldVolume();
// set a pointer to the world volume of the weightwindow geometry
void SetParallelWorldVolume(const G4String& paraName);
// set a pointer to parallel world volume of the weightwindow geometry
public: // with description
virtual const G4VPhysicalVolume& GetWorldVolume() const;
// return a reference to the world volume of the weightwindow geometry
virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
// return a pointer to parallel world volume of the weightwindow geometry
virtual G4double GetLowerWeight(const G4GeometryCell &gCell,
G4double partEnergy) const;
// derive a lower weight bound value of a "cell" addresed by a
// G4GeometryCell and the coresponding energy from the store.
void AddLowerWeights(const G4GeometryCell& gCell,
const std::vector<G4double>& lowerWeights);
// add lower weights. Only if general upper energy bounds have been set
virtual G4bool IsKnown(const G4GeometryCell &gCell) const;
// returns true if the gCell is in the store, else false
void AddUpperEboundLowerWeightPairs(const G4GeometryCell& gCell,
const G4UpperEnergyToLowerWeightMap& enWeMap);
// set upper energy - lower weight pairs for a cell
void Clear();
void SetGeneralUpperEnergyBounds(const std::set<G4double,
std::less<G4double> >& enBounds);
protected:
void SetWorldVolume();
// set a pointer to the world volume of the
// weightwindow geometry
void SetParallelWorldVolume(G4String paraName);
// set a pointer to the parallel world volume of the
// weightwindow geometry
explicit G4WeightWindowStore();
// initialise the weight window store for the given geometry
explicit G4WeightWindowStore(const G4String& ParallelWorldName);
// initialise the weight window store for the given geometry
~G4WeightWindowStore();
// destructor
virtual const G4VPhysicalVolume &GetWorldVolume() const;
// return a reference to the world volume of the
// weightwindow geometry
virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
// return a pointer to the parallel world volume of the
// weightwindow geometry
private:
void AddLowerWeights(const G4GeometryCell &gCell,
const std::vector<G4double> &lowerWeights);
// add lower weights. Only if general upper energy bounds have
// been set
void AddUpperEboundLowerWeightPairs(const G4GeometryCell &gCell,
const G4UpperEnergyToLowerWeightMap&
enWeMap);
// set upper energy - lower weight pairs for a cell
G4bool IsInWorld(const G4VPhysicalVolume&) const;
void Error(const G4String& m) const;
void SetInternalIterator(const G4GeometryCell& gCell) const;
void SetGeneralUpperEnergyBounds(const std::set<G4double, std::less<G4double> > &enBounds);
private:
private:
G4bool IsInWorld(const G4VPhysicalVolume &) const;
void Error(const G4String &m) const;
void SetInternalIterator(const G4GeometryCell &gCell) const;
private:
const G4VPhysicalVolume* fWorldVolume = nullptr;
const G4VPhysicalVolume* fWorldVolume;
// G4bool fParaFlag;
std::set<G4double, std::less<G4double> > fGeneralUpperEnergyBounds;
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap;
mutable G4GeometryCellWeight::const_iterator fCurrentIterator;
std::set<G4double, std::less<G4double> > fGeneralUpperEnergyBounds;
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap;
mutable G4GeometryCellWeight::const_iterator fCurrentIterator;
static G4ThreadLocal G4WeightWindowStore* fInstance;
static G4ThreadLocal G4WeightWindowStore* fInstance;
};
#endif