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

#include <G4WeightWindowStore.hh>

+ Inheritance diagram for G4WeightWindowStore:

Public Member Functions

virtual G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const
 
void Clear ()
 
void SetWorldVolume ()
 
void SetParallelWorldVolume (const G4String &paraName)
 
virtual const G4VPhysicalVolumeGetWorldVolume () const
 
virtual const G4VPhysicalVolumeGetParallelWorldVolumePointer () const
 
void AddLowerWeights (const G4GeometryCell &gCell, const std::vector< G4double > &lowerWeights)
 
void AddUpperEboundLowerWeightPairs (const G4GeometryCell &gCell, const G4UpperEnergyToLowerWeightMap &enWeMap)
 
void SetGeneralUpperEnergyBounds (const std::set< G4double, std::less< G4double > > &enBounds)
 
- Public Member Functions inherited from G4VWeightWindowStore
 G4VWeightWindowStore ()
 
virtual ~G4VWeightWindowStore ()
 
virtual G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const =0
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const =0
 
virtual const G4VPhysicalVolumeGetWorldVolume () const =0
 

Static Public Member Functions

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

Protected Member Functions

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

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()),
47 fGeneralUpperEnergyBounds(),
48 fCellToUpEnBoundLoWePairsMap(),
49 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
50{
51}
static G4TransportationManager * GetTransportationManager()
virtual const G4VPhysicalVolume & GetWorldVolume() const

Referenced by GetInstance().

◆ G4WeightWindowStore() [2/2]

G4WeightWindowStore::G4WeightWindowStore ( const G4String ParallelWorldName)
explicitprotected

Definition at line 53 of file G4WeightWindowStore.cc.

56 ->GetParallelWorld(ParallelWorldName)),
57 fGeneralUpperEnergyBounds(),
58 fCellToUpEnBoundLoWePairsMap(),
59 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
60{
61}

◆ ~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 }
192 fCellToUpEnBoundLoWePairsMap[gCell] = map;
193}
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
int G4int
Definition: G4Types.hh:85
virtual G4bool IsKnown(const G4GeometryCell &gCell) const

◆ 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}

◆ Clear()

void G4WeightWindowStore::Clear ( )

Definition at line 131 of file G4WeightWindowStore.cc.

132{
133 fCellToUpEnBoundLoWePairsMap.clear();
134}

◆ GetInstance() [1/2]

G4WeightWindowStore * G4WeightWindowStore::GetInstance ( )
static

Definition at line 233 of file G4WeightWindowStore.cc.

234{
235 if (fInstance == nullptr)
236 {
237 fInstance = new G4WeightWindowStore();
238 }
239 return fInstance;
240}

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

◆ GetLowerWeight()

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

Implements G4VWeightWindowStore.

Definition at line 68 of file G4WeightWindowStore.cc.

71{
72 SetInternalIterator(gCell);
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

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4WeightWindowStore::GetParallelWorldVolumePointer ( ) const
virtual

Definition at line 157 of file G4WeightWindowStore.cc.

159{
160 return fWorldVolume;
161}

◆ GetWorldVolume()

const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
virtual

Implements G4VWeightWindowStore.

Definition at line 152 of file G4WeightWindowStore.cc.

153{
154 return *fWorldVolume;
155}

◆ 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

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}

◆ 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)

◆ 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

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