Geant4 11.2.2
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

G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const override
 
G4bool IsKnown (const G4GeometryCell &gCell) const override
 
void Clear ()
 
void SetWorldVolume ()
 
void SetParallelWorldVolume (const G4String &paraName)
 
const G4VPhysicalVolumeGetWorldVolume () const override
 
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 ()
 

Static Public Member Functions

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

Protected Member Functions

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

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 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
48{
49}
static G4TransportationManager * GetTransportationManager()
const G4VPhysicalVolume & GetWorldVolume() const override

Referenced by GetInstance(), and GetInstance().

◆ G4WeightWindowStore() [2/2]

G4WeightWindowStore::G4WeightWindowStore ( const G4String & ParallelWorldName)
explicitprotected

Definition at line 51 of file G4WeightWindowStore.cc.

54 ->GetParallelWorld(ParallelWorldName)),
55 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
56{
57}

◆ ~G4WeightWindowStore()

G4WeightWindowStore::~G4WeightWindowStore ( )
overrideprotecteddefault

Member Function Documentation

◆ AddLowerWeights()

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

Definition at line 156 of file G4WeightWindowStore.cc.

159{
160 if (fGeneralUpperEnergyBounds.empty())
161 {
162 Error("AddLowerWeights() - No general upper energy limits set!");
163 }
164 if (IsKnown(gCell))
165 {
166 Error("AddLowerWeights() - Cell already in the store.");
167 }
168 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
169 {
170 std::ostringstream err_mess;
171 err_mess << "AddLowerWeights() - Mismatch between "
172 << "number of lower weights (" << lowerWeights.size()
173 << ") and energy bounds (" << fGeneralUpperEnergyBounds.size()
174 << ")!";
175 Error(err_mess.str());
176 }
178 G4int i = 0;
179 for (G4double fGeneralUpperEnergyBound : fGeneralUpperEnergyBounds)
180 {
181 map[fGeneralUpperEnergyBound] = lowerWeights[i];
182 ++i;
183 }
184 fCellToUpEnBoundLoWePairsMap[gCell] = map;
185}
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
G4bool IsKnown(const G4GeometryCell &gCell) const override

◆ AddUpperEboundLowerWeightPairs()

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

Definition at line 187 of file G4WeightWindowStore.cc.

190{
191 if (IsKnown(gCell))
192 {
193 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
194 }
195 if (IsKnown(gCell))
196 {
197 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
198 }
199 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
200
201}

◆ Clear()

void G4WeightWindowStore::Clear ( )

Definition at line 124 of file G4WeightWindowStore.cc.

125{
126 fCellToUpEnBoundLoWePairsMap.clear();
127}

◆ GetInstance() [1/2]

G4WeightWindowStore * G4WeightWindowStore::GetInstance ( )
static

Definition at line 225 of file G4WeightWindowStore.cc.

226{
227 if (fInstance == nullptr)
228 {
229 fInstance = new G4WeightWindowStore();
230 }
231 return fInstance;
232}

Referenced by G4WeightWindowBiasing::ConstructProcess().

◆ GetInstance() [2/2]

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

Definition at line 239 of file G4WeightWindowStore.cc.

241{
242 if (fInstance == nullptr)
243 {
244#ifdef G4VERBOSE
245 G4cout << "G4IStore:: Creating new Parallel IStore "
246 << ParallelWorldName << G4endl;
247#endif
248 fInstance = new G4WeightWindowStore(ParallelWorldName);
249 }
250 return fInstance;
251}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

◆ GetLowerWeight()

G4double G4WeightWindowStore::GetLowerWeight ( const G4GeometryCell & gCell,
G4double partEnergy ) const
overridevirtual

Implements G4VWeightWindowStore.

Definition at line 61 of file G4WeightWindowStore.cc.

64{
65 SetInternalIterator(gCell);
66 auto gCellIterator = fCurrentIterator;
67 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
68 {
69 Error("GetLowerWitgh() - Cell does not exist!");
70 return 0.;
71 }
72 G4UpperEnergyToLowerWeightMap upEnLoWeiPairs = fCurrentIterator->second;
73 G4double lowerWeight = -1;
74 G4bool found = false;
75 for (const auto & upEnLoWeiPair : upEnLoWeiPairs)
76 {
77 if (partEnergy < upEnLoWeiPair.first)
78 {
79 lowerWeight = upEnLoWeiPair.second;
80 found = true;
81 break;
82 }
83 }
84 if (!found)
85 {
86 std::ostringstream err_mess;
87 err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl
88 << "Energy: " << partEnergy << ".";
89 Error(err_mess.str());
90 }
91 return lowerWeight;
92}
bool G4bool
Definition G4Types.hh:86

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4WeightWindowStore::GetParallelWorldVolumePointer ( ) const
virtual

Definition at line 150 of file G4WeightWindowStore.cc.

152{
153 return fWorldVolume;
154}

◆ GetWorldVolume()

const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
overridevirtual

Implements G4VWeightWindowStore.

Definition at line 145 of file G4WeightWindowStore.cc.

146{
147 return *fWorldVolume;
148}

◆ IsKnown()

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

Implements G4VWeightWindowStore.

Definition at line 111 of file G4WeightWindowStore.cc.

113{
114 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
115
116 if ( inWorldKnown )
117 {
118 SetInternalIterator(gCell);
119 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
120 }
121 return inWorldKnown;
122}
const G4VPhysicalVolume & GetPhysicalVolume() const

Referenced by AddLowerWeights(), and AddUpperEboundLowerWeightPairs().

◆ SetGeneralUpperEnergyBounds()

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

Definition at line 203 of file G4WeightWindowStore.cc.

206{
207 if (!fGeneralUpperEnergyBounds.empty())
208 {
209 Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
210 }
211 fGeneralUpperEnergyBounds = enBounds;
212}

◆ SetParallelWorldVolume()

void G4WeightWindowStore::SetParallelWorldVolume ( const G4String & paraName)

Definition at line 138 of file G4WeightWindowStore.cc.

139{
141 ->GetParallelWorld(paraName);
142 // fGeometryCelli = new G4GeometryCellImportance;
143}
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)

◆ SetWorldVolume()

void G4WeightWindowStore::SetWorldVolume ( )

Definition at line 129 of file G4WeightWindowStore.cc.

130{
131 G4cout << " G4IStore:: SetWorldVolume " << G4endl;
134 G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
135 // fGeometryCelli = new G4GeometryCellImportance;
136}
G4VPhysicalVolume * GetWorldVolume() const
G4Navigator * GetNavigatorForTracking() const
const G4String & GetName() const

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