#include <G4WeightWindowStore.hh>
Inheritance diagram for G4WeightWindowStore:
Public Member Functions | |
G4WeightWindowStore (const G4VPhysicalVolume &worldvolume) | |
~G4WeightWindowStore () | |
G4double | GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const |
G4bool | IsKnown (const G4GeometryCell &gCell) const |
const G4VPhysicalVolume & | GetWorldVolume () 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) |
Definition at line 48 of file G4WeightWindowStore.hh.
G4WeightWindowStore::G4WeightWindowStore | ( | const G4VPhysicalVolume & | worldvolume | ) | [explicit] |
Definition at line 44 of file G4WeightWindowStore.cc.
00044 : 00045 fWorldVolume(worldvolume), 00046 fGeneralUpperEnergyBounds(), 00047 fCellToUpEnBoundLoWePairsMap(), 00048 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end()) 00049 {}
G4WeightWindowStore::~G4WeightWindowStore | ( | ) |
void G4WeightWindowStore::AddLowerWeights | ( | const G4GeometryCell & | gCell, | |
const std::vector< G4double > & | lowerWeights | |||
) |
Definition at line 123 of file G4WeightWindowStore.cc.
References IsKnown().
00125 { 00126 if (fGeneralUpperEnergyBounds.empty()) { 00127 Error("AddLowerWeights() - No general upper energy limits set!"); 00128 } 00129 if (IsKnown(gCell)) { 00130 Error("AddLowerWeights() - Cell already in the store."); 00131 } 00132 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size()) { 00133 std::ostringstream err_mess; 00134 err_mess << "AddLowerWeights() - Mismatch between " 00135 << "number of lower weights (" << lowerWeights.size() 00136 << ") and energy bounds (" << fGeneralUpperEnergyBounds.size() 00137 << ")!"; 00138 Error(err_mess.str()); 00139 } 00140 G4UpperEnergyToLowerWeightMap map; 00141 G4int i = 0; 00142 for (std::set<G4double, std::less<G4double> >::iterator it = 00143 fGeneralUpperEnergyBounds.begin(); 00144 it != fGeneralUpperEnergyBounds.end(); 00145 it++) { 00146 map[*it] = lowerWeights[i]; 00147 i++; 00148 } 00149 fCellToUpEnBoundLoWePairsMap[gCell] = map; 00150 }
void G4WeightWindowStore::AddUpperEboundLowerWeightPairs | ( | const G4GeometryCell & | gCell, | |
const G4UpperEnergyToLowerWeightMap & | enWeMap | |||
) |
Definition at line 154 of file G4WeightWindowStore.cc.
References IsKnown().
00156 { 00157 if (IsKnown(gCell)) { 00158 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store."); 00159 } 00160 if (IsKnown(gCell)) { 00161 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store."); 00162 } 00163 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap; 00164 00165 }
G4double G4WeightWindowStore::GetLowerWeight | ( | const G4GeometryCell & | gCell, | |
G4double | partEnergy | |||
) | const [virtual] |
Implements G4VWeightWindowStore.
Definition at line 55 of file G4WeightWindowStore.cc.
References G4endl.
00057 { 00058 SetInternalIterator(gCell); 00059 G4GeometryCellWeight::const_iterator gCellIterator = fCurrentIterator; 00060 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.end()) { 00061 Error("GetLowerWitgh() - Cell does not exist!"); 00062 return 0.; 00063 } 00064 G4UpperEnergyToLowerWeightMap upEnLoWeiPairs = 00065 fCurrentIterator->second; 00066 G4double lowerWeight = -1; 00067 G4bool found = false; 00068 for (G4UpperEnergyToLowerWeightMap::iterator it = 00069 upEnLoWeiPairs.begin(); it != upEnLoWeiPairs.end(); it++) { 00070 if (partEnergy < it->first) { 00071 lowerWeight = it->second; 00072 found = true; 00073 break; 00074 } 00075 } 00076 if (!found) { 00077 std::ostringstream err_mess; 00078 err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl 00079 << "Energy: " << partEnergy << "."; 00080 Error(err_mess.str()); 00081 } 00082 return lowerWeight; 00083 00084 00085 }
const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume | ( | ) | const [virtual] |
G4bool G4WeightWindowStore::IsKnown | ( | const G4GeometryCell & | gCell | ) | const [virtual] |
Implements G4VWeightWindowStore.
Definition at line 104 of file G4WeightWindowStore.cc.
References G4GeometryCell::GetPhysicalVolume().
Referenced by AddLowerWeights(), and AddUpperEboundLowerWeightPairs().
00105 { 00106 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume())); 00107 00108 if ( inWorldKnown ) { 00109 SetInternalIterator(gCell); 00110 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.end()); 00111 } 00112 return inWorldKnown; 00113 }
void G4WeightWindowStore::SetGeneralUpperEnergyBounds | ( | const std::set< G4double, std::less< G4double > > & | enBounds | ) |
Definition at line 169 of file G4WeightWindowStore.cc.
00171 { 00172 if (!fGeneralUpperEnergyBounds.empty()) { 00173 Error("SetGeneralUpperEnergyBounds() - Energy bounds already set."); 00174 } 00175 fGeneralUpperEnergyBounds = enBounds; 00176 }