Geant4  10.02.p01
PrimaryGeneratorAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: PrimaryGeneratorAction.cc 83919 2014-09-23 08:40:35Z gcosmo $
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "PrimaryGeneratorAction.hh"
41 #include "PrimaryGeneratorMessenger.hh"
42 
43 #include "G4Event.hh"
44 #include "G4ParticleGun.hh"
45 #include "G4ParticleTable.hh"
46 #include "G4ParticleDefinition.hh"
47 #include "Randomize.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
53  fParticleGun(0),
54  fAction0(0),
55  fAction1(0),
56  fAction2(0),
57  fAction3(0),
58  fAction4(0),
59  fSelectedAction(0),
60  fGunMessenger(0)
61 {
62  // default particle kinematic
63  //
64  G4int n_particle = 1;
65  fParticleGun = new G4ParticleGun(n_particle);
66 
67  G4ParticleDefinition* particle
70 
72 
78 
79  //create a messenger for this class
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
86 {
87  delete fAction0;
88  delete fAction1;
89  delete fAction2;
90  delete fAction3;
91  delete fAction4;
92  delete fParticleGun;
93  delete fGunMessenger;
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
100  switch(fSelectedAction)
101  {
102  case 0:
103  fAction0->GeneratePrimaries(anEvent);
104  break;
105  case 1:
106  fAction1->GeneratePrimaries(anEvent);
107  break;
108  case 2:
109  fAction2->GeneratePrimaries(anEvent);
110  break;
111  case 3:
112  fAction3->GeneratePrimaries(anEvent);
113  break;
114  case 4:
115  fAction4->GeneratePrimaries(anEvent);
116  break;
117  default:
118  G4cerr << "Invalid generator fAction" << G4endl;
119  }
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the PrimaryGeneratorAction2 class.
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
PrimaryGeneratorMessenger * fGunMessenger
int G4int
Definition: G4Types.hh:78
PrimaryGeneratorAction0 * fAction0
void SetParticlePosition(G4ThreeVector aPosition)
PrimaryGeneratorAction4 * fAction4
Definition of the PrimaryGeneratorAction3 class.
PrimaryGeneratorAction1 * fAction1
Definition of the PrimaryGeneratorAction1 class.
PrimaryGeneratorAction3 * fAction3
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
Definition of the PrimaryGeneratorAction0 class.
Definition of the PrimaryGeneratorAction4 class.
PrimaryGeneratorAction2 * fAction2
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4GLOB_DLL std::ostream G4cerr