ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimKinePrimGenerator.cc
Go to the documentation of this file.
1 // - AUTHOR: M.S. Golovkov/Pang Danyang 02/2008
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimKinePrimGenerator
11 /// Program to calculate relativistic kinematics of binary reaction
12 /////////////////////////////////////////////////////////////////
13 
15 
16 #include "globals.hh"
17 #include "Randomize.hh"
18 
19 using namespace std;
20 
21 //////////////////////////////////////////////////////////////////
22 /// Constructor
23 ///
24 /// Original program needs the following data:
25 /// - wm(4) -> masses in MeV (here we use Atomic mass unit u)
26 /// - 1 -> beam
27 /// - 2 -> target
28 /// - 3 -> scattered particle
29 /// - 4 -> recoil
30 /// - tb -> incident energy in MeV (lab)
31 /// - tetacmp -> angle of the scattered particle in cms (rad)
32 ///
33 /// output:
34 /// - ANGAs[0] -> angle of scattered particle (3) in lab (rad)
35 /// - ANGAs[1] -> energy of scattered particle (3) in lab (MeV)
36 /// - ANGAr[0] -> angle of recoiled particle (4) in lab (rad)
37 /// - ANGAr[1] -> energy of recoiled particle (4) in lab (MeV)
39  //Default masses (just an elastic 8He on 12C)
40  m1 = 8.; // 8He mass
41  m2 = 12.; // C12 mass
42  m3 = 8.; // 8He mass
43  m4 = 12.; // C12 mass
44 
45  ex1=0.0; // excitation energy of projectile
46  ex2=0.0; // excitation energy of target
47  ex3=0.0; // excitation energy of scattered particle
48  ex4=0.0; // excitation energy of recoil
49 
50  tb = 100; // incident energy
51 
52  thetacmsInput = 12.3456789; // in degrees, as the program converts to rad
53 
54  ANGAs = new G4double[2];
55  ANGAr = new G4double[2];
56 
57  for(G4int i = 0;i<2;i++){
58  ANGAs[i] = 0.;
59  ANGAr[i] = 0.;
60  }
61 
62  NoSolution=FALSE;
63 }
64 
65 //////////////////////////////////////////////////////////////////
66 /// Destructor
68  delete ANGAs;
69  delete ANGAr;
70 }
71 
72 //////////////////////////////////////////////////////////////////
73 /// Reproduces the relativistic kinematics calculations from
74 /// kin_cmlabf.f of M.S. Golovkov
75 ///
76 /// Arguments:
77 /// - masses: m1, m2, m3, m4 (for incident, target, scattered and recoil masses)
78 /// - excitation energies: ex1, ex2, ex3, ex4
79 /// - energies: Tb (lab energy in MeV)
80 /// - angles: thetacmsInput (theta CM angle of the scattered particle in degree)
81 ///
82 /// Output:
83 /// - given in two vectors called ANGAs and ANGAr (scattered and recoiled particle)
84 /// the elements are:
85 /// - 0: Theta lab (in rad)
86 /// - 1: ELAB (in MeV)
88  //Initial constants
89  const G4double U = 931.49401;
90  const G4double rad2deg = 0.0174532925;
91  const G4double PI=3.14159265358979323846;
92 
93  G4double wm1=m1*U+ex1;
94  G4double wm2=m2*U+ex2;
95  G4double wm3=m3*U+ex3;
96  G4double wm4=m4*U+ex4;
97 
98  G4double eb=tb+wm1;
99  G4double pb2=tb*tb+2.0*tb*wm1;
100  G4double pb=sqrt(pb2);
101  G4double beta=pb/(eb+wm2);
102  G4double gamma=1.0/sqrt(1.0-beta*beta);
103 
104  G4double thetacms=thetacmsInput*rad2deg; // degree to radian
105 
106  G4double thetacmr=PI-thetacms;
107  G4double e=tb+wm1+wm2;
108  G4double e_cm2 = e*e-pb2;
109  G4double e_cm = sqrt(e_cm2);
110  G4double t_cm = e_cm-wm3-wm4;
111 
112  if(t_cm<0.0){
113  G4cout << "Kine No solution!";
114  NoSolution=TRUE;
115  return;
116  }
117 
118  G4double t_cm2=t_cm*t_cm;
119  G4double t3_cm=(t_cm2+2.*wm4*t_cm)/(t_cm+wm3+wm4)/2.0;
120  G4double t4_cm=(t_cm2+2.*wm3*t_cm)/(t_cm+wm3+wm4)/2.0;
121  G4double p3_cm2=t3_cm*t3_cm+2.0*t3_cm*wm3;
122  G4double p3_cm =sqrt(p3_cm2);
123  G4double tg_thetalabs=p3_cm*sin(thetacms)/(gamma*(p3_cm*cos(thetacms)+beta*sqrt(p3_cm*p3_cm+wm3*wm3)));
124 
125  if(tg_thetalabs>=1.0e6){
126  ANGAs[0]=PI/2;
127  }
128  else{
129  ANGAs[0]=atan(tg_thetalabs);
130  }
131 
132  if(ANGAs[0]<0.0) ANGAs[0]=PI+ANGAs[0];
133 
134  G4double p4_cm2=t4_cm*t4_cm+2.*t4_cm*wm4;
135  G4double p4_cm =sqrt(p4_cm2);
136  G4double tg_thetalabr=p4_cm*sin(thetacmr)/(gamma*(p4_cm*cos(thetacmr)+beta*sqrt(p4_cm*p4_cm+wm4*wm4)));
137 
138  if(tg_thetalabr>1.0e6){
139  ANGAr[0]=PI/2.0;
140  }
141  else{
142  ANGAr[0]=atan(tg_thetalabr);
143  }
144 
145  if(ANGAr[0]<0.0) ANGAr[0]=PI+ANGAr[0];
146 
147  // Lorentz transformations to lab -----
148  G4double p3_cmx = p3_cm*sin(thetacms);
149  G4double p3_cmz = p3_cm*cos(thetacms);
150  G4double p3_labx = p3_cmx;
151  G4double p3_labz = gamma*(p3_cmz+beta*(t3_cm+wm3));
152  G4double p3_lab = sqrt(p3_labx*p3_labx+p3_labz*p3_labz);
153  ANGAs[1]=sqrt(p3_lab*p3_lab+wm3*wm3)-wm3;
154 
155  G4double p4_cmx = p4_cm*sin(thetacmr);
156  G4double p4_cmz = p4_cm*cos(thetacmr);
157  G4double p4_labx = p4_cmx;
158  G4double p4_labz = gamma*(p4_cmz+beta*(t4_cm+wm4));
159  G4double p4_lab = sqrt(p4_labx*p4_labx+p4_labz*p4_labz);
160  ANGAr[1] = sqrt(p4_lab*p4_lab+wm4*wm4)-wm4;
161 
162  // PrintResults();
163 
164  return;
165 }
166 
167 //////////////////////////////////////////////////////////////////
168 /// Dump
170 
171  G4double rad2deg= 0.0174532925;
172 
173  G4cout << G4endl << " ActarSimKinePrimGenerator::printResult()" << G4endl;
174 
175  G4cout << "Incident Mass: " << m1 << " "
176  << "Target Mass: " << m2 << G4endl;
177  G4cout << "Scattered Mass: " << m3 << " "
178  << "Recoil Mass: " << m4 << G4endl;
179  G4cout << "Theta CM Angle: " << thetacmsInput << " "
180  << "LAB energy :" << tb << G4endl;
181  G4cout << "Scattered excitation energy: " << ex3 << G4endl;
182 
183  G4cout << "Lab Scattering angle:" << ANGAs[0]/rad2deg << ", Scattering energy=" << ANGAs[1] << endl;
184  G4cout << " Lab Recoil angle:" << ANGAr[0]/rad2deg << ", Recoil energy=" << ANGAr[1] << endl;
185 
186 }
187 
188 //////////////////////////////////////////////////////////////////
189 /// Print the results for each solution
191 
192  G4double rad2deg= 0.0174532925;
193 
194  G4int prec = G4cout.precision(6);
195 
196  G4cout << G4endl << " ActarSimKinePrimGenerator::printResult()" << G4endl;
197 
198  G4cout << "Incident Mass: " << m1 << " "
199  << "Target Mass: " << m2 << G4endl;
200  G4cout << "Scattered Mass: " << m3 << " "
201  << "Recoil Mass: " << m4 << G4endl;
202  G4cout << "Theta CM Angle: " << thetacmsInput << " "
203  << "LAB energy :" << tb << G4endl;
204  G4cout << "Scattered excitation energy: " << ex3 << G4endl;
205 
206  G4cout << "Lab Scattering angle:" << ANGAs[0]/rad2deg << ", Scattering energy=" << ANGAs[1] << endl;
207  G4cout << " Lab Recoil angle:" << ANGAr[0]/rad2deg << ", Recoil energy=" << ANGAr[1] << endl;
208 
209  G4cout.precision(prec);
210 }
STL namespace.
void PrintResults()
Print the results for each solution.