12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Toolkit FundamentalsG4VWeightWindowAlgorithm *wwAlg = 0,G4PlaceOfAction placeOfAction =onBoundary) = 0;virtual void Configure() = 0;virtual void ClearSampling() = 0;virtual G4bool IsConfigured() const = 0;};The methods <strong>for</strong> setting up the desired combination need specific in<strong>for</strong>mation:• Importance sampling: message PrepareImportanceSampling with a G4VIStore and optionally aG4VImportanceAlgorithm• Weight window: message PrepareWeightWindow with the arguments:• *wwstore: a G4VWeightWindowStore <strong>for</strong> retrieving the lower weight bounds <strong>for</strong> the energy-space cells• *wwAlg: a G4VWeightWindowAlgorithm if a customized algorithm should be used• placeOfAction: a G4PlaceOfAction specifying where to per<strong>for</strong>m the biasing• Weight roulette: message PrepareWeightRoulett with the optional parameters:• wsurvive: survival weight• wlimit: minimal allowed value of weight * source importance / cell importance• isource: importance of the source cellEach object of a sampler class is responsible <strong>for</strong> one particle type. The particle type is given to the constructorof the sampler classes via the particle type name, e.g. "neutron". Depending on the specific purpose, the Configure()of a sampler will set up specialized processes (derived from G4VProcess) <strong>for</strong> transportation in theparallel geometry, importance sampling and weight roulette <strong>for</strong> the given particle type. When Configure()is invoked the sampler places the processes in the correct order independent of the order in which user invokedthe Prepare... methods.Note• The Prepare...() functions may each only be invoked once.• To configure the sampling the function Configure() must be called after the G4RunManager hasbeen initialized and the PhysicsList has been instantiated.The interface and framework are demonstrated in the examples/extended/biasing directory, with themain changes being to the G4GeometrySampler class and the fact that in the parallel case the WorldVolume is acopy of the Mass World. The parallel geometry now has to inherit from G4VUserParallelWorld which also hasthe GetWorld() method in order to retrieve a copy of the mass geometry WorldVolume.class B02ImportanceDetectorConstruction : public G4VUserParallelWorldghostWorld = GetWorld();The constructor <strong>for</strong> G4GeometrySampler takes a pointer to the physical world volume and the particle type name(e.g. "neutron") as arguments. In a single mass geometry the sampler is created as follows:G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron");mgs.SetParallel(false);Whilst the following lines of code are required in order to set up the sampler <strong>for</strong> the parallel geometry case:G4VPhysicalVolume* ghostWorld = pdet->GetWorldVolume();G4GeometrySampler pgs(ghostWorld,"neutron");pgs.SetParallel(true);Also note that the preparation and configuration of the samplers has to be carried out after the instantiation of theUserPhysicsList and after the initialisation of the G4RunManager:pgs.PrepareImportanceSampling(&aIstore, 0);pgs.Configure();53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!