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

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/GLG4PosGen.hh Source File
Ratpac-two
GLG4PosGen.hh
1 // This file is part of the GenericLAND software library.
2 // $Id: GLG4PosGen.hh,v 1.2 2005/11/19 17:59:39 volsung Exp $
3 //
4 // GenericLAND global position generator for primary events,
5 // by G.Horton-Smith, August 3, 2001
6 // (See note on GenericLAND generators for more information.)
7 #ifndef __GLG4PosGen_h__
8 #define __GLG4PosGen_h__ 1
9 
10 #include "globals.hh"
11 class G4PrimaryVertex;
12 class G4VPhysicalVolume;
13 class G4Material;
14 
15 #include <G4ThreeVector.hh>
16 #include <vector>
17 
18 class GLG4PosGen {
19  public:
20  GLG4PosGen(const char *arg_dbname = "pos") : _dbname(arg_dbname) {}
21  virtual ~GLG4PosGen() {}
22 
23  virtual void GeneratePosition(G4ThreeVector &argResult) = 0;
24  // Select position for event
25 
26  virtual void SetState(G4String newValues) = 0;
27  // sets filename or other information needed by global position generator
28 
29  virtual G4String GetState() const = 0;
30  // returns the current state information in a form that can be understood
31  // by SetState (and, hopefully, a well-informed human)
32 
33  protected:
34  G4String _dbname; // used for GLG4param key prefix
35 };
36 
37 class GLG4PosGen_Point : public GLG4PosGen {
38  public:
39  GLG4PosGen_Point(const char *arg_dbname = "point");
40  virtual void GeneratePosition(G4ThreeVector &argResult);
41  // Generates a position either at a fixed point in the global coordinates
42  void SetState(G4String newValues);
43  // newValues == x y z coordinates in mm (separated by white space),
44  G4String GetState() const;
45  // returns current state in format above
46  protected:
47  G4ThreeVector _fixedPos;
48 };
49 
50 class GLG4PosGen_Paint : public GLG4PosGen {
51  public:
52  GLG4PosGen_Paint(const char *arg_dbname = "paint");
53  virtual void GeneratePosition(G4ThreeVector &argResult);
54  // Generates a position uniformly over the surface of the volume
55  // which containst he given point.
56  // (This approach to specifying the volume isn't my favorite, but
57  // it is strongly motivated by subtleties in Geant4's geometry code.)
58  void SetState(G4String newValues);
59  // newValues == x y z coordinates in mm (separated by white space),
60  // optionally followed by name of physical volume expected at that position,
61  // optionally followed by thickness of coat of "paint" (external to volume).
62  // optionally followed by name of material to which to restrict "paint".
63  G4String GetState() const;
64  // returns current state in format above
65  protected:
66  G4ThreeVector _pos;
67  G4double _thickness;
68  G4String _pVolumeName;
69  G4VPhysicalVolume *_pVolume;
70  G4String _materialName;
71  G4Material *_material;
72  int _ntried;
73  int _nfound;
74  G4double _boundingBoxVolume;
75  std::vector<G4ThreeVector> _intercepts;
76 };
77 
78 class GLG4PosGen_Fill : public GLG4PosGen {
79  public:
80  GLG4PosGen_Fill(const char *arg_dbname = "fill");
81  virtual void GeneratePosition(G4ThreeVector &argResult);
82  // Generates a position uniformly filling the volume which contains
83  // the given point.
84  // (This approach to specifying the volume isn't my favorite, but
85  // it is strongly motivated by subtleties in Geant4's geometry code.)
86  // - A random point in a compact physical volume is pretty fast.
87  // - A volume which only sparsely fills its geometric "extent" may
88  // require many iterations to find an internal point -- this will be slow.
89  void SetState(G4String newValues);
90  // newValues == x y z coordinates in mm (separated by white space),
91  // optionally followed by name of physical volume expected at that position;
92  G4String GetState() const;
93  // returns current state in format above
94  protected:
95  G4ThreeVector _pos;
96  G4String _pVolumeName;
97  G4VPhysicalVolume *_pVolume;
98  G4String _materialName;
99  G4Material *_material;
100  int _ntried;
101  int _nfound;
102  G4double _boundingBoxVolume;
103 };
104 
106  public:
107  GLG4PosGen_FillCyl(const char *arg_dbname = "fillcyl");
108  virtual void GeneratePosition(G4ThreeVector &argResult);
109  // Generates a position uniformly filling the cylindrical volume which
110  // is defined by the given height and radius
111  // (This approach to specifying the volume isn't my favorite, but
112  // it is strongly motivated by subtleties in Geant4's geometry code.)
113  // - A random point in a compact physical volume is pretty fast.
114  // - A volume which only sparsely fills its geometric "extent" may
115  // require many iterations to find an internal point -- this will be slow.
116  void SetState(G4String newValues);
117  // newValues == x y z coordinates in mm (separated by white space),
118  // optionally followed by name of physical volume expected at that position;
119  G4String GetState() const;
120  // returns current state in format above
121  protected:
122  G4double _radius, _height;
123  int _volumeInfoLoaded;
124 };
125 
127  public:
128  GLG4PosGen_Cosmic(const char *arg_dbname);
129  virtual void GenerateVertexPositions(G4PrimaryVertex *argVertex, double max_chain_time, double event_rate,
130  double dt = 0.0);
131  // external flux uniformly distributed over area normal to
132  // incident direction of first track in vertex
133  void GeneratePosition(G4ThreeVector &); // (not used)
134  void SetState(G4String newValues);
135  // newValues == "width height"
136  // width == width of rectangular area normal to incident direction (mm)
137  // height == height of rectangular area normal to incident direction (mm)
138  // Appropriate values for GenericLAND would be 20000 33000.
139  // The rectangle is rotated so that the "width" direction vector lies in
140  // the XY plane for non-zero polar angle of the incident track.
141  // If a track is generated which completely misses the detector,
142  // the PDG code of the vertex tracks are modified to make them have
143  // an impossible effective ISTHEP codes of 1, so Geant4 does not attempt
144  // to track them.
145  // This means the generated external flux in Hz/mm**2 is always
146  // flux = (rate/(width*height)),
147  // regardless of the geometry of the detector, where "rate" is the rate
148  // set via /generators/rate. The "rate" must be chosen appropriately
149  // for the area of the rectangle.
150  G4String GetState() const;
151  // returns current state in format above
152  private:
153  G4double _width, _height;
154 };
155 
156 #endif
Definition: GLG4PosGen.hh:126
Definition: GLG4PosGen.hh:105
Definition: GLG4PosGen.hh:78
Definition: GLG4PosGen.hh:50
Definition: GLG4PosGen.hh:37
Definition: GLG4PosGen.hh:18