G4GeometrySampler Class Reference

#include <G4GeometrySampler.hh>

Inheritance diagram for G4GeometrySampler:

G4VSampler

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)

Detailed Description

Definition at line 53 of file G4GeometrySampler.hh.


Constructor & Destructor Documentation

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

Definition at line 50 of file G4GeometrySampler.cc.

00051   : fParticleName(particlename),
00052     fWorld(parallelworld),
00053     fImportanceConfigurator(0),
00054     //    fScoreConfigurator(0),
00055     //    fGCellFinder(0),
00056     fWeightCutOffConfigurator(0),
00057     fIStore(0),
00058     fWeightWindowConfigurator(0),
00059     fWWStore(0),
00060     fIsConfigured(false)
00061 {
00062   paraflag = false;
00063 }

G4GeometrySampler::~G4GeometrySampler (  )  [virtual]

Definition at line 65 of file G4GeometrySampler.cc.

References ClearSampling().

00066 {
00067   ClearSampling();
00068 }


Member Function Documentation

void G4GeometrySampler::ClearSampling (  )  [virtual]

Implements G4VSampler.

Definition at line 70 of file G4GeometrySampler.cc.

Referenced by ~G4GeometrySampler().

00071 {
00072   if (fImportanceConfigurator)
00073   {
00074     delete fImportanceConfigurator;
00075     fImportanceConfigurator = 0;
00076   }
00077   if (fWeightWindowConfigurator)
00078   {
00079     delete fWeightWindowConfigurator;
00080     fWeightWindowConfigurator = 0;
00081   }
00082 //   if (fScoreConfigurator)
00083 //   {
00084 //     delete fScoreConfigurator;
00085 //     fScoreConfigurator = 0;
00086 //   }
00087   if (fWeightCutOffConfigurator)
00088   {
00089     delete fWeightCutOffConfigurator;
00090     fWeightCutOffConfigurator = 0;
00091   }
00092 //   if (fGCellFinder)
00093 //   {
00094 //     delete fGCellFinder;
00095 //     fGCellFinder = 0;
00096 //   }
00097   fIStore = 0;
00098   fConfigurators.clear();
00099   fIsConfigured = false;
00100 }

void G4GeometrySampler::Configure (  )  [virtual]

Implements G4VSampler.

Definition at line 204 of file G4GeometrySampler.cc.

References G4WeightCutOffConfigurator::Configure(), G4VSamplerConfigurator::Configure(), G4cout, G4endl, and IsConfigured().

00205 {
00206   G4cout << " entering configure " << G4endl;
00207   if (!IsConfigured())
00208   {
00209     fIsConfigured = true;
00210 
00211 //     if (fScoreConfigurator)
00212 //     {
00213 //       G4cout << " score configurator push_back " << G4endl;
00214 //       fConfigurators.push_back(fScoreConfigurator);
00215 //       G4cout << " pushed " << G4endl;
00216 //     }
00217     if (fImportanceConfigurator)
00218     {
00219       G4cout << " importance configurator push_back " << G4endl;
00220       fConfigurators.push_back(fImportanceConfigurator);
00221       G4cout << " pushed " << G4endl;
00222     }
00223     if (fWeightWindowConfigurator)
00224     {
00225       G4cout << " weight window configurator push_back " << G4endl;
00226       fConfigurators.push_back(fWeightWindowConfigurator);
00227       G4cout << " pushed " << G4endl;
00228     }
00229     
00230     G4cout << " vsampler configurator loop " << G4endl;
00231     G4VSamplerConfigurator *preConf = 0;
00232     G4int i = 0;
00233     for (G4Configurators::iterator it = fConfigurators.begin();
00234          it != fConfigurators.end(); it++)
00235     {
00236       i++;
00237       G4cout << " looping " << i << G4endl;
00238       G4VSamplerConfigurator *currConf =*it;
00239       G4cout << " sampler configurator " << G4endl;
00240       currConf->Configure(preConf);
00241       G4cout << " configure preconf " << G4endl;
00242       preConf = *it;
00243     }
00244     if (fWeightCutOffConfigurator)
00245     {
00246       G4cout << " NEW weight window configure " << G4endl;
00247       fWeightCutOffConfigurator->Configure(0);
00248       G4cout << " configured " << G4endl;
00249     }
00250   }
00251   return;
00252 }

G4bool G4GeometrySampler::IsConfigured (  )  const [virtual]

Implements G4VSampler.

Definition at line 102 of file G4GeometrySampler.cc.

References G4cout, and G4endl.

Referenced by Configure().

00103 {
00104   G4bool isconf = false;
00105   if (fIsConfigured)
00106   {
00107    G4cout << "WARNING - G4GeometrySampler::IsConfigured()"
00108           << "          Some initalization exists, use ClearSampling()"
00109           << "          before a new initialization !" << G4endl;
00110    isconf = true;
00111   }
00112   return isconf;
00113 }

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

Implements G4VSampler.

Definition at line 136 of file G4GeometrySampler.cc.

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

00138 {
00139   G4cout << " preparing importance sampling " << G4endl;
00140   fIStore = istore;
00141   G4cout << " creating istore " << G4endl;
00142 
00143   fImportanceConfigurator =
00144     new G4ImportanceConfigurator(fWorld, fParticleName, *fIStore, ialg, paraflag);
00145 
00146   G4cout << " creating importance configurator " << G4endl;
00147 
00148   if (!fImportanceConfigurator)
00149   {
00150     G4Exception("G4GeometrySampler::PrepareImportanceSampling()",
00151                 "FatalError", FatalException,
00152                 "Failed allocation of G4ImportanceConfigurator !");
00153   }
00154 }

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

Implements G4VSampler.

Definition at line 157 of file G4GeometrySampler.cc.

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

00160 {
00161   //  fGCellFinder = new G4GCellFinder(fWorld);
00162   G4cout << " preparing weight roulette" << G4endl;
00163   //  fGCellFinder = new G4GCellFinder();
00164 //   if (!fGCellFinder)
00165 //   {
00166 //     G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
00167 //                 "FatalError", FatalException,
00168 //                 "Failed allocation of G4GCellFinder !");
00169 //   }
00170   
00171   fWeightCutOffConfigurator = 
00172     new G4WeightCutOffConfigurator(fWorld, fParticleName,
00173                                    wsurvive,
00174                                    wlimit,
00175                                    isource,
00176                                    fIStore,
00177                                    paraflag);
00178                                    //*fGCellFinder, paraflag);
00179   if (!fWeightCutOffConfigurator)
00180   {
00181     G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
00182                 "FatalError", FatalException,
00183                 "Failed allocation of G4WeightCutOffConfigurator !");
00184   }
00185 }

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

Implements G4VSampler.

Definition at line 188 of file G4GeometrySampler.cc.

References G4cout, and G4endl.

00191 {
00192 
00193   G4cout << " preparing weight window" << G4endl;
00194 
00195   fWWStore = wwstore;
00196   
00197   fWeightWindowConfigurator =
00198     new G4WeightWindowConfigurator(fWorld, fParticleName,
00199                                     *fWWStore,
00200                                     wwAlg,
00201                                     placeOfAction, paraflag);
00202 }

void G4GeometrySampler::SetParallel ( G4bool  paraflag  )  [virtual]

Implements G4VSampler.

Definition at line 254 of file G4GeometrySampler.cc.

00255 {
00256   paraflag = para;
00257 }

void G4GeometrySampler::SetParticle ( const G4String particlename  ) 

Definition at line 259 of file G4GeometrySampler.cc.

00260 {
00261   fParticleName = particlename;
00262 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:04 2013 for Geant4 by  doxygen 1.4.7