46 ->GetNavigatorForTracking()->GetWorldVolume()),
47 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
52G4WeightWindowStore(
const G4String& ParallelWorldName)
54 ->GetParallelWorld(ParallelWorldName)),
55 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.cend())
63 SetInternalIterator(gCell);
64 auto gCellIterator = fCurrentIterator;
65 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.cend())
67 Error(
"GetLowerWitgh() - Cell does not exist!");
73 for (
const auto & upEnLoWeiPair : upEnLoWeiPairs)
75 if (partEnergy < upEnLoWeiPair.first)
77 lowerWeight = upEnLoWeiPair.second;
84 std::ostringstream err_mess;
85 err_mess <<
"GetLowerWitgh() - Couldn't find lower weight bound." <<
G4endl
86 <<
"Energy: " << partEnergy <<
".";
87 Error(err_mess.str());
92void G4WeightWindowStore::
95 fCurrentIterator = fCellToUpEnBoundLoWePairsMap.find(gCell);
98G4bool G4WeightWindowStore::
102 if (!(aVolume == *fWorldVolume))
104 isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
116 SetInternalIterator(gCell);
117 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.cend());
124 fCellToUpEnBoundLoWePairsMap.clear();
132 G4cout <<
" World volume is: " << fWorldVolume->GetName() <<
G4endl;
145 return *fWorldVolume;
156 const std::vector<G4double>& lowerWeights)
158 if (fGeneralUpperEnergyBounds.empty())
160 Error(
"AddLowerWeights() - No general upper energy limits set!");
164 Error(
"AddLowerWeights() - Cell already in the store.");
166 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size())
168 std::ostringstream err_mess;
169 err_mess <<
"AddLowerWeights() - Mismatch between "
170 <<
"number of lower weights (" << lowerWeights.size()
171 <<
") and energy bounds (" << fGeneralUpperEnergyBounds.size()
173 Error(err_mess.str());
177 for (
G4double fGeneralUpperEnergyBound : fGeneralUpperEnergyBounds)
179 map[fGeneralUpperEnergyBound] = lowerWeights[i];
182 fCellToUpEnBoundLoWePairsMap[gCell] = std::move(
map);
191 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
195 Error(
"AddUpperEboundLowerWeightPairs() - Cell already in the store.");
197 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
203 std::less<G4double> >& enBounds)
205 if (!fGeneralUpperEnergyBounds.empty())
207 Error(
"SetGeneralUpperEnergyBounds() - Energy bounds already set.");
209 fGeneralUpperEnergyBounds = enBounds;
212void G4WeightWindowStore::Error(
const G4String& msg)
const
225 if (fInstance ==
nullptr)
227 fInstance =
new G4WeightWindowStore();
240 if (fInstance ==
nullptr)
243 G4cout <<
"G4IStore:: Creating new Parallel IStore "
244 << ParallelWorldName <<
G4endl;
246 fInstance =
new G4WeightWindowStore(ParallelWorldName);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
G4UpperEnergyToLowerWeightMap and G4GeometryCellWeight are maps used internally by the weight window ...
G4GLOB_DLL std::ostream G4cout
G4GeometryCell is used for scoring and importance sampling. It defines a "cell", which,...
const G4VPhysicalVolume & GetPhysicalVolume() const
G4VPhysicalVolume * GetWorldVolume() const
G4TransportationManager is a singleton class which stores the navigator used by the transportation pr...
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4WeightWindowStore is an concrete implementation of a weight window store according to the G4VWeight...
void AddLowerWeights(const G4GeometryCell &gCell, const std::vector< G4double > &lowerWeights)
void SetParallelWorldVolume(const G4String ¶Name)
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)