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 | // |
---|
27 | // $Id: G4CrossSectionTest.cc,v 1.3 2008/03/25 10:36:28 pia Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // ------------------------------------------------------------------- |
---|
32 | // Author: Maria Grazia Pia |
---|
33 | // |
---|
34 | // Creation date: 6 August 2001 |
---|
35 | // |
---|
36 | // Modifications: |
---|
37 | // |
---|
38 | // ------------------------------------------------------------------- |
---|
39 | |
---|
40 | #include "globals.hh" |
---|
41 | #include "G4ios.hh" |
---|
42 | #include <fstream> |
---|
43 | #include <iomanip> |
---|
44 | |
---|
45 | |
---|
46 | #include "G4ParticleDefinition.hh" |
---|
47 | #include "G4ParticleTypes.hh" |
---|
48 | //#include "G4ParticleTable.hh" |
---|
49 | #include "G4ParticleMomentum.hh" |
---|
50 | #include "G4DynamicParticle.hh" |
---|
51 | #include "G4ThreeVector.hh" |
---|
52 | #include "G4Track.hh" |
---|
53 | #include "G4SystemOfUnits.hh" |
---|
54 | |
---|
55 | #include "G4CrossSectionElasticScreenedRutherford.hh" |
---|
56 | #include "G4CrossSectionExcitationEmfietzoglou.hh" |
---|
57 | #include "G4CrossSectionExcitationEmfietzoglouPartial.hh" |
---|
58 | #include "G4CrossSectionExcitationBorn.hh" |
---|
59 | #include "G4CrossSectionExcitationBornPartial.hh" |
---|
60 | #include "G4CrossSectionIonisationBornElectron.hh" |
---|
61 | #include "G4CrossSectionIonisationBorn.hh" |
---|
62 | |
---|
63 | #include "G4CrossSectionChargeTransferCH.hh" |
---|
64 | #include "G4CrossSectionChargeTransferExp.hh" |
---|
65 | |
---|
66 | int main() |
---|
67 | { |
---|
68 | |
---|
69 | // G4cout.setf( ios::scientific, ios::floatfield ); |
---|
70 | |
---|
71 | // G4CrossSectionElasticScreenedRutherford* cross = new G4CrossSectionElasticScreenedRutherford; |
---|
72 | // G4CrossSectionExcitationEmfietzoglou* cross = new G4CrossSectionExcitationEmfietzoglou; |
---|
73 | // G4CrossSectionExcitationEmfietzoglouPartial* cross = new G4CrossSectionExcitationEmfietzoglouPartial; |
---|
74 | // G4CrossSectionExcitationBornPartial* cross = new G4CrossSectionExcitationBornPartial; |
---|
75 | // G4CrossSectionIonisationBornElectron* cross = new G4CrossSectionIonisationBornElectron; |
---|
76 | |
---|
77 | // G4CrossSectionIonisationBorn* cross = new G4CrossSectionIonisationBorn; |
---|
78 | |
---|
79 | G4CrossSectionChargeTransferCH* cross = new G4CrossSectionChargeTransferCH; |
---|
80 | |
---|
81 | // G4CrossSectionChargeTransferExp* cross = new G4CrossSectionChargeTransferExp; |
---|
82 | |
---|
83 | // Particle definitions |
---|
84 | |
---|
85 | G4ParticleDefinition* electron = G4Electron::ElectronDefinition(); |
---|
86 | G4ParticleDefinition* proton = G4Proton::ProtonDefinition(); |
---|
87 | G4ParticleDefinition* positron = G4Positron::PositronDefinition(); |
---|
88 | |
---|
89 | // Create a DynamicParticle |
---|
90 | |
---|
91 | G4double initX = 0.; |
---|
92 | G4double initY = 0.; |
---|
93 | G4double initZ = 1.; |
---|
94 | |
---|
95 | G4ParticleMomentum direction(initX,initY,initZ); |
---|
96 | |
---|
97 | G4cout << "Enter initial energy in keV" << G4endl; |
---|
98 | G4double e0; |
---|
99 | G4cin >> e0; |
---|
100 | e0 = e0 * keV; |
---|
101 | |
---|
102 | G4cout << "Enter energy step in keV" << G4endl; |
---|
103 | |
---|
104 | G4double eStep; |
---|
105 | G4cin >> eStep; |
---|
106 | eStep = eStep * keV; |
---|
107 | |
---|
108 | |
---|
109 | // 10 energy steps between the energy limits |
---|
110 | G4int nStep = 10; |
---|
111 | |
---|
112 | for (G4int i=0; i<nStep; i++) |
---|
113 | { |
---|
114 | G4double energy = e0 + i * eStep; |
---|
115 | |
---|
116 | // G4DynamicParticle dynamicParticle(electron,direction,energy); |
---|
117 | G4DynamicParticle dynamicParticle(proton,direction,energy); |
---|
118 | // G4DynamicParticle dynamicParticle(positron,direction,energy); |
---|
119 | |
---|
120 | // dynamicParticle.DumpInfo(0); |
---|
121 | |
---|
122 | // Track |
---|
123 | |
---|
124 | G4ThreeVector position(0.,0.,0.); |
---|
125 | G4double time = 0. ; |
---|
126 | |
---|
127 | G4Track track(&dynamicParticle,time,position); |
---|
128 | |
---|
129 | G4double sigma = cross->CrossSection(track); |
---|
130 | // G4double sigma = cross->CrossSection(energy,0); |
---|
131 | // G4double sigma = cross->CrossSection(energy,electron::GetParticleName()); |
---|
132 | |
---|
133 | // G4cout << energy/keV <<" keV, cross section = " << sigma / (cm*cm) << " cm2" << G4endl; |
---|
134 | |
---|
135 | // G4cout << energy/keV <<" " << sigma / (cm*cm) << G4endl; |
---|
136 | G4cout << energy/keV <<" " << sigma / cm2 << G4endl; |
---|
137 | |
---|
138 | // G4int level = cross->RandomSelect(energy); |
---|
139 | |
---|
140 | // G4cout << "Level = " << level << G4endl; |
---|
141 | } |
---|
142 | |
---|
143 | delete cross; |
---|
144 | |
---|
145 | G4cout << "END OF THE MAIN PROGRAM" << G4endl; |
---|
146 | } |
---|
147 | |
---|
148 | |
---|