Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4RegionsManager Class Reference

Manager class for converting VMC cuts in energy in G4 regions. More...

#include <TG4RegionsManager.h>

Inheritance diagram for TG4RegionsManager:

Public Member Functions

 TG4RegionsManager ()
 
 ~TG4RegionsManager () override=default
 
void DefineRegions () override
 
void UpdateProductionCutsTable () override
 
void CheckRegions () const override
 
void PrintRegions (std::ostream &output) const override
 
void LoadRegions ()
 
void DumpRegion (const G4String &volName) const
 
void SetRangePrecision (G4int precision)
 Set the precision for calculating ranges.
 
void SetEnergyTolerance (G4double tolerance)
 Set the tolerance (relative) for comparing energy cut values.
 
void SetLoad (G4bool isLoad)
 
void SetFromG4Table (G4bool isG4Table)
 Set the option to print/save cuts from G4 table.
 
G4int GetRangePrecision () const
 Return the precision for calculating ranges.
 
G4double GetEnergyTolerance () const
 Return the tolerance (relative) for comparing energy cut values.
 
G4String GetFileName () const
 
G4bool IsG4Table () const
 Return the option to print or save regions from production cuts table.
 
G4bool IsLoad () const
 Return the option to load regions ranges from a file.
 
- Public Member Functions inherited from TG4VRegionsManager
 TG4VRegionsManager ()
 
virtual ~TG4VRegionsManager ()
 
virtual void SaveRegions ()
 
virtual void DumpRegionStore () const
 
void SetFileName (const G4String &fileName)
 Set the file name for regions output.
 
void SetApplyForGamma (G4bool applyForGamma)
 Set the option to apply range cuts for gamma (default is true)
 
void SetApplyForElectron (G4bool applyForElectron)
 Set the option to apply range cuts for e- (default is true)
 
void SetApplyForPositron (G4bool applyForPositron)
 Set the option to apply range cuts for e+ (default is true)
 
void SetApplyForProton (G4bool applyForProton)
 Set the option to apply range cuts for proton (default is true)
 
void SetCheck (G4bool isCheck)
 Set the option to perform consistency check (by default false)
 
void SetPrint (G4bool isPrint)
 Set the option to print all regions.
 
void SetSave (G4bool isSave)
 Set the option to save all regions in a file.
 
G4String GetFileName () const
 Return the file name for regions output.
 
G4bool GetApplyForGamma () const
 Return the option to apply range cuts for gamma.
 
G4bool GetApplyForElectron () const
 Return the option to apply range cuts for e+.
 
G4bool GetApplyForPositron () const
 Return the option to apply range cuts for positron.
 
G4bool GetApplyForProton () const
 Return the option to apply range cuts for proton.
 
G4bool IsCheck () const
 Return the option to perform consistency check.
 
G4bool IsPrint () const
 Return the option to print all regions.
 
G4bool IsSave () const
 Return option to save all regions in a file.
 
- Public Member Functions inherited from TG4Verbose
 TG4Verbose (const G4String &cmdName)
 
 TG4Verbose (const G4String &cmdName, G4int verboseLevel)
 
virtual ~TG4Verbose ()
 
virtual void VerboseLevel (G4int level)
 
virtual G4int VerboseLevel () const
 

Private Types

using TG4RegionData = std::array<G4double, fgkValuesSize>
 

Private Member Functions

 TG4RegionsManager (const TG4RegionsManager &right)=delete
 
TG4RegionsManageroperator= (const TG4RegionsManager &right)=delete
 
G4bool Iterate (G4double energyCut, G4double &lowerCut, G4double &higherCut, G4double defaultRangeCut, G4double lowEdgeEnergy, G4double highEdgeEnergy, G4int nbin, std::map< G4double, G4double > &map, std::map< G4double, G4double >::const_iterator &it, G4Material *material, G4VRangeToEnergyConverter &converter) const
 
std::pair< G4double, G4double > ConvertEnergyToRange (G4double energyCut, G4Material *material, G4VRangeToEnergyConverter &converter, G4double defaultRangeValue) const
 
std::pair< G4double, G4double > GetRangeCut (G4double energyCut, G4Material *material, G4VRangeToEnergyConverter &converter, G4double defaultRangeValue) const
 
void CheckRegionsRanges () const
 
void PrintFromMap (std::ostream &output) const
 

Private Attributes

TG4RegionsMessenger fMessenger
 messenger
 
G4int fRangePrecision = fgkDefaultRangePrecision
 the precision for calculating ranges
 
G4double fEnergyTolerance = fgkDefaultEnergyTolerance
 the tolerance (relative) for comparing energy cut values
 
G4bool fIsG4Table = false
 option to print or save regions from G4 production cuts table
 
G4bool fIsLoad = false
 option to load regions ranges from a file
 
std::map< G4String, TG4RegionDatafRegionData
 map for computed or loaded regions data
 

Static Private Attributes

static constexpr G4int fgkDefaultRangePrecision = 5
 the default precision for calculating ranges
 
static constexpr G4double fgkDefaultEnergyTolerance = 0.01
 the default tolerance (relative) for comparing energy cut values
 
static constexpr G4int fgkNofBins = 10
 the number of bins for search range iteration
 
static constexpr G4int fgkMinRangeOrder = -3
 the minimum range order
 
static constexpr G4int fgkMaxRangeOrder = 6
 the maximum range order
 

Additional Inherited Members

- Static Public Member Functions inherited from TG4VRegionsManager
static TG4VRegionsManagerInstance ()
 Return the singleton instance.
 
- Protected Types inherited from TG4VRegionsManager
using TG4RegionData = std::array<G4double, fgkValuesSize>
 
- Protected Member Functions inherited from TG4VRegionsManager
 TG4VRegionsManager (const TG4VRegionsManager &right)=delete
 
TG4VRegionsManageroperator= (const TG4VRegionsManager &right)=delete
 
G4double GetGlobalEnergyCut (TG4G3Cut cutType) const
 
G4double GetEnergyCut (TG4Limits *limits, TG4G3Cut cutType, G4double globalCutValue) const
 
G4bool IsCoupleUsedInTheRegion (const G4MaterialCutsCouple *couple, const G4Region *region) const
 
void CheckRegionsInGeometry () const
 
void PrintLegend (std::ostream &output) const
 
void PrintRegionData (std::ostream &output, const G4String &matName, const TG4RegionData &values) const
 
void PrintFromG4Table (std::ostream &output) const
 
- Protected Attributes inherited from TG4VRegionsManager
G4String fFileName
 file name for regions output
 
G4bool fApplyForGamma = true
 option to apply cuts for gamma (default is true)
 
G4bool fApplyForElectron = true
 option to apply cuts for e- (default is true)
 
G4bool fApplyForPositron = true
 option to apply cuts for e+ (default is true)
 
G4bool fApplyForProton = true
 option to apply cuts for proton (default is true)
 
G4bool fIsCheck = false
 option to perform consistency check (by default false)
 
G4bool fIsPrint = false
 option to print all regions
 
G4bool fIsSave = false
 option to save all regions in a file
 
- Static Protected Attributes inherited from TG4VRegionsManager
static constexpr size_t fgkRangeGamIdx = 0
 
static constexpr size_t fgkRangeEleIdx = 1
 
static constexpr size_t fgkCutGamIdx = 2
 
static constexpr size_t fgkCutEleIdx = 3
 
static constexpr size_t fgkVmcCutGamIdx = 4
 
static constexpr size_t fgkVmcCutEleIdx = 5
 
static constexpr size_t fgkValuesSize = 6
 
static TG4VRegionsManagerfgInstance = nullptr
 the singleton instance
 
static const G4String fgkDefaultRegionName
 the name of the region with default cuts
 
static const G4String fgkDefaultFileName = "regions.dat"
 the name of the region with default cuts
 

Detailed Description

Manager class for converting VMC cuts in energy in G4 regions.

The VMC cuts in energy can be defined via the following TVirtulaMC functions:

  • TVirtualMC::SetCut(..)
  • TVirtualMC::Gstpar(..)

The TG4RegionsManager class defined regions with cuts in range corresponding to the VMC energy cuts set by user following these rules:

  • If the VMC energy cut defined by user results in a range cut smaller than the default range cut value defined in user physics list, the VMC cut is ignored and the default range cut is used
  • The range cut is first evaluated within the range 1e-03mm to 1m; when the range cut order is found, it is refined up to given precision (2 orders of magnitude by default) within 10 values of each order and the range value with the closest energy still smaller than VMC cut is chosen.
    It may happen that value cannot be refined up to given precision, then the best found value is returned.
  • The regions are defined only in case when the VMC cuts result in range cuts different from the range cuts in default region; then the region includes all logical volumes with a given material
  • As the range cuts do not match precisely to user defined energy cuts, the specialCuts process applies the energy cuts as tracking cuts when a particle with energy cut below threshold is generated.

By default, the computed range cut for e- is applied also to e+ and proton. This feature can be switched off by the UI commands:

  • /mcRegions/applyForPositron false
  • /mcRegions/applyForProton false

User can select several levels of verbosity; the following information is then printed:

  • 0 no output
  • 1 number of regions added via VMC
  • 2 the list of all volumes, the cuts in energy and calculated cuts in range
  • 3 all evaluated energy values
Author
I. Hrivnacova; IPN Orsay

Definition at line 77 of file TG4RegionsManager.h.

Member Typedef Documentation

◆ TG4RegionData

using TG4RegionsManager::TG4RegionData = std::array<G4double, fgkValuesSize>
private

Definition at line 106 of file TG4RegionsManager.h.

Constructor & Destructor Documentation

◆ TG4RegionsManager() [1/2]

TG4RegionsManager::TG4RegionsManager ( )

Definition at line 44 of file TG4RegionsManager.cxx.

◆ ~TG4RegionsManager()

TG4RegionsManager::~TG4RegionsManager ( )
overridedefault

◆ TG4RegionsManager() [2/2]

TG4RegionsManager::TG4RegionsManager ( const TG4RegionsManager & right)
privatedelete

Member Function Documentation

◆ DefineRegions()

void TG4RegionsManager::DefineRegions ( )
overridevirtual

Apply cuts defined in tracking media

Implements TG4VRegionsManager.

Definition at line 336 of file TG4RegionsManager.cxx.

◆ UpdateProductionCutsTable()

void TG4RegionsManager::UpdateProductionCutsTable ( )
inlineoverridevirtual

Implements TG4VRegionsManager.

Definition at line 85 of file TG4RegionsManager.h.

◆ CheckRegions()

void TG4RegionsManager::CheckRegions ( ) const
overridevirtual

Perform two checks:

  • if calculated energy cuts are consistent with energy cuts defined in limits
  • if the region to which the volume belongs correspond to its material

Reimplemented from TG4VRegionsManager.

Definition at line 580 of file TG4RegionsManager.cxx.

◆ PrintRegions()

void TG4RegionsManager::PrintRegions ( std::ostream & output) const
overridevirtual

Print regions from data map or the production cuts table.

Reimplemented from TG4VRegionsManager.

Definition at line 566 of file TG4RegionsManager.cxx.

◆ LoadRegions()

void TG4RegionsManager::LoadRegions ( )

Load all regions ranges from the input file.

Definition at line 591 of file TG4RegionsManager.cxx.

Referenced by DefineRegions().

◆ DumpRegion()

void TG4RegionsManager::DumpRegion ( const G4String & volName) const

Dump region properties for volume with given name

Definition at line 679 of file TG4RegionsManager.cxx.

◆ SetRangePrecision()

void TG4RegionsManager::SetRangePrecision ( G4int precision)
inline

Set the precision for calculating ranges.

Definition at line 161 of file TG4RegionsManager.h.

Referenced by TG4RegionsMessenger::SetNewValue().

◆ SetEnergyTolerance()

void TG4RegionsManager::SetEnergyTolerance ( G4double tolerance)
inline

Set the tolerance (relative) for comparing energy cut values.

Definition at line 168 of file TG4RegionsManager.h.

Referenced by TG4RegionsMessenger::SetNewValue().

◆ SetLoad()

void TG4RegionsManager::SetLoad ( G4bool isLoad)

Set the option to load regions ranges from a file.

Definition at line 757 of file TG4RegionsManager.cxx.

Referenced by TG4RegionsMessenger::SetNewValue().

◆ SetFromG4Table()

void TG4RegionsManager::SetFromG4Table ( G4bool isG4Table)
inline

Set the option to print/save cuts from G4 table.

Definition at line 175 of file TG4RegionsManager.h.

Referenced by TG4RegionsMessenger::SetNewValue().

◆ GetRangePrecision()

G4int TG4RegionsManager::GetRangePrecision ( ) const
inline

Return the precision for calculating ranges.

Definition at line 181 of file TG4RegionsManager.h.

◆ GetEnergyTolerance()

G4double TG4RegionsManager::GetEnergyTolerance ( ) const
inline

Return the tolerance (relative) for comparing energy cut values.

Definition at line 187 of file TG4RegionsManager.h.

◆ GetFileName()

G4String TG4RegionsManager::GetFileName ( ) const

◆ IsG4Table()

G4bool TG4RegionsManager::IsG4Table ( ) const
inline

Return the option to print or save regions from production cuts table.

Definition at line 193 of file TG4RegionsManager.h.

◆ IsLoad()

G4bool TG4RegionsManager::IsLoad ( ) const
inline

Return the option to load regions ranges from a file.

Definition at line 197 of file TG4RegionsManager.h.

◆ operator=()

TG4RegionsManager & TG4RegionsManager::operator= ( const TG4RegionsManager & right)
privatedelete

◆ Iterate()

G4bool TG4RegionsManager::Iterate ( G4double energyCut,
G4double & lowerCut,
G4double & higherCut,
G4double defaultRangeCut,
G4double lowEdgeEnergy,
G4double highEdgeEnergy,
G4int nbin,
std::map< G4double, G4double > & map,
std::map< G4double, G4double >::const_iterator & it,
G4Material * material,
G4VRangeToEnergyConverter & converter ) const
private

Helper function called from ConvertEnergyToRange() in each iteration

Definition at line 53 of file TG4RegionsManager.cxx.

Referenced by ConvertEnergyToRange().

◆ ConvertEnergyToRange()

std::pair< G4double, G4double > TG4RegionsManager::ConvertEnergyToRange ( G4double energyCut,
G4Material * material,
G4VRangeToEnergyConverter & converter,
G4double defaultRangeValue ) const
private

Estimate cut in range for given cut in energy. Return negative value if range cut is not fount.

Definition at line 101 of file TG4RegionsManager.cxx.

Referenced by GetRangeCut().

◆ GetRangeCut()

std::pair< G4double, G4double > TG4RegionsManager::GetRangeCut ( G4double energyCut,
G4Material * material,
G4VRangeToEnergyConverter & converter,
G4double defaultRangeValue ) const
private

Convert energy cuts in range cuts; return defaultRangeCut, if found value is smaller than default

Definition at line 204 of file TG4RegionsManager.cxx.

Referenced by DefineRegions().

◆ CheckRegionsRanges()

void TG4RegionsManager::CheckRegionsRanges ( ) const
private

Loop over region data map and check if the calculated cuts are consistent with the energy cuts defined in limits

Definition at line 272 of file TG4RegionsManager.cxx.

Referenced by CheckRegions().

◆ PrintFromMap()

void TG4RegionsManager::PrintFromMap ( std::ostream & output) const
private

Loop over regions data map and print all regions ranges, calculated energy cuts and the VMC energy cuts.

Definition at line 314 of file TG4RegionsManager.cxx.

Referenced by PrintRegions().

Member Data Documentation

◆ fgkDefaultRangePrecision

G4int TG4RegionsManager::fgkDefaultRangePrecision = 5
staticconstexprprivate

the default precision for calculating ranges

Definition at line 133 of file TG4RegionsManager.h.

◆ fgkDefaultEnergyTolerance

G4double TG4RegionsManager::fgkDefaultEnergyTolerance = 0.01
staticconstexprprivate

the default tolerance (relative) for comparing energy cut values

Definition at line 135 of file TG4RegionsManager.h.

◆ fgkNofBins

G4int TG4RegionsManager::fgkNofBins = 10
staticconstexprprivate

the number of bins for search range iteration

Definition at line 137 of file TG4RegionsManager.h.

Referenced by ConvertEnergyToRange().

◆ fgkMinRangeOrder

G4int TG4RegionsManager::fgkMinRangeOrder = -3
staticconstexprprivate

the minimum range order

Definition at line 139 of file TG4RegionsManager.h.

Referenced by ConvertEnergyToRange().

◆ fgkMaxRangeOrder

G4int TG4RegionsManager::fgkMaxRangeOrder = 6
staticconstexprprivate

the maximum range order

Definition at line 141 of file TG4RegionsManager.h.

Referenced by ConvertEnergyToRange().

◆ fMessenger

TG4RegionsMessenger TG4RegionsManager::fMessenger
private

messenger

Definition at line 147 of file TG4RegionsManager.h.

◆ fRangePrecision

G4int TG4RegionsManager::fRangePrecision = fgkDefaultRangePrecision
private

the precision for calculating ranges

Definition at line 149 of file TG4RegionsManager.h.

Referenced by ConvertEnergyToRange(), GetRangePrecision(), and SetRangePrecision().

◆ fEnergyTolerance

G4double TG4RegionsManager::fEnergyTolerance = fgkDefaultEnergyTolerance
private

the tolerance (relative) for comparing energy cut values

Definition at line 151 of file TG4RegionsManager.h.

Referenced by CheckRegionsRanges(), GetEnergyTolerance(), and SetEnergyTolerance().

◆ fIsG4Table

G4bool TG4RegionsManager::fIsG4Table = false
private

option to print or save regions from G4 production cuts table

Definition at line 153 of file TG4RegionsManager.h.

Referenced by IsG4Table(), PrintRegions(), and SetFromG4Table().

◆ fIsLoad

G4bool TG4RegionsManager::fIsLoad = false
private

option to load regions ranges from a file

Definition at line 155 of file TG4RegionsManager.h.

Referenced by DefineRegions(), GetRangeCut(), IsLoad(), LoadRegions(), and SetLoad().

◆ fRegionData

std::map<G4String, TG4RegionData> TG4RegionsManager::fRegionData
private

map for computed or loaded regions data

Definition at line 157 of file TG4RegionsManager.h.

Referenced by CheckRegionsRanges(), DefineRegions(), GetRangeCut(), LoadRegions(), and PrintFromMap().


The documentation for this class was generated from the following files: