QwGeant4
QweakSimPrimaryGeneratorAction.hh
Go to the documentation of this file.
1 
2 //=============================================================================
3 //
4 // ---------------------------
5 // | Doxygen File Information |
6 // ---------------------------
7 /**
8 
9  \file QweakSimPrimaryGeneratorAction.hh
10  $Revision: 1.4 $
11  $Date: 2006/05/05 21:34:59 $
12  \author Klaus Hans Grimm
13 
14 */
15 //=============================================================================
16 //
17 //=============================================================================
18 //
19 // ---------------------------
20 // | Doxygen Class Information |
21 // ---------------------------
22 /**
23  \class QweakSimPrimaryGeneratorAction
24 
25  \brief Deal with primary particle generation and inject it in the detector
26 
27  The primary particle is taken from the root file ep_elastic.root which contains the vertex and kinematic of elastic
28  scattered electrons.
29 
30  Placeholder for a long explaination
31 
32  */
33 //=============================================================================
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 #ifndef QweakSimPrimaryGeneratorAction_h
36 #define QweakSimPrimaryGeneratorAction_h
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
38 
39 // geant4 includes
40 #include "G4ios.hh"
41 #include "G4Types.hh"
42 #include "G4ThreeVector.hh"
43 #include "G4ParticleGun.hh"
44 #include "G4ParticleTable.hh"
45 #include "G4VUserPrimaryGeneratorAction.hh"
46 
47 // user includes
49 #include "QweakSimEPEvent.hh"
50 
51 // geant4 classes
52 class G4ParticleGun;
53 
54 // user classes
57 class QweakSimEPEvent;
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
61 class QweakSimPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
62 {
63 public:
66 
67 public:
68 
69 
70  void SetBeamRasteringRegion(G4double X_min = -2.0*mm,
71  G4double X_max = 2.0*mm,
72  G4double Y_min = -2.0*mm,
73  G4double Y_max = 2.0*mm) {
74  if (X_max < X_min) X_max = X_min;
75  if (Y_max < Y_min) Y_max = Y_min;
76  fPositionX_min = X_min;
77  fPositionX_max = X_max;
78  fPositionY_min = Y_min;
79  fPositionY_max = Y_max;
80  }
81 
82 
83  void GeneratePrimaries(G4Event* anEvent);
85  void SetNtupleEventCounter(G4int cnt);
86 
87  void SetPolarization(G4String polarization) {
88  fPolarization = polarization;
89  }
90 
91  void SetBeamParticleType(G4String type = "e-") {
92  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
93  G4ParticleDefinition* particle = particleTable->FindParticle(type);
94  if (particle) {
95  G4cout << "###### Setting beam particle type to " << type << G4endl;
96  beamParticle = particle;
97  }
98  }
99 
100  void SetScatteredParticleType(G4String type = "e-") {
101  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
102  G4ParticleDefinition* particle = particleTable->FindParticle(type);
103  if (particle) {
104  G4cout << "###### Setting scattered particle type to " << type << G4endl;
105  scatteredParticle = particle;
106  }
107  }
108 
109  void SetParticleType(G4ParticleDefinition* particle) {
110  if (particleGun && particle) {
111  //G4cout << "###### Setting particle type to " << particle->GetParticleName() << G4endl;
112  particleGun->SetParticleDefinition(particle);
113  }
114  else {
115  G4cerr << "###### ERROR: No particle specified, check code!" << G4endl;
116  }
117 
118  }
119 
121 
122 private:
123 
124  G4ParticleDefinition* beamParticle;
125  G4ParticleDefinition* scatteredParticle;
126 
127  G4ParticleGun* particleGun;
128 
130 
132 
134 
135  G4String fPolarization;
136 
137  G4double fPositionX_min;
138  G4double fPositionX_max;
139  G4double fPositionY_min;
140  G4double fPositionY_max;
141 
142 };
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
146 #endif
147 
QweakSimUserInformation * GetUserInfo() const
void SetParticleType(G4ParticleDefinition *particle)
Deal with primary particle generation and inject it in the detector.
void GeneratePrimaries(G4Event *anEvent)
QweakSimPrimaryGeneratorActionMessenger * myMessenger
void SetBeamRasteringRegion(G4double X_min=-2.0 *mm, G4double X_max=2.0 *mm, G4double Y_min=-2.0 *mm, G4double Y_max=2.0 *mm)
QweakSimPrimaryGeneratorAction(QweakSimUserInformation *myUI, QweakSimEPEvent *myEPEvent)