source: trunk/source/processes/electromagnetic/lowenergy/test/testGryzinski.cc @ 1350

Last change on this file since 1350 was 1350, checked in by garnier, 13 years ago

update to last version 4.9.4

File size: 4.4 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//Ho preso la struttura dal test AtomicDexecitation.cc
27
28#include "globals.hh"
29#include "G4ios.hh"
30#include <vector>
31#include <iostream>
32#include <fstream>
33#include "G4VhShellCrossSection.hh"
34#include "G4hShellCrossSection.hh"
35#include "G4AtomicTransitionManager.hh"
36#include "G4Proton.hh"
37
38int main()
39{ 
40  G4int Z; 
41  G4double incidentEnergy;
42  G4double mass;
43  G4double deltaEnergy;
44  size_t shellNumber;
45 
46  G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance();
47  G4VhShellCrossSection* shell = new G4hShellCrossSection;
48
49  //massa del protone in Kg
50  //mass = 1.67262158e-27 * kg;
51
52  G4Proton* aProtone = G4Proton::Proton();
53  mass = aProtone->GetPDGMass();
54
55  std::vector<G4double> energies; 
56
57  energies.push_back(0.005); // 5 KeV
58  energies.push_back(0.010);
59  energies.push_back(0.050);
60  energies.push_back(0.100);
61  energies.push_back(0.500);
62  energies.push_back(1.000);
63  energies.push_back(5.000);
64  energies.push_back(10.00);
65  energies.push_back(15.00);
66  energies.push_back(50.00); // 50 MeV
67
68
69  G4cout << "Enter shell number: " << G4endl;
70  G4cin >> shellNumber;
71
72
73  //Z is the atomic number
74  for (Z = 1; Z<=92; Z++)
75    { 
76      G4cout << "Z = " << Z << G4endl;
77     
78      //Cross section for each incident energy
79      for (G4int k=0; k<10;k++)
80        {
81          incidentEnergy = energies[k]*MeV;
82         
83          // *************************************************************** //
84          // From Grizinsky, Phys.Rev. 138,2A, A305 & A322, deltaEnergy      //
85          // is the maximum energy of the delta ray emitted. So, deltaEnergy //
86          // will be proton energy - biding energy of the selected shell.    //
87          // *************************************************************** //
88
89          G4double bindingEnergy = transitionManager->Shell(Z,shellNumber)->BindingEnergy();
90
91          deltaEnergy = incidentEnergy - bindingEnergy;
92
93          std::vector<G4double> CS = shell->Probabilities(Z,incidentEnergy,mass,deltaEnergy);
94         
95          //Volendo scrivere sullo schermo       
96          G4cout << " Incident Energy : " << incidentEnergy/MeV << " MeV -- ";
97          G4cout << "Cross Section = " << CS[shellNumber]/barn <<" barn " << G4endl; 
98
99
100          //Volendo scrivere i risultati in un file.
101
102          //         ofstream outfile( "mytest.out");
103          //         outfile << CS[1]/barn << " Barn" <<  G4endl;
104          //         outfile.close();
105
106          //       ofstream outfile( "mytest.out", std::ios::out );
107          //         fOut.write((G4double) (CS[1]), sizeof (G4int));
108          //            //Per verificare che il file si apra.
109          //            if( ! outfile) {
110          //         G4cerr << "Sorry! We anable to open the file.out!" << G4endl;
111          //         break;
112          //         // return -1;
113          //         }
114          //         mytest.out  << "Cross Section = " << CS[1]/barn << "Barn" <<  G4endl;           
115        }
116    } 
117  delete shell;
118
119  G4cout<<"END OF THE MAIN PROGRAM"<<G4endl;
120}
Note: See TracBrowser for help on using the repository browser.