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 | // |
---|
26 | // |
---|
27 | // GridParticleGun |
---|
28 | // |
---|
29 | // Declaration of grid particle gun |
---|
30 | // |
---|
31 | // Grid gun: particles travel parallel to vector "direction". |
---|
32 | // Each particle has a double index (ij) where (0 <= i < n), (0 <= j < m). |
---|
33 | // The starting point of particle ij is: |
---|
34 | // |
---|
35 | // startingPoint = origin + (i/n)*g1 + (j/m)*g2 |
---|
36 | // |
---|
37 | // where g1 and g2 are directions and origin a position. |
---|
38 | |
---|
39 | #ifndef GridParticleGun_hh |
---|
40 | #define GridParticleGun_hh |
---|
41 | |
---|
42 | #include "globals.hh" |
---|
43 | #include "G4VPrimaryGenerator.hh" |
---|
44 | #include "G4ThreeVector.hh" |
---|
45 | #include "G4ParticleDefinition.hh" |
---|
46 | #include "G4PrimaryVertex.hh" |
---|
47 | #include "G4ParticleMomentum.hh" |
---|
48 | |
---|
49 | class G4Event; |
---|
50 | class GridParticleGunMessenger; |
---|
51 | |
---|
52 | class GridParticleGun : public G4VPrimaryGenerator |
---|
53 | { |
---|
54 | public: |
---|
55 | GridParticleGun(); |
---|
56 | GridParticleGun( G4ThreeVector direction, |
---|
57 | G4ThreeVector origin, |
---|
58 | G4ThreeVector grid1, |
---|
59 | G4ThreeVector grid2, |
---|
60 | G4int n1, G4int n2 ); |
---|
61 | ~GridParticleGun(); |
---|
62 | |
---|
63 | void GeneratePrimaryVertex( G4Event *evt ); |
---|
64 | |
---|
65 | inline void SetDirection( G4ThreeVector newDirection) { direction = newDirection; } |
---|
66 | inline G4ThreeVector GetDirection() const { return direction; } |
---|
67 | |
---|
68 | inline void SetOrigin( G4ThreeVector newOrigin) { origin = newOrigin; } |
---|
69 | inline G4ThreeVector GetOrigin() const { return origin; } |
---|
70 | |
---|
71 | inline void SetGrid1( G4ThreeVector newGrid1 ) { grid1 = newGrid1; } |
---|
72 | inline G4ThreeVector GetGrid1() const { return grid1; } |
---|
73 | |
---|
74 | inline void SetGrid2( G4ThreeVector newGrid2 ) { grid2 = newGrid2; } |
---|
75 | inline G4ThreeVector GetGrid2() const { return grid2; } |
---|
76 | |
---|
77 | inline void SetN1( G4int newN1 ) { n1 = newN1; }; |
---|
78 | inline G4int GetN1() const { return n1; } |
---|
79 | |
---|
80 | inline void SetN2( G4int newN2 ) { n2 = newN2; }; |
---|
81 | inline G4int GetN2() const { return n2; } |
---|
82 | |
---|
83 | |
---|
84 | private: |
---|
85 | void SetDefaults(); |
---|
86 | |
---|
87 | protected: |
---|
88 | G4int n1, n2; |
---|
89 | G4ThreeVector direction, origin, grid1, grid2; |
---|
90 | G4ParticleDefinition *particleType; |
---|
91 | |
---|
92 | private: |
---|
93 | GridParticleGunMessenger *messenger; |
---|
94 | }; |
---|
95 | |
---|
96 | #endif |
---|