46 ->GetNavigatorForTracking()->GetWorldVolume()),
47 fGeneralUpperEnergyBounds(),
48 fCellToUpEnBoundLoWePairsMap(),
49 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
56 ->GetParallelWorld(ParallelWorldName)),
57 fGeneralUpperEnergyBounds(),
58 fCellToUpEnBoundLoWePairsMap(),
59 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
72 SetInternalIterator(gCell);
73 auto gCellIterator = fCurrentIterator;
74 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
76 Error(
"GetLowerWitgh() - Cell does not exist!");
82 for (
auto it = upEnLoWeiPairs.cbegin(); it != upEnLoWeiPairs.cend(); ++it)
84 if (partEnergy < it->first)
86 lowerWeight = it->second;
93 std::ostringstream err_mess;
94 err_mess <<
"GetLowerWitgh() - Couldn't find lower weight bound." <<
G4endl
95 <<
"Energy: " << partEnergy <<
".";
96 Error(err_mess.str());
101void G4WeightWindowStore::
104 fCurrentIterator = fCellToUpEnBoundLoWePairsMap.find(gCell);
107G4bool G4WeightWindowStore::
111 if (!(aVolume == *fWorldVolume))
125 SetInternalIterator(gCell);
126 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
133 fCellToUpEnBoundLoWePairsMap.clear();
154 return *fWorldVolume;
165 const std::vector<G4double>& lowerWeights)
167 if (fGeneralUpperEnergyBounds.empty())
169 Error(
"AddLowerWeights() - No general upper energy limits set!");
173 Error(
"AddLowerWeights() - Cell already in the store.");
175 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
177 std::ostringstream err_mess;
178 err_mess <<
"AddLowerWeights() - Mismatch between "
179 <<
"number of lower weights (" << lowerWeights.size()
180 <<
") and energy bounds (" << fGeneralUpperEnergyBounds.size()
182 Error(err_mess.str());
186 for (
auto it = fGeneralUpperEnergyBounds.cbegin();
187 it != fGeneralUpperEnergyBounds.cend(); ++it)
189 map[*it] = lowerWeights[i];
192 fCellToUpEnBoundLoWePairsMap[gCell] = map;
201 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
205 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
207 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
213 std::less<G4double> >& enBounds)
215 if (!fGeneralUpperEnergyBounds.empty())
217 Error(
"SetGeneralUpperEnergyBounds() - Energy bounds already set.");
219 fGeneralUpperEnergyBounds = enBounds;
222void G4WeightWindowStore::Error(
const G4String& msg)
const
235 if (fInstance ==
nullptr)
250 if (fInstance ==
nullptr)
253 G4cout <<
"G4IStore:: Creating new Parallel IStore "
254 << 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)
void SetParallelWorldVolume(const G4String ¶Name)
virtual const G4VPhysicalVolume * GetParallelWorldVolumePointer() const
void SetGeneralUpperEnergyBounds(const std::set< G4double, std::less< G4double > > &enBounds)
virtual const G4VPhysicalVolume & GetWorldVolume() const
static G4WeightWindowStore * GetInstance()
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
virtual G4double GetLowerWeight(const G4GeometryCell &gCell, G4double partEnergy) const
void AddUpperEboundLowerWeightPairs(const G4GeometryCell &gCell, const G4UpperEnergyToLowerWeightMap &enWeMap)