[819] | 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 "G4Electron.hh" |
---|
| 28 | #include "G4Element.hh" |
---|
| 29 | #include "G4ElectroNuclearCrossSection.hh" |
---|
| 30 | |
---|
| 31 | int main() |
---|
| 32 | { |
---|
| 33 | G4ElectroNuclearCrossSection eACrossSection; |
---|
| 34 | const G4int nN=6; // A#of plots (nuclei in the test) |
---|
| 35 | ofstream file0("h1_epl.out", ios::out); |
---|
| 36 | file0.setf( ios::scientific, ios::floatfield ); |
---|
| 37 | ofstream file1("h1_eph.out", ios::out); |
---|
| 38 | file1.setf( ios::scientific, ios::floatfield ); |
---|
| 39 | ofstream file2("cu_epl.out", ios::out); |
---|
| 40 | file2.setf( ios::scientific, ios::floatfield ); |
---|
| 41 | ofstream file3("cu_eph.out", ios::out); |
---|
| 42 | file3.setf( ios::scientific, ios::floatfield ); |
---|
| 43 | G4Element* theElement[nN]={new G4Element("Hydrogen", "H", 1, 1.*g/mole), |
---|
| 44 | new G4Element("Deuterium", "D", 1, 2.*g/mole), |
---|
| 45 | new G4Element("Carbon", "C", 6, 12.*g/mole), |
---|
| 46 | new G4Element("Aluminum", "Al", 13, 27.*g/mole), |
---|
| 47 | new G4Element("Copper", "Cu", 29, 64.*g/mole), |
---|
| 48 | new G4Element("Lead", "Pb", 82, 208.*g/mole)}; |
---|
| 49 | G4ParticleDefinition* theParticleDefinition = G4Electron::ElectronDefinition(); |
---|
| 50 | G4DynamicParticle* theDynamicParticle; |
---|
| 51 | for(G4int n=0; n<4; n++) |
---|
| 52 | { |
---|
| 53 | G4double ekin=1000.; |
---|
| 54 | if(n==3) ekin=10000.; |
---|
| 55 | else if(n==1) ekin=10000000.; |
---|
| 56 | G4int nel=0; |
---|
| 57 | if(n>1) nel=3; |
---|
| 58 | theDynamicParticle = new G4DynamicParticle(theParticleDefinition, |
---|
| 59 | G4ParticleMomentum(1.,0.,0.), ekin*MeV); |
---|
| 60 | G4double sig = eACrossSection.GetCrossSection(theDynamicParticle,theElement[nel])/millibarn; |
---|
| 61 | G4cout<<"n="<<n<<", Cross Section="<<sig<<G4endl; |
---|
| 62 | delete theDynamicParticle; |
---|
| 63 | G4int prob[100]; |
---|
| 64 | for(G4int k=0; k<100; k++) prob[k]=0; |
---|
| 65 | for(G4int i=0; i<10000000; i++) |
---|
| 66 | { |
---|
| 67 | G4double phe=eACrossSection.GetEffectivePhotonEnergy(); |
---|
| 68 | //if(phe<100.)G4Exception("Too low photon energy"); |
---|
| 69 | G4int ind=static_cast<int>(phe/10.); |
---|
| 70 | if(n==3) ind/=10; |
---|
| 71 | else if(n==1) ind/=10000; |
---|
| 72 | prob[ind]++; |
---|
| 73 | if(!(i%1000000)) G4cout<<i<<" equivalent photons are generated"<<G4endl; |
---|
| 74 | } |
---|
| 75 | //G4cout<<"Now printing"<<G4endl; |
---|
| 76 | for(G4int j=0; j<100; j++) |
---|
| 77 | { |
---|
| 78 | //G4cout<<"j="<<j<<G4endl; |
---|
| 79 | if (!n) file0<<j*10 <<" "<<prob[j]<<G4endl; |
---|
| 80 | else if(n==1) file1<<j*100000<<" "<<prob[j]<<G4endl; |
---|
| 81 | else if(n==2) file2<<j*10 <<" "<<prob[j]<<G4endl; |
---|
| 82 | else if(n==3) file3<<j*100 <<" "<<prob[j]<<G4endl; |
---|
| 83 | } |
---|
| 84 | } |
---|
| 85 | return EXIT_SUCCESS; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|