1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * DISCLAIMER * |
---|
4 | // * * |
---|
5 | // * The following disclaimer summarizes all the specific disclaimers * |
---|
6 | // * of contributors to this software. The specific disclaimers,which * |
---|
7 | // * govern, are listed with their locations in: * |
---|
8 | // * http://cern.ch/geant4/license * |
---|
9 | // * * |
---|
10 | // * Neither the authors of this software system, nor their employing * |
---|
11 | // * institutes,nor the agencies providing financial support for this * |
---|
12 | // * work make any representation or warranty, express or implied, * |
---|
13 | // * regarding this software system or assume any liability for its * |
---|
14 | // * use. * |
---|
15 | // * * |
---|
16 | // * This code implementation is the intellectual property of the * |
---|
17 | // * GEANT4 collaboration. * |
---|
18 | // * By copying, distributing or modifying the Program (or any work * |
---|
19 | // * based on the Program) you indicate your acceptance of this * |
---|
20 | // * statement, and all its terms. * |
---|
21 | // ******************************************************************** |
---|
22 | // |
---|
23 | // |
---|
24 | // ------------------------------------------------------------------- |
---|
25 | // GEANT 4 class file --- Copyright CERN 1998 |
---|
26 | // CERN Geneva Switzerland |
---|
27 | // |
---|
28 | // |
---|
29 | // File name: G4TableTest.cc |
---|
30 | // |
---|
31 | // Author: Maria Grazia Pia (pia@genova.infn.it), |
---|
32 | // |
---|
33 | // Creation date: 15 April 1999 |
---|
34 | // |
---|
35 | // Modifications: |
---|
36 | // |
---|
37 | // ------------------------------------------------------------------- |
---|
38 | |
---|
39 | #include "globals.hh" |
---|
40 | |
---|
41 | #include "G4ios.hh" |
---|
42 | #include <fstream> |
---|
43 | #include <iomanip> |
---|
44 | #include <iostream> |
---|
45 | #include <assert.h> |
---|
46 | |
---|
47 | #include "CLHEP/Hist/TupleManager.h" |
---|
48 | #include "CLHEP/Hist/HBookFile.h" |
---|
49 | #include "CLHEP/Hist/Histogram.h" |
---|
50 | #include "CLHEP/Hist/Tuple.h" |
---|
51 | |
---|
52 | #include "Randomize.hh" |
---|
53 | |
---|
54 | #include "G4ParticleDefinition.hh" |
---|
55 | #include "G4AntiProton.hh" |
---|
56 | #include "G4AntiNeutron.hh" |
---|
57 | #include "G4Proton.hh" |
---|
58 | #include "G4Neutron.hh" |
---|
59 | #include "G4PionPlus.hh" |
---|
60 | #include "G4PionMinus.hh" |
---|
61 | #include "G4PionZero.hh" |
---|
62 | #include "G4Gamma.hh" |
---|
63 | #include "G4MuonMinus.hh" |
---|
64 | #include "G4MuonPlus.hh" |
---|
65 | #include "G4KaonMinus.hh" |
---|
66 | #include "G4KaonPlus.hh" |
---|
67 | #include "G4NeutrinoMu.hh" |
---|
68 | #include "G4AntiNeutrinoMu.hh" |
---|
69 | #include "G4Lambda.hh" |
---|
70 | |
---|
71 | #include "G4VDecayChannel.hh" |
---|
72 | #include "G4DecayTable.hh" |
---|
73 | |
---|
74 | #include "G4KineticTrack.hh" |
---|
75 | #include "G4KineticTrackVector.hh" |
---|
76 | |
---|
77 | #include "G4VShortLivedParticle.hh" |
---|
78 | #include "G4ShortLivedConstructor.hh" |
---|
79 | #include "G4ParticleTable.hh" |
---|
80 | #include "G4ShortLivedTable.hh" |
---|
81 | |
---|
82 | #include "G4VXResonanceTable.hh" |
---|
83 | #include "G4XNNstarTable.hh" |
---|
84 | #include "G4XDeltaNstarTable.hh" |
---|
85 | #include "G4XDeltaDeltaTable.hh" |
---|
86 | #include "G4XNDeltaTable.hh" |
---|
87 | #include "G4XNDeltastarTable.hh" |
---|
88 | #include "G4XDeltaDeltastarTable.hh" |
---|
89 | |
---|
90 | #include "G4ResonanceNames.hh" |
---|
91 | |
---|
92 | #include <vector> |
---|
93 | |
---|
94 | int main() |
---|
95 | { |
---|
96 | // MGP ---- HBOOK initialization |
---|
97 | HepTupleManager* hbookManager; |
---|
98 | G4String fileName = "xtables.hbook"; |
---|
99 | hbookManager = new HBookFile(fileName, 58); |
---|
100 | assert (hbookManager != 0); |
---|
101 | |
---|
102 | // ==== Initialization phase ==== |
---|
103 | |
---|
104 | G4ParticleDefinition* gamma = G4Gamma::GammaDefinition(); |
---|
105 | |
---|
106 | G4ParticleDefinition* proton = G4Proton::ProtonDefinition(); |
---|
107 | G4ParticleDefinition* antiProton = G4AntiProton::AntiProtonDefinition(); |
---|
108 | G4ParticleDefinition* neutron = G4Neutron::NeutronDefinition(); |
---|
109 | G4ParticleDefinition* antiNeutron = G4AntiNeutron::AntiNeutronDefinition(); |
---|
110 | |
---|
111 | G4ParticleDefinition* pionPlus = G4PionPlus::PionPlusDefinition(); |
---|
112 | G4ParticleDefinition* pionMinus = G4PionMinus::PionMinusDefinition(); |
---|
113 | G4ParticleDefinition* pionZero = G4PionZero::PionZeroDefinition(); |
---|
114 | |
---|
115 | G4ParticleDefinition* kaonPlus = G4KaonPlus::KaonPlusDefinition(); |
---|
116 | G4ParticleDefinition* kaonMinus = G4KaonMinus::KaonMinusDefinition(); |
---|
117 | |
---|
118 | G4ParticleDefinition* lambda = G4Lambda::LambdaDefinition(); |
---|
119 | |
---|
120 | G4ParticleDefinition* theMuonPlus = G4MuonPlus::MuonPlusDefinition(); |
---|
121 | G4ParticleDefinition* theMuonMinus = G4MuonMinus::MuonMinusDefinition(); |
---|
122 | |
---|
123 | G4ParticleDefinition* theNeutrinoMu = G4NeutrinoMu::NeutrinoMuDefinition(); |
---|
124 | G4ParticleDefinition* theAntiNeutrinoMu = G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); |
---|
125 | |
---|
126 | // Construct resonances |
---|
127 | G4ShortLivedConstructor shortLived; |
---|
128 | shortLived.ConstructParticle(); |
---|
129 | |
---|
130 | // Get the particle table |
---|
131 | G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); |
---|
132 | |
---|
133 | // ==== End of the initialization phase ==== |
---|
134 | |
---|
135 | // The list of resonances handled by the Kinetic Model |
---|
136 | G4ResonanceNames* resonanceList = new G4ResonanceNames; |
---|
137 | |
---|
138 | // ==== Nucleons ==== |
---|
139 | |
---|
140 | G4cout << proton->GetParticleName() |
---|
141 | <<": mass " << proton->GetPDGMass() |
---|
142 | <<", width " << proton->GetPDGWidth() |
---|
143 | <<", iSpin "<< proton->GetPDGiSpin() |
---|
144 | <<", iIsospin " << proton->GetPDGiIsospin() |
---|
145 | <<", iIsospin3 " << proton->GetPDGiIsospin3() |
---|
146 | << G4endl; |
---|
147 | |
---|
148 | G4cout << neutron->GetParticleName() |
---|
149 | <<": mass " << neutron->GetPDGMass() |
---|
150 | <<", width " << neutron->GetPDGWidth() |
---|
151 | <<", iSpin "<< neutron->GetPDGiSpin() |
---|
152 | <<", iIsospin " << neutron->GetPDGiIsospin() |
---|
153 | <<", iIsospin3 " << neutron->GetPDGiIsospin3() |
---|
154 | << G4endl; |
---|
155 | |
---|
156 | // ===== Delta ===== |
---|
157 | |
---|
158 | std::vector<G4String> listDelta = resonanceList->DeltaNames(); |
---|
159 | G4int nDelta = listDelta.size(); |
---|
160 | G4cout << G4endl << "===== Delta ===== " << G4endl; |
---|
161 | |
---|
162 | G4int i; |
---|
163 | for (i=0; i<nDelta; i++) |
---|
164 | { |
---|
165 | // Particle information |
---|
166 | G4String name = listDelta[i]; |
---|
167 | G4ParticleDefinition* def = particleTable->FindParticle(name); |
---|
168 | if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl; |
---|
169 | G4cout << def->GetParticleName() |
---|
170 | <<": mass " << def->GetPDGMass() |
---|
171 | <<", width " << def->GetPDGWidth() |
---|
172 | <<", iSpin "<< def->GetPDGiSpin() |
---|
173 | <<", iIsospin " << def->GetPDGiIsospin() |
---|
174 | <<", iIsospin3 " << def->GetPDGiIsospin3() |
---|
175 | << G4endl; |
---|
176 | } |
---|
177 | |
---|
178 | // pp -> N Delta cross section table |
---|
179 | G4VXResonanceTable* tableND = new G4XNDeltaTable; |
---|
180 | |
---|
181 | for (i=0; i<nDelta; i+=4) |
---|
182 | { |
---|
183 | // Book a ntuple |
---|
184 | G4String name = listDelta[i]; |
---|
185 | G4String ntName = "N " + name; |
---|
186 | HepTuple* ntupleND = hbookManager->ntuple(ntName); |
---|
187 | |
---|
188 | G4String xName = " p p -> Delta " + name; |
---|
189 | const G4PhysicsVector* sigma = tableND->CrossSectionTable(name); |
---|
190 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
191 | G4cout << "----------- " << xName <<" cross section table ----------- " |
---|
192 | << G4endl; |
---|
193 | |
---|
194 | // Fill the ntuple |
---|
195 | G4int j; |
---|
196 | for (j=0; j<entries; j++) |
---|
197 | { |
---|
198 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
199 | G4bool dummy = false; |
---|
200 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
201 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
202 | << G4endl; |
---|
203 | ntupleND->column("e",energy /GeV); |
---|
204 | ntupleND->column("sigma",x); |
---|
205 | ntupleND->dumpData(); |
---|
206 | } |
---|
207 | G4cout << ntName << " ntuple available" << G4endl; |
---|
208 | } |
---|
209 | delete tableND; |
---|
210 | |
---|
211 | // pp -> Delta Delta cross section table |
---|
212 | G4VXResonanceTable* tableDD = new G4XDeltaDeltaTable; |
---|
213 | |
---|
214 | for (i=0; i<nDelta; i+=4) |
---|
215 | { |
---|
216 | // Book a ntuple |
---|
217 | G4String name = listDelta[i]; |
---|
218 | G4String ntName = "delta " + name; |
---|
219 | HepTuple* ntupleDD = hbookManager->ntuple(ntName); |
---|
220 | |
---|
221 | G4String xName = " p p -> Delta " + name; |
---|
222 | const G4PhysicsVector* sigma = tableDD->CrossSectionTable(name); |
---|
223 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
224 | G4cout << "----------- " << xName << " cross section table ----------- " |
---|
225 | << G4endl; |
---|
226 | |
---|
227 | // Fill the ntuple |
---|
228 | G4int j; |
---|
229 | for (j=0; j<entries; j++) |
---|
230 | { |
---|
231 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
232 | G4bool dummy = false; |
---|
233 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
234 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
235 | << G4endl; |
---|
236 | ntupleDD->column("e",energy /GeV); |
---|
237 | ntupleDD->column("sigma",x); |
---|
238 | ntupleDD->dumpData(); |
---|
239 | } |
---|
240 | G4cout << ntName << " ntuple available" << G4endl; |
---|
241 | } |
---|
242 | delete tableDD; |
---|
243 | |
---|
244 | |
---|
245 | // Excited Nucleons ===== |
---|
246 | |
---|
247 | G4cout << G4endl << "===== Excited Nucleons ===== " << G4endl; |
---|
248 | |
---|
249 | std::vector<G4String> listNstar = resonanceList->NstarNames(); |
---|
250 | G4int nNstar = listNstar.size(); |
---|
251 | |
---|
252 | for (i=0; i<nNstar; i++) |
---|
253 | { |
---|
254 | G4String name = listNstar[i]; |
---|
255 | G4ParticleDefinition* def = particleTable->FindParticle(name); |
---|
256 | if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl; |
---|
257 | G4cout << def->GetParticleName() |
---|
258 | <<": mass " << def->GetPDGMass() |
---|
259 | <<", width " << def->GetPDGWidth() |
---|
260 | <<", iSpin "<< def->GetPDGiSpin() |
---|
261 | <<", iIsospin " << def->GetPDGiIsospin() |
---|
262 | <<", iIsospin3 " << def->GetPDGiIsospin3() |
---|
263 | << G4endl; |
---|
264 | } |
---|
265 | |
---|
266 | // pp -> N Nstar cross section table |
---|
267 | G4VXResonanceTable* tableNNstar = new G4XNNstarTable; |
---|
268 | |
---|
269 | for (i=0; i<nNstar; i+=2) |
---|
270 | { |
---|
271 | // Book a ntuple |
---|
272 | G4String name = listNstar[i]; |
---|
273 | G4String ntName = "N " + name; |
---|
274 | HepTuple* ntupleNNstar = hbookManager->ntuple(ntName); |
---|
275 | |
---|
276 | G4String xName = " p p -> N " + name; |
---|
277 | const G4PhysicsVector* sigma = tableNNstar->CrossSectionTable(name); |
---|
278 | if (sigma == 0) |
---|
279 | G4cout << name << " does not return a valid PhysicsVector " << G4endl; |
---|
280 | |
---|
281 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
282 | G4cout << "----------- " << xName << " cross section table ----------- " |
---|
283 | << G4endl; |
---|
284 | |
---|
285 | // Fill the ntuple |
---|
286 | G4int j; |
---|
287 | for (j=0; j<entries; j++) |
---|
288 | { |
---|
289 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
290 | G4bool dummy = false; |
---|
291 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
292 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
293 | << G4endl; |
---|
294 | ntupleNNstar->column("e",energy /GeV); |
---|
295 | ntupleNNstar->column("sigma",x); |
---|
296 | ntupleNNstar->dumpData(); |
---|
297 | } |
---|
298 | G4cout << ntName << " ntuple available" << G4endl; |
---|
299 | } |
---|
300 | delete tableNNstar; |
---|
301 | |
---|
302 | // pp -> Nstar Delta cross section table |
---|
303 | G4VXResonanceTable* tableDNstar = new G4XDeltaNstarTable; |
---|
304 | |
---|
305 | for (i=0; i<nNstar; i+=2) |
---|
306 | { |
---|
307 | // Book a ntuple |
---|
308 | G4String name = listNstar[i]; |
---|
309 | G4String ntName = "delta " + name; |
---|
310 | HepTuple* ntupleDNstar = hbookManager->ntuple(ntName); |
---|
311 | |
---|
312 | G4String xName = " p p -> Delta " + name; |
---|
313 | const G4PhysicsVector* sigma = tableDNstar->CrossSectionTable(name); |
---|
314 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
315 | G4cout << "----------- " << xName << " cross section table ----------- " |
---|
316 | << G4endl; |
---|
317 | |
---|
318 | // Fill the ntuple |
---|
319 | G4int j; |
---|
320 | for (j=0; j<entries; j++) |
---|
321 | { |
---|
322 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
323 | G4bool dummy = false; |
---|
324 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
325 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
326 | << G4endl; |
---|
327 | ntupleDNstar->column("e",energy /GeV); |
---|
328 | ntupleDNstar->column("sigma",x); |
---|
329 | ntupleDNstar->dumpData(); |
---|
330 | } |
---|
331 | G4cout << ntName << " ntuple available" << G4endl; |
---|
332 | } |
---|
333 | delete tableDNstar; |
---|
334 | |
---|
335 | // ===== Excited Deltas ===== |
---|
336 | |
---|
337 | G4cout << G4endl << "===== Excited Deltas ===== " << G4endl; |
---|
338 | |
---|
339 | std::vector<G4String> listDeltastar = resonanceList->DeltastarNames(); |
---|
340 | G4int nDeltastar = listDeltastar.size(); |
---|
341 | |
---|
342 | for (i=0; i<nDeltastar; i++) |
---|
343 | { |
---|
344 | G4String name = listDeltastar[i]; |
---|
345 | G4ParticleDefinition* def = particleTable->FindParticle(name); |
---|
346 | if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl; |
---|
347 | G4cout << def->GetParticleName() |
---|
348 | <<": mass " << def->GetPDGMass() |
---|
349 | <<", width " << def->GetPDGWidth() |
---|
350 | <<", iSpin "<< def->GetPDGiSpin() |
---|
351 | <<", iIsospin " << def->GetPDGiIsospin() |
---|
352 | <<", iIsospin3 " << def->GetPDGiIsospin3() |
---|
353 | << G4endl; |
---|
354 | } |
---|
355 | |
---|
356 | // pp -> N Deltastar cross section table |
---|
357 | G4VXResonanceTable* tableNDstar = new G4XNDeltastarTable; |
---|
358 | |
---|
359 | for (i=0; i<nDeltastar; i+=4) |
---|
360 | { |
---|
361 | // Book a ntuple |
---|
362 | G4String name = listDeltastar[i]; |
---|
363 | G4String ntName = "N " + name; |
---|
364 | HepTuple* ntupleNDstar = hbookManager->ntuple(ntName); |
---|
365 | |
---|
366 | G4String xName = " p p -> N " + name; |
---|
367 | const G4PhysicsVector* sigma = tableNDstar->CrossSectionTable(name); |
---|
368 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
369 | G4cout << "----------- " << xName << " cross section table ----------- " |
---|
370 | << G4endl; |
---|
371 | |
---|
372 | // Fill the ntuple |
---|
373 | G4int j; |
---|
374 | for (j=0; j<entries; j++) |
---|
375 | { |
---|
376 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
377 | G4bool dummy = false; |
---|
378 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
379 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
380 | << G4endl; |
---|
381 | ntupleNDstar->column("e",energy /GeV); |
---|
382 | ntupleNDstar->column("sigma",x); |
---|
383 | ntupleNDstar->dumpData(); |
---|
384 | } |
---|
385 | G4cout << ntName << " ntuple available" << G4endl; |
---|
386 | } |
---|
387 | delete tableNDstar; |
---|
388 | |
---|
389 | // pp -> Delta Deltastar cross section table |
---|
390 | G4VXResonanceTable* tableDDstar = new G4XDeltaDeltastarTable; |
---|
391 | |
---|
392 | for (i=0; i<nDeltastar; i+=4) |
---|
393 | { |
---|
394 | // Book a ntuple |
---|
395 | G4String name = listDeltastar[i]; |
---|
396 | G4String ntName = "delta " + name; |
---|
397 | HepTuple* ntupleDDstar = hbookManager->ntuple(ntName); |
---|
398 | |
---|
399 | G4String xName = " p p -> Delta " + name; |
---|
400 | const G4PhysicsVector* sigma = tableDDstar->CrossSectionTable(name); |
---|
401 | G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength(); |
---|
402 | G4cout << "----------- " << xName << " cross section table ----------- " |
---|
403 | << G4endl; |
---|
404 | |
---|
405 | // Fill the ntuple |
---|
406 | G4int j; |
---|
407 | for (j=0; j<entries; j++) |
---|
408 | { |
---|
409 | const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j); |
---|
410 | G4bool dummy = false; |
---|
411 | G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn; |
---|
412 | G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " |
---|
413 | << G4endl; |
---|
414 | ntupleDDstar->column("e",energy /GeV); |
---|
415 | ntupleDDstar->column("sigma",x); |
---|
416 | ntupleDDstar->dumpData(); |
---|
417 | } |
---|
418 | G4cout << ntName << " ntuple available" << G4endl; |
---|
419 | } |
---|
420 | delete tableDDstar; |
---|
421 | |
---|
422 | hbookManager->write(); |
---|
423 | |
---|
424 | G4cout << "ntuples are in file " << fileName<< G4endl; |
---|
425 | |
---|
426 | delete resonanceList; |
---|
427 | |
---|
428 | return EXIT_SUCCESS; |
---|
429 | } |
---|