46 ->GetNavigatorForTracking()->GetWorldVolume()),
47 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
54 ->GetParallelWorld(ParallelWorldName)),
55 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
65 SetInternalIterator(gCell);
66 auto gCellIterator = fCurrentIterator;
67 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
69 Error(
"GetLowerWitgh() - Cell does not exist!");
75 for (
const auto & upEnLoWeiPair : upEnLoWeiPairs)
77 if (partEnergy < upEnLoWeiPair.first)
79 lowerWeight = upEnLoWeiPair.second;
86 std::ostringstream err_mess;
87 err_mess <<
"GetLowerWitgh() - Couldn't find lower weight bound." <<
G4endl
88 <<
"Energy: " << partEnergy <<
".";
89 Error(err_mess.str());
94void G4WeightWindowStore::
97 fCurrentIterator = fCellToUpEnBoundLoWePairsMap.find(gCell);
100G4bool G4WeightWindowStore::
104 if (!(aVolume == *fWorldVolume))
118 SetInternalIterator(gCell);
119 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
126 fCellToUpEnBoundLoWePairsMap.clear();
147 return *fWorldVolume;
158 const std::vector<G4double>& lowerWeights)
160 if (fGeneralUpperEnergyBounds.empty())
162 Error(
"AddLowerWeights() - No general upper energy limits set!");
166 Error(
"AddLowerWeights() - Cell already in the store.");
168 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
170 std::ostringstream err_mess;
171 err_mess <<
"AddLowerWeights() - Mismatch between "
172 <<
"number of lower weights (" << lowerWeights.size()
173 <<
") and energy bounds (" << fGeneralUpperEnergyBounds.size()
175 Error(err_mess.str());
179 for (
G4double fGeneralUpperEnergyBound : fGeneralUpperEnergyBounds)
181 map[fGeneralUpperEnergyBound] = lowerWeights[i];
184 fCellToUpEnBoundLoWePairsMap[gCell] = map;
193 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
197 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
199 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
205 std::less<G4double> >& enBounds)
207 if (!fGeneralUpperEnergyBounds.empty())
209 Error(
"SetGeneralUpperEnergyBounds() - Energy bounds already set.");
211 fGeneralUpperEnergyBounds = enBounds;
214void G4WeightWindowStore::Error(
const G4String& msg)
const
227 if (fInstance ==
nullptr)
242 if (fInstance ==
nullptr)
245 G4cout <<
"G4IStore:: Creating new Parallel IStore "
246 << ParallelWorldName <<
G4endl;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
G4GLOB_DLL std::ostream G4cout
const G4VPhysicalVolume & GetPhysicalVolume() const
G4bool IsAncestor(const G4VPhysicalVolume *p) const
G4VPhysicalVolume * GetWorldVolume() const
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
void AddLowerWeights(const G4GeometryCell &gCell, const std::vector< G4double > &lowerWeights)
~G4WeightWindowStore() override
void SetParallelWorldVolume(const G4String ¶Name)
virtual const G4VPhysicalVolume * GetParallelWorldVolumePointer() const
void SetGeneralUpperEnergyBounds(const std::set< G4double, std::less< G4double > > &enBounds)
static G4WeightWindowStore * GetInstance()
G4bool IsKnown(const G4GeometryCell &gCell) const override
const G4VPhysicalVolume & GetWorldVolume() const override
G4double GetLowerWeight(const G4GeometryCell &gCell, G4double partEnergy) const override
void AddUpperEboundLowerWeightPairs(const G4GeometryCell &gCell, const G4UpperEnergyToLowerWeightMap &enWeMap)