G4EnergyLossForExtrapolator.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 //
00026 // $Id$
00027 //
00028 //---------------------------------------------------------------------------
00029 //
00030 // ClassName:    G4EnergyLossForExtrapolator
00031 //  
00032 // Description:  This class provide calculation of energy loss, fluctuation, 
00033 //               and msc angle
00034 //
00035 // Author:       09.12.04 V.Ivanchenko 
00036 //
00037 // Modification: 
00038 // 08-04-05 Rename Propogator -> Extrapolator
00039 // 16-03-06 Add muon tables
00040 // 21-03-06 Add verbosity defined in the constructor and Initialisation
00041 //          start only when first public method is called (V.Ivanchenko)
00042 // 03-05-06 Remove unused pointer G4Material* from number of methods (VI)
00043 // 28-07-07 Add maxEnergyTransfer for computation of energy loss (VI)
00044 //
00045 //----------------------------------------------------------------------------
00046 //
00047 
00048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00049 
00050 #ifndef G4EnergyLossForExtrapolator_h
00051 #define G4EnergyLossForExtrapolator_h 1
00052 
00053 #include <vector>
00054 #include <CLHEP/Units/PhysicalConstants.h>
00055 
00056 #include "globals.hh"
00057 #include "G4PhysicsTable.hh"
00058 
00059 class G4ParticleDefinition;
00060 class G4Material;
00061 class G4MaterialCutsCouple;
00062 class G4ProductionCuts;
00063 
00064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00065 
00066 class G4EnergyLossForExtrapolator 
00067 {
00068 public:
00069   G4EnergyLossForExtrapolator(G4int verb = 1);
00070 
00071   ~G4EnergyLossForExtrapolator();
00072 
00073   G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*);
00074 
00075   G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*);
00076 
00077   G4double ComputeEnergy(G4double range, const G4ParticleDefinition*);
00078 
00079   G4double EnergyAfterStep(G4double kinEnergy, G4double step, 
00080                            const G4Material*, const G4ParticleDefinition*);
00081 
00082   G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 
00083                             const G4Material*, const G4ParticleDefinition*);
00084 
00085   G4double TrueStepLength(G4double kinEnergy, G4double step,
00086                           const G4Material*, const G4ParticleDefinition* part);
00087 
00088   inline G4double EnergyAfterStep(G4double kinEnergy, G4double step, 
00089                                   const G4Material*, const G4String& particleName);
00090 
00091   inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 
00092                                    const G4Material*, const G4String& particleName);
00093 
00094   inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 
00095                                          const G4Material*, 
00096                                          const G4ParticleDefinition* part);
00097 
00098   inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 
00099                                          const G4Material*, 
00100                                          const G4String& particleName);
00101 
00102   inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part, 
00103                                   G4double kinEnergy, G4double stepLength);
00104 
00105   inline G4double EnergyDispersion(G4double kinEnergy, G4double step, 
00106                                    const G4Material*, const G4ParticleDefinition*);
00107 
00108   inline G4double EnergyDispersion(G4double kinEnergy, G4double step, 
00109                                    const G4Material*, const G4String& particleName);
00110 
00111   inline void SetVerbose(G4int val);
00112 
00113   inline void SetMinKinEnergy(G4double);
00114 
00115   inline void SetMaxKinEnergy(G4double);
00116 
00117   inline void SetMaxEnergyTransfer(G4double);
00118    
00119 private:
00120 
00121   void Initialisation();
00122 
00123   G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*, 
00124                          G4double kinEnergy);
00125 
00126   G4PhysicsTable* PrepareTable();
00127 
00128   const G4ParticleDefinition* FindParticle(const G4String& name);
00129 
00130   void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 
00131 
00132   void ComputeMuonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 
00133 
00134   void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 
00135 
00136   void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table);
00137 
00138   inline G4double ComputeValue(G4double x, const G4PhysicsTable* table);
00139 
00140   // hide assignment operator
00141   G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right);
00142   G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&);
00143 
00144   const G4ParticleDefinition* currentParticle;
00145   const G4ParticleDefinition* electron;
00146   const G4ParticleDefinition* positron;
00147   const G4ParticleDefinition* muonPlus;
00148   const G4ParticleDefinition* muonMinus;
00149   const G4ParticleDefinition* proton;
00150 
00151   G4ProductionCuts*        cuts;
00152   std::vector<const G4MaterialCutsCouple*> couples;
00153 
00154   G4String currentParticleName;
00155 
00156   G4PhysicsTable*          dedxElectron;
00157   G4PhysicsTable*          dedxPositron;
00158   G4PhysicsTable*          dedxMuon;
00159   G4PhysicsTable*          dedxProton;
00160   G4PhysicsTable*          rangeElectron;
00161   G4PhysicsTable*          rangePositron;
00162   G4PhysicsTable*          rangeMuon;
00163   G4PhysicsTable*          rangeProton;
00164   G4PhysicsTable*          invRangeElectron;
00165   G4PhysicsTable*          invRangePositron;
00166   G4PhysicsTable*          invRangeMuon;
00167   G4PhysicsTable*          invRangeProton;
00168   G4PhysicsTable*          mscElectron;
00169 
00170   const G4Material* currentMaterial;
00171   G4int       index;
00172   G4double    electronDensity;
00173   G4double    radLength;
00174   G4double    mass;
00175   G4double    charge2;
00176   G4double    kineticEnergy;
00177   G4double    gam;
00178   G4double    bg2;
00179   G4double    beta2;
00180   G4double    tmax;
00181 
00182   G4double    linLossLimit;
00183   G4double    emin;
00184   G4double    emax;
00185   G4double    maxEnergyTransfer;
00186 
00187   G4int       nbins;
00188   G4int       nmat;
00189   G4int       verbose;
00190   G4bool      isInitialised;
00191 };
00192 
00193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00194 
00195 inline G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy, 
00196                                                              G4double step, 
00197                                                              const G4Material* mat, 
00198                                                              const G4String& name)
00199 {
00200   return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
00201 }
00202 
00203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00204 
00205 inline G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy, 
00206                                                               G4double step, 
00207                                                               const G4Material* mat, 
00208                                                               const G4String& name)
00209 {
00210   return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
00211 }
00212 
00213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00214 
00215 inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, 
00216                                                                     G4double step, 
00217                                                                     const G4Material* mat, 
00218                                                                     const G4String& name)
00219 {
00220   return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
00221 }
00222 
00223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00224 
00225 inline G4double 
00226 G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, 
00227                                               G4double step, 
00228                                               const G4Material* mat, 
00229                                               const G4String& name)
00230 {
00231   return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
00232 }
00233 
00234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00235 
00236 inline G4double 
00237 G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, 
00238                                                     G4double stepLength, 
00239                                                     const G4Material* mat, 
00240                                                     const G4ParticleDefinition* part)
00241 {
00242   G4double theta = 0.0;
00243   if(SetupKinematics(part, mat, kinEnergy)) {
00244     G4double t = stepLength/radLength;
00245     G4double y = std::max(0.001, t); 
00246     theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass);
00247   }
00248   return theta;
00249 }
00250 
00251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00252 
00253 inline G4double 
00254 G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat, 
00255                                              const G4ParticleDefinition* part,
00256                                              G4double kinEnergy, 
00257                                              G4double stepLength)
00258 {
00259   G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
00260   return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
00261 } 
00262 
00263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00264   
00265 inline 
00266 G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, 
00267                                                        G4double stepLength, 
00268                                                        const G4Material* mat, 
00269                                                        const G4ParticleDefinition* part)
00270 {
00271   G4double sig2 = 0.0;
00272   if(SetupKinematics(part, mat, kinEnergy)) {
00273     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
00274     sig2 = (1.0/beta2 - 0.5)*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
00275   }
00276   return sig2;
00277 }
00278 
00279 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00280 
00281 inline G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x, 
00282                                                           const G4PhysicsTable* table)
00283 {
00284   G4double res = 0.0;
00285   G4bool b;
00286   if(table) res = ((*table)[index])->GetValue(x, b);
00287   return res;
00288 }
00289 
00290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00291 
00292 inline void G4EnergyLossForExtrapolator::SetVerbose(G4int val) 
00293 {
00294   verbose = val;
00295 }
00296 
00297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00298 
00299 inline void G4EnergyLossForExtrapolator::SetMinKinEnergy(G4double val)
00300 {
00301   emin = val;
00302 }
00303 
00304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00305 
00306 inline void G4EnergyLossForExtrapolator::SetMaxKinEnergy(G4double val)
00307 {
00308   emax = val;
00309 }
00310 
00311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00312 
00313 inline void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer(G4double val)
00314 {
00315   maxEnergyTransfer = val;
00316 }
00317 
00318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00319 
00320 #endif
00321 

Generated on Mon May 27 17:48:10 2013 for Geant4 by  doxygen 1.4.7