Day 3 - Exercises G4ParticleGun & G4GeneralParticleSource

Geant4 and Calorimetry in HEP

OBJECTIVE

Learn how to use G4ParticleGun to generate events ( G4ParticleGun is also described in the Software reference manual.) Also learn to use the General Particle Source interface.

GEOMETRY

A geantino beam of 10 GeV is directed in positive z-direction.

The setup consists of a single box containing 10 sandwich layers of 5mm Lead and 10mm Scintillator (z direction). The x and y dimensions are 50 cm.

HOW

PRACTICE

In this exercice you will be asked to define the events you want to generate in Geant4 : particle, energy, position and direction.

The relevant method to look at are : the class constructor PrimaryGeneratorAction::PrimaryGeneratorAction() and the method PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)

In the second part you will define the events you want to generate in Geant4 with GPS macro commands.

Exercise 3.1.1 - Specify particle characteristics via macro commands

        Idle> /gun/energy 2. GeV
        Idle> /run/beamOn 1

        Idle> /tracking/verbose 1	  
        Idle> /run/beamOn 1

        Idle> /tracking/verbose 0  
        Idle> /gun/energy 2. GeV
        Idle> /gun/direction 0 0 1
        Idle> /gun/position 0 0 -1. m
        Idle> /gun/particle gamma

        Idle> /run/beamOn 1

Exercise 3.1.2 - Specify particle characteristics in C++

Edit the file src/PrimaryGeneratorAction.cc and complete following section in class constructor :

  // complete particle name and energy  ( do not forget unit)
  G4ParticleDefinition* particle = particleTable->FindParticle("gamma");
  
  particleGun->SetParticleDefinition(particle);
  particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
  particleGun->SetParticleEnergy(10.0*GeV);

Save, compile, and launch the program



  Idle> /run/beamOn 1       

Exercise 2.1.3: Activate GPS

Change DetectorConstruction.cc and DetectorConstruction.hh to use the G4GeneralParticleSource.

Exercise 2.1.4 : GPS macro commands

        Idle> /gps/energy 2. GeV
        Idle> /gps/direction 0 0 1
        Idle> /gps/position 0 0 -1. m
        Idle> /run/beamOn 10

Generated on Thu May 12 14:04:05 2011