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

#include <G4GeometrySampler.hh>

Inheritance diagram for G4GeometrySampler:
G4VSampler

Public Member Functions

 G4GeometrySampler (G4VPhysicalVolume *worldvolume, const G4String &particlename)
 
 G4GeometrySampler (G4String worldvolumeName, const G4String &particlename)
 
virtual ~G4GeometrySampler ()
 
virtual void PrepareImportanceSampling (G4VIStore *istore, const G4VImportanceAlgorithm *ialg)
 
virtual void PrepareWeightRoulett (G4double wsurvive, G4double wlimit, G4double isource)
 
virtual void PrepareWeightWindow (G4VWeightWindowStore *wwstore, G4VWeightWindowAlgorithm *wwAlg, G4PlaceOfAction placeOfAction)
 
virtual void Configure ()
 
virtual void AddProcess ()
 
virtual void ClearSampling ()
 
virtual G4bool IsConfigured () const
 
void SetParallel (G4bool paraflag)
 
void SetWorld (const G4VPhysicalVolume *world)
 
void SetParticle (const G4String &particlename)
 
G4String GetParticleName ()
 
- Public Member Functions inherited from G4VSampler
 G4VSampler ()
 
virtual ~G4VSampler ()
 

Detailed Description

Definition at line 53 of file G4GeometrySampler.hh.

Constructor & Destructor Documentation

G4GeometrySampler::G4GeometrySampler ( G4VPhysicalVolume worldvolume,
const G4String particlename 
)
explicit

Definition at line 51 of file G4GeometrySampler.cc.

52  : fParticleName(particlename),
53  fWorld(world),
54  fImportanceConfigurator(0),
55  // fScoreConfigurator(0),
56  // fGCellFinder(0),
57  fWeightCutOffConfigurator(0),
58  fIStore(0),
59  fWeightWindowConfigurator(0),
60  fWWStore(0),
61  fIsConfigured(false)
62 {
63  paraflag = false;
64  // fWorldName = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetName();
65  // if(fWorld == G4TransportationManager::GetTransportationManager()->GetParallelWorld(fWorld->GetName())) paraflag = true;
66  // G4cout << "G4GeometrySampler:: Making geometry sampler with world: " << fWorld->GetName() << G4endl;
67 }
G4GeometrySampler::G4GeometrySampler ( G4String  worldvolumeName,
const G4String particlename 
)
explicit

Definition at line 70 of file G4GeometrySampler.cc.

References G4TransportationManager::GetNavigatorForTracking(), G4TransportationManager::GetTransportationManager(), and G4Navigator::GetWorldVolume().

71  : fParticleName(particlename),
72  fWorldName(worldName),
73  fImportanceConfigurator(0),
74  // fScoreConfigurator(0),
75  // fGCellFinder(0),
76  fWeightCutOffConfigurator(0),
77  fIStore(0),
78  fWeightWindowConfigurator(0),
79  fWWStore(0),
80  fIsConfigured(false)
81 {
82  paraflag = false;
84  // fWorld = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
85  // G4cout << "G4GeometrySampler:: Making geometry sampler with world: " << fWorld->GetName() << G4endl;
86  //G4TransportationManager::GetTransportationManager()->GetParallelWorld(parallelworldName)
87 }
G4Navigator * GetNavigatorForTracking() const
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * GetWorldVolume() const
G4GeometrySampler::~G4GeometrySampler ( )
virtual

Definition at line 89 of file G4GeometrySampler.cc.

References ClearSampling().

90 {
91  ClearSampling();
92 }
virtual void ClearSampling()

Member Function Documentation

void G4GeometrySampler::AddProcess ( )
virtual

Definition at line 287 of file G4GeometrySampler.cc.

References G4VSamplerConfigurator::Configure(), and G4WeightCutOffConfigurator::Configure().

Referenced by B03PhysicsList::AddBiasingProcess(), Configure(), G4ImportanceBiasing::ConstructProcess(), and G4WeightWindowBiasing::ConstructProcess().

288 {
289 
290  G4VSamplerConfigurator *preConf = 0;
291  G4int i = 0;
292  for (G4Configurators::iterator it = fConfigurators.begin();
293  it != fConfigurators.end(); it++)
294  {
295  i++;
296  G4VSamplerConfigurator *currConf =*it;
297  currConf->Configure(preConf);
298  preConf = *it;
299  }
300  if (fWeightCutOffConfigurator)
301  {
302  fWeightCutOffConfigurator->Configure(0);
303  }
304 
305  return;
306 }
virtual void Configure(G4VSamplerConfigurator *preConf)=0
int G4int
Definition: G4Types.hh:78
virtual void Configure(G4VSamplerConfigurator *preConf)
void G4GeometrySampler::ClearSampling ( )
virtual

Implements G4VSampler.

Definition at line 94 of file G4GeometrySampler.cc.

Referenced by ~G4GeometrySampler().

95 {
96  if (fImportanceConfigurator)
97  {
98  delete fImportanceConfigurator;
99  fImportanceConfigurator = 0;
100  }
101  if (fWeightWindowConfigurator)
102  {
103  delete fWeightWindowConfigurator;
104  fWeightWindowConfigurator = 0;
105  }
106 // if (fScoreConfigurator)
107 // {
108 // delete fScoreConfigurator;
109 // fScoreConfigurator = 0;
110 // }
111  if (fWeightCutOffConfigurator)
112  {
113  delete fWeightCutOffConfigurator;
114  fWeightCutOffConfigurator = 0;
115  }
116 // if (fGCellFinder)
117 // {
118 // delete fGCellFinder;
119 // fGCellFinder = 0;
120 // }
121  fIStore = 0;
122  fConfigurators.clear();
123  fIsConfigured = false;
124 }
void G4GeometrySampler::Configure ( )
virtual

Implements G4VSampler.

Definition at line 235 of file G4GeometrySampler.cc.

References AddProcess(), G4cout, G4endl, and IsConfigured().

Referenced by B03PhysicsList::AddBiasingProcess(), G4ImportanceBiasing::ConstructProcess(), and G4WeightWindowBiasing::ConstructProcess().

236 {
237  if (!IsConfigured())
238  {
239  fIsConfigured = true;
240 
241 // if (fScoreConfigurator)
242 // {
243 // G4cout << " score configurator push_back " << G4endl;
244 // fConfigurators.push_back(fScoreConfigurator);
245 // G4cout << " pushed " << G4endl;
246 // }
247  if (fImportanceConfigurator)
248  {
249  fConfigurators.push_back(fImportanceConfigurator);
250  }
251  if (fWeightWindowConfigurator)
252  {
253  fConfigurators.push_back(fWeightWindowConfigurator);
254  }
255 
256  // G4cout << " vsampler configurator loop " << G4endl;
257  // G4VSamplerConfigurator *preConf = 0;
258  // G4int i = 0;
259  // for (G4Configurators::iterator it = fConfigurators.begin();
260  // it != fConfigurators.end(); it++)
261  // {
262  // i++;
263  // G4cout << " looping " << i << G4endl;
264  // G4VSamplerConfigurator *currConf =*it;
265  // G4cout << " sampler configurator " << G4endl;
266  // currConf->Configure(preConf);
267  // G4cout << " configure preconf " << G4endl;
268  // preConf = *it;
269  // }
270  // if (fWeightCutOffConfigurator)
271  // {
272  // G4cout << " NEW weight window configure " << G4endl;
273  // fWeightCutOffConfigurator->Configure(0);
274  // G4cout << " configured " << G4endl;
275  // }
276  }
277 
278 #ifdef G4MULTITHREADED
279  G4cout << " make sure AddProcess() is invoked for biasing!!! " << G4endl;
280 #else
281  AddProcess();
282 #endif
283 
284  return;
285 }
virtual G4bool IsConfigured() const
G4GLOB_DLL std::ostream G4cout
virtual void AddProcess()
#define G4endl
Definition: G4ios.hh:61
G4String G4GeometrySampler::GetParticleName ( )
inline

Definition at line 84 of file G4GeometrySampler.hh.

84 {return fParticleName;};
G4bool G4GeometrySampler::IsConfigured ( ) const
virtual

Implements G4VSampler.

Definition at line 126 of file G4GeometrySampler.cc.

References G4cout, and G4endl.

Referenced by Configure().

127 {
128  G4bool isconf = false;
129  if (fIsConfigured)
130  {
131  G4cout << "WARNING - G4GeometrySampler::IsConfigured()"
132  << " Some initalization exists, use ClearSampling()"
133  << " before a new initialization !" << G4endl;
134  isconf = true;
135  }
136  return isconf;
137 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
void G4GeometrySampler::PrepareImportanceSampling ( G4VIStore istore,
const G4VImportanceAlgorithm ialg 
)
virtual

Implements G4VSampler.

Definition at line 160 of file G4GeometrySampler.cc.

References FatalException, G4cout, G4endl, G4Exception(), G4VIStore::GetWorldVolume(), and G4ImportanceConfigurator::SetWorldName().

Referenced by B03PhysicsList::AddBiasingProcess(), and G4ImportanceBiasing::ConstructProcess().

162 {
163  G4cout << "G4GeometrySampler:: preparing importance sampling WorldName is " << fWorldName << G4endl;
164  fIStore = istore;
165  // G4cout << "G4GeometrySampler:: creating istore, worldVolume: " << fWorld->GetName() << G4endl;
166 
167  fImportanceConfigurator =
168  new G4ImportanceConfigurator(&istore->GetWorldVolume(), fParticleName, *fIStore, ialg, paraflag);
169  // new G4ImportanceConfigurator(fWorld, fParticleName, *fIStore, ialg, paraflag);
170  fImportanceConfigurator->SetWorldName(fWorldName);
171 
172  if (!fImportanceConfigurator)
173  {
174  G4Exception("G4GeometrySampler::PrepareImportanceSampling()",
175  "FatalError", FatalException,
176  "Failed allocation of G4ImportanceConfigurator !");
177  }
178 }
virtual const G4VPhysicalVolume & GetWorldVolume() const =0
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
void G4GeometrySampler::PrepareWeightRoulett ( G4double  wsurvive,
G4double  wlimit,
G4double  isource 
)
virtual

Implements G4VSampler.

Definition at line 181 of file G4GeometrySampler.cc.

References FatalException, G4cout, G4endl, and G4Exception().

184 {
185  // fGCellFinder = new G4GCellFinder(fWorld);
186  G4cout << "G4GeometrySampler:: preparing weight roulette" << G4endl;
187  // fGCellFinder = new G4GCellFinder();
188 // if (!fGCellFinder)
189 // {
190 // G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
191 // "FatalError", FatalException,
192 // "Failed allocation of G4GCellFinder !");
193 // }
194 
195  fWeightCutOffConfigurator =
196  new G4WeightCutOffConfigurator(fWorld, fParticleName,
197  wsurvive,
198  wlimit,
199  isource,
200  fIStore,
201  paraflag);
202  //*fGCellFinder, paraflag);
203  if (!fWeightCutOffConfigurator)
204  {
205  G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
206  "FatalError", FatalException,
207  "Failed allocation of G4WeightCutOffConfigurator !");
208  }
209 }
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
void G4GeometrySampler::PrepareWeightWindow ( G4VWeightWindowStore wwstore,
G4VWeightWindowAlgorithm wwAlg,
G4PlaceOfAction  placeOfAction 
)
virtual

Implements G4VSampler.

Definition at line 212 of file G4GeometrySampler.cc.

References G4cout, G4endl, and G4VWeightWindowStore::GetWorldVolume().

Referenced by G4WeightWindowBiasing::ConstructProcess().

215 {
216 
217  G4cout << "G4GeometrySampler:: preparing weight window" << G4endl;
218 
219  fWWStore = wwstore;
220 
221  fWeightWindowConfigurator =
222  new G4WeightWindowConfigurator(&wwstore->GetWorldVolume(), fParticleName,
223  *fWWStore,
224  wwAlg,
225  placeOfAction, paraflag);
226 
227  // fWeightWindowConfigurator =
228  // new G4WeightWindowConfigurator(fWorld, fParticleName,
229  // *fWWStore,
230  // wwAlg,
231  // placeOfAction, paraflag);
232 
233 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
virtual const G4VPhysicalVolume & GetWorldVolume() const =0
void G4GeometrySampler::SetParallel ( G4bool  paraflag)
virtual

Implements G4VSampler.

Definition at line 308 of file G4GeometrySampler.cc.

Referenced by B03PhysicsList::AddBiasingProcess(), G4ImportanceBiasing::ConstructProcess(), G4WeightWindowBiasing::ConstructProcess(), and main().

309 {
310  paraflag = para;
311 }
void G4GeometrySampler::SetParticle ( const G4String particlename)

Definition at line 318 of file G4GeometrySampler.cc.

319 {
320  fParticleName = particlename;
321 }
void G4GeometrySampler::SetWorld ( const G4VPhysicalVolume world)

Definition at line 313 of file G4GeometrySampler.cc.

Referenced by B03PhysicsList::AddBiasingProcess().

314 {
315  fWorld = World;
316 }

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