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 | // ------------------------------------------------------------------- |
---|
28 | // GEANT 4 class file --- Copyright CERN 1998 |
---|
29 | // CERN Geneva Switzerland |
---|
30 | // |
---|
31 | // |
---|
32 | // File name: G4ExcitationHandlerTest.cc |
---|
33 | // |
---|
34 | // Author: Maria Grazia Pia (pia@genova.infn.it), |
---|
35 | // |
---|
36 | // Creation date: 27 October 1998 |
---|
37 | // |
---|
38 | // Modifications: |
---|
39 | // |
---|
40 | // ------------------------------------------------------------------- |
---|
41 | |
---|
42 | #include "globals.hh" |
---|
43 | |
---|
44 | #include "G4ios.hh" |
---|
45 | #include <fstream> |
---|
46 | #include <iomanip> |
---|
47 | #include <iostream> |
---|
48 | |
---|
49 | #include "CLHEP/Hist/TupleManager.h" |
---|
50 | #include "CLHEP/Hist/HBookFile.h" |
---|
51 | #include "CLHEP/Hist/Histogram.h" |
---|
52 | #include "CLHEP/Hist/Tuple.h" |
---|
53 | #include "CLHEP/String/Strings.h" |
---|
54 | #include "G4VEvaporationChannel.hh" |
---|
55 | #include "G4CompetitiveFission.hh" |
---|
56 | |
---|
57 | #include "G4ReactionProductVector.hh" |
---|
58 | #include "G4ReactionProduct.hh" |
---|
59 | #include "G4DynamicParticleVector.hh" |
---|
60 | #include "G4DynamicParticle.hh" |
---|
61 | #include "G4ParticleDefinition.hh" |
---|
62 | |
---|
63 | #include "G4ExcitationHandler.hh" |
---|
64 | #include "G4EvaporationChannel.hh" |
---|
65 | #include "G4PhotonEvaporation.hh" |
---|
66 | #include "G4DataVector.hh" |
---|
67 | #include "G4LorentzVector.hh" |
---|
68 | #include "G4ThreeVector.hh" |
---|
69 | #include "G4NucleiProperties.hh" |
---|
70 | #include "G4Fragment.hh" |
---|
71 | #include "Randomize.hh" |
---|
72 | #include "G4Material.hh" |
---|
73 | #include "G4Element.hh" |
---|
74 | #include "G4FragmentVector.hh" |
---|
75 | #include "G4ParticleDefinition.hh" |
---|
76 | #include "G4IonTable.hh" |
---|
77 | #include "G4Electron.hh" |
---|
78 | #include "G4Proton.hh" |
---|
79 | #include "G4Neutron.hh" |
---|
80 | #include "G4ParticleTypes.hh" |
---|
81 | #include "G4IonTable.hh" |
---|
82 | #include "G4GenericIon.hh" |
---|
83 | #include "G4NucleiPropertiesTable.hh" |
---|
84 | |
---|
85 | #include "g4rw/tvvector.h" |
---|
86 | |
---|
87 | int main() |
---|
88 | { |
---|
89 | // MGP ---- HBOOK initialization |
---|
90 | HepTupleManager* hbookManager; |
---|
91 | hbookManager = new HBookFile("handler.hbook", 58); |
---|
92 | assert (hbookManager != 0); |
---|
93 | |
---|
94 | // MGP ---- Book histograms |
---|
95 | |
---|
96 | HepHistogram* hGammaE; |
---|
97 | hGammaE = hbookManager->histogram("Gamma energy", 200,0.,20.); |
---|
98 | assert (hGammaE != 0); |
---|
99 | |
---|
100 | HepHistogram* hNProducts; |
---|
101 | hNProducts = hbookManager->histogram("Number of products", 100,0.,100.); |
---|
102 | assert (hNProducts != 0); |
---|
103 | |
---|
104 | HepHistogram* hProb; |
---|
105 | hProb = hbookManager->histogram("Probability * 1.e25", 100,0.,10.); |
---|
106 | assert (hProb != 0); |
---|
107 | |
---|
108 | // MGP ---- Book a ntuple |
---|
109 | HepTuple* ntuple; |
---|
110 | ntuple = hbookManager->ntuple("G4ExcitationHandler"); |
---|
111 | assert (ntuple != 0); |
---|
112 | |
---|
113 | G4int Z; |
---|
114 | G4int A; |
---|
115 | |
---|
116 | G4cout << "Enter Z and A" << G4endl; |
---|
117 | G4cin >> Z >> A; |
---|
118 | |
---|
119 | assert (Z > 0); |
---|
120 | assert (A > 0); |
---|
121 | assert (A > Z); |
---|
122 | |
---|
123 | G4int iter; |
---|
124 | G4cout << "Enter number of iterations " << G4endl; |
---|
125 | G4cin >> iter; |
---|
126 | if (iter <1) iter = 1; |
---|
127 | |
---|
128 | G4double excMin; |
---|
129 | G4double excMax; |
---|
130 | G4cout << "Enter initial min an max excitation energy" << G4endl; |
---|
131 | G4cin >> excMin >> excMax; |
---|
132 | assert (excMin >= 0.); |
---|
133 | assert (excMax > 0.); |
---|
134 | assert (excMax >= excMin); |
---|
135 | |
---|
136 | G4ParticleDefinition *theElectron = G4Electron::ElectronDefinition(); |
---|
137 | G4ParticleDefinition* ion = G4GenericIon::GenericIonDefinition(); |
---|
138 | G4ParticleTable* theTableOfParticles; |
---|
139 | theTableOfParticles = G4ParticleTable::GetParticleTable(); |
---|
140 | G4IonTable* theTable = new G4IonTable(); |
---|
141 | |
---|
142 | // G4ExcitationHandler for this (Z,A) material |
---|
143 | // Excitation energy levels for each channel |
---|
144 | |
---|
145 | G4int i; |
---|
146 | for (i=0; i<iter; i++) |
---|
147 | { |
---|
148 | G4double excitation = excMin + G4UniformRand() * (excMax - excMin); |
---|
149 | |
---|
150 | G4cout << G4endl << "TEST >>>>>>>>> Iteration " << i |
---|
151 | << " <<<<<<<<< Initial excitation " << excitation << G4endl; |
---|
152 | |
---|
153 | G4double px = 0.; |
---|
154 | G4double py = 0.; |
---|
155 | G4double pz = 0.; |
---|
156 | |
---|
157 | G4ThreeVector p(px,py,pz); |
---|
158 | G4double nuclearMass = G4NucleiProperties::GetNuclearMass(A,Z); |
---|
159 | G4LorentzVector p4(p,std::sqrt((nuclearMass+excitation)*(nuclearMass+excitation))); |
---|
160 | |
---|
161 | G4Fragment nucleus(A,Z,p4); |
---|
162 | |
---|
163 | G4ExcitationHandler* handler = new G4ExcitationHandler; |
---|
164 | // G4DynamicParticleVector* products = handler->BreakItUp(nucleus); |
---|
165 | G4ReactionProductVector* products = handler->BreakItUp(nucleus); |
---|
166 | |
---|
167 | // Fill histograms |
---|
168 | |
---|
169 | G4int nProducts = 0; |
---|
170 | if (products !=0) nProducts = products->entries(); |
---|
171 | |
---|
172 | G4cout << nProducts << " products: gammaE "; |
---|
173 | |
---|
174 | G4int ig = 0; |
---|
175 | for (ig=0; ig<nProducts; ig++) |
---|
176 | { |
---|
177 | if (products->at(ig)->GetDefinition() == G4Gamma::GammaDefinition()) |
---|
178 | { |
---|
179 | // G4double productE = products->at(ig)->Get4Momentum().e(); |
---|
180 | G4double productE = products->at(ig)->GetTotalEnergy(); |
---|
181 | G4cout << productE << " "; |
---|
182 | hGammaE->accumulate(productE); |
---|
183 | ntuple->column("egamma",productE); |
---|
184 | ntuple->dumpData(); |
---|
185 | } |
---|
186 | } |
---|
187 | G4cout << G4endl; |
---|
188 | |
---|
189 | delete handler; |
---|
190 | products->clearAndDestroy(); |
---|
191 | delete products; |
---|
192 | } |
---|
193 | |
---|
194 | hbookManager->write(); |
---|
195 | |
---|
196 | |
---|
197 | return EXIT_SUCCESS; |
---|
198 | } |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | |
---|
212 | |
---|
213 | |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | |
---|