00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00027 // 00028 // MODULE: G4SPSPosDistribution.hh 00029 // 00030 // Version: 1.0 00031 // Date: 5/02/04 00032 // Author: Fan Lei 00033 // Organisation: QinetiQ ltd. 00034 // Customer: ESA/ESTEC 00035 // 00037 // 00038 // CHANGE HISTORY 00039 // -------------- 00040 // 00041 // 00042 // Version 1.0, 05/02/2004, Fan Lei, Created. 00043 // Based on the G4GeneralParticleSource class in Geant4 v6.0 00044 // 00046 // 00047 // 00048 // Class Description: 00049 // 00050 // To generate the position of a primary vertex according to the defined distribution 00051 // 00053 // 00054 // MEMBER FUNCTIONS 00055 // ---------------- 00056 // 00057 // G4SPSPosDistribution () 00058 // Constructor: Initializes variables and instantiates the Navigator class 00059 // 00060 // ~G4SPSPosDistribution () 00061 // Destructor: 00062 // 00063 // void SetPosDisType(G4String) 00064 // Allows user to choose Point, Plane, Surface or Volume source 00065 // position distributions. 00066 // 00067 // void SetPosDisShape(G4String) 00068 // Allows the user to choose the particular shape they wish for the 00069 // position distribution. Choices are Square, Circle, Ellipse, Rectangle, 00070 // Sphere, Ellipsoid, Cylinder, Parallelepiped. 00071 // 00072 // void SetCentreCoords(G4ThreeVector) 00073 // Sets the co-ordinates of the centre of the position distribution. 00074 // 00075 // void SetPosRot1(G4ThreeVector) 00076 // Used to specify the co-ordinate system for the position distribution 00077 // along with SetPosRot2. SetPosRot1 sets the vector x' and need not be 00078 // a unit vector. 00079 // 00080 // void SetPosRot2(G4ThreeVector) 00081 // Used in connection with SetPosRot1. This sets a vector in the plane 00082 // x'y'. By a series of cross products x', y', z' are generated. Again 00083 // need not be a unit vector. 00084 // 00085 // void SetHalfX(G4double) 00086 // Sets the half length in x. 00087 // 00088 // void SetHalfY(G4double) 00089 // Sets the half length in y. 00090 // 00091 // void SetHalfZ(G4double) 00092 // Sets the half length in z. 00093 // 00094 // void SetRadius(G4double) 00095 // Sets the radius where appropriate for source distribution shapes. 00096 // 00097 // void SetRadius0(G4double) 00098 // Sets the inner radius where appropriate for source distribution shapes. 00099 // 00100 // void SetBeamSigmaInR(G4double); 00101 // Sets the sigma for 1D beam 00102 // 00103 // void SetBeamSigmaInX(G4double); 00104 // Sets the first sigma for 2D beam 00105 // 00106 // void SetBeamSigmaInY(G4double); 00107 // Sets the second sigma for 2D beam 00108 // 00109 // void SetParAlpha(G4double) 00110 // Sets the angle Alpha in the Parallelepiped shapes. 00111 // 00112 // void SetParTheta(G4double) 00113 // Sets the angle Theta in the Parallelepiped shapes. 00114 // 00115 // void SetParPhi(G4double) 00116 // Sets the angle Phi in the Parallelepiped shapes. 00117 // 00118 // void ConfineSourceToVolume(G4String) 00119 // Used to confine the start positions to a particular volume. 00120 // 00121 // void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; }; 00122 // Sets the biased random number generator 00123 // 00124 // G4ThreeVector GenerateOne(); 00125 // Generate one random position 00126 // 00127 // void SetVerbosity(G4int) 00128 // Sets the verbosity level. 00129 // 00131 // 00132 #ifndef G4SPSPosDistribution_h 00133 #define G4SPSPosDistribution_h 1 00134 00135 #include "G4Navigator.hh" 00136 #include "G4SPSRandomGenerator.hh" 00137 00138 class G4SPSPosDistribution 00139 { 00140 // 00141 friend class G4SPSAngDistribution; 00142 public: 00143 G4SPSPosDistribution (); 00144 ~G4SPSPosDistribution (); 00145 00146 // methods to create source position dist. 00147 void SetPosDisType(G4String); // Point, Plane, Surface, Volume 00148 inline G4String GetPosDisType() { return SourcePosType; }; 00149 void SetPosDisShape(G4String); 00150 inline G4String GetPosDisShape() { return Shape; }; 00151 // SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere, 00152 // Ellipsoid, Cylinder, Right (parallelepiped). 00153 void SetCentreCoords(G4ThreeVector); 00154 inline G4ThreeVector GetCentreCoords() { return CentreCoords; } ; 00155 void SetPosRot1(G4ThreeVector); 00156 void SetPosRot2(G4ThreeVector); 00157 void SetHalfX(G4double); 00158 inline G4double GetHalfX() { return halfx; } ; 00159 void SetHalfY(G4double); 00160 inline G4double GetHalfY() { return halfy; } ; 00161 void SetHalfZ(G4double); 00162 inline G4double GetHalfZ() { return halfz; } ; 00163 void SetRadius(G4double); 00164 inline G4double GetRadius() { return Radius; }; 00165 void SetRadius0(G4double); 00166 void SetBeamSigmaInR(G4double); 00167 void SetBeamSigmaInX(G4double); 00168 void SetBeamSigmaInY(G4double); 00169 void SetParAlpha(G4double); 00170 void SetParTheta(G4double); 00171 void SetParPhi(G4double); 00172 void ConfineSourceToVolume(G4String); 00173 // 00174 void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; }; 00175 // Set the verbosity level. 00176 void SetVerbosity(G4int a) {verbosityLevel = a; } ; 00177 // 00178 G4ThreeVector GenerateOne(); 00179 00180 private: 00181 00182 void GenerateRotationMatrices(); 00183 // the following routines generate the source position 00184 void GeneratePointSource(); 00185 void GeneratePointsInBeam(); 00186 void GeneratePointsInPlane(); 00187 void GeneratePointsOnSurface(); 00188 void GeneratePointsInVolume(); 00189 00190 G4bool IsSourceConfined(); 00191 00192 private: 00193 00194 // Position distribution Variables 00195 G4String SourcePosType; //Point,Plane,Surface,Volume 00196 G4String Shape; //Circle,Square,Rectangle etc.. 00197 G4double halfx, halfy, halfz; //half lengths 00198 G4double Radius; //Radius for circles or spheres 00199 G4double Radius0; // The inner radius of an annulus 00200 G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source 00201 G4ThreeVector CentreCoords; // Coords of centre of input shape 00202 G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix 00203 G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds 00204 G4bool Confine; //If true confines source distribution to VolName 00205 G4String VolName; 00206 G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices 00207 G4ThreeVector particle_position; // the final particle position to be returned 00208 // 00209 G4Navigator *gNavigator; 00210 // 00211 G4SPSRandomGenerator* posRndm; // biased random generator 00212 // Verbosity 00213 G4int verbosityLevel; 00214 00215 }; 00216 00217 #endif 00218 00219 00220 00221