Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4RegionsManager.h
Go to the documentation of this file.
1#ifndef TG4_REGIONS_MANAGER_H
2#define TG4_REGIONS_MANAGER_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2014 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
17
18#include "TG4VRegionsManager.h"
19
20#include <globals.hh>
21
22#include <map>
23
24class TG4Limits;
25
26class G4Region;
27class G4Material;
28class G4VRangeToEnergyConverter;
29class G4MaterialCutsCouple;
30
76
78{
79 public:
81 ~TG4RegionsManager() override = default;
82
83 // methods
84 void DefineRegions() override;;
85 void UpdateProductionCutsTable() override {}
86
87 void CheckRegions() const override;
88 void PrintRegions(std::ostream& output) const override;
89 void LoadRegions();
90 void DumpRegion(const G4String& volName) const;
91
92 // set methods
93 void SetRangePrecision(G4int precision);
94 void SetEnergyTolerance(G4double tolerance);
95 void SetLoad(G4bool isLoad);
96 void SetFromG4Table(G4bool isG4Table);
97
98 // get methods
99 G4int GetRangePrecision() const;
100 G4double GetEnergyTolerance() const;
101 G4String GetFileName() const;
102 G4bool IsG4Table() const;
103 G4bool IsLoad() const;
104
105 private:
106 using TG4RegionData = std::array<G4double, fgkValuesSize>;
107
108 TG4RegionsManager(const TG4RegionsManager& right) = delete;
110
111 // methods
112 G4bool Iterate(G4double energyCut, G4double& lowerCut, G4double& higherCut,
113 G4double defaultRangeCut, G4double lowEdgeEnergy, G4double highEdgeEnergy,
114 G4int nbin, std::map<G4double, G4double>& map,
115 std::map<G4double, G4double>::const_iterator& it, G4Material* material,
116 G4VRangeToEnergyConverter& converter) const;
117
118 std::pair<G4double,G4double>
119 ConvertEnergyToRange(G4double energyCut, G4Material* material,
120 G4VRangeToEnergyConverter& converter, G4double defaultRangeValue) const;
121
122 std::pair<G4double,G4double>
123 GetRangeCut(G4double energyCut, G4Material* material,
124 G4VRangeToEnergyConverter& converter, G4double defaultRangeValue) const;
125
126 void CheckRegionsRanges() const;
127 void PrintFromMap(std::ostream& output) const;
128
129 //
130 // static data members
131
133 static constexpr G4int fgkDefaultRangePrecision = 5;
135 static constexpr G4double fgkDefaultEnergyTolerance = 0.01;
137 static constexpr G4int fgkNofBins = 10;
139 static constexpr G4int fgkMinRangeOrder = -3;
141 static constexpr G4int fgkMaxRangeOrder = 6;
142
143 //
144 // data members
145
153 G4bool fIsG4Table = false;
155 G4bool fIsLoad = false;
157 std::map<G4String, TG4RegionData> fRegionData;
158};
159
161inline void TG4RegionsManager::SetRangePrecision(G4int precision)
162{
163 G4cout << "### New precision: " << precision << G4endl;
164 fRangePrecision = precision;
165}
166
168inline void TG4RegionsManager::SetEnergyTolerance(G4double tolerance)
169{
170 G4cout << "### New tolerance: " << tolerance << G4endl;
171 fEnergyTolerance = tolerance;
172}
173
175inline void TG4RegionsManager::SetFromG4Table(G4bool isG4Table)
176{
177 fIsG4Table = isG4Table;
178}
179
182{
183 return fRangePrecision;
184}
185
188{
189 return fEnergyTolerance;
190}
191
193inline G4bool TG4RegionsManager::IsG4Table() const
194{ return fIsG4Table; }
195
197inline G4bool TG4RegionsManager::IsLoad() const { return fIsLoad; }
198
199#endif // TG4_REGIONS_MANAGER_H
Definition of the TG4VRegionsManager class.
Extended G4UserLimits class.
Definition TG4Limits.h:38
Manager class for converting VMC cuts in energy in G4 regions.
void PrintFromMap(std::ostream &output) const
TG4RegionsMessenger fMessenger
messenger
std::pair< G4double, G4double > ConvertEnergyToRange(G4double energyCut, G4Material *material, G4VRangeToEnergyConverter &converter, G4double defaultRangeValue) const
G4int fRangePrecision
the precision for calculating ranges
void DefineRegions() override
G4bool IsLoad() const
Return the option to load regions ranges from a file.
void CheckRegionsRanges() const
void UpdateProductionCutsTable() override
G4int GetRangePrecision() const
Return the precision for calculating ranges.
static constexpr G4int fgkDefaultRangePrecision
the default precision for calculating ranges
void SetLoad(G4bool isLoad)
G4double fEnergyTolerance
the tolerance (relative) for comparing energy cut values
~TG4RegionsManager() override=default
void SetEnergyTolerance(G4double tolerance)
Set the tolerance (relative) for comparing energy cut values.
void SetFromG4Table(G4bool isG4Table)
Set the option to print/save cuts from G4 table.
std::array< G4double, fgkValuesSize > TG4RegionData
static constexpr G4double fgkDefaultEnergyTolerance
the default tolerance (relative) for comparing energy cut values
void CheckRegions() const override
G4bool IsG4Table() const
Return the option to print or save regions from production cuts table.
G4bool fIsLoad
option to load regions ranges from a file
static constexpr G4int fgkMinRangeOrder
the minimum range order
void SetRangePrecision(G4int precision)
Set the precision for calculating ranges.
std::pair< G4double, G4double > GetRangeCut(G4double energyCut, G4Material *material, G4VRangeToEnergyConverter &converter, G4double defaultRangeValue) const
void DumpRegion(const G4String &volName) const
TG4RegionsManager & operator=(const TG4RegionsManager &right)=delete
TG4RegionsManager(const TG4RegionsManager &right)=delete
G4String GetFileName() const
void PrintRegions(std::ostream &output) const override
static constexpr G4int fgkMaxRangeOrder
the maximum range order
std::map< G4String, TG4RegionData > fRegionData
map for computed or loaded regions data
G4double GetEnergyTolerance() const
Return the tolerance (relative) for comparing energy cut values.
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
G4bool fIsG4Table
option to print or save regions from G4 production cuts table
static constexpr G4int fgkNofBins
the number of bins for search range iteration
Messenger class that defines commands for TG4RegionsManager[2].
Base class for mangers for converting VMC cuts in energy in G4 regions.