Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4VRegionsManager.h
Go to the documentation of this file.
1#ifndef TG4_V_REGIONS_MANAGER_H
2#define TG4_V_REGIONS_MANAGER_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2023 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 "TG4G3Cut.h"
19#include "TG4RegionsMessenger.h"
20#include "TG4Verbose.h"
21
22#include <globals.hh>
23
24#include <map>
25
26class TG4Limits;
27
28class G4Region;
29class G4Material;
30class G4VRangeToEnergyConverter;
31class G4MaterialCutsCouple;
32
37
39{
40 public:
42 virtual ~TG4VRegionsManager();
43
45
46 // methods
47 virtual void DefineRegions() = 0;
48 virtual void UpdateProductionCutsTable() = 0;
49
50 virtual void CheckRegions() const;
51 virtual void PrintRegions(std::ostream& output) const;
52 virtual void SaveRegions();
53 virtual void DumpRegionStore() const;
54
55 // set methods
56 void SetFileName(const G4String& fileName);
57 void SetApplyForGamma(G4bool applyForGamma);
58 void SetApplyForElectron(G4bool applyForElectron);
59 void SetApplyForPositron(G4bool applyForPositron);
60 void SetApplyForProton(G4bool applyForProton);
61 void SetCheck(G4bool isCheck);
62 void SetPrint(G4bool isPrint);
63 void SetSave(G4bool isSave);
64
65 // get methods
66 G4String GetFileName() const;
67 G4bool GetApplyForGamma() const;
68 G4bool GetApplyForElectron() const;
69 G4bool GetApplyForPositron() const;
70 G4bool GetApplyForProton() const;
71 G4bool IsCheck() const;
72 G4bool IsPrint() const;
73 G4bool IsSave() const;
74
75 protected:
76 // constants
77 static constexpr size_t fgkRangeGamIdx = 0;
78 static constexpr size_t fgkRangeEleIdx = 1;
79 static constexpr size_t fgkCutGamIdx = 2;
80 static constexpr size_t fgkCutEleIdx = 3;
81 static constexpr size_t fgkVmcCutGamIdx = 4;
82 static constexpr size_t fgkVmcCutEleIdx = 5;
83 static constexpr size_t fgkValuesSize = 6;
84
85 using TG4RegionData = std::array<G4double, fgkValuesSize>;
86
87 TG4VRegionsManager(const TG4VRegionsManager& right) = delete;
89
90 // methods
91 G4double GetGlobalEnergyCut(TG4G3Cut cutType) const;
92
93 G4double GetEnergyCut(
94 TG4Limits* limits, TG4G3Cut cutType, G4double globalCutValue) const;
95
97 const G4MaterialCutsCouple* couple, const G4Region* region) const;
98
99 void CheckRegionsInGeometry() const;
100 void PrintLegend(std::ostream& output) const;
101 void PrintRegionData(std::ostream& output, const G4String& matName,
102 const TG4RegionData& values) const;
103 void PrintFromG4Table(std::ostream& output) const;
104
105 //
106 // static data members
107
111 static const G4String fgkDefaultRegionName;
113 static const G4String fgkDefaultFileName;
114
115 //
116 // data members
117
119 G4String fFileName;
121 G4bool fApplyForGamma = true;
123 G4bool fApplyForElectron = true;
125 G4bool fApplyForPositron = true;
127 G4bool fApplyForProton = true;
129 G4bool fIsCheck = false;
131 G4bool fIsPrint = false;
133 G4bool fIsSave = false;
134};
135
138
140inline void TG4VRegionsManager::SetFileName(const G4String& fileName)
141{ fFileName = fileName; }
142
144inline void TG4VRegionsManager::SetApplyForGamma(G4bool applyForGamma)
145{
146 fApplyForGamma = applyForGamma;
147}
148
150inline void TG4VRegionsManager::SetApplyForElectron(G4bool applyForElectron)
151{
152 fApplyForElectron = applyForElectron;
153}
154
156inline void TG4VRegionsManager::SetApplyForPositron(G4bool applyForPositron)
157{
158 fApplyForPositron = applyForPositron;
159}
160
162inline void TG4VRegionsManager::SetApplyForProton(G4bool applyForProton)
163{
164 fApplyForProton = applyForProton;
165}
166
168inline void TG4VRegionsManager::SetCheck(G4bool isCheck)
169{ fIsCheck = isCheck; }
170
172inline void TG4VRegionsManager::SetPrint(G4bool isPrint)
173{ fIsPrint = isPrint; }
174
176inline void TG4VRegionsManager::SetSave(G4bool isSave)
177{ fIsSave = isSave; }
178
180inline G4String TG4VRegionsManager::GetFileName() const
181{ return fFileName; }
182
185{
186 return fApplyForGamma;
187}
188
191{
192 return fApplyForElectron;
193}
194
197{
198 return fApplyForPositron;
199}
200
203{
204 return fApplyForProton;
205}
206
208inline G4bool TG4VRegionsManager::IsCheck() const { return fIsCheck; }
209
211inline G4bool TG4VRegionsManager::IsPrint() const { return fIsPrint; }
212
214inline G4bool TG4VRegionsManager::IsSave() const { return fIsSave; }
215
216#endif // TG4_V_REGIONS_MANAGER_H
Definition of the enumeration TG4G3Cut.
Definition of the TG4RegionsMessenger class.
Definition of the TG4Verbose class.
Extended G4UserLimits class.
Definition TG4Limits.h:38
Base class for mangers for converting VMC cuts in energy in G4 regions.
static constexpr size_t fgkRangeGamIdx
G4bool fIsCheck
option to perform consistency check (by default false)
G4bool GetApplyForProton() const
Return the option to apply range cuts for proton.
G4bool fApplyForElectron
option to apply cuts for e- (default is true)
G4bool fIsSave
option to save all regions in a file
virtual void DefineRegions()=0
virtual void UpdateProductionCutsTable()=0
G4bool fApplyForPositron
option to apply cuts for e+ (default is true)
TG4VRegionsManager & operator=(const TG4VRegionsManager &right)=delete
void PrintLegend(std::ostream &output) const
void SetPrint(G4bool isPrint)
Set the option to print all regions.
void PrintRegionData(std::ostream &output, const G4String &matName, const TG4RegionData &values) const
G4bool IsCheck() const
Return the option to perform consistency check.
void SetApplyForGamma(G4bool applyForGamma)
Set the option to apply range cuts for gamma (default is true)
static const G4String fgkDefaultRegionName
the name of the region with default cuts
void SetApplyForPositron(G4bool applyForPositron)
Set the option to apply range cuts for e+ (default is true)
G4bool IsPrint() const
Return the option to print all regions.
G4bool fIsPrint
option to print all regions
void SetApplyForProton(G4bool applyForProton)
Set the option to apply range cuts for proton (default is true)
static TG4VRegionsManager * Instance()
Return the singleton instance.
static const G4String fgkDefaultFileName
the name of the region with default cuts
static constexpr size_t fgkValuesSize
static TG4VRegionsManager * fgInstance
the singleton instance
static constexpr size_t fgkCutGamIdx
G4double GetEnergyCut(TG4Limits *limits, TG4G3Cut cutType, G4double globalCutValue) const
G4bool IsCoupleUsedInTheRegion(const G4MaterialCutsCouple *couple, const G4Region *region) const
void SetCheck(G4bool isCheck)
Set the option to perform consistency check (by default false)
G4bool GetApplyForElectron() const
Return the option to apply range cuts for e+.
G4bool fApplyForGamma
option to apply cuts for gamma (default is true)
void SetFileName(const G4String &fileName)
Set the file name for regions output.
std::array< G4double, fgkValuesSize > TG4RegionData
static constexpr size_t fgkCutEleIdx
static constexpr size_t fgkVmcCutGamIdx
void PrintFromG4Table(std::ostream &output) const
G4bool GetApplyForPositron() const
Return the option to apply range cuts for positron.
void CheckRegionsInGeometry() const
void SetApplyForElectron(G4bool applyForElectron)
Set the option to apply range cuts for e- (default is true)
G4bool fApplyForProton
option to apply cuts for proton (default is true)
void SetSave(G4bool isSave)
Set the option to save all regions in a file.
G4double GetGlobalEnergyCut(TG4G3Cut cutType) const
virtual void DumpRegionStore() const
static constexpr size_t fgkRangeEleIdx
G4bool IsSave() const
Return option to save all regions in a file.
G4String fFileName
file name for regions output
TG4VRegionsManager(const TG4VRegionsManager &right)=delete
virtual void CheckRegions() const
G4String GetFileName() const
Return the file name for regions output.
virtual void PrintRegions(std::ostream &output) const
static constexpr size_t fgkVmcCutEleIdx
G4bool GetApplyForGamma() const
Return the option to apply range cuts for gamma.
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
TG4G3Cut
Enumeration for G3 types of kinetic energy cuts.
Definition TG4G3Cut.h:22