G4SPSRandomGenerator.hh

Go to the documentation of this file.
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:        G4SPSRandomGenerator.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 // 26/10/2004 F Lei
00042 //    Created separated the theta, phi generators for position distributions.
00043 //
00044 // Version 1.0, 05/02/2004, Fan Lei, Created.
00045 //    Based on the G4GeneralParticleSource class in Geant4 v6.0
00046 //
00048 //
00049 // Class Description:
00050 //
00051 // Special random number generator used by G4GeneralParticleSource to allow 
00052 // biasing applied at the lowest level for all distributions.
00053 //
00055 //
00056 // MEMBER FUNCTIONS
00057 // ----------------
00058 //
00059 // G4SPSRandomGenerator ()
00060 //    Constructor: Initializes variables
00061 //
00062 // ~G4SPSRandomGenerator ()
00063 //    Destructor: 
00064 //
00065 // void SetXBias(G4ThreeVector)
00066 //    Allows the user to re-distribute the random
00067 //    numbers used to generate x co-ordinates.
00068 //
00069 // void SetYBias(G4ThreeVector)
00070 //    Allows the user to re-distribute the random
00071 //    numbers used to generate y co-ordinates.
00072 //
00073 // void SetZBias(G4ThreeVector)
00074 //    Allows the user to re-distribute the random
00075 //    numbers used to generate z co-ordinates.
00076 //
00077 // void SetThetaBias(G4ThreeVector)
00078 //    Allows the user to re-distribute the random
00079 //    numbers used to generate values of theta.
00080 //
00081 // void SetPhiBias(G4ThreeVector)
00082 //    Allows the user to re-distribute the random
00083 //    numbers used to generate values of phi.
00084 //
00085 // void SetPosThetaBias(G4ThreeVector)
00086 //    Allows the user to re-distribute the random
00087 //    numbers used to generate values of theta for position distribution.
00088 //
00089 // void SetPosPhiBias(G4ThreeVector)
00090 //    Allows the user to re-distribute the random
00091 //    numbers used to generate values of phi for position distribution.
00092 //
00093 // void SetEnergyBias(G4ThreeVector)
00094 //    Allows the user to re-distribute the random
00095 //    numbers used to generate the energies.
00096 //
00097 // G4double GenRandX()
00098 //    Generates the random number for x, with or without biasing.
00099 //
00100 // G4double GenRandY()
00101 //    Generates the random number for y, with or without biasing.
00102 //
00103 // G4double GenRandZ()
00104 //    Generates the random number for z, with or without biasing.
00105 //
00106 // G4double GenRandTheta()
00107 //    Generates the random number for theta, with or without biasing.
00108 //
00109 // G4double GenRandPhi()
00110 //    Generates the random number for phi, with or without biasing.
00111 //
00112 // G4double GenRandEnergy()
00113 //    Generates the random number for energy, with or without biasing.
00114 //
00115 // G4double GenRandPosTheta()
00116 //    Generates the random number for theta, with or without biasing for position distribution.
00117 //
00118 // G4double GenRandPosPhi()
00119 //    Generates the random number for phi, with or without biasing for position distribution.
00120 //
00121 //  inline G4double GetBiasWeight()
00122 //    Returns the weight change after biasing
00123 // 
00124 //  void ReSetHist(G4String);
00125 //    Re-sets the histogram for user defined distribution
00126 //
00127 // void SetVerbosity(G4int)
00128 //    Sets the verbosity level.
00129 //
00131 //
00132 #ifndef G4SPSRandomGenerator_h
00133 #define G4SPSRandomGenerator_h 1
00134 
00135 #include "G4PhysicsOrderedFreeVector.hh"
00136 #include "G4DataInterpolation.hh"
00137 
00138 class G4SPSRandomGenerator {
00139 public:
00140         G4SPSRandomGenerator();
00141         ~G4SPSRandomGenerator();
00142 
00143         //  static G4SPSRandomGenerator* getInstance ();
00144 
00145         // Biasing Methods
00146         void SetXBias(G4ThreeVector);
00147         void SetYBias(G4ThreeVector);
00148         void SetZBias(G4ThreeVector);
00149         void SetThetaBias(G4ThreeVector);
00150         void SetPhiBias(G4ThreeVector);
00151         void SetEnergyBias(G4ThreeVector);
00152         void SetPosThetaBias(G4ThreeVector);
00153         void SetPosPhiBias(G4ThreeVector);
00154         G4double GenRandX();
00155         G4double GenRandY();
00156         G4double GenRandZ();
00157         G4double GenRandTheta();
00158         G4double GenRandPhi();
00159         G4double GenRandEnergy();
00160         G4double GenRandPosTheta();
00161         G4double GenRandPosPhi();
00162 
00163         inline void SetIntensityWeight(G4double weight) {
00164                 bweights[8] = weight;
00165         }
00166         ;
00167 
00168         inline G4double GetBiasWeight() {
00169                 return bweights[0] * bweights[1] * bweights[2] * bweights[3]
00170                                 * bweights[4] * bweights[5] * bweights[6] * bweights[7]
00171                                 * bweights[8];
00172         }
00173         ;
00174 
00175         // method to re-set the histograms
00176         void ReSetHist(G4String);
00177 
00178         // Set the verbosity level.
00179         void SetVerbosity(G4int a) {
00180                 verbosityLevel = a;
00181         }
00182         ;
00183 
00184 private:
00185 
00186         //  static G4SPSRandomGenerator  *instance;
00187 
00188         G4bool XBias, IPDFXBias;
00189         G4PhysicsOrderedFreeVector XBiasH;
00190         G4PhysicsOrderedFreeVector IPDFXBiasH;
00191         G4bool YBias, IPDFYBias;
00192         G4PhysicsOrderedFreeVector YBiasH;
00193         G4PhysicsOrderedFreeVector IPDFYBiasH;
00194         G4bool ZBias, IPDFZBias;
00195         G4PhysicsOrderedFreeVector ZBiasH;
00196         G4PhysicsOrderedFreeVector IPDFZBiasH;
00197         G4bool ThetaBias, IPDFThetaBias;
00198         G4PhysicsOrderedFreeVector ThetaBiasH;
00199         G4PhysicsOrderedFreeVector IPDFThetaBiasH;
00200         G4bool PhiBias, IPDFPhiBias;
00201         G4PhysicsOrderedFreeVector PhiBiasH;
00202         G4PhysicsOrderedFreeVector IPDFPhiBiasH;
00203         G4bool EnergyBias, IPDFEnergyBias;
00204         G4PhysicsOrderedFreeVector EnergyBiasH;
00205         G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
00206         G4bool PosThetaBias, IPDFPosThetaBias;
00207         G4PhysicsOrderedFreeVector PosThetaBiasH;
00208         G4PhysicsOrderedFreeVector IPDFPosThetaBiasH;
00209         G4bool PosPhiBias, IPDFPosPhiBias;
00210         G4PhysicsOrderedFreeVector PosPhiBiasH;
00211         G4PhysicsOrderedFreeVector IPDFPosPhiBiasH;
00212 
00213         //G4double alpha;   // for biasing energy
00214 
00215         G4double bweights[9]; //record x,y,z,theta,phi,energy,posThet,posPhi,intensity weights
00216 
00217         // Verbosity
00218         G4int verbosityLevel;
00219 
00220         G4PhysicsOrderedFreeVector ZeroPhysVector; // for re-set only
00221 
00222 };
00223 
00224 #endif
00225 

Generated on Mon May 27 17:49:53 2013 for Geant4 by  doxygen 1.4.7