/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/GLG4VertexGen.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/GLG4VertexGen.hh Source File
Ratpac-two
GLG4VertexGen.hh
Go to the documentation of this file.
1 #ifndef __GLG4VertexGen_h__
2 #define __GLG4VertexGen_h__ 1
13 #include <stdio.h> // for FILE
14 
15 #include <G4ThreeVector.hh>
16 
17 #include "globals.hh"
18 
19 class G4Event;
20 class G4Track;
21 class G4PrimaryVertex;
22 class G4ParticleDefinition;
24 
27  public:
28  GLG4VertexGen(const char *arg_dbname = "vertex") : _dbname(arg_dbname){};
29  virtual ~GLG4VertexGen(){};
30  // Generate and add new vertex to this event. Position and
31  // time of vertex are offset from 0 by dx and dt. (These
32  // are usually derived from GLG4PosGen and GLG4TimeGen.)
33  virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt) = 0;
34  // adds vertices.
35  virtual void SetState(G4String newValues) = 0;
36  // sets filename or other information needed by vertex generator
37  virtual G4String GetState() = 0;
38  // returns the current state information in a form that can be understood
39  // by SetState (and, hopefully, a well-informed human)
40 
43  virtual bool ELimitable() { return false; };
46  virtual void LimitEnergies(double, double){};
48  virtual double EMaximum() { return 99999; };
50  virtual double EMinimum() { return 0; };
51 
52  protected:
53  G4String _dbname; // used for GLG4param key prefix
54 };
55 
61  public:
62  GLG4VertexGen_Gun(const char *arg_dbname = "gun");
63  virtual ~GLG4VertexGen_Gun();
64  virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt);
65  // generates a primary vertex with given particle type, direction, energy,
66  // and consistent polarization.
67 
68  virtual void SetState(G4String newValues);
69  // format: particle_name dir_x dir_y dir_z kinetic_energy polx poly polz
70  // If dir_x==dir_y==dir_z==0, the directions are isotropic.
71  // If particle has mass==0 and spin==1, final polarization will be
72  // projected into plane perpindicular to momentum and made a unit vector;
73  // if polarization has zero magnitude, a polarization is chosen randomly.
74 
75  virtual G4String GetState();
76  // returns current state formatted as above
77 
78  public:
79  // the following useful static const data should be universally accessable
80  // (I copied it from the G4IonTable source code, where it is privatized
81  // with no accessor functions.)
82  enum { numberOfElements = 110 };
83  static const char *theElementNames[numberOfElements];
84 
85  protected:
86  G4ParticleDefinition *_pDef;
87  G4ThreeVector _mom;
88  G4double _ke;
89  G4ThreeVector _pol;
90  G4int _multiplicity;
91 };
92 
94 
99  public:
100  GLG4VertexGen_Gun2(const char *arg_dbname = "gun2");
101  virtual ~GLG4VertexGen_Gun2();
102  virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt);
103  // generates a primary vertex with given particle type, direction, energy,
104  // and consistent polarization.
105 
106  virtual void SetState(G4String newValues);
107  // format: particle_name dir_x dir_y dir_z kinetic_energy polx poly polz
108  // If dir_x==dir_y==dir_z==0, the directions are isotropic.
109  // If particle has mass==0 and spin==1, final polarization will be
110  // projected into plane perpindicular to momentum and made a unit vector;
111  // if polarization has zero magnitude, a polarization is chosen randomly.
112 
113  virtual G4String GetState();
114  // returns current state formatted as above
115 
116  public:
117  // the following useful static const data should be universally accessable
118  // (I copied it from the G4IonTable source code, where it is privatized
119  // with no accessor functions.)
120  enum { numberOfElements = 110 };
121  static const char *theElementNames[numberOfElements];
122 
123  protected:
124  G4ParticleDefinition *_pDef;
125  G4ThreeVector _mom;
126  G4double _mom_theta;
127  G4double _ke1;
128  G4double _ke2;
129  G4ThreeVector _pol;
130  G4int _multiplicity;
131 };
132 
138  public:
139  GLG4VertexGen_HEPEvt(const char *arg_dbname = "external");
140  virtual ~GLG4VertexGen_HEPEvt();
141  virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt);
142 
143  // Generates a primary vertex based on information from an ASCII stream.
144  // The ASCII stream contains information in a HEPEVT style.
145 
146  virtual void SetState(G4String newValues);
147  // The argument is a Perl "open" style filename argument:
148  // if the filename ends with '|', the filename is interpreted as
149  // a command which pipes output to us; otherwise, if the filename begins
150  // with '<' or an ordinary character, the file is opened for input.
151  // The "pipe" style can be used to read a gzip'ped file or to start
152  // a program which feeds events to us directly.
153  virtual G4String GetState();
154  // returns current state formatted as above
155 
156  void Open(const char *argFilename);
157  void GetDataLine(char *buffer, size_t size);
158  void Close();
159  void SetUseExternalPos(bool val) { _useExternalPos = val; };
160  bool GetUseExternalPos() { return _useExternalPos; };
161 
162  enum {
163  kIonCodeOffset = 9800000, // nuclei have codes like 98zzaaa
164  kPDGcodeModulus = 10000000, // PDG codes are 7 digits long
165  kISTHEP_ParticleForTracking = 1, // only ISTHEP==1 are for tracking
166  kISTHEP_InformatonMin = 100, // 100 and above are "informatons"
167  kISTHEP_Max = 213 // <= MAXINT / kPDGcodeModulus
168  };
169 
170  protected:
171  G4String _filename;
172  FILE *_file;
173  bool _isPipe;
174  bool _useExternalPos; // true to use positions listed in ACCII stream
175 };
176 
177 #endif
Definition: GLG4PrimaryGeneratorAction.hh:21
Definition: GLG4VertexGen.hh:98
virtual void SetState(G4String newValues)
Definition: GLG4VertexGen.cc:396
virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt)
Definition: GLG4VertexGen.cc:284
Definition: GLG4VertexGen.hh:60
virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt)
Definition: GLG4VertexGen.cc:64
virtual void SetState(G4String newValues)
Definition: GLG4VertexGen.cc:162
Definition: GLG4VertexGen.hh:137
virtual void SetState(G4String newValues)
Definition: GLG4VertexGen.cc:865
virtual void GeneratePrimaryVertex(G4Event *argEvent, G4ThreeVector &dx, G4double dt)
Definition: GLG4VertexGen.cc:655
Definition: GLG4VertexGen.hh:26
virtual double EMinimum()
Definition: GLG4VertexGen.hh:50
virtual bool ELimitable()
Definition: GLG4VertexGen.hh:43
virtual void LimitEnergies(double, double)
Definition: GLG4VertexGen.hh:46
virtual double EMaximum()
Definition: GLG4VertexGen.hh:48