Presentation is loading. Please wait.

Presentation is loading. Please wait.

Geant4 KISTI Tutorial Marc Verderi LLR – Ecole polytechnique October 2012 Event Biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI.

Similar presentations


Presentation on theme: "Geant4 KISTI Tutorial Marc Verderi LLR – Ecole polytechnique October 2012 Event Biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI."— Presentation transcript:

1 Geant4 KISTI Tutorial Marc Verderi LLR – Ecole polytechnique October 2012 Event Biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 1

2 ›There are simulation problems in which what we are interesting in is rare –Occurrence is low because of the physics, or because of the setup, etc. –What we are interested in is what we want to “tally” –We need to tally something rare ›Examples of such problems are: –Estimating the efficiency of a shield ›Only a tiny fraction of the incident flux exits the shield ›Almost all the CPU is spent simulating what happens inside the shield ›While we primarily want to tally the exiting flux –Obtaining the response of a very thin detector ›For example to obtain the response to neutrons ›Most of them do not interact in ›We want to tally the effect of neutrons in the detector –Estimating the dose in a very small part of a big setup ›For example an electronic chip in a satellite ›Most of the time is spent simulating showers that do not contribute to the dose ›While we want to tally this dose ›An “analog” (usual) simulation is very inefficient in addressing these problems. Introduction detector Thick shield 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 2

3 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 3 What is « event biasing » ? Track i, weight i

4 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 4 ›In an « importance sampling » technique, the analog pdfs (probability density function) are replaced by biased ones: ›The weight, for some value x, is then the ratio of the analog over the biased distribution values, at x Importance Sampling x analog pdf(x) biased pdf(x) x Phase space region of interest analog-pdf(x) w(x) = ------------------ biased-pdf(x)

5 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 5 ›In splitting, the physical distributions are unchanged, but a « splitting » occurs at some places when particles go into the direction of where the tally is to be made –In above example, particles moving toward exit are cloned ›cloning is basically compensating for the physical absorption in shielding. –When cloning happens, clones receive a weight ½ (here) of the initial track ›Splitting comes together with « killing » or « Russian Roulette » –In above example, particles moving back are killed with a (here) probabilty ½ and, if it survives, its weight is multiplied by 2 (here). Splitting Incident flux Exiting flux, tallied Splitting by 2 (here)

6 Present Geant4 Biasing Options 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 6

7 ›The General Particle Source (GPS) allows to bias the particle source: –Position –Angular Distribution –Energy Distribution ›This is an « importance sampling » biasing –The physical distributions are replaced by biased ones ›Primary particles are given a weight that is the ratio of analog / biased probabilities –In the simulation, all daughter, gran-daughter,… particles from the primary inherit the weight of this primary Primary Particle Biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 7

8 ›Cross-section Biasing: –Possibility to enhance a (low) cross-section ›This an « importance sampling » approach –Available for photon inelastic, electron & positron nuclear processes Options In Hadronic (1) //init reaction model G4ElectroNuclearReaction* theElectroReaction = new G4ElectroNuclearReaction(); //create process and register model G4ElectronNuclearProcess theElectronNuclearProcess; theElectronNuclearProcess.RegisterMe(theElectroReaction); //apply biasing theElectronNuclearProcess.BiasCrossSectionByFactor(100); //register process pManager->AddDiscreteProcess(&theElectronNuclearProcess); 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 8

9 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 9 ›Leading Particle Biasing: –It is a technique used for estimating the penetration of particles in a shield –Instead of simulating the full shower, only keep: ›The most energetic particle ›And one particle of each species –This is a « killing » - based biaising (say an « anti-splitting » technique) ›Radioactive decay (from Dennis presentation) –Enhance particular decay within a given time window –Sample all decay modes with equal probabilities –Split parent nuclide in a user defined number of copies, letting the decay go –Enhance emission in a particular direction Options In Hadronic (2)

10 ›This an other technique for shield studies ›Attach « importance » to cells in geometry –If a track moves from importances « 4 » to « 8 » (here): ›it is splitted in 2 = 8/4 copies ›each copy having a weight = ½ of the incoming track –If a track moves the other way, from importance « 8 » to « 4 » ›it is killed with a probability ½ – This is the « Russian Roulette » ›If particle survives, its weight is multiplied by 2 (here) Geometry based splitting Splitting 48 Killing x … … 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 10

11 ›Cell (G4GeometryCell) and Importance (G4IStore) declarations: //define importance cells G4GeometryCell* cellA = new G4GeometryCell(my_G4PhysicalVolume_A); G4GeometryCell* cellB = new G4GeometryCell(my_G4PhysicalVolume_B); //create importance store and add cells to it G4IStore* myStore = new G4IStore(my_worldPhysicalVolume); myStore->AddImportancegeometryCell(G4double importance=1, cellA); myStore->AddImportancegeometryCell(G4double importance=2, cellB); ›Configure information collection (G4CellScorer), in volumes of the tracking geometry, and specify the splitting algorithm: //create and initialize sampler G4MassGeometrySampler mySampler = new G4MassGeometrySampler(“e+“); mySampler->PrepareScoring(new G4CellScorer); mySampler->PrepareImportanceSampling(myStore, new G4ImportanceAlgorithm()); mySampler->Configure(); ›Configuration can be made different, if needed, starting from the base classes: – G4VSampler, G4VIStore, G4VScorer, G4VImportanceAlgorithm ›Scorers can also be attached to volumes in a parallel geometry. The G4VSampler implementation G4ParallelGeometrySampler(…) allows this. Geometry based splitting 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 11

12 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 12 See: geant4/examples/extended/biasing/B01

13 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 13 ›This is a « splitting & killing » technique, to avoid having –Too high weight tracks at some point ›As this makes the convergence of the estimated quantities difficult ›Tracks with weight above some value are splitted –Too low weight tracks ›As these are essentially a waste of time ›Tracks below some value are « Russian roulette »’d ›This can be configured per cell and per energy. ›See: geant4/examples/extended/biasing/B01 Weight Window Technique

14 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 14 Reverse Monte Carlo Extended source (Sky) ›Simulation in which particles go back in time ! ›Useful in case of small device to be simulated in a big environment –Requested by ESA, for dose study in electronic chips in satellites ›Simulation starts with the red track –So-called “adjoint” track –Going back in time –Increasing in energy –Up to reaching the extended source ›If track energy < high energy limit of the sky source spectrum –Proceed with a usual “forward” simulation (green track) ›When many track simulated, adjust adjoint track weights so that energy spectrum of adjoint particle matches sky source spectrum –This provides the weight of the green tracks ›Dose in chip can then be computed, accounting for the forward track contribution, with the proper weight. ›See: geant4/examples/extended/biasing/ReverseMC01 Adjoint track Forward (normal) track

15 ›G4WrapperProcess can be used to implement user defined event biasing ›G4WrapperProcess, which is a process itself, wraps an existing process ›All function calls forwarded to wrapped process ›Needed steps: 1.Create derived class inheriting from G4WrapperProcess 2.Override only the methods to be modified, e.g., PostStepDoIt() 3.Register this class in place of the original 4.Finally, register the original (wrapped) process with user class User defined biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 15

16 ›Bremstralhung splitting is a technique used for example in medical applications: –Radio-therapy with photon beam generated by bremstralhung –Interest is in generated photons, not in the electron  enhance photon production ›At a point bremstralhung reaction is repeated N times, with the same initial electron –All bremstralhung photons are given a weight 1/N – The electron continues with one of the state among the N ones generated G4VParticleChange* myWrappedProc::PostStepDoIt(const G4Track& track, const G4Step& step) { G4double weight = track.GetWeight()/fNSplit;... std::vector secondaries(fNSplit); // Secondary store // Loop over wrapped PSDI method to generate multiple secondaries for (G4int i=0; i<fNSplit; i++) { particleChange = pRegProcess->PostStepDoIt(track, step); assert (0 != particleChange); particleChange->SetVerboseLevel(0); // Save the secondaries generated on this cycle for (G4int j=0; j GetNumberOfSecondaries(); j++) { secondaries.push_back (new G4Track(*(particleChange->GetSecondary(j)))); } // -- and then pass these secondaries to the particle change… } Example with brem. splitting 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 16

17 ›Note: in 9.6, a built-in brem. splitting option will be proposed. Example with a brem. splitting 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 17

18 Options to come 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 18

19 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 19 ›Not present for now are techniques in which the usual interaction exponential law has to be replaced by something else in the tracking ›This includes: –Forced interaction: ›Useful in the thin detector case –Force a free flight ›Prevent interaction to occur (that’s easy) ›But not only: gets the weight for this ›Punch through studies –So-called exponential transform ›Cross-section replaced by an other one, direction dependent for example ›And also, not present are techniques in which the physical laws describing the final state are changed –Ie change final state angular distribution, etc. What is not present (but is planned) detector

20 Convergence: a word of caution 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 20

21 Convergence ›Ensuring convergence is an issue in biasing: –The fact that not all events have a weight « 1 » in a biased simulation is a source of pitfall –Should be careful to not be « victim » of an apparent, but wrong, convergence ›A « toy » example of bad sampling: 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 21

22 Convergence ›Ensuring convergence is an issue in biasing: –The fact that not all events have a weight « 1 » in a biased simulation is a source of pitfall –Should be careful to not be « victim » of an apparent, but wrong, convergence ›A « toy » example of bad sampling: 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 22

23 100k events 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 23

24 10M events 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 24

25 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 25 ›Our deliberately chosen bad sampling is instructive: –We have a wide variety of weights ›Many tiny ones – Waste of time to determine the mean value ›Few huge ones – Responsible for jumps ›Such problem –if can not be improved- could at least be alleviated with a weight window technique – In a real problem (useless here in our toy problem) –We have huge weights from time to time ›These are not wrong ! ›Temptation would be to “dismiss” these events ›But in our case, these events bring down the mean value to the correct value ›These are not wrong, but their presence is a sign of a bad sampling –We observe monotonic increase of the mean value ›We are sampling only “one side” of the problem ›Convergence criteria have been established in other packages –Like MCNP ›You are invited at staying critical when using such biasing techniques. Some qualitative observations

26 ›Biasing techniques can provide very large acceleration factors to certain simulation problems. –Problems in which we need to tally rare events ›Geant4 proposes biasing options on –Primary source (GPS), leading particle, cross-section (had), radioactive decay, splitting with importance in geometry, weight window, user biasing with G4WrapperProcess, and soon bremstralhung splitting –And is developing others (forced interaction, forced flight) ›Biasing techniques have to be handled with care ! –Be critical on convergence ! ›But these techniques are nevertheless unique in helping in addressing rare event simulation problems. Conclusion 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 26

27 More… About biasied vs analog pdf in Importance Sampling 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 27

28 x analog pdf(x) biased pdf(x) analog-pdf(x) w(x) = ------------------ biased-pdf(x) x Unrecoverable region => remaining biais Waste of time: w = 0 always 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI TUTORIAL 28


Download ppt "Geant4 KISTI Tutorial Marc Verderi LLR – Ecole polytechnique October 2012 Event Biasing 01/11/2012 MARC VERDERI - LLR ECOLE POLYTECHNIQUE - GEANT4 KISTI."

Similar presentations


Ads by Google