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: GVFlashShowerParameterisation.cc 69796 2013-05-15 13:26:12Z gcosmo $ 00027 // 00028 // 00029 // ------------------------------------------------------------ 00030 // GEANT 4 class implementation 00031 // 00032 // ------- GVFlashShowerParameterisation ------- 00033 // 00034 // Authors: Joanna Weng - 11.2005 00035 // ------------------------------------------------------------ 00036 00037 #include <cmath> 00038 00039 #include "GVFlashShowerParameterisation.hh" 00040 00041 #include "G4PhysicalConstants.hh" 00042 #include "G4SystemOfUnits.hh" 00043 #include "Randomize.hh" 00044 #include "G4ios.hh" 00045 #include "G4Material.hh" 00046 #include "Gamma.hh" // @@@@ 00047 #include "G4MaterialTable.hh" 00048 00049 GVFlashShowerParameterisation::GVFlashShowerParameterisation() 00050 : thePar(0), density(0.), A(0.), Z(0.), X0(0.), Ec(0.), Rm(0.), NSpot(0.) 00051 { 00052 } 00053 00054 GVFlashShowerParameterisation::~GVFlashShowerParameterisation() 00055 { 00056 } 00057 00058 G4double GVFlashShowerParameterisation::GetEffZ(const G4Material * mat ) 00059 { 00060 // Returns Z or effective Z=sum(pi*Zi) (if compound/mixture) 00061 // of given material 00062 // 00063 G4double z = 0.; 00064 G4int nofElements = mat->GetNumberOfElements(); 00065 if (nofElements > 1) 00066 { 00067 for (G4int i=0; i<nofElements; i++) { 00068 G4double zOfElement = mat->GetElement(i)->GetZ(); 00069 G4double massFraction = mat->GetFractionVector()[i]; 00070 // cout << mat->GetElement(i)->GetName() 00071 // <<" Z= "<<zOfElement << " , Fraction= "<<massFraction <<endl; 00072 z += zOfElement*massFraction; 00073 } 00074 } 00075 else { 00076 z = mat->GetZ(); 00077 } 00078 return z; 00079 } 00080 00081 G4double GVFlashShowerParameterisation::GetEffA (const G4Material * mat ) 00082 { 00083 // Returns A or effective A=sum(pi*Ai) (if compound/mixture) 00084 // of given material 00085 // 00086 G4double a = 0.; 00087 G4int nofElements = mat->GetNumberOfElements(); 00088 if (nofElements > 1) { 00089 for (G4int i=0; i<nofElements; i++) { 00090 G4double aOfElement = mat->GetElement(i)->GetA()/(g/mole); 00091 G4double massFraction = mat->GetFractionVector()[i]; 00092 a += aOfElement*massFraction; 00093 } 00094 } 00095 else { 00096 a = mat->GetA()/(g/mole); 00097 } 00098 return a; 00099 } 00100 00101 void GVFlashShowerParameterisation::PrintMaterial(const G4Material * mat) 00102 { 00103 G4cout<<"/********************************************/ " << G4endl; 00104 G4cout<<" - GVFlashShowerParameterisation::Material - " << G4endl; 00105 G4cout<<" Material : " << mat->GetName() << G4endl; 00106 G4cout<<" Z = "<< Z << G4endl; 00107 G4cout<<" A = "<< A << G4endl; 00108 G4cout<<" X0 = "<<X0/cm <<" cm" << G4endl; 00109 G4cout<<" Rm= "<<Rm/cm <<" cm" << G4endl; 00110 G4cout<<" Ec = "<<Ec/MeV << " MeV"<< G4endl; 00111 G4cout<<"/********************************************/ " << G4endl; 00112 } 00113 00114 G4double GVFlashShowerParameterisation::GeneratePhi() 00115 { 00116 G4double Phi = twopi*G4UniformRand() ; 00117 return Phi; 00118 } 00119 00120 G4double GVFlashShowerParameterisation::gam(G4double x, G4double a) const 00121 { 00122 static MyGamma theG; 00123 return theG.Gamma(a, x); 00124 }