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: G4SPSAngDistribution.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 // 00039 // CHANGE HISTORY 00040 // -------------- 00041 // 26/10/2004 F Lei 00042 // Added a "focused" option to allow all primary particles pointing to 00043 // a user specified focusing point. 00044 // 00045 // Version 1.0, 05/02/2004, Fan Lei, Created. 00046 // Based on the G4GeneralParticleSource class in Geant4 v6.0 00047 // 00049 // 00050 // Class Description: 00051 // 00052 // To generate the direction of a primary vertex according to the defined distribution 00053 // 00055 // 00056 // MEMBER FUNCTIONS 00057 // ---------------- 00058 // 00059 // G4SPSAngDistribution () 00060 // Constructor: Initializes variables 00061 // 00062 // ~G4SPSAngDistribution () 00063 // Destructor: 00064 // 00065 // void SetAngDistType(G4String) 00066 // Used to set the type of angular distribution wanted. Arguments 00067 // are iso, cos, beam and user for isotropic, cosine-law, beam and user-defined 00068 // respectively. 00069 // 00070 // void DefineAngRefAxes(G4String, G4ThreeVector) 00071 // DefineAngRefAxes is used in a similar way as SetPosRot to 00072 // define vectors, one x' and one in the plane x'y', to create 00073 // a rotated set of axes for the angular distribution. 00074 // 00075 // void SetMinTheta(G4double) 00076 // Sets the minimum value for the angle theta. 00077 // 00078 // void SetMinPhi(G4double) 00079 // Sets the minimum value for phi. 00080 // 00081 // void SetMaxTheta(G4double) 00082 // Sets the maximum value for theta. 00083 // 00084 // void SetMaxPhi(G4double) 00085 // Sets the maximum value for phi. 00086 // 00087 // void UserDefAngTheta(G4ThreeVector) 00088 // This method allows the user to define a histogram in Theta. 00089 // 00090 // void UserDefAngPhi(G4ThreeVector) 00091 // This method allows the user to define a histogram in phi. 00092 // 00093 // void GenerateIsotropicFlux() 00094 // This method generates momentum vectors for particles according 00095 // to an isotropic distribution. 00096 // 00097 // void GenerateCosineLawFlux() 00098 // This method generates momentum vectors for particles according 00099 // to a cosine-law distribution. 00100 // 00101 // void GenerateFocusedFlux() 00102 // This method generates momentum vectors for particles pointing to 00103 // an user specified focusing point. 00104 // 00105 // void GenerateUserDefFlux() 00106 // Controls generation of momentum vectors according to user-defined 00107 // distributions. 00108 // 00109 // G4double GenerateUserDefTheta() 00110 // Generates the theta angle according to a user-defined distribution. 00111 // 00112 // G4double GenerateUserDefPhi() 00113 // Generates phi according to a user-defined distribution. 00114 // 00115 // void SetBeamSigmaInAngR(G4double); 00116 // Sets the sigma for 1D beam 00117 // 00118 // void SetBeamSigmaInAngX(G4double); 00119 // Sets the first sigma for 2D beam 00120 // 00121 // void SetBeamSigmaInAngY(G4double); 00122 // Sets the second sigma for 2D beam 00123 // 00124 // void SetUserWRTSurface(G4bool) 00125 // Allows user to have user-defined spectra either with respect to the 00126 // co-ordinate system (default) or with respect to the surface normal. 00127 // 00128 // void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; }; 00129 // Sets the required position generator, required for determining the cosine-law distribution 00130 // 00131 // void SetBiasRndm (G4SPSRandomGenerator* a) 00132 // Sets the biased random number generator 00133 // 00134 // G4ThreeVector GenerateOne(); 00135 // Generate one random direction 00136 // 00137 // void ReSetHist(G4String); 00138 // Re-sets the histogram for user defined distribution 00139 // 00140 // void SetVerbosity(G4int) 00141 // Sets the verbosity level. 00142 // 00144 // 00145 #ifndef G4SPSAngDistribution_h 00146 #define G4SPSAngDistribution_h 1 00147 00148 #include "G4PhysicsOrderedFreeVector.hh" 00149 #include "G4DataInterpolation.hh" 00150 #include "G4ParticleMomentum.hh" 00151 00152 #include "G4SPSPosDistribution.hh" 00153 #include "G4SPSRandomGenerator.hh" 00154 00155 class G4SPSAngDistribution 00156 { 00157 public: 00158 G4SPSAngDistribution (); 00159 ~G4SPSAngDistribution (); 00160 00161 // Angular Distribution Methods 00162 void SetAngDistType(G4String); 00163 void DefineAngRefAxes(G4String, G4ThreeVector); 00164 void SetMinTheta(G4double); 00165 void SetMinPhi(G4double); 00166 void SetMaxTheta(G4double); 00167 void SetMaxPhi(G4double); 00168 void SetBeamSigmaInAngR(G4double); 00169 void SetBeamSigmaInAngX(G4double); 00170 void SetBeamSigmaInAngY(G4double); 00171 void UserDefAngTheta(G4ThreeVector); 00172 void UserDefAngPhi(G4ThreeVector); 00173 void SetFocusPoint(G4ThreeVector); 00174 inline void SetParticleMomentumDirection 00175 (G4ParticleMomentum aMomentumDirection) 00176 { particle_momentum_direction = aMomentumDirection.unit(); } 00177 void SetUseUserAngAxis(G4bool); 00178 void SetUserWRTSurface(G4bool); 00179 // 00180 void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; } 00181 void SetBiasRndm(G4SPSRandomGenerator* a) {angRndm = a;} 00182 // method to re-set the histograms 00183 void ReSetHist(G4String); 00184 // 00185 // Set the verbosity level. 00186 void SetVerbosity(G4int a) {verbosityLevel = a; } 00187 // some get methods 00188 G4String GetDistType() { return AngDistType;} 00189 G4double GetMinTheta() { return MinTheta; } 00190 G4double GetMaxTheta() { return MaxTheta; } 00191 G4double GetMinPhi() { return MinPhi; } 00192 G4double GetMaxPhi() { return MaxPhi; } 00193 // 00194 G4ParticleMomentum GenerateOne(); 00195 00196 private: 00197 // These methods generate the momentum vectors for the particles. 00198 void GenerateFocusedFlux(); 00199 void GenerateIsotropicFlux(); 00200 void GenerateCosineLawFlux(); 00201 void GenerateBeamFlux(); 00202 void GeneratePlanarFlux(); 00203 void GenerateUserDefFlux(); 00204 G4double GenerateUserDefTheta(); 00205 G4double GenerateUserDefPhi(); 00206 00207 private: 00208 00209 // Angular distribution variables. 00210 G4String AngDistType; // String to hold Ang dist type iso, cos, user 00211 G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist 00212 G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi 00213 G4double DR,DX,DY ; // Standard deviations for beam divergence 00214 G4double Theta, Phi; // Store these for use with DEBUG 00215 G4ThreeVector FocusPoint ; // the focusing point in mother coordinates 00216 G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist 00217 G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data 00218 G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram. 00219 G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins 00220 G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram. 00221 G4String UserDistType; //String to hold user distributions 00222 G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt 00223 // surface normals or co-ordinate system 00224 G4bool UserAngRef; // Set to true when user defines a new coordinates 00225 // 00226 G4ParticleMomentum particle_momentum_direction; 00227 // 00228 G4SPSPosDistribution* posDist; // need it here for the cosine-law distri 00229 G4SPSRandomGenerator* angRndm; // biased random generator 00230 00231 // Verbosity 00232 G4int verbosityLevel; 00233 // 00234 G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only 00235 }; 00236 00237 #endif