Geant4 Visualisation and (G)UI

Geant4 Visualisation and (G)UI

Biasing and scoring PART I Geant4 biasing Event biasing (1/2) What is analogue simulation ? Sample using natural probability distribution, N(x) Predicts mean with correct fluctuations Can be inefficient for certain applications What is non-analogue/event biased simulation ?

Cheat - apply artificial biasing probability distribution, B(x) in place of natural one, N(x) B(x) enhances production of whatever it is that is interesting To get meaningful results, must apply a weight correction Predicts same analogue mean with smaller variance Increases efficiency of the Monte Carlo Does not predict correct fluctuations Should be used with care Biasing and scoring - Geant4 Course 3 Event biasing (2/2) Geant4 provides built-in general use biasing techniques

The effect consists in producing a small number of secondaries, which are artificially recognized as a huge number of particles by their statistical weights reduce CPU time Event biasing can be used, for instance, for the transportation of particles through a thick shielding An utility class G4WrapperProcess support user-defined biasing Biasing and scoring - Geant4 Course 4 Event biasing techniques (1) Production cuts / threshold

Geometry based biasing This is a biasing technique most popular for many applications: set high cuts to reduce secondary production Importance weighting for volume/region Duplication or sudden death of tracks Primary event biasing Biasing primary events and/or primary particles in terms of type of event, momentum distribution generate only primaries that can produce events that are interesting for you Biasing and scoring - Geant4 Course 5 Event biasing techniques (2)

Forced interaction Enhanced process or channel and physics-based biasing Force a particular interaction, e.g. within a volume Increasing cross section for a given process (e.g.bremsstrahlung) Biasing secondary production in terms of particle type, momentum distribution, cross-section, etc. Leading particle biasing Take into account only the most energetic (or most important) secondary

Currently NOT supported in Geant4 Biasing and scoring - Geant4 Course 6 Variance Reduction Use variance reduction techniques to reduce computing time taken to calculate a result with a given variance (= statistic error) Want to increase efficiency of the Monte Carlo Measure of efficiency is given by 1 2 sT

s = variance on calculated quantity T = computing time Biasing and scoring - Geant4 Course 7 Geometric Biasing The purpose of geometry-based event biasing is to save computing time by sampling less often the particle histories entering less important geometry regions, and more often in more important regions. * Importance sampling technique * Weight window technique Biasing and scoring - Geant4 Course 8 Importance sampling technique (1) less more important important I=1

I=2 W=1 W=0.5 W=0.5 P=2 Importance sampling acts on particles crossing boundaries between importance cells. The action taken depends on the importance value (I) assigned to the cell. In general, a track is played either split or Russian roulette at the geometrical boundary depending on the importance value assigned to the cell. P = 0.5

X W=1 W=0. 5 Biasing and scoring - Geant4 Course 9 Importance sampling technique (2) less more important important I=1 Survival probability (P) is defined by the ratio of importance value P = Ipost / Ipre The track weight is changed to W/P (weight necessary to get correct results at the end!)

I=2 W=1 W=0.5 W=0.5 P=2 P = 0.5 X W=1 W=0. 5 If P>1: splitting a track E.g. creating two particles with half the weight if it moves into volume with double importance value.

If P<1: Russian-roulette in opposite direction E.g. Kill particles according to the survival probability (1 - P). Biasing and scoring - Geant4 Course 10 increasing importance Importance biasing An gu o l a im s e

on i t ula Im po ce n rta g n i s a i b 10 MeV neutron in thick concrete cylinder Biasing and scoring - Geant4 Course 11

Physics biasing Built-in cross section biasing for PhotoInelastic, ElectronNuclear and PositronNuclear processes G4ElectroNuclearReaction * theeReaction = new G4ElectroNuclearReaction; G4ElectronNuclearProcess theElectronNuclearProcess; theElectronNuclearProcess.RegisterMe(theeReaction); theElectronNuclearProcess.BiasCrossSectionByFactor(100); Similar tool for rare EM processes (e+e- annihilation to pair or hadrons, conversion to +-) G4AnnihiToMuPair* theProcess = new G4AnnihiToMuPair(); theProcess->SetCrossSecFactor(100); It is possible to introduce these factors for all EM processes, with a definition of customized processes that inherit from the normal ones ( extended example)

Artificially enhance/reduce cross section of a process (useful for thin layer interactions or thick layer shielding) General implementation under Biasing and scoring - Geant4 Course development 12 How to learn more about biasing There are examples in Geant4, to show how to use the most common biasing techniques: examples/extended/biasing examples/advanced/Tiara geometry-based biasing examples/extended/medical/fanoCavity cross-section biasing (Compton scattering) Additional documentation about biasing techniques available in the Geant4 User Guide, section 3.7 Biasing and scoring - Geant4 Course

13 Biasing example B01 Shows the importance sampling in the mass (tracking) geometry 10 MeV neutron shielding by cylindrical thick concrete 80 cm high concrete cylinder divided into 18 slabs (importance values assigned in the DetectorConstruction for simplicity) Air Air importance of the slab 1 2n 1

2 4 8 16 32 64 .. Biasing and scoring - Geant4 Course 14 Flux kinetic energy of particle Results of example B01 For analogue simulation, large statistical fluctuations! Biasing and scoring - Geant4 Course 15 PART II Geant4 scoring Extract useful information (1/2)

Given geometry, physics and primary track generation, Geant4 does proper physics simulation silently. You have to add a bit of code to extract information useful to you One way is to use the available user hooks described yesterday (G4SensitiveDetector, G4UserTrackingAction, G4UserSteppingAction, etc.) You have full access to almost all information Straight-forward, but do-it-yourself Biasing and scoring - Geant4 Course 17 Extract useful information (2/2) Alternatively to user-defined sensitive detectors, primitive scorers provided by Geant4 can be used

Geant4 provides a number of primitive scorers, each one accumulating one physics quantity (e.g. total dose) for an event It is convenient to use primitive scorers instead of user-defined sensitive detectors when: you are not interested in recording each individual step, but accumulating physical quantities for an event or a run you have not too many scorers Biasing and scoring - Geant4 Course 18 G4MultiFunctionalDetector

G4MultiFunctionalDetector is a concrete class derived from G4VSensitiveDetector It should be assigned to a logical volume as a kind of (ready-for-the-use) sensitive detector It takes an arbitrary number of G4VPrimitiveSensitivity classes, to define the scoring quantities that you need Each G4VPrimitiveSensitivity accumulates one physics quantity for each physical volume E.g. G4PSDoseScorer (a concrete class of G4VPrimitiveSensitivity provided by Geant4) accumulates dose for each cell

By using this approach, no need to implement sensitive detector and hit classes! Biasing and scoring - Geant4 Course 19 G4VPrimitiveSensitivity Primitive scorers (classes derived from G4VPrimitiveSensitivity) have to be registered to the G4MultiFunctionalDetector They are designed to score one kind of quantity (surface flux, total dose) and to generate one hit collection per event automatically named as /

hit collections can be retrieved in the EventAction or RunAction (as those generated by sensitive detectors) do not share the same primitive score object among multiple G4MultiFunctionalDetector objects (results may mix up!) Biasing and scoring - Geant4 Course 20 For example MyDetectorConstruction::Construct() { G4LogicalVolume* myCellLog = new G4LogicalVolume(); G4MultiFunctionalDetector* myScorer = new instantiate multiG4MultiFunctionalDetector(myCellScorer); functional detector G4SDManager::GetSDMpointer()-> AddNewDetector(myScorer); myCellLog->SetSensitiveDetector(myScorer); G4VPrimitiveSensitivity* totalSurfFlux = new G4PSFlatSurfaceFlux(TotalSurfFlux);

myScorer->Register(totalSurfFlux); G4VPrimitiveSensitivity* totalDose = new G4PSDoseDeposit(TotalDose); myScorer->Register(totalDose); } and register in the SD manager attach to volume create a primitive scorer (surface flux) and register it create a primitive scorer (total dose) and register it Biasing and scoring - Geant4 Course 21 Some primitive scorers you may find useful Concrete Primitive Scorers ( Application Developers Guide 4.4.6) Track length

G4PSTrackLength, G4PSPassageTrackLength Deposited energy G4PSEnergyDepsit, G4PSDoseDeposit Current/Flux G4PSFlatSurfaceCurrent, G4PSSphereSurfaceCurrent,G4PSPassageCurrent, G4PSFlatSurfaceFlux, G4PSCellFlux, G4PSPassageCellFlux Others G4PSMinKinEAtGeneration, G4PSNofSecondary, G4PSNofStep, G4PSCellCharge Biasing and scoring - Geant4 Course 22 A closer look at some scorers... SurfaceCurrent :

Count number of injecting particles at defined surface. angle CellFlux : Sum of L / V of injecting particles in the geometrical cell. SurfaceFlux : Sum up 1/cos(angle) of injecting particles at defined surface L : Total step length in the cell V : Volume Biasing and scoring - Geant4 Course V : Volume

23 G4VSDFilter A G4VSDFilter can be attached to G4VPrimitiveSensitivity to define which kind of tracks have to be scored (e.g. one wants to know surface flux of protons only) G4SDChargeFilter (accepts only charged particles) G4SDNeutralFilter (accepts only neutral particles) G4SDKineticEnergyFilter (accepts tracks in a defined range of kinetic energy) G4SDParticleFilter (accepts tracks of a given particle

type) G4VSDFilter (base class to create user-customized filters) Biasing and scoring - Geant4 Course 24 For example MyDetectorConstruction::Construct() { G4VPrimitiveSensitivity* protonSurfFlux = new G4PSFlatSurfaceFlux(pSurfFlux); G4VSDFilter* protonFilter = new create a primitive scorer (surface flux), as before create a particle filter and add protons to it G4SDParticleFilter(protonFilter); protonFilter->Add(proton);

protonSurfFlux->SetFilter(protonFilter); register the filter to the primitive scorer myScorer->Register(protonSurfFlux); register the scorer to the } multifunc detector (as shown before) Biasing and scoring - Geant4 Course 25 Under development! Command-based scoring ( release) Thanks to the newly developed parallel navigation, an arbitrary scoring mesh geometry can be defined which is independent to the volumes in the mass geometry. Also, G4MultiFunctionalDetector and primitive scorer classes now offer the built-in scoring of most-common quantities UI commands for scoring no C++ required, apart from instantiating G4ScoringManager in main()

Define a scoring mesh Define filters /score/create/boxMesh /score/filter/particle /score/open, /score/close Define mesh parameters /score/filter/kinE /score/mesh/boxsize /score/mesh/nbin currently 5 filters are available /score/mesh/translate, Output Define primitive scorers /score/draw /score/quantity/eDep /score/quantity/cellFlux /score/dump, /score/list currently 20 scorers are available Biasing and scoring - Geant4 Course 26

How to learn more about scoring Have a look at the dedicated extended examples released with Geant4: examples/extended/runAndEvent/RE02 (use of primitive scorers) examples/extended/runAndEvent/RE03 (use of UI-based scoring) Biasing and scoring - Geant4 Course 27 PART III Summary Summary

Geant4 offers the possibility to improve computing performance and save CPU time via fast simulation and biasing A number of biasing techniques are available but are the users responsibility to use the results correctly (e.g. set proper weights) Scoring is implemented with a degree of flexibility, offering convenience of keeping tallies of common quantities (doses, fluxes, etc.) without the userdefined sensitive detector A number of examples available in $G4INSTALL/examples/extended Biasing and scoring - Geant4 Course 29 PART IV Backup slides Leading particle biasing Simulating a full shower is an expensive calculation

Instead of generating a full shower, trace only the most energetic secondary Other secondary particles are immediately killed before being stacked Convenient way to roughly estimate, e.g. the thickness of a shield Physical quantities such as energy are not conserved for each event Biasing and scoring - Geant4 Course 31 A tip for scoring For scoring purposes, you need to accumulate a physical quantity (e.g. energy deposition of a step) for entire run of many

events. In such a case, do NOT sum up individual energy deposition of each step directly to a variable for entire run. Total energy deposition of 106 events of 1 GeV incident particle ends up to 1 PeV (1015 eV), while energy deposition of each single step is O(1 keV) or even smaller possible rounding problems Possible work-around: create your own Run class derived from G4Run, and implement RecordEvent(const G4Event*) virtual method. Here you can get all output of the event so that you can accumulate the sum of an event to a variable for entire run. Biasing and scoring - Geant4 Course 32

Recently Viewed Presentations

  • Chapter 28

    Chapter 28

    Chapter 28 Protists Overview: Living Small Even a low-power microscope can reveal a great variety of organisms in a drop of pond water. Protist is the informal name of the kingdom of mostly unicellular eukaryotes, but there are some colonial...
  • MOVING FORWARD MONDAY March 9 - Community Unit School ...

    MOVING FORWARD MONDAY March 9 - Community Unit School ...

    CHAPTERS 1-2 READING QUIZ: Show what you know!Learning Target: I can summarize the text from a character's point-of-view. You are Piggy and you are writing in your diary (pretend that diaries are available on the island).
  • The Pathways Commission - American Accounting Association

    The Pathways Commission - American Accounting Association

    The Pathways Commission. Vision for . the First Academic Exposure to . Accounting. G. Peter and Carolyn R. Wilson. AAA 2014 Southeast Region Meeting. CRW: Thank audience for coming and the Pathways sponsors: AAA and AICPA.
  • Greek City States

    Greek City States

    Greek Speculation on Justice Pericles-"Funeral Oration" as recorded by Thucydides Sophocles, Antigone- Arbitrary ruler's law versus divine law Aristotle-Politics and Nicomachean Ethics Plato's Crito on Socrates refusing to sneak out of Athens after trial * Greek City States Wars of...


    The standards for competitive rivalry differ in countries throughout the world. What should firms do to cope with these differences? What guidance should a firm give to employees as they deal with competitive actions and competitive responses that are ethical...
  • Hexavalent Chromium Safety

    Hexavalent Chromium Safety

    The medical costs associated with occupational disease and injury are approximately $67 billion per year. The productivity costs of losing these workers are around $183 billion, including current and future lost earning, lost benefits, and lost household services (work done...
  • B2 1.2 Animal cells B2 1 Cells Animal

    B2 1.2 Animal cells B2 1 Cells Animal

    Nelson Thornes Ltd Other titles: Times New Roman Arial ~0381851 B2 1 Cells Fat cells Neurones Red blood cells Muscle cells Sperm cells Gland cells Egg cells ...
  • Hinduism


    and it contains 1028 hymns, all of which are devoted to Aryan gods. Upanishads. Hindu teachers tried to interpret and explain the hidden meaning of the Vedic hymns. This leads to the Upanishads. Upanishads: written as conversations between student and...