Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: GVFlashShowerParameterisation.cc,v 1.2 2006/06/29 19:14:26 gunter Exp $ >> 27 // GEANT4 tag $Name: geant4-09-01-patch-03 $ 26 // 28 // 27 // 29 // 28 // ------------------------------------------- 30 // ------------------------------------------------------------ 29 // GEANT 4 class implementation 31 // GEANT 4 class implementation 30 // 32 // 31 // ------- GVFlashShowerParameterisation 33 // ------- GVFlashShowerParameterisation ------- 32 // 34 // 33 // Authors: Joanna Weng - 11.2005 35 // Authors: Joanna Weng - 11.2005 34 // ------------------------------------------- 36 // ------------------------------------------------------------ 35 37 36 #include <cmath> << 37 << 38 #include "GVFlashShowerParameterisation.hh" 38 #include "GVFlashShowerParameterisation.hh" 39 << 39 #include <cmath> 40 #include "G4PhysicalConstants.hh" << 41 #include "G4SystemOfUnits.hh" << 42 #include "Randomize.hh" 40 #include "Randomize.hh" 43 #include "G4ios.hh" 41 #include "G4ios.hh" 44 #include "G4Material.hh" 42 #include "G4Material.hh" 45 #include "Gamma.hh" // @@@@ 43 #include "Gamma.hh" // @@@@ 46 #include "G4MaterialTable.hh" 44 #include "G4MaterialTable.hh" 47 45 48 GVFlashShowerParameterisation::GVFlashShowerPa 46 GVFlashShowerParameterisation::GVFlashShowerParameterisation() 49 : thePar(0), density(0.), A(0.), Z(0.), X0(0 << 47 : thePar(0) 50 { 48 { 51 fGamma = new MyGamma; << 52 } 49 } 53 50 54 GVFlashShowerParameterisation::~GVFlashShowerP 51 GVFlashShowerParameterisation::~GVFlashShowerParameterisation() 55 { 52 { 56 delete fGamma; << 57 } 53 } 58 54 59 G4double GVFlashShowerParameterisation::GetEff << 55 G4double GVFlashShowerParameterisation::GetEffZ(const G4Material * mat ) 60 { 56 { 61 // Returns Z or effective Z=sum(pi*Zi) (if c 57 // Returns Z or effective Z=sum(pi*Zi) (if compound/mixture) 62 // of given material 58 // of given material 63 // 59 // 64 G4double z = 0.; 60 G4double z = 0.; 65 G4int nofElements = (G4int)mat->GetNumberOfE << 61 G4int nofElements = mat->GetNumberOfElements(); 66 if (nofElements > 1) { << 62 if (nofElements > 1) 67 for (G4int i = 0; i < nofElements; ++i) { << 63 { >> 64 for (G4int i=0; i<nofElements; i++) { 68 G4double zOfElement = mat->GetElement(i) 65 G4double zOfElement = mat->GetElement(i)->GetZ(); 69 G4double massFraction = mat->GetFraction 66 G4double massFraction = mat->GetFractionVector()[i]; 70 // cout << mat->GetElement(i)->GetName() 67 // cout << mat->GetElement(i)->GetName() 71 // <<" Z= "<<zOfElement << " , Frac 68 // <<" Z= "<<zOfElement << " , Fraction= "<<massFraction <<endl; 72 z += zOfElement * massFraction; << 69 z += zOfElement*massFraction; 73 } 70 } 74 } 71 } 75 else { << 72 else { 76 z = mat->GetZ(); << 73 z = mat->GetZ(); 77 } << 74 } 78 return z; 75 return z; 79 } 76 } 80 77 81 G4double GVFlashShowerParameterisation::GetEff << 78 G4double GVFlashShowerParameterisation::GetEffA (const G4Material * mat ) 82 { 79 { 83 // Returns A or effective A=sum(pi*Ai) (if c 80 // Returns A or effective A=sum(pi*Ai) (if compound/mixture) 84 // of given material 81 // of given material 85 // 82 // 86 G4double a = 0.; 83 G4double a = 0.; 87 G4int nofElements = (G4int)mat->GetNumberOfE << 84 G4int nofElements = mat->GetNumberOfElements(); 88 if (nofElements > 1) { 85 if (nofElements > 1) { 89 for (G4int i = 0; i < nofElements; ++i) { << 86 for (G4int i=0; i<nofElements; i++) { 90 G4double aOfElement = mat->GetElement(i) << 87 G4double aOfElement = mat->GetElement(i)->GetA()/(g/mole); 91 G4double massFraction = mat->GetFraction << 88 G4double massFraction = mat->GetFractionVector()[i]; 92 a += aOfElement * massFraction; << 89 a += aOfElement*massFraction; 93 } 90 } 94 } 91 } 95 else { << 92 else { 96 a = mat->GetA() / (g / mole); << 93 a = mat->GetA()/(g/mole); 97 } 94 } 98 return a; 95 return a; 99 } 96 } 100 97 101 void GVFlashShowerParameterisation::PrintMater << 98 void GVFlashShowerParameterisation::PrintMaterial(const G4Material * mat) 102 { 99 { 103 G4cout << "/******************************** << 100 G4cout<<"/********************************************/ " << G4endl; 104 G4cout << " - GVFlashShowerParameterisation << 101 G4cout<<" - GVFlashShowerParameterisation::Material - " << G4endl; 105 G4cout << " Material : " << mat->GetN << 102 G4cout<<" Material : " << mat->GetName() << G4endl; 106 G4cout << " Z = " << Z << G4endl; << 103 G4cout<<" Z = "<< Z << G4endl; 107 G4cout << " A = " << A << G4endl; << 104 G4cout<<" A = "<< A << G4endl; 108 G4cout << " X0 = " << X0 / cm << " cm" << << 105 G4cout<<" X0 = "<<X0/cm <<" cm" << G4endl; 109 G4cout << " Rm = " << Rm / cm << " cm" << << 106 G4cout<<" Rm= "<<Rm/cm <<" cm" << G4endl; 110 G4cout << " Ec = " << Ec / MeV << " MeV" < << 107 G4cout<<" Ec = "<<Ec/MeV << " MeV"<< G4endl; 111 G4cout << "/******************************** << 108 G4cout<<"/********************************************/ " << G4endl; 112 } 109 } 113 110 114 G4double GVFlashShowerParameterisation::Genera 111 G4double GVFlashShowerParameterisation::GeneratePhi() 115 { 112 { 116 G4double Phi = twopi*G4UniformRand() ; 113 G4double Phi = twopi*G4UniformRand() ; 117 return Phi; 114 return Phi; 118 } 115 } 119 116 120 G4double GVFlashShowerParameterisation::gam(G4 << 117 G4double GVFlashShowerParameterisation::gam(G4double x, G4double a) const 121 { 118 { 122 return fGamma->Gamma(a, x); << 119 static MyGamma theG; >> 120 return theG.Gamma(a, x); 123 } 121 } 124 122