[816] | 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 | // |
---|
| 28 | // MODULE: G4SPSAngDistribution.hh |
---|
| 29 | // |
---|
| 30 | // Version: 1.0 |
---|
| 31 | // Date: 5/02/04 |
---|
| 32 | // Author: Fan Lei |
---|
| 33 | // Organisation: QinetiQ ltd. |
---|
| 34 | // Customer: ESA/ESTEC |
---|
| 35 | // |
---|
| 36 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 37 | // |
---|
| 38 | // |
---|
| 39 | // CHANGE HISTORY |
---|
| 40 | // -------------- |
---|
| 41 | // 26/10/2004 F Lei |
---|
| 42 | // Added a "focused" option to allow all primary particles pointing to |
---|
| 43 | // a user specified focusing point. |
---|
| 44 | // |
---|
| 45 | // Version 1.0, 05/02/2004, Fan Lei, Created. |
---|
| 46 | // Based on the G4GeneralParticleSource class in Geant4 v6.0 |
---|
| 47 | // |
---|
| 48 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 49 | // |
---|
| 50 | // Class Description: |
---|
| 51 | // |
---|
| 52 | // To generate the direction of a primary vertex according to the defined distribution |
---|
| 53 | // |
---|
| 54 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 55 | // |
---|
| 56 | // MEMBER FUNCTIONS |
---|
| 57 | // ---------------- |
---|
| 58 | // |
---|
| 59 | // G4SPSAngDistribution () |
---|
| 60 | // Constructor: Initializes variables |
---|
| 61 | // |
---|
| 62 | // ~G4SPSAngDistribution () |
---|
| 63 | // Destructor: |
---|
| 64 | // |
---|
| 65 | // void SetAngDistType(G4String) |
---|
| 66 | // Used to set the type of angular distribution wanted. Arguments |
---|
| 67 | // are iso, cos, beam and user for isotropic, cosine-law, beam and user-defined |
---|
| 68 | // respectively. |
---|
| 69 | // |
---|
| 70 | // void DefineAngRefAxes(G4String, G4ThreeVector) |
---|
| 71 | // DefineAngRefAxes is used in a similar way as SetPosRot to |
---|
| 72 | // define vectors, one x' and one in the plane x'y', to create |
---|
| 73 | // a rotated set of axes for the angular distribution. |
---|
| 74 | // |
---|
| 75 | // void SetMinTheta(G4double) |
---|
| 76 | // Sets the minimum value for the angle theta. |
---|
| 77 | // |
---|
| 78 | // void SetMinPhi(G4double) |
---|
| 79 | // Sets the minimum value for phi. |
---|
| 80 | // |
---|
| 81 | // void SetMaxTheta(G4double) |
---|
| 82 | // Sets the maximum value for theta. |
---|
| 83 | // |
---|
| 84 | // void SetMaxPhi(G4double) |
---|
| 85 | // Sets the maximum value for phi. |
---|
| 86 | // |
---|
| 87 | // void UserDefAngTheta(G4ThreeVector) |
---|
| 88 | // This method allows the user to define a histogram in Theta. |
---|
| 89 | // |
---|
| 90 | // void UserDefAngPhi(G4ThreeVector) |
---|
| 91 | // This method allows the user to define a histogram in phi. |
---|
| 92 | // |
---|
| 93 | // void GenerateIsotropicFlux() |
---|
| 94 | // This method generates momentum vectors for particles according |
---|
| 95 | // to an isotropic distribution. |
---|
| 96 | // |
---|
| 97 | // void GenerateCosineLawFlux() |
---|
| 98 | // This method generates momentum vectors for particles according |
---|
| 99 | // to a cosine-law distribution. |
---|
| 100 | // |
---|
| 101 | // void GenerateFocusedFlux() |
---|
| 102 | // This method generates momentum vectors for particles pointing to |
---|
| 103 | // an user specified focusing point. |
---|
| 104 | // |
---|
| 105 | // void GenerateUserDefFlux() |
---|
| 106 | // Controls generation of momentum vectors according to user-defined |
---|
| 107 | // distributions. |
---|
| 108 | // |
---|
| 109 | // G4double GenerateUserDefTheta() |
---|
| 110 | // Generates the theta angle according to a user-defined distribution. |
---|
| 111 | // |
---|
| 112 | // G4double GenerateUserDefPhi() |
---|
| 113 | // Generates phi according to a user-defined distribution. |
---|
| 114 | // |
---|
| 115 | // void SetBeamSigmaInAngR(G4double); |
---|
| 116 | // Sets the sigma for 1D beam |
---|
| 117 | // |
---|
| 118 | // void SetBeamSigmaInAngX(G4double); |
---|
| 119 | // Sets the first sigma for 2D beam |
---|
| 120 | // |
---|
| 121 | // void SetBeamSigmaInAngY(G4double); |
---|
| 122 | // Sets the second sigma for 2D beam |
---|
| 123 | // |
---|
| 124 | // void SetUserWRTSurface(G4bool) |
---|
| 125 | // Allows user to have user-defined spectra either with respect to the |
---|
| 126 | // co-ordinate system (default) or with respect to the surface normal. |
---|
| 127 | // |
---|
| 128 | // void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; }; |
---|
| 129 | // Sets the required position generator, required for determining the cosine-law distribution |
---|
| 130 | // |
---|
| 131 | // void SetBiasRndm (G4SPSRandomGenerator* a) |
---|
| 132 | // Sets the biased random number generator |
---|
| 133 | // |
---|
| 134 | // G4ThreeVector GenerateOne(); |
---|
| 135 | // Generate one random direction |
---|
| 136 | // |
---|
| 137 | // void ReSetHist(G4String); |
---|
| 138 | // Re-sets the histogram for user defined distribution |
---|
| 139 | // |
---|
| 140 | // void SetVerbosity(G4int) |
---|
| 141 | // Sets the verbosity level. |
---|
| 142 | // |
---|
| 143 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 144 | // |
---|
| 145 | #ifndef G4SPSAngDistribution_h |
---|
| 146 | #define G4SPSAngDistribution_h 1 |
---|
| 147 | |
---|
| 148 | #include "G4PhysicsOrderedFreeVector.hh" |
---|
| 149 | #include "G4DataInterpolation.hh" |
---|
| 150 | #include "G4ParticleMomentum.hh" |
---|
| 151 | |
---|
| 152 | #include "G4SPSPosDistribution.hh" |
---|
| 153 | #include "G4SPSRandomGenerator.hh" |
---|
| 154 | |
---|
| 155 | class G4SPSAngDistribution |
---|
| 156 | { |
---|
| 157 | public: |
---|
| 158 | G4SPSAngDistribution (); |
---|
| 159 | ~G4SPSAngDistribution (); |
---|
| 160 | |
---|
| 161 | // Angular Distribution Methods |
---|
| 162 | void SetAngDistType(G4String); |
---|
| 163 | void DefineAngRefAxes(G4String, G4ThreeVector); |
---|
| 164 | void SetMinTheta(G4double); |
---|
| 165 | void SetMinPhi(G4double); |
---|
| 166 | void SetMaxTheta(G4double); |
---|
| 167 | void SetMaxPhi(G4double); |
---|
| 168 | void SetBeamSigmaInAngR(G4double); |
---|
| 169 | void SetBeamSigmaInAngX(G4double); |
---|
| 170 | void SetBeamSigmaInAngY(G4double); |
---|
| 171 | void UserDefAngTheta(G4ThreeVector); |
---|
| 172 | void UserDefAngPhi(G4ThreeVector); |
---|
| 173 | void SetFocusPoint(G4ThreeVector); |
---|
| 174 | inline void SetParticleMomentumDirection |
---|
| 175 | (G4ParticleMomentum aMomentumDirection) |
---|
| 176 | { particle_momentum_direction = aMomentumDirection.unit(); } |
---|
| 177 | void SetUseUserAngAxis(G4bool); |
---|
| 178 | void SetUserWRTSurface(G4bool); |
---|
| 179 | // |
---|
| 180 | void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; }; |
---|
| 181 | void SetBiasRndm(G4SPSRandomGenerator* a) {angRndm = a;}; |
---|
| 182 | // method to re-set the histograms |
---|
| 183 | void ReSetHist(G4String); |
---|
| 184 | // |
---|
| 185 | // Set the verbosity level. |
---|
| 186 | void SetVerbosity(G4int a) {verbosityLevel = a; } ; |
---|
| 187 | // |
---|
| 188 | G4ParticleMomentum GenerateOne(); |
---|
| 189 | |
---|
| 190 | private: |
---|
| 191 | // These methods generate the momentum vectors for the particles. |
---|
| 192 | void GenerateFocusedFlux(); |
---|
| 193 | void GenerateIsotropicFlux(); |
---|
| 194 | void GenerateCosineLawFlux(); |
---|
| 195 | void GenerateBeamFlux(); |
---|
| 196 | void GeneratePlanarFlux(); |
---|
| 197 | void GenerateUserDefFlux(); |
---|
| 198 | G4double GenerateUserDefTheta(); |
---|
| 199 | G4double GenerateUserDefPhi(); |
---|
| 200 | |
---|
| 201 | private: |
---|
| 202 | |
---|
| 203 | // Angular distribution variables. |
---|
| 204 | G4String AngDistType; // String to hold Ang dist type iso, cos, user |
---|
| 205 | G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist |
---|
| 206 | G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi |
---|
| 207 | G4double DR,DX,DY ; // Standard deviations for beam divergence |
---|
| 208 | G4double Theta, Phi; // Store these for use with DEBUG |
---|
| 209 | G4ThreeVector FocusPoint ; // the focusing point in mother coordinates |
---|
| 210 | G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist |
---|
| 211 | G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data |
---|
| 212 | G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram. |
---|
| 213 | G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins |
---|
| 214 | G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram. |
---|
| 215 | G4String UserDistType; //String to hold user distributions |
---|
| 216 | G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt |
---|
| 217 | // surface normals or co-ordinate system |
---|
| 218 | G4bool UserAngRef; // Set to true when user defines a new coordinates |
---|
| 219 | // |
---|
| 220 | G4ParticleMomentum particle_momentum_direction; |
---|
| 221 | // |
---|
| 222 | G4SPSPosDistribution* posDist; // need it here for the cosine-law distri |
---|
| 223 | G4SPSRandomGenerator* angRndm; // biased random generator |
---|
| 224 | |
---|
| 225 | // Verbosity |
---|
| 226 | G4int verbosityLevel; |
---|
| 227 | // |
---|
| 228 | G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only |
---|
| 229 | }; |
---|
| 230 | |
---|
| 231 | #endif |
---|
| 232 | |
---|
| 233 | |
---|
| 234 | |
---|
| 235 | |
---|