Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4IStore Class Reference

#include <G4IStore.hh>

Inheritance diagram for G4IStore:
G4VIStore

Public Member Functions

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)
 
void Clear ()
 
virtual G4double GetImportance (const G4GeometryCell &gCell) const
 
G4double GetImportance (const G4VPhysicalVolume &, G4int aRepNum=0) const
 
virtual const G4VPhysicalVolumeGetParallelWorldVolumePointer () const
 
virtual const G4VPhysicalVolumeGetWorldVolume () const
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const
 
void SetParallelWorldVolume (const G4String &paraName)
 
void SetWorldVolume ()
 

Static Public Member Functions

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

Protected Member Functions

 G4IStore ()
 
 G4IStore (const G4String &ParallelWorldName)
 
 ~G4IStore ()
 

Private Member Functions

void Error (const G4String &m) const
 
G4bool IsInWorld (const G4VPhysicalVolume &) const
 
void SetInternalIterator (const G4GeometryCell &gCell) const
 

Private Attributes

G4GeometryCellImportance::const_iterator fCurrentIterator
 
G4GeometryCellImportance fGeometryCelli
 
const G4VPhysicalVolumefWorldVolume = nullptr
 

Static Private Attributes

static G4ThreadLocal G4IStorefInstance = nullptr
 

Detailed Description

Definition at line 49 of file G4IStore.hh.

Constructor & Destructor Documentation

◆ G4IStore() [1/2]

G4IStore::G4IStore ( )
explicitprotected

Definition at line 48 of file G4IStore.cc.

50 ->GetNavigatorForTracking()->GetWorldVolume())
51{
52}
const G4VPhysicalVolume * fWorldVolume
Definition: G4IStore.hh:112
virtual const G4VPhysicalVolume & GetWorldVolume() const
Definition: G4IStore.cc:93
static G4TransportationManager * GetTransportationManager()

Referenced by GetInstance().

◆ G4IStore() [2/2]

G4IStore::G4IStore ( const G4String ParallelWorldName)
explicitprotected

Definition at line 54 of file G4IStore.cc.

56 ->GetParallelWorld(ParallelWorldName))
57{
58#ifdef G4VERBOSE
59 G4cout << " G4IStore:: ParallelWorldName = "
60 << ParallelWorldName << G4endl;
61 G4cout << " G4IStore:: fParallelWorldVolume = "
63#endif
64}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const

References fWorldVolume, G4cout, G4endl, and G4VPhysicalVolume::GetName().

◆ ~G4IStore()

G4IStore::~G4IStore ( )
protected

Definition at line 66 of file G4IStore.cc.

67{
68}

Member Function Documentation

◆ AddImportanceGeometryCell() [1/2]

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

Definition at line 108 of file G4IStore.cc.

110{
111 if (importance < 0 )
112 {
113 Error("AddImportanceGeometryCell() - Invalid importance value given.");
114 }
115 if (!IsInWorld(gCell.GetPhysicalVolume()) )
116 {
117 Error("AddImportanceGeometryCell() - Physical volume not found!");
118 }
119 SetInternalIterator(gCell);
120 if (fCurrentIterator != fGeometryCelli.cend())
121 {
122 Error("AddImportanceGeometryCell() - Region already existing!");
123 }
124 fGeometryCelli[gCell] = importance;
125}
const G4VPhysicalVolume & GetPhysicalVolume() const
void SetInternalIterator(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:103
void Error(const G4String &m) const
Definition: G4IStore.cc:233
G4GeometryCellImportance fGeometryCelli
Definition: G4IStore.hh:113
G4GeometryCellImportance::const_iterator fCurrentIterator
Definition: G4IStore.hh:115
G4bool IsInWorld(const G4VPhysicalVolume &) const
Definition: G4IStore.cc:223

References Error(), fCurrentIterator, fGeometryCelli, G4GeometryCell::GetPhysicalVolume(), IsInWorld(), and SetInternalIterator().

Referenced by AddImportanceGeometryCell().

◆ AddImportanceGeometryCell() [2/2]

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

Definition at line 127 of file G4IStore.cc.

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

References AddImportanceGeometryCell().

◆ ChangeImportance() [1/2]

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

Definition at line 134 of file G4IStore.cc.

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

References Error(), fCurrentIterator, fGeometryCelli, G4GeometryCell::GetPhysicalVolume(), IsInWorld(), and SetInternalIterator().

Referenced by ChangeImportance().

◆ ChangeImportance() [2/2]

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

Definition at line 154 of file G4IStore.cc.

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

References ChangeImportance().

◆ Clear()

void G4IStore::Clear ( )

Definition at line 70 of file G4IStore.cc.

71{
72 fGeometryCelli.clear();
73}

References fGeometryCelli.

◆ Error()

void G4IStore::Error ( const G4String m) const
private

Definition at line 233 of file G4IStore.cc.

234{
235 G4Exception("G4IStore::Error()", "GeomBias0002", FatalException, msg);
236}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

References FatalException, and G4Exception().

Referenced by AddImportanceGeometryCell(), ChangeImportance(), and GetImportance().

◆ GetImportance() [1/2]

G4double G4IStore::GetImportance ( const G4GeometryCell gCell) const
virtual

Implements G4VIStore.

Definition at line 181 of file G4IStore.cc.

182{
183#ifdef G4MULTITHREADED
184 G4MUTEXLOCK(&G4IStore::IStoreMutex);
185#endif
186 SetInternalIterator(gCell);
187 auto gCellIterator = fCurrentIterator;
188 if (gCellIterator == fGeometryCelli.cend())
189 {
190 std::ostringstream err_mess;
191 err_mess << "GetImportance() - Region does not exist!" << G4endl
192 << "Geometry cell, " << gCell
193 << ", not found in: " << fGeometryCelli << ".";
194 Error(err_mess.str());
195 return 0.;
196 }
197 G4double importance_value = (*fCurrentIterator).second;
198#ifdef G4MULTITHREADED
199 G4MUTEXUNLOCK(&G4IStore::IStoreMutex);
200#endif
201 return importance_value;
202 // return (*fCurrentIterator).second;
203}
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
double G4double
Definition: G4Types.hh:83

References Error(), fCurrentIterator, fGeometryCelli, G4endl, G4MUTEXLOCK, G4MUTEXUNLOCK, and SetInternalIterator().

◆ GetImportance() [2/2]

G4double G4IStore::GetImportance ( const G4VPhysicalVolume aVolume,
G4int  aRepNum = 0 
) const

Definition at line 161 of file G4IStore.cc.

163{
164#ifdef G4MULTITHREADED
165 G4MUTEXLOCK(&G4IStore::IStoreMutex);
166#endif
167 SetInternalIterator(G4GeometryCell(aVolume, aRepNum));
168 auto gCellIterator = fCurrentIterator;
169 if (gCellIterator == fGeometryCelli.cend())
170 {
171 Error("GetImportance() - Region does not exist!");
172 return 0.;
173 }
174 G4double importance_value = (*fCurrentIterator).second;
175#ifdef G4MULTITHREADED
176 G4MUTEXUNLOCK(&G4IStore::IStoreMutex);
177#endif
178 return importance_value;
179}

References Error(), fCurrentIterator, fGeometryCelli, G4MUTEXLOCK, G4MUTEXUNLOCK, and SetInternalIterator().

◆ GetInstance() [1/2]

G4IStore * G4IStore::GetInstance ( )
static

Definition at line 243 of file G4IStore.cc.

244{
245 if (fInstance == nullptr)
246 {
247#ifdef G4VERBOSE
248 G4cout << "G4IStore:: Creating new MASS IStore " << G4endl;
249#endif
250 fInstance = new G4IStore();
251 }
252 return fInstance;
253}
static G4ThreadLocal G4IStore * fInstance
Definition: G4IStore.hh:117
G4IStore()
Definition: G4IStore.cc:48

References fInstance, G4cout, G4endl, and G4IStore().

Referenced by G4ImportanceBiasing::ConstructProcess().

◆ GetInstance() [2/2]

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

Definition at line 260 of file G4IStore.cc.

261{
262 if (fInstance == nullptr)
263 {
264#ifdef G4VERBOSE
265 G4cout << "G4IStore:: Creating new Parallel IStore "
266 << ParallelWorldName << G4endl;
267#endif
268 fInstance = new G4IStore(ParallelWorldName);
269 }
270 return fInstance;
271}

References fInstance, G4cout, G4endl, and G4IStore().

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4IStore::GetParallelWorldVolumePointer ( ) const
virtual

Definition at line 98 of file G4IStore.cc.

99{
100 return fWorldVolume;
101}

References fWorldVolume.

◆ GetWorldVolume()

const G4VPhysicalVolume & G4IStore::GetWorldVolume ( ) const
virtual

Implements G4VIStore.

Definition at line 93 of file G4IStore.cc.

94{
95 return *fWorldVolume;
96}

References fWorldVolume.

◆ IsInWorld()

G4bool G4IStore::IsInWorld ( const G4VPhysicalVolume aVolume) const
private

Definition at line 223 of file G4IStore.cc.

224{
225 G4bool isIn(true);
226 if (!(aVolume == *fWorldVolume))
227 {
228 isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
229 }
230 return isIn;
231}
bool G4bool
Definition: G4Types.hh:86
G4bool IsAncestor(const G4VPhysicalVolume *p) const
G4LogicalVolume * GetLogicalVolume() const

References fWorldVolume, G4VPhysicalVolume::GetLogicalVolume(), and G4LogicalVolume::IsAncestor().

Referenced by AddImportanceGeometryCell(), ChangeImportance(), and IsKnown().

◆ IsKnown()

G4bool G4IStore::IsKnown ( const G4GeometryCell gCell) const
virtual

Implements G4VIStore.

Definition at line 205 of file G4IStore.cc.

206{
207#ifdef G4MULTITHREADED
208 G4MUTEXLOCK(&G4IStore::IStoreMutex);
209#endif
210 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
211
212 if ( inWorldKnown )
213 {
214 SetInternalIterator(gCell);
215 inWorldKnown = (fCurrentIterator != fGeometryCelli.cend());
216 }
217#ifdef G4MULTITHREADED
218 G4MUTEXUNLOCK(&G4IStore::IStoreMutex);
219#endif
220 return inWorldKnown;
221}

References fCurrentIterator, fGeometryCelli, G4MUTEXLOCK, G4MUTEXUNLOCK, G4GeometryCell::GetPhysicalVolume(), IsInWorld(), and SetInternalIterator().

◆ SetInternalIterator()

void G4IStore::SetInternalIterator ( const G4GeometryCell gCell) const
private

Definition at line 103 of file G4IStore.cc.

104{
105 fCurrentIterator = fGeometryCelli.find(gCell);
106}

References fCurrentIterator, and fGeometryCelli.

Referenced by AddImportanceGeometryCell(), ChangeImportance(), GetImportance(), and IsKnown().

◆ SetParallelWorldVolume()

void G4IStore::SetParallelWorldVolume ( const G4String paraName)

Definition at line 84 of file G4IStore.cc.

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

References fWorldVolume, G4cout, G4endl, G4VPhysicalVolume::GetName(), G4TransportationManager::GetParallelWorld(), and G4TransportationManager::GetTransportationManager().

◆ SetWorldVolume()

void G4IStore::SetWorldVolume ( )

Definition at line 75 of file G4IStore.cc.

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

References fWorldVolume, G4cout, G4endl, G4VPhysicalVolume::GetName(), G4TransportationManager::GetNavigatorForTracking(), G4TransportationManager::GetTransportationManager(), and G4Navigator::GetWorldVolume().

Field Documentation

◆ fCurrentIterator

G4GeometryCellImportance::const_iterator G4IStore::fCurrentIterator
mutableprivate

◆ fGeometryCelli

G4GeometryCellImportance G4IStore::fGeometryCelli
private

◆ fInstance

G4ThreadLocal G4IStore * G4IStore::fInstance = nullptr
staticprivate

Definition at line 117 of file G4IStore.hh.

Referenced by GetInstance().

◆ fWorldVolume

const G4VPhysicalVolume* G4IStore::fWorldVolume = nullptr
private

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