Geant4  10.02.p03
G4WeightWindowStore Class Reference

#include <G4WeightWindowStore.hh>

Inheritance diagram for G4WeightWindowStore:
Collaboration diagram for G4WeightWindowStore:

Public Member Functions

virtual G4double GetLowerWeight (const G4GeometryCell &gCell, G4double partEnergy) const
 
virtual G4bool IsKnown (const G4GeometryCell &gCell) const
 
void Clear ()
 
void SetWorldVolume ()
 
void SetParallelWorldVolume (G4String paraName)
 
virtual const G4VPhysicalVolumeGetWorldVolume () const
 
virtual const G4VPhysicalVolumeGetParallelWorldVolumePointer () 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 ()
 

Static Public Member Functions

static G4WeightWindowStoreGetInstance ()
 
static G4WeightWindowStoreGetInstance (const G4String &ParallelWorldName)
 

Protected Member Functions

 G4WeightWindowStore ()
 
 G4WeightWindowStore (const G4String &ParallelWorldName)
 
 ~G4WeightWindowStore ()
 

Private Member Functions

G4bool IsInWorld (const G4VPhysicalVolume &) const
 
void Error (const G4String &m) const
 
void SetInternalIterator (const G4GeometryCell &gCell) const
 

Private Attributes

const G4VPhysicalVolumefWorldVolume
 
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
 
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
 
G4GeometryCellWeight::const_iterator fCurrentIterator
 

Static Private Attributes

static G4ThreadLocal G4WeightWindowStorefInstance = 0
 

Detailed Description

Definition at line 58 of file G4WeightWindowStore.hh.

Constructor & Destructor Documentation

◆ G4WeightWindowStore() [1/2]

G4WeightWindowStore::G4WeightWindowStore ( )
explicitprotected

Definition at line 49 of file G4WeightWindowStore.cc.

49  :
54 {}
const G4VPhysicalVolume * fWorldVolume
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
virtual const G4VPhysicalVolume & GetWorldVolume() const
G4GeometryCellWeight::const_iterator fCurrentIterator
static G4TransportationManager * GetTransportationManager()
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
Here is the caller graph for this function:

◆ G4WeightWindowStore() [2/2]

G4WeightWindowStore::G4WeightWindowStore ( const G4String ParallelWorldName)
explicitprotected

Definition at line 57 of file G4WeightWindowStore.cc.

57  :
58 fWorldVolume(G4TransportationManager::GetTransportationManager()->GetParallelWorld(ParallelWorldName)),
62 {}
const G4VPhysicalVolume * fWorldVolume
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
G4GeometryCellWeight::const_iterator fCurrentIterator
static G4TransportationManager * GetTransportationManager()
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap

◆ ~G4WeightWindowStore()

G4WeightWindowStore::~G4WeightWindowStore ( )
protected

Definition at line 64 of file G4WeightWindowStore.cc.

65 {}

Member Function Documentation

◆ AddLowerWeights()

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

Definition at line 161 of file G4WeightWindowStore.cc.

163 {
164  if (fGeneralUpperEnergyBounds.empty()) {
165  Error("AddLowerWeights() - No general upper energy limits set!");
166  }
167  if (IsKnown(gCell)) {
168  Error("AddLowerWeights() - Cell already in the store.");
169  }
170  if (lowerWeights.size() != fGeneralUpperEnergyBounds.size()) {
171  std::ostringstream err_mess;
172  err_mess << "AddLowerWeights() - Mismatch between "
173  << "number of lower weights (" << lowerWeights.size()
174  << ") and energy bounds (" << fGeneralUpperEnergyBounds.size()
175  << ")!";
176  Error(err_mess.str());
177  }
179  G4int i = 0;
180  for (std::set<G4double, std::less<G4double> >::iterator it =
181  fGeneralUpperEnergyBounds.begin();
182  it != fGeneralUpperEnergyBounds.end();
183  it++) {
184  map[*it] = lowerWeights[i];
185  i++;
186  }
187  fCellToUpEnBoundLoWePairsMap[gCell] = map;
188 }
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
void Error(const G4String &m) const
int G4int
Definition: G4Types.hh:78
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
double G4double
Definition: G4Types.hh:76
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddUpperEboundLowerWeightPairs()

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

Definition at line 192 of file G4WeightWindowStore.cc.

194 {
195  if (IsKnown(gCell)) {
196  Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
197  }
198  if (IsKnown(gCell)) {
199  Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
200  }
201  fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
202 
203 }
void Error(const G4String &m) const
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clear()

void G4WeightWindowStore::Clear ( )

Definition at line 128 of file G4WeightWindowStore.cc.

129 {
131 }
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap

◆ Error()

void G4WeightWindowStore::Error ( const G4String m) const
private

Definition at line 217 of file G4WeightWindowStore.cc.

218 {
219  G4Exception("G4WeightWindowStore::Error()",
220  "GeomBias0002", FatalException, msg);
221 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstance() [1/2]

G4WeightWindowStore * G4WeightWindowStore::GetInstance ( void  )
static

Definition at line 229 of file G4WeightWindowStore.cc.

230 {
231  if (!fInstance)
232  {
234  }
235  return fInstance;
236 }
static G4ThreadLocal G4WeightWindowStore * fInstance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstance() [2/2]

G4WeightWindowStore * G4WeightWindowStore::GetInstance ( const G4String ParallelWorldName)
static

Definition at line 243 of file G4WeightWindowStore.cc.

244 {
245  if (!fInstance)
246  {
247  G4cout << "G4IStore:: Creating new Parallel IStore " << ParallelWorldName << G4endl;
248  fInstance = new G4WeightWindowStore(ParallelWorldName);
249  }
250  return fInstance;
251 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal G4WeightWindowStore * fInstance
Here is the call graph for this function:

◆ GetLowerWeight()

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

Implements G4VWeightWindowStore.

Definition at line 68 of file G4WeightWindowStore.cc.

70 {
71  SetInternalIterator(gCell);
72  G4GeometryCellWeight::const_iterator gCellIterator = fCurrentIterator;
73  if (gCellIterator == fCellToUpEnBoundLoWePairsMap.end()) {
74  Error("GetLowerWitgh() - Cell does not exist!");
75  return 0.;
76  }
77  G4UpperEnergyToLowerWeightMap upEnLoWeiPairs =
78  fCurrentIterator->second;
79  G4double lowerWeight = -1;
80  G4bool found = false;
81  for (G4UpperEnergyToLowerWeightMap::iterator it =
82  upEnLoWeiPairs.begin(); it != upEnLoWeiPairs.end(); it++) {
83  if (partEnergy < it->first) {
84  lowerWeight = it->second;
85  found = true;
86  break;
87  }
88  }
89  if (!found) {
90  std::ostringstream err_mess;
91  err_mess << "GetLowerWitgh() - Couldn't find lower weight bound." << G4endl
92  << "Energy: " << partEnergy << ".";
93  Error(err_mess.str());
94  }
95  return lowerWeight;
96 
97 
98 }
void Error(const G4String &m) const
G4GeometryCellWeight::const_iterator fCurrentIterator
bool G4bool
Definition: G4Types.hh:79
std::map< G4double, G4double, std::less< G4double > > G4UpperEnergyToLowerWeightMap
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
void SetInternalIterator(const G4GeometryCell &gCell) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ GetParallelWorldVolumePointer()

const G4VPhysicalVolume * G4WeightWindowStore::GetParallelWorldVolumePointer ( ) const
virtual

Definition at line 153 of file G4WeightWindowStore.cc.

154 {
155  return fWorldVolume;
156 }
const G4VPhysicalVolume * fWorldVolume
Here is the call graph for this function:

◆ GetWorldVolume()

const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
virtual

Implements G4VWeightWindowStore.

Definition at line 148 of file G4WeightWindowStore.cc.

149 {
150  return *fWorldVolume;
151 }
const G4VPhysicalVolume * fWorldVolume

◆ IsInWorld()

G4bool G4WeightWindowStore::IsInWorld ( const G4VPhysicalVolume aVolume) const
private

Definition at line 107 of file G4WeightWindowStore.cc.

108 {
109  G4bool isIn(true);
110  if (!(aVolume == *fWorldVolume)) {
111  isIn = fWorldVolume->GetLogicalVolume()->IsAncestor(&aVolume);
112  }
113  return isIn;
114 }
const G4VPhysicalVolume * fWorldVolume
G4bool IsAncestor(const G4VPhysicalVolume *p) const
bool G4bool
Definition: G4Types.hh:79
G4LogicalVolume * GetLogicalVolume() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsKnown()

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

Implements G4VWeightWindowStore.

Definition at line 117 of file G4WeightWindowStore.cc.

118 {
119  G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
120 
121  if ( inWorldKnown ) {
122  SetInternalIterator(gCell);
123  inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.end());
124  }
125  return inWorldKnown;
126 }
G4bool IsInWorld(const G4VPhysicalVolume &) const
G4GeometryCellWeight::const_iterator fCurrentIterator
bool G4bool
Definition: G4Types.hh:79
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
void SetInternalIterator(const G4GeometryCell &gCell) const
const G4VPhysicalVolume & GetPhysicalVolume() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGeneralUpperEnergyBounds()

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

Definition at line 207 of file G4WeightWindowStore.cc.

209 {
210  if (!fGeneralUpperEnergyBounds.empty()) {
211  Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
212  }
213  fGeneralUpperEnergyBounds = enBounds;
214 }
std::set< G4double, std::less< G4double > > fGeneralUpperEnergyBounds
void Error(const G4String &m) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetInternalIterator()

void G4WeightWindowStore::SetInternalIterator ( const G4GeometryCell gCell) const
private

Definition at line 101 of file G4WeightWindowStore.cc.

102 {
104 }
G4GeometryCellWeight::const_iterator fCurrentIterator
G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetParallelWorldVolume()

void G4WeightWindowStore::SetParallelWorldVolume ( G4String  paraName)

Definition at line 141 of file G4WeightWindowStore.cc.

142 {
144  // fGeometryCelli = new G4GeometryCellImportance;
145 }
const G4VPhysicalVolume * fWorldVolume
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
Here is the call graph for this function:

◆ SetWorldVolume()

void G4WeightWindowStore::SetWorldVolume ( )

Definition at line 133 of file G4WeightWindowStore.cc.

134 {
135  G4cout << " G4IStore:: SetWorldVolume " << G4endl;
137  G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
138  // fGeometryCelli = new G4GeometryCellImportance;
139 }
const G4VPhysicalVolume * fWorldVolume
G4GLOB_DLL std::ostream G4cout
G4Navigator * GetNavigatorForTracking() const
static G4TransportationManager * GetTransportationManager()
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * GetWorldVolume() const
Here is the call graph for this function:

Member Data Documentation

◆ fCellToUpEnBoundLoWePairsMap

G4GeometryCellWeight G4WeightWindowStore::fCellToUpEnBoundLoWePairsMap
private

Definition at line 130 of file G4WeightWindowStore.hh.

◆ fCurrentIterator

G4GeometryCellWeight::const_iterator G4WeightWindowStore::fCurrentIterator
mutableprivate

Definition at line 131 of file G4WeightWindowStore.hh.

◆ fGeneralUpperEnergyBounds

std::set<G4double, std::less<G4double> > G4WeightWindowStore::fGeneralUpperEnergyBounds
private

Definition at line 129 of file G4WeightWindowStore.hh.

◆ fInstance

G4ThreadLocal G4WeightWindowStore * G4WeightWindowStore::fInstance = 0
staticprivate

Definition at line 133 of file G4WeightWindowStore.hh.

◆ fWorldVolume

const G4VPhysicalVolume* G4WeightWindowStore::fWorldVolume
private

Definition at line 126 of file G4WeightWindowStore.hh.


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