Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeometrySampler Class Reference

#include <G4GeometrySampler.hh>

+ Inheritance diagram for G4GeometrySampler:

Public Member Functions

 G4GeometrySampler (G4VPhysicalVolume *worldvolume, 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 ClearSampling ()
 
virtual G4bool IsConfigured () const
 
void SetParallel (G4bool paraflag)
 
void SetParticle (const G4String &particlename)
 
- Public Member Functions inherited from G4VSampler
 G4VSampler ()
 
virtual ~G4VSampler ()
 
virtual void PrepareImportanceSampling (G4VIStore *istore, const G4VImportanceAlgorithm *ialg=0)=0
 
virtual void PrepareWeightRoulett (G4double wsurvive=0.5, G4double wlimit=0.25, G4double isource=1)=0
 
virtual void PrepareWeightWindow (G4VWeightWindowStore *wwstore, G4VWeightWindowAlgorithm *wwAlg=0, G4PlaceOfAction placeOfAction=onBoundary)=0
 
virtual void Configure ()=0
 
virtual void ClearSampling ()=0
 
virtual G4bool IsConfigured () const =0
 
virtual void SetParallel (G4bool paraflag)=0
 

Detailed Description

Definition at line 53 of file G4GeometrySampler.hh.

Constructor & Destructor Documentation

◆ G4GeometrySampler()

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

Definition at line 49 of file G4GeometrySampler.cc.

51 : fParticleName(particlename),
52 fWorld(parallelworld),
53 fImportanceConfigurator(0),
54 // fScoreConfigurator(0),
55 // fGCellFinder(0),
56 fWeightCutOffConfigurator(0),
57 fIStore(0),
58 fWeightWindowConfigurator(0),
59 fWWStore(0),
60 fIsConfigured(false)
61{
62 paraflag = false;
63}

◆ ~G4GeometrySampler()

G4GeometrySampler::~G4GeometrySampler ( )
virtual

Definition at line 65 of file G4GeometrySampler.cc.

66{
68}
virtual void ClearSampling()

Member Function Documentation

◆ ClearSampling()

void G4GeometrySampler::ClearSampling ( )
virtual

Implements G4VSampler.

Definition at line 70 of file G4GeometrySampler.cc.

71{
72 if (fImportanceConfigurator)
73 {
74 delete fImportanceConfigurator;
75 fImportanceConfigurator = 0;
76 }
77 if (fWeightWindowConfigurator)
78 {
79 delete fWeightWindowConfigurator;
80 fWeightWindowConfigurator = 0;
81 }
82// if (fScoreConfigurator)
83// {
84// delete fScoreConfigurator;
85// fScoreConfigurator = 0;
86// }
87 if (fWeightCutOffConfigurator)
88 {
89 delete fWeightCutOffConfigurator;
90 fWeightCutOffConfigurator = 0;
91 }
92// if (fGCellFinder)
93// {
94// delete fGCellFinder;
95// fGCellFinder = 0;
96// }
97 fIStore = 0;
98 fConfigurators.clear();
99 fIsConfigured = false;
100}

Referenced by ~G4GeometrySampler().

◆ Configure()

void G4GeometrySampler::Configure ( )
virtual

Implements G4VSampler.

Definition at line 204 of file G4GeometrySampler.cc.

205{
206 G4cout << " entering configure " << G4endl;
207 if (!IsConfigured())
208 {
209 fIsConfigured = true;
210
211// if (fScoreConfigurator)
212// {
213// G4cout << " score configurator push_back " << G4endl;
214// fConfigurators.push_back(fScoreConfigurator);
215// G4cout << " pushed " << G4endl;
216// }
217 if (fImportanceConfigurator)
218 {
219 G4cout << " importance configurator push_back " << G4endl;
220 fConfigurators.push_back(fImportanceConfigurator);
221 G4cout << " pushed " << G4endl;
222 }
223 if (fWeightWindowConfigurator)
224 {
225 G4cout << " weight window configurator push_back " << G4endl;
226 fConfigurators.push_back(fWeightWindowConfigurator);
227 G4cout << " pushed " << G4endl;
228 }
229
230 G4cout << " vsampler configurator loop " << G4endl;
231 G4VSamplerConfigurator *preConf = 0;
232 G4int i = 0;
233 for (G4Configurators::iterator it = fConfigurators.begin();
234 it != fConfigurators.end(); it++)
235 {
236 i++;
237 G4cout << " looping " << i << G4endl;
238 G4VSamplerConfigurator *currConf =*it;
239 G4cout << " sampler configurator " << G4endl;
240 currConf->Configure(preConf);
241 G4cout << " configure preconf " << G4endl;
242 preConf = *it;
243 }
244 if (fWeightCutOffConfigurator)
245 {
246 G4cout << " NEW weight window configure " << G4endl;
247 fWeightCutOffConfigurator->Configure(0);
248 G4cout << " configured " << G4endl;
249 }
250 }
251 return;
252}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
virtual G4bool IsConfigured() const
virtual void Configure(G4VSamplerConfigurator *preConf)=0
virtual void Configure(G4VSamplerConfigurator *preConf)

◆ IsConfigured()

G4bool G4GeometrySampler::IsConfigured ( ) const
virtual

Implements G4VSampler.

Definition at line 102 of file G4GeometrySampler.cc.

103{
104 G4bool isconf = false;
105 if (fIsConfigured)
106 {
107 G4cout << "WARNING - G4GeometrySampler::IsConfigured()"
108 << " Some initalization exists, use ClearSampling()"
109 << " before a new initialization !" << G4endl;
110 isconf = true;
111 }
112 return isconf;
113}
bool G4bool
Definition: G4Types.hh:67

Referenced by Configure().

◆ PrepareImportanceSampling()

void G4GeometrySampler::PrepareImportanceSampling ( G4VIStore istore,
const G4VImportanceAlgorithm ialg 
)
virtual

Implements G4VSampler.

Definition at line 136 of file G4GeometrySampler.cc.

138{
139 G4cout << " preparing importance sampling " << G4endl;
140 fIStore = istore;
141 G4cout << " creating istore " << G4endl;
142
143 fImportanceConfigurator =
144 new G4ImportanceConfigurator(fWorld, fParticleName, *fIStore, ialg, paraflag);
145
146 G4cout << " creating importance configurator " << G4endl;
147
148 if (!fImportanceConfigurator)
149 {
150 G4Exception("G4GeometrySampler::PrepareImportanceSampling()",
151 "FatalError", FatalException,
152 "Failed allocation of G4ImportanceConfigurator !");
153 }
154}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ PrepareWeightRoulett()

void G4GeometrySampler::PrepareWeightRoulett ( G4double  wsurvive,
G4double  wlimit,
G4double  isource 
)
virtual

Implements G4VSampler.

Definition at line 157 of file G4GeometrySampler.cc.

160{
161 // fGCellFinder = new G4GCellFinder(fWorld);
162 G4cout << " preparing weight roulette" << G4endl;
163 // fGCellFinder = new G4GCellFinder();
164// if (!fGCellFinder)
165// {
166// G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
167// "FatalError", FatalException,
168// "Failed allocation of G4GCellFinder !");
169// }
170
171 fWeightCutOffConfigurator =
172 new G4WeightCutOffConfigurator(fWorld, fParticleName,
173 wsurvive,
174 wlimit,
175 isource,
176 fIStore,
177 paraflag);
178 //*fGCellFinder, paraflag);
179 if (!fWeightCutOffConfigurator)
180 {
181 G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
182 "FatalError", FatalException,
183 "Failed allocation of G4WeightCutOffConfigurator !");
184 }
185}

◆ PrepareWeightWindow()

void G4GeometrySampler::PrepareWeightWindow ( G4VWeightWindowStore wwstore,
G4VWeightWindowAlgorithm wwAlg,
G4PlaceOfAction  placeOfAction 
)
virtual

Implements G4VSampler.

Definition at line 188 of file G4GeometrySampler.cc.

191{
192
193 G4cout << " preparing weight window" << G4endl;
194
195 fWWStore = wwstore;
196
197 fWeightWindowConfigurator =
198 new G4WeightWindowConfigurator(fWorld, fParticleName,
199 *fWWStore,
200 wwAlg,
201 placeOfAction, paraflag);
202}

◆ SetParallel()

void G4GeometrySampler::SetParallel ( G4bool  paraflag)
virtual

Implements G4VSampler.

Definition at line 254 of file G4GeometrySampler.cc.

255{
256 paraflag = para;
257}

◆ SetParticle()

void G4GeometrySampler::SetParticle ( const G4String particlename)

Definition at line 259 of file G4GeometrySampler.cc.

260{
261 fParticleName = particlename;
262}

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