Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
G4WeightWindowStore Class Reference

#include <G4WeightWindowStore.hh>

Inheritance diagram for G4WeightWindowStore:
G4VWeightWindowStore

Public Member Functions

virtual ~G4WeightWindowStore ()
 
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 (G4String ParallelWorldName)
 

Protected Member Functions

 G4WeightWindowStore ()
 
 G4WeightWindowStore (G4String ParallelWorldName)
 

Detailed Description

Definition at line 58 of file G4WeightWindowStore.hh.

Constructor & Destructor Documentation

G4WeightWindowStore::G4WeightWindowStore ( )
explicitprotected

Definition at line 52 of file G4WeightWindowStore.cc.

Referenced by GetInstance().

52  :
53 fWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()),
54  fGeneralUpperEnergyBounds(),
55  fCellToUpEnBoundLoWePairsMap(),
56  fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end())
57 {}
virtual const G4VPhysicalVolume & GetWorldVolume() const
static G4TransportationManager * GetTransportationManager()
G4WeightWindowStore::G4WeightWindowStore ( G4String  ParallelWorldName)
explicitprotected

Definition at line 60 of file G4WeightWindowStore.cc.

60  :
61 fWorldVolume(G4TransportationManager::GetTransportationManager()->GetParallelWorld(ParallelWorldName)),
62  fGeneralUpperEnergyBounds(),
63  fCellToUpEnBoundLoWePairsMap(),
64  fCurrentIterator(fCellToUpEnBoundLoWePairsMap.end())
65 {}
static G4TransportationManager * GetTransportationManager()
G4WeightWindowStore::~G4WeightWindowStore ( )
virtual

Definition at line 67 of file G4WeightWindowStore.cc.

68 {}

Member Function Documentation

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

Definition at line 164 of file G4WeightWindowStore.cc.

References IsKnown().

Referenced by B01DetectorConstruction::CreateWeightWindowStore(), and B02ImportanceDetectorConstruction::CreateWeightWindowStore().

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

Definition at line 195 of file G4WeightWindowStore.cc.

References IsKnown().

197 {
198  if (IsKnown(gCell)) {
199  Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
200  }
201  if (IsKnown(gCell)) {
202  Error("AddUpperEboundLowerWeightPairs() - Cell already in the store.");
203  }
204  fCellToUpEnBoundLoWePairsMap[gCell] = enWeMap;
205 
206 }
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
void G4WeightWindowStore::Clear ( )

Definition at line 131 of file G4WeightWindowStore.cc.

132 {
133  fCellToUpEnBoundLoWePairsMap.clear();
134 }
G4WeightWindowStore * G4WeightWindowStore::GetInstance ( void  )
static

Definition at line 232 of file G4WeightWindowStore.cc.

References G4WeightWindowStore().

Referenced by G4WeightWindowBiasing::ConstructProcess(), B01DetectorConstruction::CreateWeightWindowStore(), and B02ImportanceDetectorConstruction::CreateWeightWindowStore().

233 {
234  if (!fInstance)
235  {
236  fInstance = new G4WeightWindowStore();
237  }
238  return fInstance;
239 }
G4WeightWindowStore * G4WeightWindowStore::GetInstance ( G4String  ParallelWorldName)
static

Definition at line 246 of file G4WeightWindowStore.cc.

References G4cout, G4endl, and G4WeightWindowStore().

247 {
248  if (!fInstance)
249  {
250  G4cout << "G4IStore:: Creating new Parallel IStore " << ParallelWorldName << G4endl;
251  fInstance = new G4WeightWindowStore(ParallelWorldName);
252  }
253  return fInstance;
254 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4double G4WeightWindowStore::GetLowerWeight ( const G4GeometryCell gCell,
G4double  partEnergy 
) const
virtual

Implements G4VWeightWindowStore.

Definition at line 71 of file G4WeightWindowStore.cc.

References G4endl.

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

Definition at line 156 of file G4WeightWindowStore.cc.

157 {
158  return fWorldVolume;
159 }
const G4VPhysicalVolume & G4WeightWindowStore::GetWorldVolume ( ) const
virtual

Implements G4VWeightWindowStore.

Definition at line 151 of file G4WeightWindowStore.cc.

152 {
153  return *fWorldVolume;
154 }
G4bool G4WeightWindowStore::IsKnown ( const G4GeometryCell gCell) const
virtual

Implements G4VWeightWindowStore.

Definition at line 120 of file G4WeightWindowStore.cc.

References G4GeometryCell::GetPhysicalVolume().

Referenced by AddLowerWeights(), and AddUpperEboundLowerWeightPairs().

121 {
122  G4bool inWorldKnown(IsInWorld(gCell.GetPhysicalVolume()));
123 
124  if ( inWorldKnown ) {
125  SetInternalIterator(gCell);
126  inWorldKnown = (fCurrentIterator!=fCellToUpEnBoundLoWePairsMap.end());
127  }
128  return inWorldKnown;
129 }
bool G4bool
Definition: G4Types.hh:79
const G4VPhysicalVolume & GetPhysicalVolume() const
void G4WeightWindowStore::SetGeneralUpperEnergyBounds ( const std::set< G4double, std::less< G4double > > &  enBounds)

Definition at line 210 of file G4WeightWindowStore.cc.

Referenced by B01DetectorConstruction::CreateWeightWindowStore(), and B02ImportanceDetectorConstruction::CreateWeightWindowStore().

212 {
213  if (!fGeneralUpperEnergyBounds.empty()) {
214  Error("SetGeneralUpperEnergyBounds() - Energy bounds already set.");
215  }
216  fGeneralUpperEnergyBounds = enBounds;
217 }
void G4WeightWindowStore::SetParallelWorldVolume ( G4String  paraName)

Definition at line 144 of file G4WeightWindowStore.cc.

References G4TransportationManager::GetParallelWorld(), and G4TransportationManager::GetTransportationManager().

145 {
147  // fGeometryCelli = new G4GeometryCellImportance;
148 }
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
void G4WeightWindowStore::SetWorldVolume ( )

Definition at line 136 of file G4WeightWindowStore.cc.

References G4cout, G4endl, G4VPhysicalVolume::GetName(), G4TransportationManager::GetNavigatorForTracking(), G4TransportationManager::GetTransportationManager(), and G4Navigator::GetWorldVolume().

137 {
138  G4cout << " G4IStore:: SetWorldVolume " << G4endl;
140  G4cout << " World volume is: " << fWorldVolume->GetName() << G4endl;
141  // fGeometryCelli = new G4GeometryCellImportance;
142 }
G4Navigator * GetNavigatorForTracking() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * GetWorldVolume() const

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