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 | // $Id: GVFlashShowerParameterisation.cc,v 1.2 2006/06/29 19:14:26 gunter Exp $ |
---|
27 | // GEANT4 tag $Name: $ |
---|
28 | // |
---|
29 | // |
---|
30 | // ------------------------------------------------------------ |
---|
31 | // GEANT 4 class implementation |
---|
32 | // |
---|
33 | // ------- GVFlashShowerParameterisation ------- |
---|
34 | // |
---|
35 | // Authors: Joanna Weng - 11.2005 |
---|
36 | // ------------------------------------------------------------ |
---|
37 | |
---|
38 | #include "GVFlashShowerParameterisation.hh" |
---|
39 | #include <cmath> |
---|
40 | #include "Randomize.hh" |
---|
41 | #include "G4ios.hh" |
---|
42 | #include "G4Material.hh" |
---|
43 | #include "Gamma.hh" // @@@@ |
---|
44 | #include "G4MaterialTable.hh" |
---|
45 | |
---|
46 | GVFlashShowerParameterisation::GVFlashShowerParameterisation() |
---|
47 | : thePar(0) |
---|
48 | { |
---|
49 | } |
---|
50 | |
---|
51 | GVFlashShowerParameterisation::~GVFlashShowerParameterisation() |
---|
52 | { |
---|
53 | } |
---|
54 | |
---|
55 | G4double GVFlashShowerParameterisation::GetEffZ(const G4Material * mat ) |
---|
56 | { |
---|
57 | // Returns Z or effective Z=sum(pi*Zi) (if compound/mixture) |
---|
58 | // of given material |
---|
59 | // |
---|
60 | G4double z = 0.; |
---|
61 | G4int nofElements = mat->GetNumberOfElements(); |
---|
62 | if (nofElements > 1) |
---|
63 | { |
---|
64 | for (G4int i=0; i<nofElements; i++) { |
---|
65 | G4double zOfElement = mat->GetElement(i)->GetZ(); |
---|
66 | G4double massFraction = mat->GetFractionVector()[i]; |
---|
67 | // cout << mat->GetElement(i)->GetName() |
---|
68 | // <<" Z= "<<zOfElement << " , Fraction= "<<massFraction <<endl; |
---|
69 | z += zOfElement*massFraction; |
---|
70 | } |
---|
71 | } |
---|
72 | else { |
---|
73 | z = mat->GetZ(); |
---|
74 | } |
---|
75 | return z; |
---|
76 | } |
---|
77 | |
---|
78 | G4double GVFlashShowerParameterisation::GetEffA (const G4Material * mat ) |
---|
79 | { |
---|
80 | // Returns A or effective A=sum(pi*Ai) (if compound/mixture) |
---|
81 | // of given material |
---|
82 | // |
---|
83 | G4double a = 0.; |
---|
84 | G4int nofElements = mat->GetNumberOfElements(); |
---|
85 | if (nofElements > 1) { |
---|
86 | for (G4int i=0; i<nofElements; i++) { |
---|
87 | G4double aOfElement = mat->GetElement(i)->GetA()/(g/mole); |
---|
88 | G4double massFraction = mat->GetFractionVector()[i]; |
---|
89 | a += aOfElement*massFraction; |
---|
90 | } |
---|
91 | } |
---|
92 | else { |
---|
93 | a = mat->GetA()/(g/mole); |
---|
94 | } |
---|
95 | return a; |
---|
96 | } |
---|
97 | |
---|
98 | void GVFlashShowerParameterisation::PrintMaterial(const G4Material * mat) |
---|
99 | { |
---|
100 | G4cout<<"/********************************************/ " << G4endl; |
---|
101 | G4cout<<" - GVFlashShowerParameterisation::Material - " << G4endl; |
---|
102 | G4cout<<" Material : " << mat->GetName() << G4endl; |
---|
103 | G4cout<<" Z = "<< Z << G4endl; |
---|
104 | G4cout<<" A = "<< A << G4endl; |
---|
105 | G4cout<<" X0 = "<<X0/cm <<" cm" << G4endl; |
---|
106 | G4cout<<" Rm= "<<Rm/cm <<" cm" << G4endl; |
---|
107 | G4cout<<" Ec = "<<Ec/MeV << " MeV"<< G4endl; |
---|
108 | G4cout<<"/********************************************/ " << G4endl; |
---|
109 | } |
---|
110 | |
---|
111 | G4double GVFlashShowerParameterisation::GeneratePhi() |
---|
112 | { |
---|
113 | G4double Phi = twopi*G4UniformRand() ; |
---|
114 | return Phi; |
---|
115 | } |
---|
116 | |
---|
117 | G4double GVFlashShowerParameterisation::gam(G4double x, G4double a) const |
---|
118 | { |
---|
119 | static MyGamma theG; |
---|
120 | return theG.Gamma(a, x); |
---|
121 | } |
---|