Добавил:
okley
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Моделирование (1 сем, мага) / geant4 / Geant4_1
.pdf
The main program
• Geant4 does not provide the main().
• In your main(), you have to
– Construct G4RunManager (or your derived class)
– Set user mandatory classes to RunManager
• G4VUserDetectorConstruction
• G4VUserPhysicsList
• G4VUserPrimaryGeneratorAction
• You can define VisManager, (G)UI session,
optional user action classes in your main().
21

Describe your detector
• Derive your own concrete class from
G4VUserDetectorConstruction abstract base class.
• In the virtual method Construct(),
– Instantiate all necessary materials
– Instantiate volumes of your detector geometry
– Instantiate your sensitive detector classes and set them to
the corresponding logical volumes
• Optionally you can define
– Regions for any part of your detector
– Visualization attributes (color, visibility, etc.) of your
detector elements
22

Select physics processes
• Geant4 does not have any default particles or processes.
– Even for the particle transportation, you have to define it
explicitly.
• Derive your own concrete class from G4VUserPhysicsList
abstract base class.
– Define all necessary particles
– Define all necessary processes and assign them to proper
particles
– Define cut-off ranges applied to the world (and each region)
• Geant4 provides lots of utility classes/methods and
examples.
– “Educated guess” physics lists for defining hadronic processes
for various use-cases.
23

Generate primary event
• Derive your concrete class from
G4VUserPrimaryGeneratorAction abstract base class.
• Register one or more primary generator concrete class
objects which generate primary vertices and primary
particles.
• Geant4 provides several generators in addition to the
G4VPrimaryParticleGenerator base class.
– G4ParticleGun
– G4HEPEvtInterface, G4HepMCInterface
• Interface to /hepevt/ common block or HepMC class
– G4GeneralParticleSource
• Define radioactivity
24

Optional user action classes
• All user action classes, methods of which are invoked
during “Beam On”, must be constructed in the user’s
main() and must be set to the RunManager.
• G4UserRunAction
– Instantiate user-customized run object
• G4Run* GenerateRun()
– Define histograms
• void BeginOfRunAction(const G4Run*)
– Analyze the run & store histograms
• void EndOfRunAction(const G4Run*)
• G4UserEventAction
– Event preparation & selection
• void BeginOfEventAction(const G4Event*)
– Output event information
• void EndOfEventAction(const G4Event*)
25

Optional user action classes
• • G4UserStackingAction
– Reset priority control:
• void PrepareNewEvent()
– Invoked every time a new track is pushed;
Classify a new track-priority control:
• G4ClassificationOfNewTrack
ClassifyNewTrack(const G4Track*)
– Urgent (the only poppable) – Waiting
– Postpone (to next event) – Kill
– Invoked when the Urgent stack becomes empty;
Waiting → Urgent;
Change the classification criteria;
Event filtering (Event abortion):
• void NewStage()
26

Optional user action classes
• G4UserTrackingAction
– Decide trajectory should be stored or not;
Create user-defined trajectory:
• void PreUserTrackingAction(const G4Track*)
– Delete unnecessary trajectory:
• void PostUserTrackingAction(const G4Track*)
• G4UserSteppingAction
– Kill / suspend / postpone the track;
Draw the step (for a track not to be stored as a
trajectory):
• void UserSteppingAction(const G4Step*)
27

G4UserLimits
• User limits are artificial limits affecting to the tracking.
G4UserLimits( G4double maxStep = DBL_MAX ,
G4double maxTrack = DBL_MAX ,
G4double maxTime = DBL_MAX ,
G4double minEkin = 0. ,
G4double minRange = 0. );
• maxStep — max allowed Step size in this volume
• maxTrack — max total track length
• maxTime — max global time
• minEkin — min kinetic energy remaining (only for charged particles)
• minRange — min remaining range (only for charged particles)
Blue: affecting to step
Red: affecting to track
• You can set user limits to logical volume and/or to a region.
– User limits assigned to logical volume do not propagate to daughter volumes.
– User limits assigned to region propagate to daughter volumes unless daughters belong
to another region.
– If both logical volume and associated region have user limits, those of logical volume
win.
28

Processes co-working with
G4UserLimits
In addition to instantiating G4UserLimits and setting it to
logical volume or region, you have to assign the following
process(es) to particle types you want to affect.
• Limit to step
maxStep:
– G4StepLimiter process must be defined
to affected particle types.
– This process limits a step, but it does not kill a track.
• Limits to track
maxTrack, maxTime, minEkin, minRange:
– G4UserSpecialCuts process must be defined
to affected particle types.
– This process limits a step and kills the track when the track
comes to one of these limits. Step limitation occurs only for the
final step.
29

Attaching user information
• Abstract classes
– You can use your own class derived from provided base class
– G4Run, G4VHit, G4VDigit, G4VTrajectory, G4VTrajectoryPoint
• Concrete classes
– You can attach a user information class object
• G4Event ← G4VUserEventInformation
• G4Track ← G4VUserTrackInformation
• G4PrimaryVertex ← G4VUserPrimaryVertexInformation
• G4PrimaryParticle ← G4VUserPrimaryParticleInformation
• G4Region ← G4VUserRegionInformation
• User information class object is deleted when associated
Geant4 class object is deleted.
30
Соседние файлы в папке geant4
