Code for download: session10_start.tar.gz
Exercise:
- Inspect the code for additions:
InspectexampleED.cc, EDDetectorConstruction.hh[.cc]
and search for comments regarding biasing eg:"// added for biasing"
.
As configuring the code for biasing is rather cumbersome, most of the technical things have been provided.- Look in particular in
EDDetectorConstruction.cc
for the many lines with"fIStore->AddImportanceGeometryCell(...)"
and understand the arguments passed. - Look also for the shielding which has been added just in front of the screen. This shielding is made of concrete.
Compile and run 1000 events. You will see that the concrete shield is rather efficient, as only a few particles can get through: check this plotting for example
Ekin
, using the ntuple. Keep theED.root
file (eg:mv ED.root ED-ref.root
) for further comparisons. - Look in particular in
- Estimating how well the shield shields would require quite a lot of events. We hence use biasing here to speed up the computation.
- Subdivide the concrete shield in along the z-axis using for example a replica. Add to each of these slices an importance value. Slicing the replica along
kZAxis
will make slice replica numbers going from0
tonofSlices-1
, from negative to positivez
. You may use 20 slices.
Compile and run 1000 events. You will see now that thanks to biasing, particles can go through the shield. Check this with the ntuple with Root, again plotting
Ekin
for example. - Subdivide the concrete shield in along the z-axis using for example a replica. Add to each of these slices an importance value. Slicing the replica along
- But the estimation you get here is now very biased: much higher than what it should be. To come back to realistic estimates, you must have to take into account the statistical weight.
- Extend the ntuple to store the « weight » in addition to the existing variables. Find how to obtain the weight value. The weight you need is the one at the beginning of the step.
Run 1000 events again. Plot for example again the
Ekin
spectrum, but taking into account the weight. To make this in Root -ie to re-weight events- do as:root [2] ED->Draw("Ekin","weight")
Plot also the weight directly. You will see there is quite spread: with low and high weights (1 max here). Dealing with such a spread is the delicate thing any biasing techniques as to deal with (one event with big weight will count a lot by itself alone, and may change significantly a mean value by itself). But this is an whole other story…
Solution: session10_solution.tar.gz
Exercise ++:
The exercises marked as ++ are optional; they are recommended for participants who have already some experience with Geant4 and get some time left for practicing more than the basic exercise proposed above.
- There is no exercise++ for this session.