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 "G4NuclearShellModelDensity.hh" |
---|
24 | #include "G4NuclearFermiDensity.hh" |
---|
25 | #include "G4FermiMomentum.hh" |
---|
26 | |
---|
27 | #include "G4NucleiProperties.hh" |
---|
28 | #include "G4ParticleTable.hh" |
---|
29 | #include "G4IonTable.hh" |
---|
30 | #include "globals.hh" |
---|
31 | #include "G4Fancy3DNucleus.hh" |
---|
32 | #include "G4KineticTrackVectorSTL.hh" |
---|
33 | #include "G4ThreeVector.hh" |
---|
34 | #include "G4LorentzVector.hh" |
---|
35 | |
---|
36 | G4V3DNucleus * the3DNucleus; |
---|
37 | G4KineticTrackVectorSTL theTargetList; |
---|
38 | |
---|
39 | void BuildTargetList(); |
---|
40 | G4ThreeVector GetSpherePoint(G4double r); |
---|
41 | |
---|
42 | int main(int argc, char ** argv) |
---|
43 | { |
---|
44 | G4int A, Z, nEvents; |
---|
45 | |
---|
46 | if(argc != 4) |
---|
47 | { |
---|
48 | cout << "Input A and Z: "; |
---|
49 | cin >> A >> Z; |
---|
50 | cout << "Input number of events: "; |
---|
51 | cin >> nEvents; |
---|
52 | } |
---|
53 | else |
---|
54 | { |
---|
55 | A = atoi(argv[1]); |
---|
56 | Z = atoi(argv[2]); |
---|
57 | nEvents = atoi(argv[3]); |
---|
58 | } |
---|
59 | |
---|
60 | G4KineticTrackVectorSTL::iterator iter; |
---|
61 | for(G4int i = 0; i < nEvents; ++i) |
---|
62 | { |
---|
63 | // create the nucleus |
---|
64 | the3DNucleus = new G4Fancy3DNucleus; |
---|
65 | the3DNucleus->Init(A, Z); |
---|
66 | // create theTargetList |
---|
67 | BuildTargetList(); |
---|
68 | G4LorentzVector totalMom(0, 0, 0, 0); |
---|
69 | for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter) |
---|
70 | { |
---|
71 | G4ThreeVector pos = (1/fermi)*(*iter)->GetPosition(); |
---|
72 | G4LorentzVector mom = (1/MeV)*(*iter)->Get4Momentum(); |
---|
73 | totalMom+=mom; |
---|
74 | cout << pos.x() << " " << pos.y() << " " << pos.z() << " " |
---|
75 | << pos.mag() << " " << mom.x() << " " << mom.y() << " " |
---|
76 | << mom.z() << " " << mom.t() << " " << mom.vect().mag() |
---|
77 | << " " << mom.mag() << endl; |
---|
78 | } |
---|
79 | cerr << totalMom.x() << " " << totalMom.y() << " " |
---|
80 | << totalMom.z() << " " << totalMom.t() << " " |
---|
81 | << totalMom.vect().mag() << " " << totalMom.mag() << " " |
---|
82 | << (1/MeV) * G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(Z, A) |
---|
83 | << endl; |
---|
84 | } |
---|
85 | return 0; |
---|
86 | } |
---|
87 | |
---|
88 | void BuildTargetList() |
---|
89 | { |
---|
90 | G4KineticTrackVectorSTL::iterator iter; |
---|
91 | for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter) |
---|
92 | delete (*iter); |
---|
93 | |
---|
94 | theTargetList.clear(); |
---|
95 | |
---|
96 | if(!the3DNucleus->StartLoop()) |
---|
97 | { |
---|
98 | G4cerr << "G4HadronKineticModel::BuildTargetList(): StartLoop() error!" |
---|
99 | << G4endl; |
---|
100 | return; |
---|
101 | } |
---|
102 | G4Nucleon * nucleon; |
---|
103 | G4ParticleDefinition * definition; |
---|
104 | G4ThreeVector pos; |
---|
105 | G4LorentzVector mom; |
---|
106 | while((nucleon = the3DNucleus->GetNextNucleon()) != NULL) |
---|
107 | { |
---|
108 | definition = nucleon->GetDefinition(); |
---|
109 | pos = nucleon->GetPosition(); |
---|
110 | mom = nucleon->GetMomentum(); |
---|
111 | G4KineticTrack * kt = new G4KineticTrack(definition, 0., pos, mom); |
---|
112 | theTargetList.push_back(kt); |
---|
113 | } |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | |
---|