Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4IStore Class Reference

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. More...

#include <G4IStore.hh>

Inheritance diagram for G4IStore:

Public Member Functions

G4double GetImportance (const G4GeometryCell &gCell) const override
G4bool IsKnown (const G4GeometryCell &gCell) const override
void Clear ()
void SetWorldVolume ()
void SetParallelWorldVolume (const G4String &paraName)
const G4VPhysicalVolumeGetWorldVolume () const override
const G4VPhysicalVolumeGetParallelWorldVolumePointer () const
void AddImportanceGeometryCell (G4double importance, const G4GeometryCell &gCell)
void AddImportanceGeometryCell (G4double importance, const G4VPhysicalVolume &, G4int aRepNum=0)
void ChangeImportance (G4double importance, const G4GeometryCell &gCell)
void ChangeImportance (G4double importance, const G4VPhysicalVolume &, G4int aRepNum=0)
G4double GetImportance (const G4VPhysicalVolume &vol, G4int rpNum=0) const
Public Member Functions inherited from G4VIStore
 G4VIStore ()=default
virtual ~G4VIStore ()=default

Static Public Member Functions

static G4IStoreGetInstance ()
static G4IStoreGetInstance (const G4String &ParallelWorldName)

Detailed Description

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.

Definition at line 59 of file G4IStore.hh.

Member Function Documentation

◆ AddImportanceGeometryCell() [1/2]

void G4IStore::AddImportanceGeometryCell ( G4double importance,
const G4GeometryCell & gCell )

Methods to add a "cell" together with an importance value to the store.

Definition at line 107 of file G4IStore.cc.

109{
110 if (importance < 0 )
111 {
112 Error("AddImportanceGeometryCell() - Invalid importance value given.");
113 }
114 if (!IsInWorld(gCell.GetPhysicalVolume()) )
115 {
116 Error("AddImportanceGeometryCell() - Physical volume not found!");
117 }
118 SetInternalIterator(gCell);
119 if (fCurrentIterator != fGeometryCelli.cend())
120 {
121 Error("AddImportanceGeometryCell() - Region already existing!");
122 }
123 fGeometryCelli[gCell] = importance;
124}
const G4VPhysicalVolume & GetPhysicalVolume() const

Referenced by AddImportanceGeometryCell().

◆ AddImportanceGeometryCell() [2/2]

void G4IStore::AddImportanceGeometryCell ( G4double importance,
const G4VPhysicalVolume & aVolume,
G4int aRepNum = 0 )

Definition at line 126 of file G4IStore.cc.

129{
130 AddImportanceGeometryCell(importance, G4GeometryCell(aVolume, aRepNum));
131}
void AddImportanceGeometryCell(G4double importance, const G4GeometryCell &gCell)
Definition G4IStore.cc:107

◆ ChangeImportance() [1/2]

void G4IStore::ChangeImportance ( G4double importance,
const G4GeometryCell & gCell )

Methods to change an importance value of a "cell".

Definition at line 133 of file G4IStore.cc.

135{
136 if (importance < 0 )
137 {
138 Error("ChangeImportance() - Invalid importance value given.");
139 }
140 if (!IsInWorld(gCell.GetPhysicalVolume()))
141 {
142 Error("ChangeImportance() - Physical volume not found!");
143 }
144 SetInternalIterator(gCell);
145 if (fCurrentIterator == fGeometryCelli.cend())
146 {
147 Error("ChangeImportance() - Region does not exist!");
148 }
149 fGeometryCelli[gCell] = importance;
150
151}

Referenced by ChangeImportance().

◆ ChangeImportance() [2/2]

void G4IStore::ChangeImportance ( G4double importance,
const G4VPhysicalVolume & aVolume,
G4int aRepNum = 0 )

Definition at line 153 of file G4IStore.cc.

156{
157 ChangeImportance(importance, G4GeometryCell(aVolume, aRepNum));
158}
void ChangeImportance(G4double importance, const G4GeometryCell &gCell)
Definition G4IStore.cc:133

◆ Clear()

void G4IStore::Clear ( )

Clears the cells importance store.

Definition at line 69 of file G4IStore.cc.

70{
71 fGeometryCelli.clear();
72}

◆ GetImportance() [1/2]

G4double G4IStore::GetImportance ( const G4GeometryCell & gCell) const
overridevirtual

Returns the importance value of a "cell" from the store addressed by 'gCell'.

Parameters
[in]gCellThe cell of reference.
Returns
The associated importance weight.

Implements G4VIStore.

Definition at line 177 of file G4IStore.cc.

178{
179 G4AutoLock l(&IStoreMutex);
180 SetInternalIterator(gCell);
181 auto gCellIterator = fCurrentIterator;
182 if (gCellIterator == fGeometryCelli.cend())
183 {
184 std::ostringstream err_mess;
185 err_mess << "GetImportance() - Region does not exist!" << G4endl
186 << "Geometry cell, " << gCell
187 << ", not found in: " << fGeometryCelli << ".";
188 Error(err_mess.str());
189 return 0.;
190 }
191 G4double importance_value = (*fCurrentIterator).second;
192 l.unlock();
193
194 return importance_value;
195}
G4TemplateAutoLock< G4Mutex > G4AutoLock
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67

◆ GetImportance() [2/2]

G4double G4IStore::GetImportance ( const G4VPhysicalVolume & vol,
G4int rpNum = 0 ) const

Returns the importance weight, given the volume and replica number.

Definition at line 160 of file G4IStore.cc.

162{
163 G4AutoLock l(&IStoreMutex);
164 SetInternalIterator(G4GeometryCell(aVolume, aRepNum));
165 auto gCellIterator = fCurrentIterator;
166 if (gCellIterator == fGeometryCelli.cend())
167 {
168 Error("GetImportance() - Region does not exist!");
169 return 0.;
170 }
171 G4double importance_value = (*fCurrentIterator).second;
172 l.unlock();
173
174 return importance_value;
175}

◆ GetInstance() [1/2]

G4IStore * G4IStore::GetInstance ( )
static

Returns a pointer to the singleton instance of the class.

Definition at line 232 of file G4IStore.cc.

233{
234 if (fInstance == nullptr)
235 {
236#ifdef G4VERBOSE
237 G4cout << "G4IStore:: Creating new MASS IStore " << G4endl;
238#endif
239 fInstance = new G4IStore();
240 }
241 return fInstance;
242}
G4GLOB_DLL std::ostream G4cout

Referenced by G4ImportanceBiasing::ConstructProcess().

◆ GetInstance() [2/2]

G4IStore * G4IStore::GetInstance ( const G4String & ParallelWorldName)
static

Returns a pointer to the singleton instance of the class, given the name of the parallel world of reference.

Definition at line 249 of file G4IStore.cc.

250{
251 if (fInstance == nullptr)
252 {
253#ifdef G4VERBOSE
254 G4cout << "G4IStore:: Creating new Parallel IStore "
255 << ParallelWorldName << G4endl;
256#endif
257 fInstance = new G4IStore(ParallelWorldName);
258 }
259 return fInstance;
260}

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4IStore::GetParallelWorldVolumePointer ( ) const

Returns a pointer to the world volume of the "importance" geometry.

Definition at line 97 of file G4IStore.cc.

98{
99 return fWorldVolume;
100}

◆ GetWorldVolume()

const G4VPhysicalVolume & G4IStore::GetWorldVolume ( ) const
overridevirtual

Returns a reference to the world volume of the "importance" geometry.

Implements G4VIStore.

Definition at line 92 of file G4IStore.cc.

93{
94 return *fWorldVolume;
95}

◆ IsKnown()

G4bool G4IStore::IsKnown ( const G4GeometryCell & gCell) const
overridevirtual

Returns true if 'gCell' is in the store, else false.

Parameters
[in]gCellThe cell of reference.
Returns
true if present in the store, false otherwise.

Implements G4VIStore.

Definition at line 197 of file G4IStore.cc.

198{
199 G4AutoLock l(&IStoreMutex);
200 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
201
202 if ( inWorldKnown )
203 {
204 SetInternalIterator(gCell);
205 inWorldKnown = (fCurrentIterator != fGeometryCelli.cend());
206 }
207 l.unlock();
208
209 return inWorldKnown;
210}
bool G4bool
Definition G4Types.hh:86

◆ SetParallelWorldVolume()

void G4IStore::SetParallelWorldVolume ( const G4String & paraName)

Sets a reference to parallel world volume of the "importance" geometry.

Definition at line 83 of file G4IStore.cc.

84{
85 G4cout << " G4IStore:: SetParallelWorldVolume " << G4endl;
87 ->GetParallelWorld(paraName);
88 G4cout << " ParallelWorld volume is: " << fWorldVolume->GetName() << G4endl;
89 // fGeometryCelli = new G4GeometryCellImportance;
90}
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
static G4TransportationManager * GetTransportationManager()
const G4String & GetName() const

◆ SetWorldVolume()

void G4IStore::SetWorldVolume ( )

Sets a reference to world volume of the "importance" geometry.

Definition at line 74 of file G4IStore.cc.

75{
76 G4cout << " G4IStore:: SetWorldVolume " << G4endl;
79 G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
80 // fGeometryCelli = new G4GeometryCellImportance;
81}
G4VPhysicalVolume * GetWorldVolume() const
G4Navigator * GetNavigatorForTracking() const

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