Presentation is loading. Please wait.

Presentation is loading. Please wait.

Primary Particle KOI, Tatsumi Geant4 V9.4 Geant4 Tutorial at Texas A&M 11-Jan- 2011 1.

Similar presentations


Presentation on theme: "Primary Particle KOI, Tatsumi Geant4 V9.4 Geant4 Tutorial at Texas A&M 11-Jan- 2011 1."— Presentation transcript:

1 Primary Particle KOI, Tatsumi Geant4 V9.4 Geant4 Tutorial at Texas A&M 11-Jan- 2011 1

2 G4VUserPrimaryGeneratorAction This is one of the three mandatory classes which user must implement in the code. – The others are G4VUserDetectorConstruction and G4VUserPhysicsList – Geant4 is a toolkit, so that the main() should be also prepared by user Control the generation of primary particles – Primaries particles are initial particles of each event. they will be transported in the Geometry. 290AMeV Carbon beam Cosmic ray particles bombarding space craft All secondary particles which produced by a 7TeV cms proton- proton collision Geant4 V9.42Geant4 Tutorial at Texas A&M 11-Jan-2011

3 G4VUserPrimaryGeneratorAction Cont. One or more concrete class of G4VPrimaryGenerator (primary generator) should be member of this class. This class itself should NOT generate primaries but invoke GeneratePrimaryVertex() method of the concrete class to generate primaries. In the Constructor – Instantiate primary generator(s) – Set default values to it(them) In the GeneratePrimaries() method – Randomize particle-by-particle (event-by-event) value(s) Posisiton and momentum of particle Type of particle – Set these values to primary generator(s) – Invoke GeneratePrimaryVertex() method of primary generator(s) Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20113

4 Example of UserPrimaryGeneratorAction Constructor GeneratePrimaryVertex() Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20114 PrimaryGeneratorAction::PrimaryGeneratorAction( DetectorConstruction* DC) :Detector(DC),rndmFlag("off") { G4int n_particle = 1; particleGun = new G4ParticleGun(n_particle); //create a messenger for this class gunMessenger = new PrimaryGeneratorMessenger(this); // default particle kinematic G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4String particleName; G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-"); particleGun->SetParticleDefinition(particle); particleGun- >SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.)); particleGun->SetParticleEnergy(50.*MeV); G4double position = -0.5*(Detector->GetWorldSizeX()); particleGun- >SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm)); } void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { //this function is called at the begining of event // G4double x0 = -0.5*(Detector->GetWorldSizeX()); G4double y0 = 0.*cm, z0 = 0.*cm; if (rndmFlag == "on") {y0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5); z0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5); } particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0)); particleGun->GeneratePrimaryVertex(anEvent); }

5 Primary particle and Primary vertex G4PrimaryVertex and G4PrimaryParticle classes – These classes don’t have any dependency to G4ParticleDefinition nor G4Track. – Usually create in concrete class of G4VPrimaryGenerator G4PrimaryVertex object has one or more G4PrimaryParticle objects as primary particle. These are stored in G4Event in advance to processing an event. Primary Vertex – Capability of bookkeeping decay chains Pre-assigned decay products (See in appendix) Primary particles may not necessarily be particles which can be tracked by Geant4. Geant4 provides some concrete class of G4VPrimaryGenerator. – G4ParticleGun – G4GeneralParticleSource – G4HEPEvtInterface, G4HEPMCInterface (See in appendix) Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20115

6 G4ParticleGun Concrete implementations of G4VPrimaryGenerator – A good example for experiment-specific primary generator implementation It shoots one primary particle of a certain energy from a certain point at a certain time to a certain direction. – Various set methods are available – Intercoms commands are also available for setting initial values One of most frequently asked questions is : – I want “particle shotgun”, “particle machinegun”, etc. Instead of implementing such a fancy weapon, in your implementation of UserPrimaryGeneratorAction, you can – Shoot random numbers in arbitrary distribution – Use set methods of G4ParticleGun – Use G4ParticleGun as many times as you want – Use any other primary generators as many times as you want to make overlapping events Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20116

7 How to use ParticleGun Constructor GeneratePrimaryVertex() Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20117 PrimaryGeneratorAction::PrimaryGeneratorAction( DetectorConstruction* DC) :Detector(DC),rndmFlag("off") { G4int n_particle = 1; particleGun = new G4ParticleGun(n_particle); //create a messenger for this class gunMessenger = new PrimaryGeneratorMessenger(this); // default particle kinematic G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4String particleName; G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-"); particleGun->SetParticleDefinition(particle); particleGun- >SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.)); particleGun->SetParticleEnergy(50.*MeV); G4double position = -0.5*(Detector->GetWorldSizeX()); particleGun- >SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm)); } void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { //this function is called at the begining of event // G4double x0 = -0.5*(Detector->GetWorldSizeX()); G4double y0 = 0.*cm, z0 = 0.*cm; if (rndmFlag == "on") {y0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5); z0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5); } particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0)); particleGun->GeneratePrimaryVertex(anEvent); }

8 G4GeneralParticleSource Concrete implementations of G4VPrimaryGenerator Primary vertex can be randomly chosen on the surface of a certain volume. Momentum direction and kinetic energy of the primary particle can also be randomized. Distribution could be set by UI commands. Capability of event biasing (variance reduction). – By enhancing particle type, distribution of vertex point, energy and/or direction Detailed description – http://reat.space.qinetiq.com/gps/ Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20118

9 Example of primary particle generation through G4GeneralParticleSource Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-20119 Spherical surface, isotropic radiation, black-body energy Square plane, cosine-law direction, linear energy

10 Example of primary particle generation through G4GeneralParticleSource Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201110 Spherical volume with z biasing, isotropic radiation with theta and phi biasing, integral arbitrary point-wise energy distribution with linear interpolation. Cylindrical surface, cosine-law radiation, Cosmic diffuse energy

11 How to use G4GeneralParticleSource User PrimaryGeneratorAction MyPrimaryGeneratorAction::MyPrim aryGeneratorAction() { generator = new G4GeneralParticleSource; } void MyPrimaryGeneratorAction::Generat ePrimaries(G4Event* anEvent) { generator- >GeneratePrimaryVertex(anEvent); } Command lime /control/verbose 0 /tracking/verbose 0 /event/verbose 0 /gps/verbose 2 /gps/particle gamma /gps/pos/type Plane /gps/pos/shape Square /gps/pos/centre 1 2 1 cm /gps/pos/halfx 2 cm /gps/pos/halfy 2 cm /gps/ang/type cos /gps/ene/type Lin /gps/ene/min 2 MeV /gps/ene/max 10 MeV /gps/ene/gradient 1 /gps/ene/intercept 1 /run/beamOn 10000 The above macro defines a planar source, square in shape, 4 cm by 4 cm and centred at (1,2,1) cms. By default the normal of this plane is the z-axis. The angular distribution is to follow the cosine-law. The energy spectrum is linear, with gradient and intercept equal to 1, and extends from 2 to 10 MeV. 10,000 primaries are to be generated. Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201111

12 G4ParticleGun vs. G4GeneralParticleSource Particle Gun – Simple and naïve – Shoot one track at a time You can shoot more than one tracks within an event. – Easy to handle. Use set methods to alternate track-by-track or event-by- event values. General Particle Source – Powerful – Controlled by UI commands. Almost impossible to control through set methods – Capability of shooting particles from a surface of a volume. – Capability of randomizing kinetic energy, position and/or direction following a user-specified distribution (histogram). Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201112 If you need to shoot primary particles from a surface of a complicated volume, either outward or inward, GPS is the choice. If you need a complicated distribution, GPS is the choice. Otherwise, use Particle Gun.

13 What to do and where to do In the constructor of your UserPrimaryGeneratorAction – Instantiate G4ParticleGun – Set default values by set methods of G4ParticleGun Particle type, kinetic energy, position and direction In your macro file or from your interactive terminal session – Set values for a run Particle type, kinetic energy, position and direction In the GeneratePrimaries() method of your UserPrimaryGeneratorAction – Shoot random number(s) and prepare track-by-track or event-by-event values Kinetic energy, position and direction – Use set methods of G4ParticleGun to set such values – Then invoke GeneratePrimaryVertex() method of G4ParticleGun – If you need more than one primary tracks per event, loop over randomization and GeneratePrimaryVertex(). examples/extended/analysis/A01/src/A01PrimaryGeneratorAction.cc is a good example to start with. – Also, new example to demonstrate how to use ParticleGun to alternate most of the GPS functionalities is to be included in Geant4 9.4. Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201113

14 Summary UserPrimaryActionGenerator – User's mandatory action class for primary vertex/particle generation. – have one or more G4VPrimaryGenerator concrete classes – set/change properties of generator(s) Primary Particle – This class represents a primary particle Primary Vertex – This class has one or more G4PrimaryParticle objects as primary particles. PrimaryGenerator – This class set Primary Vertex to G4Event object G4ParticleGun and G4GeneralParticleSource – Concrete class of G4VPrimaryGenerator Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201114

15 Appendix Pre-assigned decay products Interfaces to HEPEvt and HepMC Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201115

16 Pre-assigned decay products Physics generator can assign a decay channel for each individual particle separately, while in Geant4 you cannot specify a decay channel for each particle. – Decay chain can be “pre-assigned”. A parent particle in the form of G4Track object travels in the detector, bringing “pre-assigned” decay daughters as objects of G4DynamicParticle. – When the parent track comes to the decay point, pre-assigned daughters become to secondary tracks, instead of randomly selecting a decay channel defined to the particle type. Decay time of the parent can be pre-assigned as well. Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201116 Geant4 Tutorial at Texas A&M 11-Jan-201116 D0D0 --  K-K- ++  B-B- G4PrimaryParticle B-B- G4Track D0D0 --  K-K- ++  pre-assigned decay products K-K- ++  D0D0 --  B-B- K-K- ++  D0D0

17 Interfaces to HEPEvt and HepMC Concrete implementations of G4VPrimaryGenerator – A good example for experiment-specific primary generator implementation G4HEPEvtInterface – Suitable to /HEPEVT/ common block, which many of (FORTRAN) HEP physics generators are compliant to. – ASCII file input G4HepMCInterface – An interface to HepMC class, which a few new (C++) HEP physics generators are compliant to. – ASCII file input or direct linking to a generator through HepMC. Geant4 V9.4Geant4 Tutorial at Texas A&M 11-Jan-201117


Download ppt "Primary Particle KOI, Tatsumi Geant4 V9.4 Geant4 Tutorial at Texas A&M 11-Jan- 2011 1."

Similar presentations


Ads by Google