Code for download: session9_start.tar.gz
Exercise:
- Add an option in
EDScreenSD
class to account only primary particles (see the implementation of the optionfRandom
inEDPrimaryGeneratorAction
):- add a data member
G4bool fOnlyPrimaries
and its « setter »
function - add a command
/ED/screen/onlyPrimaries
with use ofG4GenericMessenger
- test new command interactively and, after it works ok, add it in
runProtons.mac
to activate scoring of primaries only
Run 1000 protons with activated option to score only primaries from batch:
./exampleED -m runProtons.mac
and save yourED.root
as, eg,ED-primaries.root
- add a data member
- Complete
EDStackingAction
class and implement an option to kill all secondary particles:- add
EDStackingAction
to the user action classes set toG4RunManager
inmain
(exampleED.cc
) - add a data member
G4bool fKillSecondaries
and its « setter » function - add a command
/ED/stacking/killSecondaries
with use of
G4GenericMessenger
- Implement
EDStackingAction::Classify()
to kill all secondary particles iffKillSecondaries
is activated
Run 1000 protons with activated option to killing all secondaries and save your
ED.root
as, eg,ED-killSeconadries.root
Compare the spectrum of primary particles in both files.
Compare the time of simulation with both options. (The time of run is measured byG4Timer
object added inEDRunAction
). - add
- Visualization:
- Implement drawing hits in chambers:
- Up to now we were storing only a local position in
EDChamberHit
class; add a data memberfGlobalPosition
and its « setter » and « getter » functions inEDChamberHit
- Update
EDChamberSD::ProcessHit()
to store also a global position in the hit - Add and implement
EDChamberHit::Draw()
function.
(SeeB2TrackerHit
class inbasic/B2/B2a
example).
- Up to now we were storing only a local position in
- Activate drawing hits in
vis.mac
macro
- Implement drawing hits in chambers:
Solution: session9_solution.tar.gz
Exercise ++:
The exercises marked as ++ are optional; they are recommended for participants who have already some experience with Geant4 and
There is no exercise++ for this session.