Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -33,9 +33,8 @@
// from the index pointing to the same MCC in the file. This class
// has a map between them.
// First implementation - 20th August 2004, H.Kurashige
//-------------------------------------------------------------
// Author: H.Kurashige, 20 August 2004 - First implementation
// --------------------------------------------------------------------
#ifndef G4MCCIndexConversionTable_hh
#define G4MCCIndexConversionTable_hh 1
@@ -45,38 +44,42 @@
class G4MCCIndexConversionTable
{
public: // with description
public:
G4MCCIndexConversionTable();
// Default constructor.
G4MCCIndexConversionTable();
// Default constructor.
virtual ~G4MCCIndexConversionTable();
// Destructor.
virtual ~G4MCCIndexConversionTable();
// Destructor.
void Reset(size_t size);
// reset conversion table
void Reset(std::size_t size);
// reset conversion table
G4bool IsUsed(size_t index) const;
// returns 'true' if the indicated MCC in the file
// is used in the current production cut table
G4bool IsUsed(std::size_t index) const;
// returns 'true' if the indicated MCC in the file
// is used in the current production cut table
void SetNewIndex(size_t index, size_t new_value);
// set the index in the current production cut table
// for the indicated MCC in the file
void SetNewIndex(std::size_t index, std::size_t new_value);
// set the index in the current production cut table
// for the indicated MCC in the file
G4int GetIndex(size_t index) const;
// get the index in the current production cut table
// for the indicated MCC in the file
G4int GetIndex(std::size_t index) const;
// get the index in the current production cut table
// for the indicated MCC in the file
size_t size() const;
std::size_t size() const;
protected:
protected:
std::vector<G4int> vecNewIndex;
};
// ------------------
// Inline methods
// ------------------
inline
G4bool G4MCCIndexConversionTable::IsUsed(size_t index) const
G4bool G4MCCIndexConversionTable::IsUsed(std::size_t index) const
{
if (index >= vecNewIndex.size()) return false;
@@ -86,25 +89,28 @@ inline
}
inline
void G4MCCIndexConversionTable::SetNewIndex(size_t index, size_t new_value)
void G4MCCIndexConversionTable::SetNewIndex(std::size_t index,
std::size_t new_value)
{
if (index >= vecNewIndex.size()) return;
// set the index in the current production cut table
// for the indicated MCC in the file
vecNewIndex[index]=G4int(new_value);
}
inline
G4int G4MCCIndexConversionTable::GetIndex(size_t index) const
G4int G4MCCIndexConversionTable::GetIndex(std::size_t index) const
{
if (index >= vecNewIndex.size()) return -1;
// get the index in the current production cut table
// for the indicated MCC in the file
return (vecNewIndex[index]);
}
inline
size_t G4MCCIndexConversionTable::size() const
std::size_t G4MCCIndexConversionTable::size() const
{
return vecNewIndex.size();
}
@@ -23,130 +23,147 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MaterialCutsCouple
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is
//
// ------------------------------------------------------------
// First Implementation 17 Sep. 2002 H.Kurahige
// ------------------------------------------------------------
// The same material can be used in regions with different cut values,
// and physics processes must prepare several different cross-sections
// for that material.
// The G4ProductionCutsTable has G4MaterialCutsCouple objects, each of
// which consists of a material paired with a cut value.
// G4MaterialCutsCouples objects are numbered with an index which is the
// same as the index of a G4PhysicsVector for the corresponding
// G4MaterialCutsCouple in the G4PhysicsTable.
// The list of G4MaterialCutsCouple objects used in the geometry setup
// is updated before starting the event loop in each run.
#ifndef G4MaterialCutsCouple_h
#define G4MaterialCutsCouple_h 1
// Author: H.Kurashige, 17 September 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4MaterialCutsCouple_hh
#define G4MaterialCutsCouple_hh 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ProductionCuts.hh"
class G4Material;
#include "G4ProductionCuts.hh"
class G4MaterialCutsCouple
{
public: // with description
// constructor
G4MaterialCutsCouple();
G4MaterialCutsCouple(const G4Material*, G4ProductionCuts* cut=0);
public:
// copy constructor
G4MaterialCutsCouple(const G4MaterialCutsCouple &right);
G4MaterialCutsCouple();
G4MaterialCutsCouple(const G4Material*, G4ProductionCuts* cut = nullptr);
// Constructors
G4MaterialCutsCouple & operator=(const G4MaterialCutsCouple &right);
virtual ~G4MaterialCutsCouple();
// Destructor
public:
// destructor
virtual ~G4MaterialCutsCouple();
G4MaterialCutsCouple(const G4MaterialCutsCouple& right);
G4MaterialCutsCouple& operator=(const G4MaterialCutsCouple& right);
// Copy constructor & assignment operator
// equal opperators
G4bool operator==(const G4MaterialCutsCouple &right) const;
G4bool operator!=(const G4MaterialCutsCouple &right) const;
G4bool operator==(const G4MaterialCutsCouple& right) const;
G4bool operator!=(const G4MaterialCutsCouple& right) const;
// Equality operators
public: // with description
void SetMaterial(const G4Material*);
// Set pointer to material
void SetMaterial(const G4Material*);
// Set pointer to material
const G4Material* GetMaterial() const;
// Get pointer to material
const G4Material* GetMaterial() const;
// Get pointer to material
void SetProductionCuts(G4ProductionCuts*);
// Set pointer to production cuts
void SetProductionCuts(G4ProductionCuts*);
// Set pointer to production cuts
G4ProductionCuts* GetProductionCuts() const;
// Get pointer to production cuts
G4ProductionCuts* GetProductionCuts() const;
// Get pointer to production cuts
G4bool IsRecalcNeeded() const;
// return true if cut and/or material has been modified
// after last calculation of PhysicsTable
G4bool IsRecalcNeeded() const;
// Return true if cut and/or material has been modified
// after last calculation of PhysicsTable
void PhysicsTableUpdated();
// inform end of calculation of PhysicsTable
void PhysicsTableUpdated();
// Inform end of calculation of Physics Table
void SetIndex(G4int idx);
G4int GetIndex() const;
// Set/Get the index number in G4ProductionCutsTable
void SetIndex(G4int idx);
G4int GetIndex() const;
// Set/Get the index number in G4ProductionCutsTable
void SetUseFlag(G4bool flg=true);
G4bool IsUsed() const;
void SetUseFlag(G4bool flg = true);
G4bool IsUsed() const;
private:
G4bool isMaterialModified;
const G4Material* fMaterial;
G4ProductionCuts* fCuts;
G4int indexNumber;
G4bool isUsedInGeometry;
G4bool isMaterialModified = false;
const G4Material* fMaterial = nullptr;
G4ProductionCuts* fCuts = nullptr;
G4int indexNumber = -1;
G4bool isUsedInGeometry = false;
};
#include "G4ProductionCuts.hh"
inline
void G4MaterialCutsCouple::SetIndex(G4int idx)
{ indexNumber = idx; }
inline
G4int G4MaterialCutsCouple::GetIndex() const
{ return indexNumber; }
// ------------------
// Inline methods
// ------------------
inline
void G4MaterialCutsCouple::SetUseFlag(G4bool flg)
{ isUsedInGeometry = flg; }
void G4MaterialCutsCouple::SetIndex(G4int idx)
{
indexNumber = idx;
}
inline
G4bool G4MaterialCutsCouple::IsUsed() const
{ return isUsedInGeometry; }
G4int G4MaterialCutsCouple::GetIndex() const
{
return indexNumber;
}
inline
void G4MaterialCutsCouple::SetUseFlag(G4bool flg)
{
isUsedInGeometry = flg;
}
inline
void G4MaterialCutsCouple::SetProductionCuts(G4ProductionCuts* aCut)
{ fCuts = aCut; }
G4bool G4MaterialCutsCouple::IsUsed() const
{
return isUsedInGeometry;
}
inline
G4ProductionCuts* G4MaterialCutsCouple::GetProductionCuts() const
{ return fCuts; }
void G4MaterialCutsCouple::SetProductionCuts(G4ProductionCuts* aCut)
{
fCuts = aCut;
}
inline
G4bool G4MaterialCutsCouple::operator==(const G4MaterialCutsCouple &right) const
G4ProductionCuts* G4MaterialCutsCouple::GetProductionCuts() const
{
return fCuts;
}
inline
G4bool G4MaterialCutsCouple::operator==(const G4MaterialCutsCouple& right) const
{
return (this == &right);
}
inline
G4bool G4MaterialCutsCouple::operator!=(const G4MaterialCutsCouple &right) const
G4bool G4MaterialCutsCouple::operator!=(const G4MaterialCutsCouple& right) const
{
return (this != &right);
}
inline
void G4MaterialCutsCouple::SetMaterial(const G4Material* material)
void G4MaterialCutsCouple::SetMaterial(const G4Material* material)
{
fMaterial = material;
isMaterialModified = true;
}
inline
const G4Material* G4MaterialCutsCouple::GetMaterial() const
const G4Material* G4MaterialCutsCouple::GetMaterial() const
{
return fMaterial;
}
@@ -155,22 +172,15 @@ inline
G4bool G4MaterialCutsCouple::IsRecalcNeeded() const
{
G4bool isCutModified = false;
if (fCuts !=0 ) isCutModified = fCuts->IsModified();
if (fCuts != nullptr ) isCutModified = fCuts->IsModified();
return (isMaterialModified || isCutModified);
}
inline
void G4MaterialCutsCouple::PhysicsTableUpdated()
void G4MaterialCutsCouple::PhysicsTableUpdated()
{
if (fCuts !=0 ) fCuts->PhysicsTableUpdated();
if (fCuts != nullptr ) fCuts->PhysicsTableUpdated();
isMaterialModified = false;
}
#endif
@@ -23,68 +23,63 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4PhysicsTableHelper
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// Class Description
// G4PhysicsTableHelper is a static utility class
// for helping proceeses to build their physics table
//
// ------------------------------------------------------------
// First Implementation 20 Aug. 2004 H.Kurashige
//
// ------------------------------------------------------------
// G4PhysicsTableHelper is a static utility class for helping processes
// to build their physics table.
#ifndef G4PhysicsTableHelper_h
#define G4PhysicsTableHelper_h 1
// Author: H.Kurashige, 20 August 2004 - First implementation
// --------------------------------------------------------------------
#ifndef G4PhysicsTableHelper_hh
#define G4PhysicsTableHelper_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4PhysicsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Region.hh"
class G4PhysicsTableHelper
{
protected:
G4PhysicsTableHelper();
~G4PhysicsTableHelper();
G4PhysicsTableHelper(const G4PhysicsTableHelper& right);
G4PhysicsTableHelper& operator=(const G4PhysicsTableHelper&);
public: // with description
public:
static G4PhysicsTable* PreparePhysicsTable(G4PhysicsTable* physTable);
// Prepare the given physics table before building the physics table
// resize the given physics table to match with the current
// production cut table.
// Prepare the given physics table. Before building the table
// resize the given physics table to match with the current
// production cut table
static G4bool RetrievePhysicsTable(G4PhysicsTable* physTable,
const G4String& fileName,
G4bool ascii );
// Retrieve physics table from the given file and
// fill the given physics table with retrievd physics vectors
const G4String& fileName,
G4bool ascii );
// Retrieve the physics table from the given file and
// fill the given physics table with retrieved physics vectors
static void SetPhysicsVector(G4PhysicsTable* physTable,
size_t idx,
G4PhysicsVector* vec);
// Set a physics vector at given position
std::size_t idx,
G4PhysicsVector* vec);
// Set a physics vector at given position
public: // with description
static void SetVerboseLevel(G4int value);
static G4int GetVerboseLevel();
// set/get controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
static void SetVerboseLevel(G4int value);
static G4int GetVerboseLevel();
// Set/get control flag for output message
// 0: Silent
// 1: Warning message
// 2: More
G4PhysicsTableHelper(const G4PhysicsTableHelper&) = delete;
G4PhysicsTableHelper& operator=(const G4PhysicsTableHelper&) = delete;
protected:
static G4ThreadLocal G4int verboseLevel;
// controle flag for output message
protected:
G4PhysicsTableHelper();
~G4PhysicsTableHelper();
static G4ThreadLocal G4int verboseLevel;
// Control flag for output message
};
#endif
@@ -23,35 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ProductionCuts
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is
//
// ------------------------------------------------------------
// First Implementation 17 Sep. 2002 H.Kurahige
// Add cuts for proton 28 Jul. 2009 H.Kurashige
// ------------------------------------------------------------
// A G4ProductionCuts object must be created and initialized with the cut
// value desired for a given geometrical region.
// Production cyts are applicable for gamma, proton, e- and e+.
#ifndef G4ProductionCuts_h
#define G4ProductionCuts_h 1
// Author: H.Kurashige, 17 September 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4ProductionCuts_hh
#define G4ProductionCuts_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4ParticleDefinition.hh"
enum G4ProductionCutsIndex
{
idxG4GammaCut =0,
idxG4GammaCut = 0,
idxG4ElectronCut,
idxG4PositronCut,
idxG4ProtonCut, // for proton
NumberOfG4CutIndex
@@ -59,85 +54,91 @@ enum G4ProductionCutsIndex
class G4ProductionCuts
{
public: // with description
// constructor
G4ProductionCuts();
// copy constructor
G4ProductionCuts(const G4ProductionCuts &right);
G4ProductionCuts & operator=(const G4ProductionCuts &right);
public:
// destructor
virtual ~G4ProductionCuts();
// equal opperators
G4bool operator==(const G4ProductionCuts &right) const;
G4bool operator!=(const G4ProductionCuts &right) const;
public: // with description
// Set Cuts methods
void SetProductionCut(G4double cut, G4int index = -1);
void SetProductionCut(G4double cut, G4ParticleDefinition* ptcl);
void SetProductionCut(G4double cut, const G4String& pName);
// Set the productionCut in range with an index to particle type
// if index is omitted, the value is applied to all particles
G4double GetProductionCut(G4int index) const;
// Get the productionCut in range with an index to particle type
G4double GetProductionCut(const G4String& name) const;
// Get the productionCut in range with a name of particle type
void SetProductionCuts(std::vector<G4double>&);
// Set the vector of production cuts in range for all particles
const std::vector<G4double>& GetProductionCuts() const;
// Get the vector of production cuts in range for all particles
G4bool IsModified() const;
// return true if any cut value has been modified
// after last calculation of PhysicsTable
void PhysicsTableUpdated();
// inform end of calculation of PhysicsTable to ProductionCut
public:
static G4int GetIndex(const G4String& name);
static G4int GetIndex(const G4ParticleDefinition* ptcl);
G4ProductionCuts();
// Constructor
G4ProductionCuts(const G4ProductionCuts& right);
// Copy constructor
virtual ~G4ProductionCuts();
// Destructor
G4ProductionCuts& operator=(const G4ProductionCuts& right);
// Assignment operator
G4bool operator==(const G4ProductionCuts& right) const;
G4bool operator!=(const G4ProductionCuts& right) const;
// Equality operators
void SetProductionCut(G4double cut, G4int index = -1);
void SetProductionCut(G4double cut, G4ParticleDefinition* ptcl);
void SetProductionCut(G4double cut, const G4String& pName);
// Set the production cut in range with an index to particle type.
// If index is omitted, the value is applied to all particles
G4double GetProductionCut(G4int index) const;
// Get the production cut in range with an index to particle type
G4double GetProductionCut(const G4String& name) const;
// Get the production cut in range with a name of particle type
void SetProductionCuts(std::vector<G4double>&);
// Set the vector of production cuts in range for all particles
const std::vector<G4double>& GetProductionCuts() const;
// Get the vector of production cuts in range for all particles
G4bool IsModified() const;
// Return true if any cut value has been modified
// after last calculation of Physics Table
void PhysicsTableUpdated();
// Inform end of calculation of Physics Table to production cut
static G4int GetIndex(const G4String& name);
static G4int GetIndex(const G4ParticleDefinition* ptcl);
protected:
std::vector<G4double> fRangeCuts;
G4bool isModified;
std::vector<G4double> fRangeCuts;
G4bool isModified = true;
private:
static G4ThreadLocal G4ParticleDefinition* gammaDef;
static G4ThreadLocal G4ParticleDefinition* electDef;
static G4ThreadLocal G4ParticleDefinition* positDef;
static G4ThreadLocal G4ParticleDefinition* protonDef; // for proton
static G4ThreadLocal G4ParticleDefinition* gammaDef;
static G4ThreadLocal G4ParticleDefinition* electDef;
static G4ThreadLocal G4ParticleDefinition* positDef;
static G4ThreadLocal G4ParticleDefinition* protonDef; // for proton
};
// ------------------
// Inline methods
// ------------------
inline
void G4ProductionCuts::SetProductionCut(G4double cut, G4int index)
void G4ProductionCuts::SetProductionCut(G4double cut, G4int index)
{
if (index<0) {
for(G4int i = 0; i < NumberOfG4CutIndex; i++) {
if (index<0)
{
for(G4int i = 0; i < NumberOfG4CutIndex; ++i)
{
fRangeCuts[i] = cut;
}
isModified = true;
} else if (index < NumberOfG4CutIndex) {
}
else if (index < NumberOfG4CutIndex)
{
fRangeCuts[index] = cut;
isModified = true;
}
}
inline
void G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptcl)
void G4ProductionCuts::SetProductionCut(G4double cut,
G4ParticleDefinition* ptcl)
{
G4int idx = -1;
if(ptcl) idx = GetIndex(ptcl);
@@ -145,24 +146,25 @@ void G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptc
}
inline
void G4ProductionCuts::SetProductionCut(G4double cut, const G4String& pName)
void G4ProductionCuts::SetProductionCut(G4double cut, const G4String& pName)
{
G4int idx = GetIndex(pName);
if(idx>=0) SetProductionCut(cut,idx);
}
inline
G4double G4ProductionCuts::GetProductionCut(G4int index) const
G4double G4ProductionCuts::GetProductionCut(G4int index) const
{
G4double cut=-1.0;
if ( (index>=0) && (index<NumberOfG4CutIndex) ) {
if ( (index>=0) && (index<NumberOfG4CutIndex) )
{
cut = fRangeCuts[index];
}
return cut;
}
inline
G4double G4ProductionCuts::GetProductionCut(const G4String& name) const
G4double G4ProductionCuts::GetProductionCut(const G4String& name) const
{
return GetProductionCut(GetIndex(name));
}
@@ -175,26 +177,15 @@ const std::vector<G4double>& G4ProductionCuts::GetProductionCuts() const
}
inline
G4bool G4ProductionCuts::IsModified() const
G4bool G4ProductionCuts::IsModified() const
{
return isModified;
}
inline
void G4ProductionCuts::PhysicsTableUpdated()
void G4ProductionCuts::PhysicsTableUpdated()
{
isModified = false;
}
#endif
@@ -23,252 +23,237 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ProductionCutsTable
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// Class Description
// G4ProductionCutsTable is a static singleton class of a table of
// G4ProductionCuts objects. This class also manages tables of
// production cut and energy cut for each particle type.
//
// ------------------------------------------------------------
// First Implementation 05 Oct. 2002 M.Asai
//
// Modified 03 Feb 2004 H.Kurashige
// Modify RetrieveCutsTable to allow ordering of materials and
// couples can be different from one in file (i.e. at storing)
// Modified 20 Aug. 2004 H.Kurashige
// Modify RetrieveCutsTable to allow materials and
// couples can be different from one in file (i.e. at storing)
// Modified 2 Mar. 2008 H.Kurashige
// add messenger
// ------------------------------------------------------------
// G4ProductionCutsTable is a singleton class for a table of
// G4ProductionCuts objects. This class manages tables of production
// cuts and energy cuts for each particle type.
#ifndef G4ProductionCutsTable_h
#define G4ProductionCutsTable_h 1
// Author: M.Asai, 5 October 2002 - First implementation
// Modifications: H.Kurashige, 2004-2008
// --------------------------------------------------------------------
#ifndef G4ProductionCutsTable_hh
#define G4ProductionCutsTable_hh 1
#include <cmath>
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4MCCIndexConversionTable.hh"
#include "G4Region.hh"
class G4RegionStore;
class G4VRangeToEnergyConverter;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4ProductionCuts;
class G4ProductionCutsTableMessenger;
#include "globals.hh"
#include <cmath>
#include "G4ios.hh"
#include <vector>
#include "G4MaterialCutsCouple.hh"
#include "G4MCCIndexConversionTable.hh"
#include "G4Region.hh"
class G4ProductionCutsTable
{
public: // with description
static G4ProductionCutsTable* GetProductionCutsTable();
// This static method returns the singleton pointer of this class object.
// At the first invokation of this method, the singleton object is instantiated.
protected:
G4ProductionCutsTable();
private:
G4ProductionCutsTable(const G4ProductionCutsTable& right);
public:
static G4ProductionCutsTable* GetProductionCutsTable();
// This static method returns the singleton pointer of this class object.
// At first invocation, the singleton object is instantiated
G4ProductionCutsTable(const G4ProductionCutsTable&) = delete;
G4ProductionCutsTable& operator=(const G4ProductionCutsTable&) = delete;
virtual ~G4ProductionCutsTable();
public: // with description
void UpdateCoupleTable(G4VPhysicalVolume* currentWorld);
// This method triggers an update of the table of G4ProductionCuts objects.
// Triggers an update of the table of G4ProductionCuts objects
void SetEnergyRange(G4double lowedge, G4double highedge);
// This method sets the limits of energy cuts for all particles.
// Sets the limits of energy cuts for all particles
G4double GetLowEdgeEnergy() const;
G4double GetHighEdgeEnergy() const;
// These methods get the limits of energy cuts for all particles.
// Get the limits of energy cuts for all particles
// get/set max cut energy of RangeToEnergy Converter for all particle type
G4double GetMaxEnergyCut();
void SetMaxEnergyCut(G4double value);
// Get/set max cut energy of RangeToEnergy converter
// for all particle types
void DumpCouples() const;
// Display a list of registored couples
// Displays a list of registered couples
const G4MCCIndexConversionTable* GetMCCIndexConversionTable() const;
// gives the pointer to the MCCIndexConversionTable
// Gives the pointer to the MCCIndexConversionTable
private:
static G4ProductionCutsTable* fG4ProductionCutsTable;
typedef std::vector<G4MaterialCutsCouple*> G4CoupleTable;
typedef std::vector<G4MaterialCutsCouple*>::const_iterator CoupleTableIterator;
typedef std::vector<G4double> G4CutVectorForAParticle;
typedef std::vector<G4CutVectorForAParticle*> G4CutTable;
G4CoupleTable coupleTable;
G4CutTable rangeCutTable;
G4CutTable energyCutTable;
G4RegionStore* fG4RegionStore;
G4VRangeToEnergyConverter* converters[NumberOfG4CutIndex];
G4ProductionCuts* defaultProductionCuts;
G4MCCIndexConversionTable mccConversionTable;
// These two vectors are for the backward comparibility
G4double* rangeDoubleVector[NumberOfG4CutIndex];
G4double* energyDoubleVector[NumberOfG4CutIndex];
public:
const std::vector<G4double>* GetRangeCutsVector(size_t pcIdx) const;
const std::vector<G4double>* GetEnergyCutsVector(size_t pcIdx) const;
// These two vectors are for the backward comparibility
G4double* GetRangeCutsDoubleVector(size_t pcIdx) const;
G4double* GetEnergyCutsDoubleVector(size_t pcIdx) const;
const std::vector<G4double>* GetRangeCutsVector(std::size_t pcIdx) const;
const std::vector<G4double>* GetEnergyCutsVector(std::size_t pcIdx) const;
public: // with description
size_t GetTableSize() const;
// This method returns the size of the couple table.
std::size_t GetTableSize() const;
// Returns the size of the couple table
const G4MaterialCutsCouple* GetMaterialCutsCouple(G4int i) const;
// This method returns the pointer to the couple.
const G4MaterialCutsCouple* GetMaterialCutsCouple(G4int i) const;
// Returns the pointer to the couple
const G4MaterialCutsCouple*
GetMaterialCutsCouple(const G4Material* aMat,
const G4ProductionCuts* aCut) const;
// This method returns the pointer to the couple.
const G4MaterialCutsCouple* GetMaterialCutsCouple(const G4Material* aMat,
const G4ProductionCuts* aCut) const;
// Returns the pointer to the couple
G4int GetCoupleIndex(const G4MaterialCutsCouple* aCouple) const;
G4int GetCoupleIndex(const G4Material* aMat,
const G4ProductionCuts* aCut) const;
// These methods return the index of the couple.
// -1 is returned if index is not found.
G4int GetCoupleIndex(const G4MaterialCutsCouple* aCouple) const;
G4int GetCoupleIndex(const G4Material* aMat,
const G4ProductionCuts* aCut) const;
// Return the index of the couple.
// -1 is returned if index is not found
G4bool IsModified() const;
// This method returns TRUE if at least one production cut value is modified.
G4bool IsModified() const;
// Returns TRUE if at least one production cut value is modified
void PhysicsTableUpdated();
// This method resets the status of IsModified(). This method must
// be exclusively used by RunManager when physics tables are built.
void PhysicsTableUpdated();
// Resets the status of IsModified(). This method must be exclusively
// used by the RunManager when physics tables are built
G4ProductionCuts* GetDefaultProductionCuts() const;
// This method returns the default production cuts.
G4ProductionCuts* GetDefaultProductionCuts() const;
// Returns the default production cuts
G4double ConvertRangeToEnergy(const G4ParticleDefinition* particle,
const G4Material* material,
G4double range );
// This method gives energy corresponding to range value
//
// -1 is returned if particle or material is not found.
G4double ConvertRangeToEnergy(const G4ParticleDefinition* particle,
const G4Material* material,
G4double range);
// Gives energy corresponding to range value.
// -1 is returned if particle or material is not found
void ResetConverters();
// reset all Range To Energy Converters
private:
void ScanAndSetCouple(G4LogicalVolume* aLV,
G4MaterialCutsCouple* aCouple,
G4Region* aRegion);
void ResetConverters();
// Resets all range to energy converters
bool IsCoupleUsedInTheRegion(const G4MaterialCutsCouple* aCouple,
const G4Region* aRegion) const;
G4bool StoreCutsTable(const G4String& directory,
G4bool ascii = false);
// Stores cuts and material information in files under the
// the specified directory
public: // with description
// Store cuts and material information in files under the specified directory.
G4bool StoreCutsTable(const G4String& directory,
G4bool ascii = false);
// Retrieve material cut couple information
// in files under the specified directory.
G4bool RetrieveCutsTable(const G4String& directory,
G4bool ascii = false);
// check stored material and cut values are consistent with the current detector setup.
G4bool CheckForRetrieveCutsTable(const G4String& directory,
G4bool ascii = false);
G4bool RetrieveCutsTable(const G4String& directory,
G4bool ascii = false);
// Retrieve material cut couple information
// in files under the specified directory
protected:
G4bool CheckForRetrieveCutsTable(const G4String& directory,
G4bool ascii = false);
// Checks stored material and cut values are consistent
// with the current detector setup
// Store material information in files under the specified directory.
virtual G4bool StoreMaterialInfo(const G4String& directory,
G4bool ascii = false);
G4double* GetRangeCutsDoubleVector(std::size_t pcIdx) const;
G4double* GetEnergyCutsDoubleVector(std::size_t pcIdx) const;
// Methods for backward compatibility
// check stored material is consistent with the current detector setup.
virtual G4bool CheckMaterialInfo(const G4String& directory,
G4bool ascii = false);
// Store materialCutsCouple information in files under the specified directory.
virtual G4bool StoreMaterialCutsCoupleInfo(const G4String& directory,
G4bool ascii = false);
// check stored materialCutsCouple is consistent with the current detector setup.
virtual G4bool CheckMaterialCutsCoupleInfo(const G4String& directory,
G4bool ascii = false);
// Store cut values information in files under the specified directory.
virtual G4bool StoreCutsInfo(const G4String& directory,
G4bool ascii = false);
// Retrieve cut values information in files under the specified directory.
virtual G4bool RetrieveCutsInfo(const G4String& directory,
G4bool ascii = false);
private:
G4bool firstUse;
enum { FixedStringLengthForStore = 32 };
public: // with description
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
// controle flag for output message
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
// Control flag for output message
// 0: Silent
// 1: Warning message
// 2: More
private:
G4int verboseLevel;
G4ProductionCutsTableMessenger* fMessenger;
protected:
G4ProductionCutsTable();
virtual G4bool StoreMaterialInfo(const G4String& directory,
G4bool ascii = false);
// Stores material information in files under the specified directory
virtual G4bool CheckMaterialInfo(const G4String& directory,
G4bool ascii = false);
// Checks stored material is consistent with the current detector setup
virtual G4bool StoreMaterialCutsCoupleInfo(const G4String& directory,
G4bool ascii = false);
// Stores materialCutsCouple information in files under the
// specified directory
virtual G4bool CheckMaterialCutsCoupleInfo(const G4String& directory,
G4bool ascii = false);
// Checks stored materialCutsCouple is consistent with
// the current detector setup
virtual G4bool StoreCutsInfo(const G4String& directory,
G4bool ascii = false);
// Stores cut values information in files under the specified directory
virtual G4bool RetrieveCutsInfo(const G4String& directory,
G4bool ascii = false);
// Retrieves cut values information in files under the
// specified directory
private:
void ScanAndSetCouple(G4LogicalVolume* aLV,
G4MaterialCutsCouple* aCouple,
G4Region* aRegion);
G4bool IsCoupleUsedInTheRegion(const G4MaterialCutsCouple* aCouple,
const G4Region* aRegion) const;
private:
static G4ProductionCutsTable* fProductionCutsTable;
std::vector<G4MaterialCutsCouple*> coupleTable;
std::vector<std::vector<G4double>*> rangeCutTable;
std::vector<std::vector<G4double>*> energyCutTable;
G4RegionStore* fG4RegionStore = nullptr;
G4VRangeToEnergyConverter* converters[NumberOfG4CutIndex];
G4ProductionCuts* defaultProductionCuts = nullptr;
G4MCCIndexConversionTable mccConversionTable;
// These two vectors are for backward compatibility
G4double* rangeDoubleVector[NumberOfG4CutIndex];
G4double* energyDoubleVector[NumberOfG4CutIndex];
enum { FixedStringLengthForStore = 32 };
G4ProductionCutsTableMessenger* fMessenger = nullptr;
G4int verboseLevel = 1;
G4bool firstUse = true;
};
// ------------------
// Inline methods
// ------------------
inline
const std::vector<G4double>* G4ProductionCutsTable::GetRangeCutsVector(size_t pcIdx) const
const std::vector<G4double>*
G4ProductionCutsTable::GetRangeCutsVector(std::size_t pcIdx) const
{
return rangeCutTable[pcIdx];
}
inline
const std::vector<G4double>* G4ProductionCutsTable::GetEnergyCutsVector(size_t pcIdx) const
const std::vector<G4double>*
G4ProductionCutsTable::GetEnergyCutsVector(std::size_t pcIdx) const
{
return energyCutTable[pcIdx];
return energyCutTable[pcIdx];
}
inline
size_t G4ProductionCutsTable::GetTableSize() const
std::size_t G4ProductionCutsTable::GetTableSize() const
{
return coupleTable.size();
}
inline
const G4MaterialCutsCouple* G4ProductionCutsTable::GetMaterialCutsCouple(G4int i) const
const G4MaterialCutsCouple*
G4ProductionCutsTable::GetMaterialCutsCouple(G4int i) const
{
return coupleTable[size_t(i)];
return coupleTable[std::size_t(i)];
}
inline
G4bool G4ProductionCutsTable::IsModified() const
G4bool G4ProductionCutsTable::IsModified() const
{
if(firstUse) return true;
for(G4ProductionCutsTable::CoupleTableIterator itr=coupleTable.begin();
itr!=coupleTable.end();itr++){
for(auto itr=coupleTable.cbegin(); itr!=coupleTable.cend(); ++itr)
{
if((*itr)->IsRecalcNeeded())
{
return true;
@@ -278,36 +263,47 @@ inline
}
inline
void G4ProductionCutsTable::PhysicsTableUpdated()
void G4ProductionCutsTable::PhysicsTableUpdated()
{
for(G4ProductionCutsTable::CoupleTableIterator itr=coupleTable.begin();itr!=coupleTable.end();itr++){
for(auto itr=coupleTable.cbegin(); itr!=coupleTable.cend(); ++itr)
{
(*itr)->PhysicsTableUpdated();
}
}
inline
G4double* G4ProductionCutsTable::GetRangeCutsDoubleVector(size_t pcIdx) const
{ return rangeDoubleVector[pcIdx]; }
G4double*
G4ProductionCutsTable::GetRangeCutsDoubleVector(std::size_t pcIdx) const
{
return rangeDoubleVector[pcIdx];
}
inline
G4double* G4ProductionCutsTable::GetEnergyCutsDoubleVector(size_t pcIdx) const
{ return energyDoubleVector[pcIdx]; }
G4double*
G4ProductionCutsTable::GetEnergyCutsDoubleVector(std::size_t pcIdx) const
{
return energyDoubleVector[pcIdx];
}
inline
G4ProductionCuts* G4ProductionCutsTable::GetDefaultProductionCuts() const
{ return defaultProductionCuts; }
G4ProductionCuts* G4ProductionCutsTable::GetDefaultProductionCuts() const
{
return defaultProductionCuts;
}
inline
bool G4ProductionCutsTable::IsCoupleUsedInTheRegion(
G4bool G4ProductionCutsTable::IsCoupleUsedInTheRegion(
const G4MaterialCutsCouple* aCouple,
const G4Region* aRegion) const
{
G4ProductionCuts* fProductionCut = aRegion->GetProductionCuts();
std::vector<G4Material*>::const_iterator mItr = aRegion->GetMaterialIterator();
size_t nMaterial = aRegion->GetNumberOfMaterials();
for(size_t iMate=0;iMate<nMaterial;iMate++, mItr++){
auto mItr = aRegion->GetMaterialIterator();
std::size_t nMaterial = aRegion->GetNumberOfMaterials();
for(std::size_t iMate=0;iMate<nMaterial; ++iMate, ++mItr)
{
if(aCouple->GetMaterial()==(*mItr) &&
aCouple->GetProductionCuts()==fProductionCut){
aCouple->GetProductionCuts()==fProductionCut)
{
return true;
}
}
@@ -316,54 +312,49 @@ bool G4ProductionCutsTable::IsCoupleUsedInTheRegion(
inline
const G4MaterialCutsCouple*
G4ProductionCutsTable::GetMaterialCutsCouple(const G4Material* aMat,
const G4ProductionCuts* aCut) const
{
for(CoupleTableIterator cItr=coupleTable.begin();cItr!=coupleTable.end();cItr++)
G4ProductionCutsTable::GetMaterialCutsCouple(const G4Material* aMat,
const G4ProductionCuts* aCut) const
{
for(auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
{
if((*cItr)->GetMaterial()!=aMat) continue;
if((*cItr)->GetProductionCuts()==aCut) return (*cItr);
}
return 0;
return nullptr;
}
inline
G4int G4ProductionCutsTable::GetCoupleIndex(const G4MaterialCutsCouple* aCouple) const
G4int
G4ProductionCutsTable::GetCoupleIndex(const G4MaterialCutsCouple* aCouple) const
{
G4int idx = 0;
for(CoupleTableIterator cItr=coupleTable.begin();cItr!=coupleTable.end();cItr++)
for(auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
{
if((*cItr)==aCouple) return idx;
idx++;
++idx;
}
return -1;
}
inline
G4int G4ProductionCutsTable:: GetCoupleIndex(const G4Material* aMat,
const G4ProductionCuts* aCut) const
G4int G4ProductionCutsTable::GetCoupleIndex(const G4Material* aMat,
const G4ProductionCuts* aCut) const
{
const G4MaterialCutsCouple* aCouple = GetMaterialCutsCouple(aMat,aCut);
return GetCoupleIndex(aCouple);
}
inline
G4int G4ProductionCutsTable::GetVerboseLevel() const
G4int G4ProductionCutsTable::GetVerboseLevel() const
{
return verboseLevel;
return verboseLevel;
}
inline
const G4MCCIndexConversionTable*
G4ProductionCutsTable::GetMCCIndexConversionTable() const
const G4MCCIndexConversionTable*
G4ProductionCutsTable::GetMCCIndexConversionTable() const
{
return &mccConversionTable;
}
#endif
@@ -23,34 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ProductionCutsTableMessenger
//
// Class description:
//
// This is a messenger class to interface to information exchange
// between G4ProductionCutsTable and UI.
//
//---------------------------------------------------------------
//
// G4ProcductionCutsTableMessenger.hh
//
// Class Description:
// This is a messenger class to interface to exchange information
// between ProductionCutsTable and UI.
// --
// the List of Directory and Commands
// -
// /run/particle/ Paricle control commands.
// Commands :
// SetCuts * Set default cut value
// List of Directory and Commands:
//
// /run/particle/ Particle control commands
// Commands :
// SetCuts * Set default cut value
// dumpList * Dump List of particles in G4VUserPhysicsList.
// verbose * Set the Verbose level of G4VUserPhysicsList.
// ------------------------------------------------------------
// History
// first version 02 Mar. 2008 by H.Kurashige
// ------------------------------------------------------------
// verbose * Set the Verbose level of G4VUserPhysicsList
#ifndef G4ProcductionCutsTableMessenger_h
#define G4ProcductionCutsTableMessenger_h 1
// Author: H.Kurashige, 02 March 2008 - First version
// --------------------------------------------------------------------
#ifndef G4ProcductionCutsTableMessenger_hh
#define G4ProcductionCutsTableMessenger_hh 1
#include "G4UImessenger.hh"
#include "globals.hh"
class G4ProductionCutsTable;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
@@ -58,36 +54,35 @@ class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcommand;
#include "G4UImessenger.hh"
#include "globals.hh"
class G4ProductionCutsTableMessenger: public G4UImessenger
class G4ProductionCutsTableMessenger : public G4UImessenger
{
private:
// hide default constructor
G4ProductionCutsTableMessenger(){}
public:
G4ProductionCutsTableMessenger(G4ProductionCutsTable* pTable);
virtual ~G4ProductionCutsTableMessenger();
G4ProductionCutsTableMessenger(const G4ProductionCutsTableMessenger&) = delete;
G4ProductionCutsTableMessenger& operator=(const G4ProductionCutsTableMessenger&) = delete;
// Copy contructor and assignment operator not allowed
public: // with description
virtual void SetNewValue(G4UIcommand * command,G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand * command);
virtual void SetNewValue(G4UIcommand* command, G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand* command);
protected:
G4ProductionCutsTable* theCutsTable;
G4ProductionCutsTable* theCutsTable = nullptr;
private: //commands
G4UIdirectory * theDirectory;
G4UIcmdWithAnInteger * verboseCmd;
G4UIcmdWithADoubleAndUnit * setLowEdgeCmd;
G4UIcmdWithADoubleAndUnit * setHighEdgeCmd;
G4UIcmdWithADoubleAndUnit * setMaxEnergyCutCmd;
G4UIcmdWithoutParameter * dumpCmd;
private:
G4ProductionCutsTableMessenger() {}
// Hidden default constructor
G4UIdirectory* theDirectory = nullptr;
G4UIcmdWithAnInteger* verboseCmd = nullptr;
G4UIcmdWithADoubleAndUnit* setLowEdgeCmd = nullptr;
G4UIcmdWithADoubleAndUnit* setHighEdgeCmd = nullptr;
G4UIcmdWithADoubleAndUnit* setMaxEnergyCutCmd = nullptr;
G4UIcmdWithoutParameter* dumpCmd = nullptr;
};
#endif
@@ -23,62 +23,44 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4RToEConvForElectron
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is a Range to Energy Converter for electron.
//
// ------------------------------------------------------------
// First Implementation 5 Oct. 2002 H.Kurahige
// ------------------------------------------------------------
// This class is a Range to Energy Converter for electron.
#ifndef G4RToEConvForElectron_h
#define G4RToEConvForElectron_h 1
// Author: H.Kurashige, 05 October 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4RToEConvForElectron_hh
#define G4RToEConvForElectron_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForElectron : public G4VRangeToEnergyConverter
{
public:
// constructor
G4RToEConvForElectron();
public:
// destructor
virtual ~G4RToEConvForElectron();
G4RToEConvForElectron();
// Constructor
virtual ~G4RToEConvForElectron();
// Destructor
protected:
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy
) ;
G4double KineticEnergy);
protected:
G4double Mass;
G4double Z;
G4double taul;
G4double ionpot;
G4double ionpotlog;
G4double bremfactor;
G4double Mass = 0.0;
G4double Z = -1.0;
G4double taul = 0.0;
G4double ionpot = 0.0;
G4double ionpotlog = -1.0e-10;
G4double bremfactor = 0.1;
};
#endif
@@ -23,93 +23,73 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4RToEConvForGamma
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is a Range to Energy Converter for gamma.
//
// ------------------------------------------------------------
// First Implementation 5 Oct. 2002 H.Kurahige
// ------------------------------------------------------------
// This class is a Range to Energy Converter for gamma.
#ifndef G4RToEConvForGamma_h
#define G4RToEConvForGamma_h 1
// Author: H.Kurashige, 05 October 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4RToEConvForGamma_hh
#define G4RToEConvForGamma_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForGamma : public G4VRangeToEnergyConverter
{
public: // with description
// constructor
G4RToEConvForGamma();
public:
// destructor
virtual ~G4RToEConvForGamma();
public: // with description
// calculate energy cut from given range cut for the material
// virtual G4double convert(G4double rangeCut, const G4Material* material);
G4RToEConvForGamma();
// Constructor
virtual ~G4RToEConvForGamma();
// Destructor
protected:
virtual G4double ComputeLoss( G4double AtomicNumber,
G4double KineticEnergy
) ;
//-------------- Range Table ------------------------------------------
virtual void BuildRangeVector( const G4Material* aMaterial,
G4RangeVector* rangeVector);
typedef G4LossTable G4CrossSectionTable;
using G4CrossSectionTable = G4LossTable;
virtual G4double ComputeLoss( G4double AtomicNumber,
G4double KineticEnergy );
virtual void BuildRangeVector( const G4Material* aMaterial,
G4RangeVector* rangeVector );
// The Range Table
void BuildAbsorptionLengthVector( const G4Material* aMaterial,
G4RangeVector* rangeVector);
G4RangeVector* rangeVector );
G4double ComputeCrossSection( G4double AtomicNumber,
G4double KineticEnergy
);
G4double Z;
G4double s200keV, s1keV;
G4double tmin, tlow;
G4double smin, slow;
G4double cmin, clow, chigh;
G4double KineticEnergy );
G4double Z = -1.0;
G4double s200keV = 0.0, s1keV = 0.0;
G4double tmin = 0.0, tlow = 0.0;
G4double smin = 0.0, slow = 0.0;
G4double cmin = 0.0, clow = 0.0, chigh = 0.0;
};
// ------------------
// Inline methods
// ------------------
inline
G4double G4RToEConvForGamma::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy)
G4double G4RToEConvForGamma::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy)
{
return ComputeCrossSection(AtomicNumber,KineticEnergy);
}
inline
void G4RToEConvForGamma::BuildRangeVector(
const G4Material* aMaterial,
G4RangeVector* rangeVector)
void G4RToEConvForGamma::BuildRangeVector(const G4Material* aMaterial,
G4RangeVector* rangeVector)
{
BuildAbsorptionLengthVector(aMaterial, rangeVector);
}
#endif
@@ -23,62 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4RToEConvForPositron
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is a Range to Energy Converter for positron.
//
// ------------------------------------------------------------
// First Implementation 5 Oct. 2002 H.Kurahige
// ------------------------------------------------------------
// This class is a Range to Energy Converter for positron.
#ifndef G4RToEConvForPositron_h
#define G4RToEConvForPositron_h 1
// Author: H.Kurashige, 05 October 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4RToEConvForPositron_hh
#define G4RToEConvForPositron_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForPositron : public G4VRangeToEnergyConverter
{
public:
// constructor
G4RToEConvForPositron();
public:
// destructor
G4RToEConvForPositron();
// Constructor
virtual ~G4RToEConvForPositron();
// Destructor
protected:
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy
) ;
G4double KineticEnergy);
protected:
G4double Mass;
G4double Z;
G4double taul;
G4double ionpot;
G4double ionpotlog;
G4double bremfactor;
G4double Mass = 0.0;
G4double Z = -1.0;
G4double taul = 0.0;
G4double ionpot = 0.0;
G4double ionpotlog = -1.0e-10;
G4double bremfactor = 0.1;
};
#endif
@@ -23,70 +23,52 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4RToEConvForProton
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is a Range to Energy Converter for proton.
//
// ------------------------------------------------------------
// First Implementation 5 Oct. 2002 H.Kurahige
// ------------------------------------------------------------
// This class is a Range to Energy Converter for proton.
#ifndef G4RToEConvForProton_h
#define G4RToEConvForProton_h 1
// Author: H.Kurashige, 05 October 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4RToEConvForProton_hh
#define G4RToEConvForProton_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include <vector>
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForProton : public G4VRangeToEnergyConverter
{
public:
// constructor
G4RToEConvForProton();
public:
// destructor
virtual ~G4RToEConvForProton();
G4RToEConvForProton();
// Constructor
virtual G4double Convert(G4double rangeCut, const G4Material* material);
virtual ~G4RToEConvForProton();
// Destructor
// reset Loss Table and Range Vectors
virtual void Reset();
virtual G4double Convert(G4double rangeCut, const G4Material* material);
virtual void Reset();
// Reset Loss Table and Range Vectors
protected:
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy
) ;
G4double KineticEnergy);
protected:
G4double Mass;
G4double Z;
G4double tau0;
G4double taul;
G4double taum;
G4double ionpot;
G4double ca;
G4double cba;
G4double cc;
G4double Mass = 0.0;
G4double Z = -1.0;
G4double tau0 = 0.0;
G4double taul = 0.0;
G4double taum = 0.0;
G4double ionpot = 0.0;
G4double ca = 0.0;
G4double cba = 0.0;
G4double cc = 0.0;
};
#endif
@@ -23,161 +23,144 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VRangeToEnergyConverter
//
// Class description:
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
//
// Class Description
// This class is base class for Range to Energy Converters.
// Cut in energy corresponding to given cut value in range
// is calculated for a material by using Convert method
//
// ------------------------------------------------------------
// First Implementation 5 Oct. 2002 H.Kurahige
// ------------------------------------------------------------
// Base class for Range to Energy Converters.
// Cut in energy corresponding to given cut value in range
// is calculated for a material by using Convert() method.
#ifndef G4VRangeToEnergyConverter_h
#define G4VRangeToEnergyConverter_h 1
// Author: H.Kurashige, 05 October 2002 - First implementation
// --------------------------------------------------------------------
#ifndef G4VRangeToEnergyConverter_hh
#define G4VRangeToEnergyConverter_hh 1
#include "globals.hh"
#include <cmath>
#include "G4ios.hh"
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicsTable.hh"
#include "G4Element.hh"
#include "G4Material.hh"
class G4PhysicsLogVector;
class G4VRangeToEnergyConverter
{
public: // with description
// constructor
G4VRangeToEnergyConverter();
// copy constructor
G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter &right);
G4VRangeToEnergyConverter & operator=(const G4VRangeToEnergyConverter &right);
public:
// destructor
virtual ~G4VRangeToEnergyConverter();
// equal opperators
G4bool operator==(const G4VRangeToEnergyConverter &right) const;
G4bool operator!=(const G4VRangeToEnergyConverter &right) const;
G4VRangeToEnergyConverter();
// Constructor
public: // with description
// calculate energy cut from given range cut for the material
virtual G4double Convert(G4double rangeCut, const G4Material* material);
G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter& r);
// Copy constructor
// set energy range for all particle type
static void SetEnergyRange(G4double lowedge, G4double highedge);
G4VRangeToEnergyConverter& operator=(const G4VRangeToEnergyConverter &r);
// Assignment operator
// get energy range for all particle type
static G4double GetLowEdgeEnergy();
static G4double GetHighEdgeEnergy();
virtual ~G4VRangeToEnergyConverter();
// Destructor
// get/set max cut energy for all particle type
static G4double GetMaxEnergyCut();
static void SetMaxEnergyCut(G4double value);
G4bool operator==(const G4VRangeToEnergyConverter& r) const;
G4bool operator!=(const G4VRangeToEnergyConverter& r) const;
// Equality operators
virtual G4double Convert(G4double rangeCut, const G4Material* material);
// Calculate energy cut from given range cut for the material
static void SetEnergyRange(G4double lowedge, G4double highedge);
// Set energy range for all particle type
static G4double GetLowEdgeEnergy();
static G4double GetHighEdgeEnergy();
// Get energy range for all particle type
static G4double GetMaxEnergyCut();
static void SetMaxEnergyCut(G4double value);
// Get/set max cut energy for all particle type
// return pointer to the particle type which this converter takes care
const G4ParticleDefinition* GetParticleType() const;
inline const G4ParticleDefinition* GetParticleType() const;
// Return pointer to the particle type which this converter takes care of
// return the Loss Table
const G4PhysicsTable* GetLossTable() const;
//-------------- Loss Table ------------------------------------------
// theLossTable is a collection of loss vectors for all elements.
// Each loss vector has energy loss values (cross section values
// for neutral particles) which are calculated by
// ComputeLoss(G4double AtomicNumber,G4double KineticEnergy).
// ComputeLoss method is pure virtual and should be provided for each
// particle type
const G4PhysicsTable* GetLossTable() const;
// theLossTable is a collection of loss vectors for all elements.
// Each loss vector has energy loss values (cross-section values
// for neutral particles) which are calculated by
// ComputeLoss(G4double AtomicNumber, G4double KineticEnergy).
// ComputeLoss method is pure virtual and should be provided
// for each particle type
// reset Loss Table and Range Vectors
virtual void Reset();
protected:
virtual void Reset();
// Reset Loss Table and Range Vectors
static G4double LowestEnergy, HighestEnergy;
static G4double MaxEnergyCut;
G4double fMaxEnergyCut;
const G4ParticleDefinition* theParticle;
typedef G4PhysicsTable G4LossTable;
G4LossTable* theLossTable;
G4int NumberOfElements;
typedef G4PhysicsLogVector G4LossVector;
const G4int TotBin;
protected:// with description
virtual void BuildLossTable();
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy
) =0;
//-------------- Range Table ------------------------------------------
protected:
typedef G4PhysicsLogVector G4RangeVector;
virtual void BuildRangeVector(const G4Material* aMaterial,
G4RangeVector* rangeVector);
std::vector< G4RangeVector* > fRangeVectorStore;
protected:
G4double ConvertCutToKineticEnergy(
G4RangeVector* theRangeVector,
G4double theCutInLength,
size_t materialIndex
) const;
public: // with description
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
// controle flag for output message
inline void SetVerboseLevel(G4int value);
inline G4int GetVerboseLevel() const;
// control flag for output message
// 0: Silent
// 1: Warning message
// 2: More
private:
G4int verboseLevel;
protected:
virtual void BuildLossTable();
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy) = 0;
// ------------- Range Table --------------------------------------
using G4LossVector = G4PhysicsLogVector;
using G4RangeVector = G4PhysicsLogVector;
using G4LossTable = G4PhysicsTable;
virtual void BuildRangeVector(const G4Material* aMaterial,
G4RangeVector* rangeVector);
G4double ConvertCutToKineticEnergy(G4RangeVector* theRangeVector,
G4double theCutInLength,
std::size_t materialIndex ) const;
protected:
static G4double LowestEnergy, HighestEnergy;
static G4double MaxEnergyCut;
G4double fMaxEnergyCut = 0.0;
const G4ParticleDefinition* theParticle = nullptr;
G4LossTable* theLossTable = nullptr;
G4int NumberOfElements = 0;
const G4int TotBin = 300;
std::vector< G4RangeVector* > fRangeVectorStore;
private:
G4int verboseLevel = 1;
};
// ------------------
// Inline methods
// ------------------
inline
void G4VRangeToEnergyConverter::SetVerboseLevel(G4int value)
void G4VRangeToEnergyConverter::SetVerboseLevel(G4int value)
{
verboseLevel = value;
verboseLevel = value;
}
inline
G4int G4VRangeToEnergyConverter::GetVerboseLevel() const
G4int G4VRangeToEnergyConverter::GetVerboseLevel() const
{
return verboseLevel;
return verboseLevel;
}
inline
const G4ParticleDefinition* G4VRangeToEnergyConverter::GetParticleType() const
const G4ParticleDefinition* G4VRangeToEnergyConverter::GetParticleType() const
{
return theParticle;
return theParticle;
}
#endif