source: trunk/source/processes/hadronic/models/binary_cascade/test/G4ResonanceListTest.cc @ 1199

Last change on this file since 1199 was 1199, checked in by garnier, 15 years ago

nvx fichiers dans CVS

File size: 14.2 KB
Line 
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:     G4ResonanceListTest.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#include <vector>
47
48#include "CLHEP/Hist/TupleManager.h"
49#include "CLHEP/Hist/HBookFile.h"
50#include "CLHEP/Hist/Histogram.h"
51#include "CLHEP/Hist/Tuple.h"
52
53#include "Randomize.hh"
54
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 "G4ParticleDefinition.hh"
72
73#include "G4VDecayChannel.hh"
74#include "G4DecayTable.hh"
75
76#include "G4KineticTrack.hh"
77#include "G4KineticTrackVector.hh"
78
79#include "G4VShortLivedParticle.hh"
80#include "G4ShortLivedConstructor.hh"
81#include "G4ParticleTable.hh"
82#include "G4ShortLivedTable.hh"
83
84#include "G4VXResonanceTable.hh"
85#include "G4XNNstarTable.hh"
86#include "G4XDeltaNstarTable.hh"
87#include "G4XDeltaDeltaTable.hh"
88#include "G4XNDeltaTable.hh"
89#include "G4XNDeltastarTable.hh"
90#include "G4XDeltaDeltastarTable.hh"
91
92#include "G4ResonanceNames.hh"
93
94
95int main()
96{
97  // MGP ---- HBOOK initialization
98  HepTupleManager* hbookManager;
99  G4String fileName = "xtables.hbook";
100  hbookManager = new HBookFile(fileName, 58);
101  assert (hbookManager != 0);
102
103  // ==== Initialization phase ====
104
105  G4ParticleDefinition* gamma = G4Gamma::GammaDefinition();
106
107  G4ParticleDefinition* proton = G4Proton::ProtonDefinition();
108  G4ParticleDefinition* antiProton = G4AntiProton::AntiProtonDefinition();
109  G4ParticleDefinition* neutron = G4Neutron::NeutronDefinition();   
110  G4ParticleDefinition* antiNeutron = G4AntiNeutron::AntiNeutronDefinition();   
111
112  G4ParticleDefinition* pionPlus = G4PionPlus::PionPlusDefinition();
113  G4ParticleDefinition* pionMinus = G4PionMinus::PionMinusDefinition();
114  G4ParticleDefinition* pionZero = G4PionZero::PionZeroDefinition();
115
116  G4ParticleDefinition* kaonPlus = G4KaonPlus::KaonPlusDefinition();
117  G4ParticleDefinition* kaonMinus = G4KaonMinus::KaonMinusDefinition();
118   
119  G4ParticleDefinition* lambda = G4Lambda::LambdaDefinition();
120
121  G4ParticleDefinition* theMuonPlus = G4MuonPlus::MuonPlusDefinition();
122  G4ParticleDefinition* theMuonMinus = G4MuonMinus::MuonMinusDefinition();
123
124  G4ParticleDefinition* theNeutrinoMu = G4NeutrinoMu::NeutrinoMuDefinition();
125  G4ParticleDefinition* theAntiNeutrinoMu = G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
126
127  // Construct resonances
128  G4ShortLivedConstructor shortLived;
129  shortLived.ConstructParticle();
130
131  // Get the particle table
132  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
133
134  // ==== End of the initialization phase ====
135
136  // The list of resonances handled by the Kinetic Model
137  G4ResonanceNames* resonanceList = new G4ResonanceNames;
138
139  // ==== Nucleons ====
140
141  G4cout << proton->GetParticleName() 
142         <<": mass " << proton->GetPDGMass()
143         <<", width " << proton->GetPDGWidth()
144         <<", iSpin "<< proton->GetPDGiSpin()
145         <<", iIsospin " << proton->GetPDGiIsospin()
146         <<", iIsospin3 " << proton->GetPDGiIsospin3() 
147         << G4endl; 
148
149  G4cout << neutron->GetParticleName() 
150         <<": mass " << neutron->GetPDGMass()
151         <<", width " << neutron->GetPDGWidth()
152         <<", iSpin "<< neutron->GetPDGiSpin()
153         <<", iIsospin " << neutron->GetPDGiIsospin()
154         <<", iIsospin3 " << neutron->GetPDGiIsospin3() 
155         << G4endl; 
156
157  // ===== Delta =====
158
159  const std::vector<G4String> listDelta = resonanceList->DeltaNames();
160  G4int nDelta = listDelta.size();
161  G4cout << G4endl << "===== Delta ===== " << G4endl;
162
163  G4int i;
164  for (i=0; i<nDelta; i++)
165    {
166      // Particle information
167      G4String name = listDelta[i];
168      G4ParticleDefinition* def = particleTable->FindParticle(name);
169      if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl;
170      G4cout << def->GetParticleName() 
171             <<": mass " << def->GetPDGMass()
172             <<", width " << def->GetPDGWidth()
173             <<", iSpin "<< def->GetPDGiSpin()
174             <<", iIsospin " << def->GetPDGiIsospin()
175             <<", iIsospin3 " << def->GetPDGiIsospin3() 
176             << G4endl; 
177    }
178
179  // pp -> N Delta cross section table
180  G4VXResonanceTable* tableND = new G4XNDeltaTable;
181 
182  for (i=0; i<nDelta; i+=4)
183    {
184      // Book a ntuple
185      G4String name = listDelta[i];
186      G4String ntName = "N " + name;
187      HepTuple* ntupleND = hbookManager->ntuple(ntName);
188     
189      G4String xName = " p p -> Delta " + name;
190      const G4PhysicsVector* sigma = tableND->CrossSectionTable(name);
191      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
192      G4cout << "----------- " << xName <<" cross section table ----------- " 
193             << G4endl;
194
195      // Fill the ntuple
196      G4int j;
197      for (j=0; j<entries; j++)
198        {
199          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
200          G4bool dummy = false;
201          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
202          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
203                 << G4endl;
204          ntupleND->column("e",energy /GeV);
205          ntupleND->column("sigma",x);
206          ntupleND->dumpData();
207        }
208      G4cout << ntName << " ntuple available" << G4endl;
209    }
210  delete tableND;
211
212  // pp -> Delta Delta cross section table
213  G4VXResonanceTable* tableDD = new G4XDeltaDeltaTable;
214
215  for (i=0; i<nDelta; i+=4)
216    {
217      // Book a ntuple
218      G4String name = listDelta[i];
219      G4String ntName = "delta " + name;
220      HepTuple* ntupleDD = hbookManager->ntuple(ntName);
221     
222      G4String xName = " p p -> Delta " + name;
223      const G4PhysicsVector* sigma = tableDD->CrossSectionTable(name);
224      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
225      G4cout << "----------- " << xName << " cross section table ----------- " 
226             << G4endl;
227
228      // Fill the ntuple
229      G4int j;
230      for (j=0; j<entries; j++)
231        {
232          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
233          G4bool dummy = false;
234          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
235          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
236                 << G4endl;
237          ntupleDD->column("e",energy /GeV);
238          ntupleDD->column("sigma",x);
239          ntupleDD->dumpData();
240        }
241      G4cout << ntName << " ntuple available" << G4endl;
242    }
243  delete tableDD;
244
245
246  // Excited Nucleons =====
247
248  G4cout << G4endl << "===== Excited Nucleons ===== " << G4endl;
249
250  const std::vector<G4String> listNstar = resonanceList->NstarNames();
251  G4int nNstar = listNstar.size();
252
253  for (i=0; i<nNstar; i++)
254    {
255      G4String name = listNstar[i];
256      G4ParticleDefinition* def = particleTable->FindParticle(name);
257      if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl;
258      G4cout << def->GetParticleName() 
259             <<": mass " << def->GetPDGMass()
260             <<", width " << def->GetPDGWidth()
261             <<", iSpin "<< def->GetPDGiSpin()
262             <<", iIsospin " << def->GetPDGiIsospin()
263             <<", iIsospin3 " << def->GetPDGiIsospin3() 
264             << G4endl; 
265    }
266
267  // pp -> N Nstar  cross section table
268  G4VXResonanceTable* tableNNstar = new G4XNNstarTable;
269 
270  for (i=0; i<nNstar; i+=2)
271    {
272      // Book a ntuple
273      G4String name = listNstar[i];
274      G4String ntName = "N " + name;
275      HepTuple* ntupleNNstar = hbookManager->ntuple(ntName);
276
277      G4String xName = " p p -> N " + name;
278      const G4PhysicsVector* sigma = tableNNstar->CrossSectionTable(name);
279      if (sigma == 0)
280        G4cout << name << " does not return a valid PhysicsVector " << G4endl;
281
282      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
283      G4cout << "----------- " << xName << " cross section table ----------- " 
284             << G4endl;
285
286      // Fill the ntuple
287      G4int j;
288      for (j=0; j<entries; j++)
289        {
290          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
291          G4bool dummy = false;
292          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
293          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
294                 << G4endl;
295          ntupleNNstar->column("e",energy /GeV);
296          ntupleNNstar->column("sigma",x);
297          ntupleNNstar->dumpData();
298        }
299      G4cout << ntName << " ntuple available" << G4endl;
300    }
301  delete tableNNstar;
302
303  // pp -> Nstar Delta cross section table
304  G4VXResonanceTable* tableDNstar = new G4XDeltaNstarTable;
305
306  for (i=0; i<nNstar; i+=2)
307    {
308      // Book a ntuple
309      G4String name = listNstar[i];
310      G4String ntName = "delta " + name;
311      HepTuple* ntupleDNstar = hbookManager->ntuple(ntName);
312
313      G4String xName = " p p -> Delta " + name;
314      const G4PhysicsVector* sigma = tableDNstar->CrossSectionTable(name);
315      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
316      G4cout << "----------- " << xName << " cross section table ----------- " 
317             << G4endl;
318
319      // Fill the ntuple
320      G4int j;
321      for (j=0; j<entries; j++)
322        {
323          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
324          G4bool dummy = false;
325          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
326          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
327                 << G4endl;
328          ntupleDNstar->column("e",energy /GeV);
329          ntupleDNstar->column("sigma",x);
330          ntupleDNstar->dumpData();
331        }
332      G4cout << ntName << " ntuple available" << G4endl;
333    }
334  delete tableDNstar;
335
336  // ===== Excited Deltas =====
337
338  G4cout << G4endl << "===== Excited Deltas ===== " << G4endl;
339
340  const std::vector<G4String> listDeltastar = resonanceList->DeltastarNames();
341  G4int nDeltastar = listDeltastar.size();
342
343  for (i=0; i<nDeltastar; i++)
344    {
345      G4String name = listDeltastar[i];
346      G4ParticleDefinition* def = particleTable->FindParticle(name);
347      if (def == 0) G4cout << name << "does not have a ParticleDefinition " << G4endl;
348      G4cout << def->GetParticleName() 
349             <<": mass " << def->GetPDGMass()
350             <<", width " << def->GetPDGWidth()
351             <<", iSpin "<< def->GetPDGiSpin()
352             <<", iIsospin " << def->GetPDGiIsospin()
353             <<", iIsospin3 " << def->GetPDGiIsospin3() 
354             << G4endl; 
355    }
356 
357  // pp -> N Deltastar cross section table
358  G4VXResonanceTable* tableNDstar = new G4XNDeltastarTable;
359       
360  for (i=0; i<nDeltastar; i+=4)
361    {
362      // Book a ntuple
363      G4String name = listDeltastar[i];
364      G4String ntName = "N " + name;
365      HepTuple* ntupleNDstar = hbookManager->ntuple(ntName);
366
367      G4String xName = " p p -> N " + name;
368      const G4PhysicsVector* sigma = tableNDstar->CrossSectionTable(name);
369      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
370      G4cout << "----------- " << xName << " cross section table ----------- " 
371             << G4endl;
372
373  // Fill the ntuple
374      G4int j;
375      for (j=0; j<entries; j++)
376        {
377          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
378          G4bool dummy = false;
379          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
380          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
381                 << G4endl;
382          ntupleNDstar->column("e",energy /GeV);
383          ntupleNDstar->column("sigma",x);
384          ntupleNDstar->dumpData();
385        }
386      G4cout << ntName << " ntuple available" << G4endl;
387    }
388  delete tableNDstar;
389
390  // pp -> Delta Deltastar cross section table
391  G4VXResonanceTable* tableDDstar = new G4XDeltaDeltastarTable;
392     
393  for (i=0; i<nDeltastar; i+=4)
394    {
395      // Book a ntuple
396      G4String name = listDeltastar[i];
397      G4String ntName = "delta " + name;
398      HepTuple* ntupleDDstar = hbookManager->ntuple(ntName);
399
400      G4String xName = " p p -> Delta " + name;
401      const G4PhysicsVector* sigma = tableDDstar->CrossSectionTable(name);
402      G4int entries = ((G4PhysicsVector*) sigma)->GetVectorLength();
403      G4cout << "----------- " << xName << " cross section table ----------- " 
404             << G4endl;
405
406      // Fill the ntuple
407      G4int j;
408      for (j=0; j<entries; j++)
409        {
410          const G4double energy = ((G4PhysicsVector*) sigma)->GetLowEdgeEnergy(j);
411          G4bool dummy = false;
412          G4double x = ((G4PhysicsVector*) sigma)->GetValue(energy,dummy) / millibarn;
413          G4cout << j << ") energy = " << energy /GeV << " GeV - sigma = " << x << " mb " 
414                 << G4endl;
415          ntupleDDstar->column("e",energy /GeV);
416          ntupleDDstar->column("sigma",x);
417          ntupleDDstar->dumpData();
418        }
419      G4cout << ntName << " ntuple available" << G4endl;
420    }
421  delete tableDDstar;
422
423  hbookManager->write();
424
425  G4cout << "ntuples are in file " << fileName<< G4endl;
426
427  delete resonanceList;
428
429  return EXIT_SUCCESS;
430}
Note: See TracBrowser for help on using the repository browser.