source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/calcul/G4ElectroNuclearCrossSectionTest.cc @ 962

Last change on this file since 962 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 5.3 KB
Line 
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#define debug
27#define qedebug
28
29//#include "G4UIterminal.hh"
30#include "G4ios.hh"
31//#include "G4ProcessManager.hh"
32//#include "G4DynamicParticle.hh"
33#include "G4Electron.hh"
34#include "G4Element.hh"
35#include "G4ElectroNuclearCrossSection.hh"
36
37int main()
38{
39  G4ElectroNuclearCrossSection eACrossSection;
40  const G4int nN=6;                          // A#of plots (nuclei in the test)
41  const G4int nC=227;                        // A#of points in the plots (energy values)
42#ifdef qedebug
43  const G4int nP=10;                         // A#of points in nu/Q2 for each eE (energy values)
44#endif
45  std::ofstream fileH1("h1_e.out", std::ios::out);
46  fileH1.setf( std::ios::scientific, std::ios::floatfield );
47  std::ofstream fileH2("h2_e.out", std::ios::out);
48  fileH2.setf( std::ios::scientific, std::ios::floatfield );
49  std::ofstream fileC12("c12_e.out", std::ios::out);
50  fileC12.setf( std::ios::scientific, std::ios::floatfield );
51  std::ofstream fileAl27("al27_e.out", std::ios::out);
52  fileAl27.setf( std::ios::scientific, std::ios::floatfield );
53  std::ofstream fileCu("cu_e.out", std::ios::out);
54  fileCu.setf( std::ios::scientific, std::ios::floatfield );
55  std::ofstream filePb("pb_e.out", std::ios::out);
56  filePb.setf( std::ios::scientific, std::ios::floatfield );
57  G4double low[nN]={137. , 2.22, 12.5 , 8.3 , 7.  , 7.35};
58  G4double high[nN]={2.e7, 2.e7, 2.e7, 2.e7, 2.e7, 2.e7};
59  G4int zA[nN]  ={1, 1,  6, 13, 29,  82};
60  G4int aA[nN]  ={1, 2, 12, 27, 64, 208};
61  G4Element* theElement[nN]={new G4Element("Hydrogen",  "H" , zA[0], aA[0]*g/mole),
62                                                         new G4Element("Deuterium", "D" , zA[1], aA[1]*g/mole),
63                                                         new G4Element("Carbon",    "C" , zA[2], aA[2]*g/mole),
64                                                         new G4Element("Aluminum",  "Al", zA[3], aA[3]*g/mole),
65                                                         new G4Element("Copper",    "Cu", zA[4], aA[4]*g/mole),
66                                                         new G4Element("Lead",      "Pb", zA[5], aA[5]*g/mole)};
67  G4ParticleDefinition* theParticleDefinition = G4Electron::ElectronDefinition();
68  G4DynamicParticle* theDynamicParticle;
69  G4double sig=0.;
70  for(G4int n=0; n<nN; n++)                 // >>>> LOOP over Elements
71  {
72        G4double lekin = std::log(low[n]);
73        G4double dlekin= std::exp((std::log(std::log(high[n]))-std::log(lekin))/(nC-1));
74        lekin /= dlekin;
75#ifdef debug
76        G4cout<<"G4ElNucCSTest:>>>>n="<<n<<",l="<<low[n]<<",h="<<high[n]<<",n="<<nC<<",d="<<dlekin<<G4endl;
77#endif
78        for(G4int ll=0; ll<nC; ll++)            // >>>> LOOP over electron energies with the log-step
79        {
80          lekin*=dlekin;
81      G4double ekin=std::exp(lekin);
82          theDynamicParticle = new G4DynamicParticle(theParticleDefinition,
83                                                                                                 G4ParticleMomentum(1.,0.,0.), ekin*MeV);
84          sig = eACrossSection.GetCrossSection(theDynamicParticle,theElement[n])/millibarn;
85          delete theDynamicParticle;
86#ifdef debug
87      G4cout<<"G4ElNucCSTest:****>>> Z="<<zA[n]<<", A="<<aA[n]<<", eE="<<ekin<<", sigma="<<sig<<G4endl;
88#endif
89#ifdef qedebug
90          if(sig>0.)for(G4int qe=0; qe<nP; qe++) // >>>> LOOP over equiv. photon energies for particular eE
91          {
92            G4double phE = eACrossSection.GetEquivalentPhotonEnergy();
93            G4double phQ2= eACrossSection.GetEquivalentPhotonQ2(phE);
94            G4double x = phQ2/1878./phE;
95        G4cout<<"G4ElNucCSTest:.......eE="<<ekin<<", phE="<<phE<<", phQ2="<<phQ2<<", x="<<x<<G4endl;
96          } // End of the equivalent photon LOOP
97#endif
98      // Fill the result for the electro-nuclear cross section plot
99      if(!n) fileH1<<ekin<<" "<<sig<<G4endl;
100      else if(n==1) fileH2<<ekin<<" "<<sig<<G4endl;
101      else if(n==2) fileC12<<ekin<<" "<<sig<<G4endl;
102      else if(n==3) fileAl27<<ekin<<" "<<sig<<G4endl;
103      else if(n==4) fileCu<<ekin<<" "<<sig<<G4endl;
104      else if(n==5) filePb<<ekin<<" "<<sig<<G4endl;
105    } // End of the LOOP over electron energies
106  } // End of the LOOP over elements
107  return EXIT_SUCCESS;
108}
Note: See TracBrowser for help on using the repository browser.