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

 G4WeightWindowStore (const G4VPhysicalVolume &worldvolume)
 
 ~G4WeightWindowStore ()
 
G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const
 
G4bool IsKnown (const G4GeometryCell &gCell) const
 
const G4VPhysicalVolumeGetWorldVolume () 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 ()
 
virtual G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const =0
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const =0
 
virtual const G4VPhysicalVolumeGetWorldVolume () const =0
 

Detailed Description

Definition at line 48 of file G4WeightWindowStore.hh.

Constructor & Destructor Documentation

◆ G4WeightWindowStore()

G4WeightWindowStore::G4WeightWindowStore ( const G4VPhysicalVolume worldvolume)
explicit

Definition at line 43 of file G4WeightWindowStore.cc.

44 :
45 fWorldVolume(worldvolume),
46 fGeneralUpperEnergyBounds(),
47 fCellToUpEnBoundLoWePairsMap(),
48 fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end())
49{}

◆ ~G4WeightWindowStore()

G4WeightWindowStore::~G4WeightWindowStore ( )

Definition at line 51 of file G4WeightWindowStore.cc.

52{}

Member Function Documentation

◆ AddLowerWeights()

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

Definition at line 122 of file G4WeightWindowStore.cc.

125{
126 if (fGeneralUpperEnergyBounds.empty()) {
127 Error("AddLowerWeights() - No general upper energy limits set!");
128 }
129 if (IsKnown(gCell)) {
130 Error("AddLowerWeights() - Cell already in the store.");
131 }
132 if (lowerWeights.size() != fGeneralUpperEnergyBounds.size()) {
133 std::ostringstream err_mess;
134 err_mess << "AddLowerWeights() - Mismatch between "
135 << "number of lower weights (" << lowerWeights.size()
136 << ") and energy bounds (" << fGeneralUpperEnergyBounds.size()
137 << ")!";
138 Error(err_mess.str());
139 }
141 G4int i = 0;
142 for (std::set<G4double, std::less<G4double> >::iterator it =
143 fGeneralUpperEnergyBounds.begin();
144 it != fGeneralUpperEnergyBounds.end();
145 it++) {
146 map[*it] = lowerWeights[i];
147 i++;
148 }
149 fCellToUpEnBoundLoWePairsMap[gCell] = map;
150}
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4bool IsKnown(const G4GeometryCell &gCell) const

◆ AddUpperEboundLowerWeightPairs()

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

Definition at line 153 of file G4WeightWindowStore.cc.

156{
157 if (IsKnown(gCell)) {
158 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
159 }
160 if (IsKnown(gCell)) {
161 Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
162 }
163 fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
164
165}

◆ GetLowerWeight()

G4double G4WeightWindowStore::GetLowerWeight ( const G4GeometryCell gCell,
G4double  partEnergy 
) const
virtual

Implements G4VWeightWindowStore.

Definition at line 55 of file G4WeightWindowStore.cc.

57{
58 SetInternalIterator(gCell);
59 G4GeometryCellWeight::const_iterator gCellIterator = fCurrentIterator;
60 if (gCellIterator == fCellToUpEnBoundLoWePairsMap.end()) {
61 Error("GetLowerWitgh() - Cell does not exist!");
62 return 0.;
63 }
64 G4UpperEnergyToLowerWeightMap upEnLoWeiPairs =
65 fCurrentIterator->second;
66 G4double lowerWeight = -1;
67 G4bool found = false;
68 for (G4UpperEnergyToLowerWeightMap::iterator it =
69 upEnLoWeiPairs.begin(); it != upEnLoWeiPairs.end(); it++) {
70 if (partEnergy < it->first) {
71 lowerWeight = it->second;
72 found = true;
73 break;
74 }
75 }
76 if (!found) {
77 std::ostringstream err_mess;
78 err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl
79 << "Energy: " << partEnergy << ".";
80 Error(err_mess.str());
81 }
82 return lowerWeight;
83
84
85}
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52

◆ GetWorldVolume()

const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
virtual

Implements G4VWeightWindowStore.

Definition at line 116 of file G4WeightWindowStore.cc.

117{
118 return fWorldVolume;
119}

◆ IsKnown()

G4bool G4WeightWindowStore::IsKnown ( const G4GeometryCell gCell) const
virtual

Implements G4VWeightWindowStore.

Definition at line 104 of file G4WeightWindowStore.cc.

105{
106 G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
107
108 if ( inWorldKnown ) {
109 SetInternalIterator(gCell);
110 inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.end());
111 }
112 return inWorldKnown;
113}
const G4VPhysicalVolume & GetPhysicalVolume() const

Referenced by AddLowerWeights(), and AddUpperEboundLowerWeightPairs().

◆ SetGeneralUpperEnergyBounds()

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

Definition at line 168 of file G4WeightWindowStore.cc.

171{
172 if (!fGeneralUpperEnergyBounds.empty()) {
173 Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
174 }
175 fGeneralUpperEnergyBounds = enBounds;
176}

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