-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFSI.cxx
239 lines (173 loc) · 6.88 KB
/
FSI.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#include "FSI.hxx"
#include "TMath.h"
#include "CustomRand.hxx"
#include "Particle.hxx"
#include "Constants.hxx"
#include "PhaseShift.h"
#include <stdio.h>
#include "json/json.h"
using namespace std;
using namespace constants;
using namespace TMath;
FSI::FSI()
{
double ERange[2] = {0,1};
double ThetaRange[2] = {0,Pi()};
double PhiRange[2] = {0,2*Pi()};
char fname[100] = "FSI";
SpherePicker = new CustomRand(fname, ERange, ThetaRange, PhiRange);
extern Json::Value obj;
ProtGen = new TargetGen(proton_mass_mev, obj["fermi_momentum"].asBool());
CoP = new TVector3();
VertInPion = new Particle(pion_mass_mev, "", pid_pion);
VertTargProt = new Particle(proton_mass_mev, "", pid_prot);
CMInPion = new Particle(pion_mass_mev, "", pid_pion);
CMTargProt = new Particle(proton_mass_mev, "", pid_prot);
VertOutPion = new Particle(pion_mass_mev, "", pid_pion);
VertOutProt = new Particle(proton_mass_mev, "", pid_prot);
CMOutPion = new Particle(pion_mass_mev, "", pid_pion);
CMOutProt = new Particle(proton_mass_mev, "", pid_prot);
PhaseShiftWeight = new double(0);
WilliamsWeight = new double(0);
DedrickWeight = new double(0);
CatchenWeight = new double(0);
}
int FSI::Generate()
{
*VertTargProt = *ProtGen->GetParticle();
*CMInPion = *VertInPion;
*CMTargProt = *VertTargProt;
//cout << "Pion Momentum Before:\t"<<CMInPion->P() << endl;
//cout << "Proton Momentum Before:\t"<<CMTargProt->P()<<endl;
*CoP = ((VertInPion->Vect()+VertTargProt->Vect())*
(1.0/(VertInPion->E()+VertTargProt->E())));
CMInPion->Boost(-(*CoP));
//cout << "Pion Momentum After:\t"<<CMInPion->P() << endl;
CMTargProt->Boost(-(*CoP));
//cout << "Proton Momentum After:\t"<<CMTargProt->P()<<endl;
theta_pion = SpherePicker->Theta();
phi_pion = SpherePicker->Phi();
// Some factors to simplify the formula
a = Sqrt(Power(pion_mass_mev, 2)+Power(CMInPion->P(), 2))
+ Sqrt(Power(proton_mass_mev, 2)+Power(CMTargProt->P(), 2));
//cout<<a<<endl;
b = Power(pion_mass_mev, 2);
//cout<<b<<endl;
c = Power(proton_mass_mev, 2);
//cout<<c<<endl;
// Solution to E_i = E_f, taking advantage of the fact that the momenta of
// outgoing particles are equal ond opposite in the CoM frame, leaving
// pion momentum the only unknown.
x = (a*a*a*a+b*b+c*c-2*a*a*b-2*a*a*c-2*b*c)/(4*a*a);
//cout<<x<<endl;
p_pion = Sqrt(x);
//cout<<p_pion<<endl;
CMOutPion->SetThetaPhiP(theta_pion, phi_pion, p_pion);
//cout << "Pion final P:\t" << CMOutPion->P() << endl;
CMOutProt->SetVectM(-(CMOutPion->Vect()), proton_mass_mev);
//cout << "Prot final P:\t" << CMOutProt->P() << endl;
*VertOutPion = *CMOutPion;
*VertOutProt = *CMOutProt;
VertOutProt->Boost((*CoP));
VertOutPion->Boost((*CoP));
//cout << "Boost x:\t" << CoP->X() <<endl;
//cout << "Prot x: \t" << CMOutProt->X()<<endl;
//cout << "Boost y:\t" << CoP->Y() <<endl;
//cout << "Prot y: \t" << CMOutProt->Y()<<endl;
//cout << "Boost z:\t" << CoP->Z() <<endl;
//cout << "Prot z: \t" << CMOutProt->Z()<<endl;
//cout << "CM E:\t" << CMOutProt->E()<<endl;
//cout << "Vert E:\t" << VertOutProt->E()<<endl;
//Check cons laws:
if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Px() > 1.0){
cout << "Px: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Px() << endl;
return 1;
}
if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Py() > 1.0){
cout << "Py: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Py() << endl;
return 1;
}
if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Pz() > 1.0){
cout << "Pz: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Pz() << endl;
return 1;
}
if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).E() > 1.0){
cout << "E: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).E() << endl;
return 1;
}
else
return 0;
}
int FSI::CalculateWeights()
{
phaseshifts(2, CMOutPion->P()/1000, (*CMInPion+*CMTargProt).Mag2()/1000000);
//cout << CMOutPion->P() << endl;
//cout << CMOutPion->Px() << endl;
//cout << "Check 1" << endl;
Z0 = getZ0();
//cout << Z0 << endl;
Z1 = getZ1();
//cout << Z1 << endl;
Z2 = getZ2();
//cout << Z2 << endl;
//cout << "Check 2" << endl;
//cout << (Z0 +
// (Z1 * CMOutPion->Px()/CMOutPion->P()) +
// (Z2 * Power(CMOutPion->Px()/CMOutPion->P(), 2))
// ) << endl;
*PhaseShiftWeight = (Z0 +
(Z1 * CMOutPion->Px()/CMOutPion->P()) +
(Z2 * Power(CMOutPion->Px()/CMOutPion->P(), 2))
);
//cout << *PhaseShiftWeight << endl;
*PhaseShiftWeight *= 0.012; //.012 nucleons per half of He_3 nucleus area in milli barns
//cout << "Check 3" << endl;
beta = (VertInPion->P()+VertTargProt->P())/(VertInPion->E()+VertTargProt->E());
gamma = (VertInPion->E()+VertTargProt->E()) / (*VertInPion+*VertTargProt).Mag();
//cout << "Check 4" << endl;
// Jacobian by W. S. C. Williams
*WilliamsWeight = *PhaseShiftWeight * (VertInPion->Vect().Mag2()/
(gamma*CMOutPion->P()*
(VertInPion->P()-(beta*VertInPion->E()*
VertInPion->CosTheta())
)
)
);
//cout << "Check 5" << endl;
beta_pion = CMOutPion->P() / CMOutPion->E();
g = beta / beta_pion;
//cout << "Check 6" << endl;
// Jacobian by K. G. Dedrick. Rev. Mod. Phys. 34, 429 (1962)
*DedrickWeight = *PhaseShiftWeight * ((Power
(Power(g+CMOutPion->CosTheta(), 2)+
(1 - beta * beta)*
(1 - Power(CMOutPion->CosTheta(), 2)),
1.5))/
((1-beta*beta)*Abs(1+g*CMOutPion->CosTheta())
)
);
//cout << "Check 8" << endl;
// Jacobian by Gary L. Catchen J. Chem. Phys. 69(4), 15 Aug 1978
*CatchenWeight = *PhaseShiftWeight * (Power(VertInPion->P(),2)*CMOutPion->E()/
(Power(CMOutPion->P(),2)*VertInPion->E())
);
//cout << "Check 9" << endl;
return 0;
}
int FSI::GenerateNoRandom(){
//Debug only
//For this function, VertInPion and VertOutPion must be specified
*VertTargProt = *ProtGen->GetParticle();
*CMInPion = *VertInPion;
*CMTargProt = *VertTargProt;
*CoP = ((VertInPion->Vect()+VertTargProt->Vect())*
(1.0/(VertInPion->E()+VertTargProt->E())));
CMInPion->Boost(-(*CoP));
CMTargProt->Boost(-(*CoP));
*CMOutPion = *VertOutPion;
CMOutPion->Boost(-(*CoP));
CMOutProt->SetVectM(-(CMOutPion->Vect()), proton_mass_mev);
*VertOutProt = *CMOutProt;
VertOutProt->Boost(*CoP);
return 0;
}