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 | #include "G4ios.hh" |
---|
27 | #include "G4Gamma.hh" |
---|
28 | #include "G4Element.hh" |
---|
29 | #include "G4PhotoNuclearCrossSection.hh" |
---|
30 | |
---|
31 | int main() |
---|
32 | { |
---|
33 | G4PhotoNuclearCrossSection gammaACrossSection; |
---|
34 | const G4int nN=6; // A#of plots (nuclei in the test) |
---|
35 | const G4int nC=227; // A#of points in the plots (energy values) |
---|
36 | ofstream fileH1("h1.out", ios::out); |
---|
37 | fileH1.setf( ios::scientific, ios::floatfield ); |
---|
38 | ofstream fileH2("h2.out", ios::out); |
---|
39 | fileH2.setf( ios::scientific, ios::floatfield ); |
---|
40 | ofstream fileC12("c12.out", ios::out); |
---|
41 | fileC12.setf( ios::scientific, ios::floatfield ); |
---|
42 | ofstream fileAl27("al27.out", ios::out); |
---|
43 | fileAl27.setf( ios::scientific, ios::floatfield ); |
---|
44 | ofstream fileCu("cu.out", ios::out); |
---|
45 | fileCu.setf( ios::scientific, ios::floatfield ); |
---|
46 | ofstream filePb("pb.out", ios::out); |
---|
47 | filePb.setf( ios::scientific, ios::floatfield ); |
---|
48 | G4double low[nN]={137. , 2.22, 12.5 , 8.3 , 7. , 7.35 }; |
---|
49 | G4double high[nN]={4.e7, 4.e7, 4.e7, 4.e7, 4.e7, 4.e7}; |
---|
50 | G4Element* theElement[nN]={new G4Element("Hydrogen", "H", 1, 1.*g/mole), |
---|
51 | new G4Element("Deuterium", "D", 1, 2.*g/mole), |
---|
52 | new G4Element("Carbon", "C", 6, 12.*g/mole), |
---|
53 | new G4Element("Aluminum", "Al", 13, 27.*g/mole), |
---|
54 | new G4Element("Copper", "Cu", 29, 64.*g/mole), |
---|
55 | new G4Element("Lead", "Pb", 82, 208.*g/mole)}; |
---|
56 | G4ParticleDefinition* theParticleDefinition = G4Gamma::GammaDefinition(); |
---|
57 | //G4VProcess* theProcess = new G4PhotonInelasticProcess("Inelastic"); // @@ Make it?! |
---|
58 | G4DynamicParticle* theDynamicParticle; |
---|
59 | G4double sig=0.; |
---|
60 | for(G4int n=0; n<6; n++) |
---|
61 | { |
---|
62 | G4double lekin = std::log(low[n]); |
---|
63 | G4double dlekin= std::exp((std::log(std::log(high[n]))-std::log(lekin))/(nC-1)); |
---|
64 | lekin /= dlekin; |
---|
65 | //G4cout<<"n="<<n<<", low="<<low[n]<<", high="<<high[n]<<", np="<<nC<<", d="<<dlekin<<G4endl; |
---|
66 | for(G4int ll=0; ll<nC; ll++) |
---|
67 | { |
---|
68 | lekin*=dlekin; |
---|
69 | G4double ekin=std::exp(lekin); |
---|
70 | theDynamicParticle = new G4DynamicParticle(theParticleDefinition, |
---|
71 | G4ParticleMomentum(1.,0.,0.), ekin*MeV); |
---|
72 | sig = gammaACrossSection.GetCrossSection(theDynamicParticle,theElement[n])/millibarn; |
---|
73 | delete theDynamicParticle; |
---|
74 | //G4cout<<"n="<<n<<", e="<<ekin<<", sigma="<<sig<<G4endl; |
---|
75 | if(!n) fileH1<<ekin<<" "<<sig<<G4endl; |
---|
76 | else if(n==1) fileH2<<ekin<<" "<<sig<<G4endl; |
---|
77 | else if(n==2) fileC12<<ekin<<" "<<sig<<G4endl; |
---|
78 | else if(n==3) fileAl27<<ekin<<" "<<sig<<G4endl; |
---|
79 | else if(n==4) fileCu<<ekin<<" "<<sig<<G4endl; |
---|
80 | else if(n==5) filePb<<ekin<<" "<<sig<<G4endl; |
---|
81 | } // End of the point LOOP |
---|
82 | } // End of the plot LOOP |
---|
83 | return EXIT_SUCCESS; |
---|
84 | } |
---|