Import Geant4 11.4.0 source tree
This commit is contained in:
@@ -35,39 +35,58 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYCELL_HH
|
||||
#define G4GEOMETRYCELL_HH 1
|
||||
#define G4GEOMETRYCELL_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
/**
|
||||
* @brief G4GeometryCell is used for scoring and importance sampling.
|
||||
* It defines a "cell", which, similar to the concept of "touchable",
|
||||
+ is identified by a reference to a G4VPhysicalVolume and a number
|
||||
* (replica number).
|
||||
*/
|
||||
|
||||
class G4GeometryCell
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor. Initialises volume and replica number.
|
||||
* @param[in] aVolume The name of the physical volume.
|
||||
* @param[in] RepNum The associated replica number.
|
||||
*/
|
||||
G4GeometryCell(const G4VPhysicalVolume& aVolume, G4int RepNum);
|
||||
// initialise volume and replica number
|
||||
|
||||
/**
|
||||
* Copy constructor and assignment operator.
|
||||
*/
|
||||
G4GeometryCell(const G4GeometryCell& rhs) = default;
|
||||
G4GeometryCell& operator=(const G4GeometryCell& rhs);
|
||||
// copy constructor and assignment operator
|
||||
|
||||
/**
|
||||
* Default Destructor.
|
||||
*/
|
||||
~G4GeometryCell() = default;
|
||||
// simple destruction
|
||||
|
||||
/**
|
||||
* Returns the physical volume of the cell.
|
||||
*/
|
||||
const G4VPhysicalVolume& GetPhysicalVolume() const;
|
||||
// return the physical volume of the cell
|
||||
|
||||
/**
|
||||
* Returns the replica number of the cell.
|
||||
*/
|
||||
G4int GetReplicaNumber() const;
|
||||
// returns the replica number of the cell
|
||||
|
||||
private:
|
||||
|
||||
/** Pointer to the physical volume of the "cell"; treated as identifier. */
|
||||
const G4VPhysicalVolume* fVPhysicalVolume = nullptr;
|
||||
// pointer to the G4VPhysicalVolume of the "cell"; treated as identifyer
|
||||
|
||||
/** Replica number of the "cell". */
|
||||
G4int fRepNum = 0;
|
||||
// replica number of the "cell"
|
||||
};
|
||||
|
||||
G4bool operator==(const G4GeometryCell& k1, const G4GeometryCell& k2);
|
||||
|
||||
@@ -32,21 +32,31 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYCELLCOMP_HH
|
||||
#define G4GEOMETRYCELLCOMP_HH 1
|
||||
#define G4GEOMETRYCELLCOMP_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GeometryCell;
|
||||
|
||||
/**
|
||||
* @brief G4GeometryCellComp is a class needed for comparing G4GeometryCell
|
||||
* objects, e.g. in STL containers.
|
||||
*/
|
||||
|
||||
class G4GeometryCellComp
|
||||
{
|
||||
public:
|
||||
|
||||
G4GeometryCellComp();
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
G4GeometryCellComp() = default;
|
||||
|
||||
/**
|
||||
* Comparison operator, returns true if g1 < g2.
|
||||
*/
|
||||
G4bool operator() (const G4GeometryCell& g1,
|
||||
const G4GeometryCell& g2) const;
|
||||
// returns true if g1 < g2
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,22 +27,26 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Used internally by importance sampling.
|
||||
// Used internually by importance sampling.
|
||||
// It is a container for "cell" importance value pairs.
|
||||
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef GEOMETRYCELLIMPORTANCE_HH
|
||||
#define GEOMETRYCELLIMPORTANCE_HH 1
|
||||
#define GEOMETRYCELLIMPORTANCE_HH
|
||||
|
||||
#include <map>
|
||||
#include "globals.hh"
|
||||
#include "G4GeometryCell.hh"
|
||||
#include "G4GeometryCellComp.hh"
|
||||
|
||||
/**
|
||||
* @brief G4GeometryCellImportance is a map used internually by importance
|
||||
* sampling. It is a container for "cell" importance value pairs.
|
||||
*/
|
||||
|
||||
using G4GeometryCellImportance = std::map<G4GeometryCell,
|
||||
G4double, G4GeometryCellComp>;
|
||||
// implement container G4GeometryCellImportance as map
|
||||
|
||||
std::ostream& operator<<(std::ostream& out,
|
||||
const G4GeometryCellImportance& gCelli);
|
||||
|
||||
@@ -40,32 +40,53 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYCELLSTEP_HH
|
||||
#define G4GEOMETRYCELLSTEP_HH 1
|
||||
#define G4GEOMETRYCELLSTEP_HH
|
||||
|
||||
#include "G4GeometryCell.hh"
|
||||
|
||||
/**
|
||||
* @brief G4GeometryCellStep 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.
|
||||
*/
|
||||
|
||||
class G4GeometryCellStep
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor. Initialises pre and post G4GeometryCell.
|
||||
* @param[in] preCell The previous cell.
|
||||
* @param[in] postCell The next cell.
|
||||
*/
|
||||
G4GeometryCellStep(const G4GeometryCell& preCell,
|
||||
const G4GeometryCell& postCell);
|
||||
// initialise pre and post G4GeometryCell
|
||||
|
||||
~G4GeometryCellStep();
|
||||
/**
|
||||
* Default Destructor.
|
||||
*/
|
||||
~G4GeometryCellStep() = default;
|
||||
|
||||
/**
|
||||
* Returns the "cell" the track previously touched.
|
||||
*/
|
||||
inline const G4GeometryCell& GetPreGeometryCell() const;
|
||||
// addressing the "cell" the track previously touched
|
||||
|
||||
/**
|
||||
* Returns the current "cell".
|
||||
*/
|
||||
inline const G4GeometryCell& GetPostGeometryCell() const;
|
||||
// addressing the current "cell"
|
||||
|
||||
/**
|
||||
* Returns true if the step crosses boundary of the geometry it refers to.
|
||||
*/
|
||||
inline G4bool GetCrossBoundary() const;
|
||||
// returns true if step crosses boundary of the geometry it refers to
|
||||
|
||||
// the following functions are used by the scoring and importance
|
||||
// system to set the cell information.
|
||||
//
|
||||
/**
|
||||
* Functions 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);
|
||||
|
||||
@@ -25,16 +25,20 @@
|
||||
//
|
||||
// Declarations
|
||||
//
|
||||
// Declarations of streams for G4GeometryCell and G4GeometryCellStep
|
||||
// Declarations of streams for G4GeometryCell and G4GeometryCellStep.
|
||||
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYCELLSTEPSTREAM_HH
|
||||
#define G4GEOMETRYCELLSTEPSTREAM_HH 1
|
||||
#define G4GEOMETRYCELLSTEPSTREAM_HH
|
||||
|
||||
#include "G4GeometryCell.hh"
|
||||
#include "G4GeometryCellStep.hh"
|
||||
|
||||
/**
|
||||
* @brief Declarations of streams for G4GeometryCell and G4GeometryCellStep.
|
||||
*/
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const G4GeometryCell& tk);
|
||||
std::ostream& operator<<(std::ostream& out, const G4GeometryCellStep& ps);
|
||||
|
||||
|
||||
@@ -34,13 +34,19 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYCELLWEIGHT_HH
|
||||
#define G4GEOMETRYCELLWEIGHT_HH 1
|
||||
#define G4GEOMETRYCELLWEIGHT_HH
|
||||
|
||||
#include <map>
|
||||
#include "globals.hh"
|
||||
#include "G4GeometryCell.hh"
|
||||
#include "G4GeometryCellComp.hh"
|
||||
|
||||
/**
|
||||
* @brief G4UpperEnergyToLowerWeightMap and G4GeometryCellWeight are maps
|
||||
* used internally by the weight window technique sampling, mapping cells
|
||||
* to maps of upper energy to lower weight bounds.
|
||||
*/
|
||||
|
||||
using G4UpperEnergyToLowerWeightMap =
|
||||
std::map<G4double, G4double, std::less<G4double> >;
|
||||
using G4GeometryCellWeight =
|
||||
|
||||
@@ -36,75 +36,124 @@
|
||||
// If a cell is not known by the importance store no biasing should be
|
||||
// applied between this cell and its nighbors.
|
||||
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// Author: Michael Dressel (CERN), 2002 - Created
|
||||
// Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4ISTORE_HH
|
||||
#define G4ISTORE_HH 1
|
||||
#define G4ISTORE_HH
|
||||
|
||||
#include "G4VIStore.hh"
|
||||
#include "G4GeometryCellImportance.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
/**
|
||||
* @brief G4IStore is a concrete implementation of an "importance store", as
|
||||
* derived from G4VIStore. It is a singleton, using 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 its neighbors.
|
||||
* If a cell is not known by the importance store no biasing should be
|
||||
* applied between this cell and its nighbors.
|
||||
*/
|
||||
|
||||
class G4IStore : public G4VIStore
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns a pointer to the singleton instance of the class.
|
||||
*/
|
||||
static G4IStore* GetInstance();
|
||||
// return ptr to singleton instance of the class.
|
||||
|
||||
/**
|
||||
* Returns a pointer to the singleton instance of the class, given
|
||||
* the name of the parallel world of reference.
|
||||
*/
|
||||
static G4IStore* GetInstance(const G4String& ParallelWorldName);
|
||||
// return ptr to singleton instance of the class.
|
||||
|
||||
/**
|
||||
* Returns the importance value of a "cell" from the store addressed
|
||||
* by 'gCell'.
|
||||
* @param[in] gCell The cell of reference.
|
||||
* @returns The associated importance weight.
|
||||
*/
|
||||
G4double GetImportance(const G4GeometryCell& gCell) const override;
|
||||
// derive an importance value of a "cell" addressed by a
|
||||
// G4GeometryCell from the store.
|
||||
|
||||
/**
|
||||
* Returns true if 'gCell' is in the store, else false.
|
||||
* @param[in] gCell The cell of reference.
|
||||
* @returns true if present in the store, false otherwise.
|
||||
*/
|
||||
G4bool IsKnown(const G4GeometryCell& gCell) const override;
|
||||
// returns true if the gCell is in the store, else false
|
||||
|
||||
/**
|
||||
* Clears the cells importance store.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* Sets a reference to world volume of the "importance" geometry.
|
||||
*/
|
||||
void SetWorldVolume();
|
||||
// set a reference to the world volume of the "importance" geometry
|
||||
|
||||
/**
|
||||
* Sets a reference to parallel world volume of the "importance" geometry.
|
||||
*/
|
||||
void SetParallelWorldVolume(const G4String& paraName);
|
||||
// set a reference to parallel world volume of the "importance" geometry
|
||||
|
||||
/**
|
||||
* Returns a reference to the world volume of the "importance" geometry.
|
||||
*/
|
||||
const G4VPhysicalVolume& GetWorldVolume() const override;
|
||||
// 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
|
||||
/**
|
||||
* Returns a pointer to the world volume of the "importance" geometry.
|
||||
*/
|
||||
const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
|
||||
|
||||
/**
|
||||
* Methods to add a "cell" together with an importance value to the store.
|
||||
*/
|
||||
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.
|
||||
|
||||
/**
|
||||
* Methods to change an importance value of a "cell".
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* Returns the importance weight, given the volume and replica number.
|
||||
*/
|
||||
G4double GetImportance(const G4VPhysicalVolume& vol, G4int rpNum = 0) const;
|
||||
|
||||
protected:
|
||||
|
||||
explicit G4IStore();
|
||||
// initialise the importance store for the given geometry
|
||||
explicit G4IStore(const G4String& ParallelWorldName);
|
||||
// initialise the importance store for the given geometry
|
||||
|
||||
~G4IStore() override;
|
||||
// destructor
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Constructors. Initialising the importance store for the given geometry.
|
||||
*/
|
||||
explicit G4IStore();
|
||||
explicit G4IStore(const G4String& ParallelWorldName);
|
||||
|
||||
/**
|
||||
* Default Destructor.
|
||||
*/
|
||||
~G4IStore() override = default;
|
||||
|
||||
/**
|
||||
* Internal utilities.
|
||||
*/
|
||||
G4bool IsInWorld(const G4VPhysicalVolume&) const;
|
||||
void SetInternalIterator(const G4GeometryCell& gCell) const;
|
||||
|
||||
/**
|
||||
* Internal logger.
|
||||
*/
|
||||
void Error(const G4String& m) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -33,29 +33,44 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4IMPORTANCEALGORITHM_HH
|
||||
#define G4IMPORTANCEALGORITHM_HH 1
|
||||
#define G4IMPORTANCEALGORITHM_HH
|
||||
|
||||
#include "G4Threading.hh"
|
||||
#include "G4VImportanceAlgorithm.hh"
|
||||
|
||||
/**
|
||||
* @brief G4ImportanceAlgorithm is a concrete implementation of a
|
||||
* G4VImportanceAlgorithm.
|
||||
*/
|
||||
|
||||
class G4ImportanceAlgorithm : public G4VImportanceAlgorithm
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4ImportanceAlgorithm();
|
||||
// simple construction
|
||||
|
||||
~G4ImportanceAlgorithm() override;
|
||||
// repeate warning if triggered
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4ImportanceAlgorithm() = default;
|
||||
~G4ImportanceAlgorithm() override = default;
|
||||
|
||||
/**
|
||||
* Calculates the number of tracks and their weight according to the
|
||||
* pre and post importance value and the weight of the mother track.
|
||||
* @param[in] ipre "pre" importance value.
|
||||
* @param[in] ipost "post" importance value.
|
||||
* @param[in] init_w Initial weight value.
|
||||
* @returns A struct containing the number of copies (including the
|
||||
* mother track) to be produced and the weight of each track.
|
||||
*/
|
||||
G4Nsplit_Weight Calculate(G4double ipre,
|
||||
G4double ipost,
|
||||
G4double init_w) const override;
|
||||
// calculate the number of tracks and their weight according to the
|
||||
// pre and post importance value and the weight of the mother track
|
||||
G4double ipost,
|
||||
G4double init_w) const override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Simple internal loggers.
|
||||
*/
|
||||
void Error(const G4String& m) const;
|
||||
void Warning(const G4String& m) const;
|
||||
|
||||
|
||||
@@ -33,20 +33,26 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4NSPLIT_WEIGHT_HH
|
||||
#define G4NSPLIT_WEIGHT_HH 1
|
||||
#define G4NSPLIT_WEIGHT_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/**
|
||||
* @brief G4Nsplit_Weight is a class (struct) used by importance sampling.
|
||||
* It contains the number of tracks a mother track should be split into and
|
||||
* their associated weight.
|
||||
*/
|
||||
|
||||
class G4Nsplit_Weight
|
||||
{
|
||||
public:
|
||||
|
||||
/** 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
|
||||
|
||||
/** 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);
|
||||
|
||||
@@ -35,20 +35,34 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VGCELLFINDER_HH
|
||||
#define G4VGCELLFINDER_HH 1
|
||||
#define G4VGCELLFINDER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4GeometryCell.hh"
|
||||
|
||||
class G4Step;
|
||||
|
||||
/**
|
||||
* @brief G4VGCellFinder is an interface base class for GCellFinder.
|
||||
* The G4GeometryCell is obtained in the parallel geometry from
|
||||
* G4VParallelStepper and in the mass geometry from G4Step. This interface
|
||||
* allows one to implement the two different ways to get a G4GeometryCell
|
||||
* used by a process.
|
||||
*/
|
||||
|
||||
class G4VGCellFinder
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VGCellFinder();
|
||||
virtual ~G4VGCellFinder();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VGCellFinder() = default;
|
||||
virtual ~G4VGCellFinder() = default;
|
||||
|
||||
/**
|
||||
* Returns the pre/post cell given the step.
|
||||
*/
|
||||
virtual G4GeometryCell GetPreGeometryCell(const G4Step& aStep) const = 0;
|
||||
virtual G4GeometryCell GetPostGeometryCell(const G4Step& aStep) const = 0;
|
||||
};
|
||||
|
||||
@@ -31,33 +31,54 @@
|
||||
// It defines how a importance value together with a "cell"
|
||||
// (a G4VPhysicalVolume and a replica number) has to be added
|
||||
// to the "importance store" and how a importance value can be derived
|
||||
// from the "importance store".
|
||||
//
|
||||
// from the "importance store".
|
||||
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VISTORE_HH
|
||||
#define G4VISTORE_HH 1
|
||||
#define G4VISTORE_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GeometryCell;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
/**
|
||||
* @brief G4VIStore is an interface of an "importance store" used by importance
|
||||
* sampling. It defines how an importance value together with a "cell"
|
||||
* (a G4VPhysicalVolume and a replica number) has to be added to the
|
||||
* "importance store" and how a importance value can be derived from the
|
||||
* "importance store".
|
||||
*/
|
||||
|
||||
class G4VIStore
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VIStore();
|
||||
virtual ~G4VIStore();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VIStore() = default;
|
||||
virtual ~G4VIStore() = default;
|
||||
|
||||
/**
|
||||
* Returns the importance value of a "cell" from the store addressed
|
||||
* by 'gCell'.
|
||||
* @param[in] gCell The cell of reference.
|
||||
* @returns The associated importance weight.
|
||||
*/
|
||||
virtual G4double GetImportance(const G4GeometryCell& gCell) const = 0;
|
||||
// derive a importance value of a "cell" addressed by a G4GeometryCell
|
||||
// from the store
|
||||
|
||||
/**
|
||||
* Returns true if 'gCell' is in the store, else false.
|
||||
* @param[in] gCell The cell of reference.
|
||||
* @returns true if present in the store, false otherwise.
|
||||
*/
|
||||
virtual G4bool IsKnown(const G4GeometryCell& gCell) const = 0;
|
||||
// returns true if the gCell is in the store, else false
|
||||
|
||||
/**
|
||||
* Returns a reference to the world volume of the "importance" geometry.
|
||||
*/
|
||||
virtual const G4VPhysicalVolume& GetWorldVolume() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,21 +40,44 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VIMPORTANCEALGORITHM_HH
|
||||
#define G4VIMPORTANCEALGORITHM_HH 1
|
||||
#define G4VIMPORTANCEALGORITHM_HH
|
||||
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
|
||||
/**
|
||||
* @brief G4VImportanceAlgorithm is an interface used by importance sampling
|
||||
* to get the number of copies and weight a mother particle should be split
|
||||
* into when crossing a boundary of "importance cells".
|
||||
* The interface defines the input to be the ratio of the pre over the post
|
||||
* importance and the weight of the mother track.
|
||||
* It returns a struct containing the number of copies (including the mother
|
||||
* track) to be produced and the weight of each track.
|
||||
* A user defined algorithm deriving from this interface may be used by the
|
||||
* importance sampling.
|
||||
*/
|
||||
|
||||
class G4VImportanceAlgorithm
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VImportanceAlgorithm();
|
||||
virtual ~G4VImportanceAlgorithm();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VImportanceAlgorithm() = default;
|
||||
virtual ~G4VImportanceAlgorithm() = default;
|
||||
|
||||
/**
|
||||
* Calculates the number of tracks and their weight according to the
|
||||
* pre and post importance value and the weight of the mother track.
|
||||
* @param[in] ipre "pre" importance value.
|
||||
* @param[in] ipost "post" importance value.
|
||||
* @param[in] init_w Initial weight value.
|
||||
* @returns A struct containing the number of copies (including the
|
||||
* mother track) to be produced and the weight of each track.
|
||||
*/
|
||||
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
|
||||
|
||||
@@ -36,19 +36,32 @@
|
||||
// Author: Michael Dressel (CERN), 2002
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VIMPORTANCESPLITEXAMINER_HH
|
||||
#define G4VIMPORTANCESPLITEXAMINER_HH 1
|
||||
#define G4VIMPORTANCESPLITEXAMINER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
|
||||
/**
|
||||
* @brief G4VImportanceSplitExaminer is an interface used internally by
|
||||
* importance sampling. It delivers G4Nsplit_Weight according to a track weight.
|
||||
* An implementation of the interface decides how to obtain remaining necessary
|
||||
* information about the ratio of importances in the pre and post "cell".
|
||||
*/
|
||||
|
||||
class G4VImportanceSplitExaminer
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VImportanceSplitExaminer();
|
||||
virtual ~G4VImportanceSplitExaminer();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VImportanceSplitExaminer() = default;
|
||||
virtual ~G4VImportanceSplitExaminer() = default;
|
||||
|
||||
/**
|
||||
* Gets G4Nsplit_Weight for a given mother track weight.
|
||||
*/
|
||||
virtual G4Nsplit_Weight Examine(G4double w) const = 0;
|
||||
// Get G4Nsplit_Weight for a given mother track weight
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,21 +35,32 @@
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VWEIGHTWINDOWALGORITHM_HH
|
||||
#define G4VWEIGHTWINDOWALGORITHM_HH 1
|
||||
#define G4VWEIGHTWINDOWALGORITHM_HH
|
||||
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
|
||||
/**
|
||||
* @brief G4VWeightWindowAlgorithm is an 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.
|
||||
*/
|
||||
|
||||
class G4VWeightWindowAlgorithm
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VWeightWindowAlgorithm();
|
||||
virtual ~G4VWeightWindowAlgorithm();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VWeightWindowAlgorithm() = default;
|
||||
virtual ~G4VWeightWindowAlgorithm() = default;
|
||||
|
||||
/**
|
||||
* Calculates the 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 = 0;
|
||||
// calculate number of tracks and their weight according
|
||||
// to the initial track weight and the lower energy bound
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,35 +29,49 @@
|
||||
//
|
||||
// Interface class for a weight window store. It defines how the lower
|
||||
// weight window bound can be obtained from a weight window store.
|
||||
//
|
||||
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4VWEIGHTWINDOWSTORE_HH
|
||||
#define G4VWEIGHTWINDOWSTORE_HH 1
|
||||
#define G4VWEIGHTWINDOWSTORE_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GeometryCell;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
/**
|
||||
* @brief G4VWeightWindowStore is an interface class for a weight window store.
|
||||
* It defines how the lower weight window bound can be obtained from a weight
|
||||
* window store.
|
||||
*/
|
||||
|
||||
class G4VWeightWindowStore
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4VWeightWindowStore();
|
||||
virtual ~G4VWeightWindowStore();
|
||||
/**
|
||||
* Default Constructor and Destructor.
|
||||
*/
|
||||
G4VWeightWindowStore() = default;
|
||||
virtual ~G4VWeightWindowStore() = default;
|
||||
|
||||
/**
|
||||
* Computes a lower weight bound value of a "cell" addressed by a
|
||||
* G4GeometryCell and the corresponding 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.
|
||||
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* Returns a reference to the wolrd volume of the geometry.
|
||||
*/
|
||||
virtual const G4VPhysicalVolume& GetWorldVolume() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,25 +45,47 @@
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4WEIGHTWINDOWALGORITHM_HH
|
||||
#define G4WEIGHTWINDOWALGORITHM_HH 1
|
||||
#define G4WEIGHTWINDOWALGORITHM_HH
|
||||
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
#include "G4VWeightWindowAlgorithm.hh"
|
||||
|
||||
/**
|
||||
* @brief G4WeightWindowAlgorithm is a concrete implementation of a weight
|
||||
* window algorithm.
|
||||
*/
|
||||
|
||||
class G4WeightWindowAlgorithm : public G4VWeightWindowAlgorithm
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor. The arguments configure the algorithm.
|
||||
* In case of upperLimitFactor=survivalFactor=1 the algorithm becomes
|
||||
* the expected weight algorithm of the importance sampling technique.
|
||||
* @param[in] upperLimitFactor The factor defining the upper weight limit
|
||||
* W_u = upperLimitFactor * W_l (W_l lower weight bound).
|
||||
* @param[in] survivalFactor uUsed in calculating the survival weight
|
||||
* W_s = survivalFactor * W_l.
|
||||
* @param[in] 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.
|
||||
*/
|
||||
G4WeightWindowAlgorithm(G4double upperLimitFactor = 5,
|
||||
G4double survivalFactor = 3,
|
||||
G4int maxNumberOfSplits = 5);
|
||||
|
||||
~G4WeightWindowAlgorithm() override;
|
||||
/**
|
||||
* Default Destructor.
|
||||
*/
|
||||
~G4WeightWindowAlgorithm() override = default;
|
||||
|
||||
/**
|
||||
* Calculates the number of tracks and their weight according
|
||||
* to the initial track weight and the lower energy bound.
|
||||
*/
|
||||
G4Nsplit_Weight Calculate(G4double init_w,
|
||||
G4double lowerWeightBound) const override;
|
||||
// calculate number of tracks and their weight according
|
||||
// to the initial track weight and the lower energy bound
|
||||
G4double lowerWeightBound) const override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -31,73 +31,117 @@
|
||||
// G4VWeightWindowStore interface.
|
||||
// See also G4VWeightWindowStore.
|
||||
|
||||
// Author: Michael Dressel (CERN), 2003
|
||||
// Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// Author: Michael Dressel (CERN), 2003 - Created
|
||||
// Alex Howard (CERN), 2013 - Changed class to a 'singleton'
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4WEIGHTWINDOWSTORE_HH
|
||||
#define G4WEIGHTWINDOWSTORE_HH 1
|
||||
#define G4WEIGHTWINDOWSTORE_HH
|
||||
|
||||
#include "G4VWeightWindowStore.hh"
|
||||
#include "G4GeometryCellWeight.hh"
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* @brief G4WeightWindowStore is an concrete implementation of a weight window
|
||||
* store according to the G4VWeightWindowStore interface.
|
||||
*/
|
||||
|
||||
class G4WeightWindowStore: public G4VWeightWindowStore
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns a pointer to the singleton instance of the class.
|
||||
*/
|
||||
static G4WeightWindowStore* GetInstance();
|
||||
// return ptr to singleton instance of the class
|
||||
|
||||
/**
|
||||
* Returns a pointer to the singleton instance of the class, given
|
||||
* the name of the parallel world of reference.
|
||||
*/
|
||||
static G4WeightWindowStore* GetInstance(const G4String& ParallelWorldName);
|
||||
// return ptr to singleton instance of the class
|
||||
|
||||
/**
|
||||
* Derives a lower weight bound value of a "cell" addressed by a
|
||||
* G4GeometryCell and the corresponding energy from the store.
|
||||
*/
|
||||
G4double GetLowerWeight(const G4GeometryCell& gCell,
|
||||
G4double partEnergy) const override;
|
||||
// derive a lower weight bound value of a "cell" addressed by a
|
||||
// G4GeometryCell and the corresponding energy from the store
|
||||
G4double partEnergy) const override;
|
||||
|
||||
/**
|
||||
* Returns true if 'gCell' is in the store, else false.
|
||||
* @param[in] gCell The cell of reference.
|
||||
* @returns true if present in the store, false otherwise.
|
||||
*/
|
||||
G4bool IsKnown(const G4GeometryCell &gCell) const override;
|
||||
// returns true if the gCell is in the store, else false
|
||||
|
||||
/**
|
||||
* Clears the cells weights map.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* Sets a reference to world volume of the "weightwindow" geometry.
|
||||
*/
|
||||
void SetWorldVolume();
|
||||
// set a pointer to the world volume of the weightwindow geometry
|
||||
|
||||
/**
|
||||
* Sets a reference to parallel world volume of the "weightwindow" geometry.
|
||||
*/
|
||||
void SetParallelWorldVolume(const G4String& paraName);
|
||||
// set a pointer to parallel world volume of the weightwindow geometry
|
||||
|
||||
/**
|
||||
* Returns a reference to the world volume of the "weightwindow" geometry.
|
||||
*/
|
||||
const G4VPhysicalVolume& GetWorldVolume() const override;
|
||||
// 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
|
||||
|
||||
/**
|
||||
* Returns a pointer to the world volume of the "weightwindow" geometry.
|
||||
*/
|
||||
const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
|
||||
|
||||
/**
|
||||
* Adds lower weights. Only if general upper energy bounds have been set.
|
||||
*/
|
||||
void AddLowerWeights(const G4GeometryCell& gCell,
|
||||
const std::vector<G4double>& lowerWeights);
|
||||
// add lower weights. Only if general upper energy bounds have been set
|
||||
|
||||
/**
|
||||
* Sets upper energy - lower weight pairs for a cell.
|
||||
*/
|
||||
void AddUpperEboundLowerWeightPairs(const G4GeometryCell& gCell,
|
||||
const G4UpperEnergyToLowerWeightMap& enWeMap);
|
||||
// set upper energy - lower weight pairs for a cell
|
||||
|
||||
/**
|
||||
* Sets the energy bounds.
|
||||
*/
|
||||
void SetGeneralUpperEnergyBounds(const std::set<G4double,
|
||||
std::less<G4double> >& enBounds);
|
||||
protected:
|
||||
|
||||
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() override;
|
||||
// destructor
|
||||
|
||||
std::less<G4double> >& enBounds);
|
||||
private:
|
||||
|
||||
/**
|
||||
* Constructors. Initialise the weight window store for the given geometry.
|
||||
*/
|
||||
explicit G4WeightWindowStore();
|
||||
explicit G4WeightWindowStore(const G4String& ParallelWorldName);
|
||||
|
||||
/**
|
||||
* Default Destructor.
|
||||
*/
|
||||
~G4WeightWindowStore() override = default;
|
||||
|
||||
/**
|
||||
* Internal utilities.
|
||||
*/
|
||||
G4bool IsInWorld(const G4VPhysicalVolume&) const;
|
||||
void Error(const G4String& m) const;
|
||||
void SetInternalIterator(const G4GeometryCell& gCell) const;
|
||||
|
||||
/**
|
||||
* Internal logger.
|
||||
*/
|
||||
void Error(const G4String& m) const;
|
||||
|
||||
private:
|
||||
|
||||
const G4VPhysicalVolume* fWorldVolume = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user