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

#include <G4WeightWindowStore.hh>

Inheritance diagram for G4WeightWindowStore:
G4VWeightWindowStore

Public Member Functions

void AddLowerWeights (const G4GeometryCell &gCell, const std::vector< G4double > &lowerWeights)
 
void AddUpperEboundLowerWeightPairs (const G4GeometryCell &gCell, const G4UpperEnergyToLowerWeightMap &enWeMap)
 
void Clear ()
 
virtual G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const
 
virtual const G4VPhysicalVolumeGetParallelWorldVolumePointer () const
 
virtual const G4VPhysicalVolumeGetWorldVolume () const
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const
 
void SetGeneralUpperEnergyBounds (const std::set< G4double, std::less< G4double > > &enBounds)
 
void SetParallelWorldVolume (const G4String &paraName)
 
void SetWorldVolume ()
 

Static Public Member Functions

static G4WeightWindowStoreGetInstance ()
 
static G4WeightWindowStoreGetInstance (const G4String &ParallelWorldName)
 

Protected Member Functions

 G4WeightWindowStore ()
 
 G4WeightWindowStore (const G4String &ParallelWorldName)
 
 ~G4WeightWindowStore ()
 

Private Member Functions

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

Private Attributes

G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
 
G4GeometryCellWeight::const_iterator fCurrentIterator
 
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
 
const G4VPhysicalVolumefWorldVolume = nullptr
 

Static Private Attributes

static G4ThreadLocal G4WeightWindowStorefInstance = nullptr
 

Detailed Description

Definition at line 45 of file G4WeightWindowStore.hh.

Constructor & Destructor Documentation

◆ G4WeightWindowStore() [1/2]

G4WeightWindowStore::G4WeightWindowStore ( )
explicitprotected

Definition at line 43 of file G4WeightWindowStore.cc.

46 ->GetNavigatorForTracking()->GetWorldVolume()),
50{
51}
static G4TransportationManager * GetTransportationManager()
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
virtual const G4VPhysicalVolume & GetWorldVolume() const
G4GeometryCellWeight::const_iterator fCurrentIterator
const G4VPhysicalVolume * fWorldVolume

Referenced by GetInstance().

◆ G4WeightWindowStore() [2/2]

G4WeightWindowStore::G4WeightWindowStore ( const G4String ParallelWorldName)
explicitprotected

◆ ~G4WeightWindowStore()

G4WeightWindowStore::~G4WeightWindowStore ( )
protected

Definition at line 63 of file G4WeightWindowStore.cc.

65{
66}

Member Function Documentation

◆ AddLowerWeights()

void G4WeightWindowStore::AddLowerWeights ( const G4GeometryCell gCell,
const std::vector< G4double > &  lowerWeights 
)

Definition at line 163 of file G4WeightWindowStore.cc.

166{
167 if (fGeneralUpperEnergyBounds.empty())
168 {
169 Error("AddLowerWeights() - No general upper energy limits set!");
170 }
171 if (IsKnown(gCell))
172 {
173 Error("AddLowerWeights() - Cell already in the store.");
174 }
175 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
176 {
177 std::ostringstream err_mess;
178 err_mess << "AddLowerWeights() - Mismatch between "
179 << "number of lower weights (" << lowerWeights.size()
180 << ") and energy bounds (" << fGeneralUpperEnergyBounds.size()
181 << ")!";
182 Error(err_mess.str());
183 }
185 G4int i = 0;
186 for (auto it = fGeneralUpperEnergyBounds.cbegin();
187 it != fGeneralUpperEnergyBounds.cend(); ++it)
188 {
189 map[*it] = lowerWeights[i];
190 ++i;
191 }
193}
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
int G4int
Definition: G4Types.hh:85
void Error(const G4String &m) const
virtual G4bool IsKnown(const G4GeometryCell &gCell) const

References Error(), fCellToUpEnBoundLoWePairsMap, fGeneralUpperEnergyBounds, IsKnown(), and anonymous_namespace{G4QuasiElRatios.cc}::map.

◆ AddUpperEboundLowerWeightPairs()

void G4WeightWindowStore::AddUpperEboundLowerWeightPairs ( const G4GeometryCell gCell,
const G4UpperEnergyToLowerWeightMap enWeMap 
)

Definition at line 195 of file G4WeightWindowStore.cc.

198{
199 if (IsKnown(gCell))
200 {
201 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
202 }
203 if (IsKnown(gCell))
204 {
205 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
206 }
207 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
208
209}

References Error(), fCellToUpEnBoundLoWePairsMap, and IsKnown().

◆ Clear()

void G4WeightWindowStore::Clear ( )

Definition at line 131 of file G4WeightWindowStore.cc.

132{
134}

References fCellToUpEnBoundLoWePairsMap.

◆ Error()

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

Definition at line 222 of file G4WeightWindowStore.cc.

223{
224 G4Exception("G4WeightWindowStore::Error()",
225 "GeomBias0002", FatalException, msg);
226}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

References FatalException, and G4Exception().

Referenced by AddLowerWeights(), AddUpperEboundLowerWeightPairs(), GetLowerWeight(), and SetGeneralUpperEnergyBounds().

◆ GetInstance() [1/2]

G4WeightWindowStore * G4WeightWindowStore::GetInstance ( )
static

Definition at line 233 of file G4WeightWindowStore.cc.

234{
235 if (fInstance == nullptr)
236 {
238 }
239 return fInstance;
240}
static G4ThreadLocal G4WeightWindowStore * fInstance

References fInstance, and G4WeightWindowStore().

Referenced by G4WeightWindowBiasing::ConstructProcess().

◆ GetInstance() [2/2]

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

Definition at line 247 of file G4WeightWindowStore.cc.

249{
250 if (fInstance == nullptr)
251 {
252#ifdef G4VERBOSE
253 G4cout << "G4IStore:: Creating new Parallel IStore "
254 << ParallelWorldName << G4endl;
255#endif
256 fInstance = new G4WeightWindowStore(ParallelWorldName);
257 }
258 return fInstance;
259}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

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

◆ GetLowerWeight()

G4double G4WeightWindowStore::GetLowerWeight ( const G4GeometryCell gCell,
G4double  partEnergy 
) const
virtual

Implements G4VWeightWindowStore.

Definition at line 68 of file G4WeightWindowStore.cc.

71{
73 auto gCellIterator = fCurrentIterator;
74 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
75 {
76 Error("GetLowerWitgh() - Cell does not exist!");
77 return 0.;
78 }
79 G4UpperEnergyToLowerWeightMap upEnLoWeiPairs = fCurrentIterator->second;
80 G4double lowerWeight = -1;
81 G4bool found = false;
82 for (auto it = upEnLoWeiPairs.cbegin(); it != upEnLoWeiPairs.cend(); ++it)
83 {
84 if (partEnergy < it->first)
85 {
86 lowerWeight = it->second;
87 found = true;
88 break;
89 }
90 }
91 if (!found)
92 {
93 std::ostringstream err_mess;
94 err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl
95 << "Energy: " << partEnergy << ".";
96 Error(err_mess.str());
97 }
98 return lowerWeight;
99}
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
void SetInternalIterator(const G4GeometryCell &gCell) const

References Error(), fCellToUpEnBoundLoWePairsMap, fCurrentIterator, G4endl, and SetInternalIterator().

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4WeightWindowStore::GetParallelWorldVolumePointer ( ) const
virtual

Definition at line 157 of file G4WeightWindowStore.cc.

159{
160 return fWorldVolume;
161}

References fWorldVolume.

◆ GetWorldVolume()

const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
virtual

Implements G4VWeightWindowStore.

Definition at line 152 of file G4WeightWindowStore.cc.

153{
154 return *fWorldVolume;
155}

References fWorldVolume.

◆ IsInWorld()

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

Definition at line 107 of file G4WeightWindowStore.cc.

109{
110 G4bool isIn(true);
111 if (!(aVolume == *fWorldVolume))
112 {
113 isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
114 }
115 return isIn;
116}
G4bool IsAncestor(const G4VPhysicalVolume *p) const
G4LogicalVolume * GetLogicalVolume() const

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

Referenced by IsKnown().

◆ IsKnown()

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

Implements G4VWeightWindowStore.

Definition at line 118 of file G4WeightWindowStore.cc.

120{
121 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
122
123 if ( inWorldKnown )
124 {
125 SetInternalIterator(gCell);
126 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
127 }
128 return inWorldKnown;
129}
const G4VPhysicalVolume & GetPhysicalVolume() const
G4bool IsInWorld(const G4VPhysicalVolume &) const

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

Referenced by AddLowerWeights(), and AddUpperEboundLowerWeightPairs().

◆ SetGeneralUpperEnergyBounds()

void G4WeightWindowStore::SetGeneralUpperEnergyBounds ( const std::set< G4double, std::less< G4double > > &  enBounds)

Definition at line 211 of file G4WeightWindowStore.cc.

214{
215 if (!fGeneralUpperEnergyBounds.empty())
216 {
217 Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
218 }
219 fGeneralUpperEnergyBounds = enBounds;
220}

References Error(), and fGeneralUpperEnergyBounds.

◆ SetInternalIterator()

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

Definition at line 101 of file G4WeightWindowStore.cc.

103{
105}

References fCellToUpEnBoundLoWePairsMap, and fCurrentIterator.

Referenced by GetLowerWeight(), and IsKnown().

◆ SetParallelWorldVolume()

void G4WeightWindowStore::SetParallelWorldVolume ( const G4String paraName)

Definition at line 145 of file G4WeightWindowStore.cc.

146{
148 ->GetParallelWorld(paraName);
149 // fGeometryCelli = new G4GeometryCellImportance;
150}
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)

References fWorldVolume, G4TransportationManager::GetParallelWorld(), and G4TransportationManager::GetTransportationManager().

◆ SetWorldVolume()

void G4WeightWindowStore::SetWorldVolume ( )

Definition at line 136 of file G4WeightWindowStore.cc.

137{
138 G4cout << " G4IStore:: SetWorldVolume " << G4endl;
141 G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
142 // fGeometryCelli = new G4GeometryCellImportance;
143}
G4VPhysicalVolume * GetWorldVolume() const
G4Navigator * GetNavigatorForTracking() const
const G4String & GetName() const

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

Field Documentation

◆ fCellToUpEnBoundLoWePairsMap

G4GeometryCellWeight G4WeightWindowStore::fCellToUpEnBoundLoWePairsMap
private

◆ fCurrentIterator

G4GeometryCellWeight::const_iterator G4WeightWindowStore::fCurrentIterator
mutableprivate

Definition at line 107 of file G4WeightWindowStore.hh.

Referenced by GetLowerWeight(), IsKnown(), and SetInternalIterator().

◆ fGeneralUpperEnergyBounds

std::set<G4double, std::less<G4double> > G4WeightWindowStore::fGeneralUpperEnergyBounds
private

Definition at line 105 of file G4WeightWindowStore.hh.

Referenced by AddLowerWeights(), and SetGeneralUpperEnergyBounds().

◆ fInstance

G4ThreadLocal G4WeightWindowStore * G4WeightWindowStore::fInstance = nullptr
staticprivate

Definition at line 109 of file G4WeightWindowStore.hh.

Referenced by GetInstance().

◆ fWorldVolume

const G4VPhysicalVolume* G4WeightWindowStore::fWorldVolume = nullptr
private

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