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

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

nvx fichiers dans CVS

File size: 2.6 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#include "globals.hh"
24#include "G4FermiMomentum.hh"
25#include "G4NuclearShellModelDensity.hh"
26#include "G4NuclearFermiDensity.hh"
27#include "G4Fancy3DNucleus.hh"
28
29
30int main(int argc, char ** argv)
31{
32  G4int A, Z, nEvents;
33
34  if(argc != 4)
35  {
36    cout << "Input A and Z: ";
37    cin >> A >> Z;
38    cout << "Input number of events: ";
39    cin >> nEvents;
40  }
41  else
42  {
43    A = atoi(argv[1]);
44    Z = atoi(argv[2]);
45    nEvents = atoi(argv[3]);
46  }
47
48  G4VNuclearDensity * density;
49  if(A < 17)
50    density = new G4NuclearShellModelDensity(A, Z);
51  else
52    density = new G4NuclearFermiDensity(A, Z);
53
54  G4FermiMomentum fermiMom;
55  fermiMom.Init(A, Z);
56
57  G4Fancy3DNucleus nucleus;
58  nucleus.Init(A, Z);
59  G4double radius = nucleus.GetOuterRadius();
60  G4double step = radius/1000.;
61  G4double r = 0;
62  while(r < 2*radius)
63  {
64    G4ThreeVector pos(0, 0, r);
65    G4double d = density->GetDensity(pos);
66    G4double p = fermiMom.GetFermiMomentum(d);
67    G4ThreeVector mom = fermiMom.GetMomentum(d);
68    cout << p/MeV << " " << (1/MeV)*mom.x() << " " << (1/MeV)*mom.y() << " "
69         << (1/MeV)*mom.z() << " " << (1/MeV)*mom.mag() << " " << r/fermi
70         << endl;
71    r += step;
72  }
73  return 0;
74}
Note: See TracBrowser for help on using the repository browser.