Code for download: session9_start.tar.gz
Exercise:
- Add an option in
EDScreenSDclass to account only primary particles (see the implementation of the optionfRandominEDPrimaryGeneratorAction):- add a data member
G4bool fOnlyPrimariesand its « setter »
function - add a command
/ED/screen/onlyPrimarieswith use ofG4GenericMessenger - test new command interactively and, after it works ok, add it in
runProtons.macto activate scoring of primaries only
Run 1000 protons with activated option to score only primaries from batch:
./exampleED -m runProtons.mac
and save yourED.rootas, eg,ED-primaries.root - add a data member
- Complete
EDStackingActionclass and implement an option to kill all secondary particles:- add
EDStackingActionto the user action classes set toG4RunManagerinmain(exampleED.cc) - add a data member
G4bool fKillSecondariesand its « setter » function - add a command
/ED/stacking/killSecondarieswith use of
G4GenericMessenger - Implement
EDStackingAction::Classify()to kill all secondary particles iffKillSecondariesis activated
Run 1000 protons with activated option to killing all secondaries and save your
ED.rootas, eg,ED-killSeconadries.rootCompare the spectrum of primary particles in both files.
Compare the time of simulation with both options. (The time of run is measured byG4Timerobject added inEDRunAction). - add
- Visualization:
- Implement drawing hits in chambers:
- Up to now we were storing only a local position in
EDChamberHitclass; add a data memberfGlobalPositionand its « setter » and « getter » functions inEDChamberHit - Update
EDChamberSD::ProcessHit()to store also a global position in the hit - Add and implement
EDChamberHit::Draw()function.
(SeeB2TrackerHitclass inbasic/B2/B2aexample).
- Up to now we were storing only a local position in
- Activate drawing hits in
vis.macmacro
- 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.
