File indexing completed on 2025-01-18 09:15:14
0001 #include "FSI.hxx"
0002
0003 #include "TMath.h"
0004
0005 #include "CustomRand.hxx"
0006 #include "Particle.hxx"
0007 #include "Constants.hxx"
0008 #include "PhaseShift.h"
0009
0010 #include <stdio.h>
0011 #include "json/json.h"
0012
0013 using namespace std;
0014 using namespace constants;
0015 using namespace TMath;
0016
0017 FSI::FSI()
0018 {
0019 double ERange[2] = {0,1};
0020 double ThetaRange[2] = {0,Pi()};
0021 double PhiRange[2] = {0,2*Pi()};
0022 char fname[100] = "FSI";
0023 SpherePicker = new CustomRand(fname, ERange, ThetaRange, PhiRange);
0024
0025 extern Json::Value obj;
0026 ProtGen = new TargetGen(proton_mass_mev, obj["fermi_momentum"].asBool());
0027
0028 CoP = new TVector3();
0029
0030 VertInPion = new Particle(pion_mass_mev, "", pid_pion);
0031 VertTargProt = new Particle(proton_mass_mev, "", pid_prot);
0032
0033 CMInPion = new Particle(pion_mass_mev, "", pid_pion);
0034 CMTargProt = new Particle(proton_mass_mev, "", pid_prot);
0035
0036 VertOutPion = new Particle(pion_mass_mev, "", pid_pion);
0037 VertOutProt = new Particle(proton_mass_mev, "", pid_prot);
0038
0039 CMOutPion = new Particle(pion_mass_mev, "", pid_pion);
0040 CMOutProt = new Particle(proton_mass_mev, "", pid_prot);
0041
0042 PhaseShiftWeight = new double(0);
0043
0044 WilliamsWeight = new double(0);
0045 DedrickWeight = new double(0);
0046 CatchenWeight = new double(0);
0047 }
0048
0049 int FSI::Generate()
0050 {
0051
0052 *VertTargProt = *ProtGen->GetParticle();
0053
0054 *CMInPion = *VertInPion;
0055 *CMTargProt = *VertTargProt;
0056
0057
0058
0059
0060 *CoP = ((VertInPion->Vect()+VertTargProt->Vect())*
0061 (1.0/(VertInPion->E()+VertTargProt->E())));
0062
0063
0064 CMInPion->Boost(-(*CoP));
0065
0066 CMTargProt->Boost(-(*CoP));
0067
0068
0069 theta_pion = SpherePicker->Theta();
0070 phi_pion = SpherePicker->Phi();
0071
0072
0073 a = Sqrt(Power(pion_mass_mev, 2)+Power(CMInPion->P(), 2))
0074 + Sqrt(Power(proton_mass_mev, 2)+Power(CMTargProt->P(), 2));
0075
0076 b = Power(pion_mass_mev, 2);
0077
0078 c = Power(proton_mass_mev, 2);
0079
0080
0081
0082
0083
0084 x = (a*a*a*a+b*b+c*c-2*a*a*b-2*a*a*c-2*b*c)/(4*a*a);
0085
0086
0087
0088 p_pion = Sqrt(x);
0089
0090
0091
0092 CMOutPion->SetThetaPhiP(theta_pion, phi_pion, p_pion);
0093
0094 CMOutProt->SetVectM(-(CMOutPion->Vect()), proton_mass_mev);
0095
0096
0097 *VertOutPion = *CMOutPion;
0098 *VertOutProt = *CMOutProt;
0099
0100 VertOutProt->Boost((*CoP));
0101 VertOutPion->Boost((*CoP));
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Px() > 1.0){
0115 cout << "Px: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Px() << endl;
0116 return 1;
0117 }
0118 if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Py() > 1.0){
0119 cout << "Py: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Py() << endl;
0120 return 1;
0121 }
0122 if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Pz() > 1.0){
0123 cout << "Pz: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).Pz() << endl;
0124 return 1;
0125 }
0126 if (((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).E() > 1.0){
0127 cout << "E: " << ((*CMInPion+*CMTargProt)-(*CMOutProt+*CMOutPion)).E() << endl;
0128 return 1;
0129 }
0130 else
0131 return 0;
0132
0133 }
0134
0135 int FSI::CalculateWeights()
0136 {
0137 phaseshifts(2, CMOutPion->P()/1000, (*CMInPion+*CMTargProt).Mag2()/1000000);
0138
0139
0140
0141
0142
0143
0144 Z0 = getZ0();
0145
0146 Z1 = getZ1();
0147
0148 Z2 = getZ2();
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158 *PhaseShiftWeight = (Z0 +
0159 (Z1 * CMOutPion->Px()/CMOutPion->P()) +
0160 (Z2 * Power(CMOutPion->Px()/CMOutPion->P(), 2))
0161 );
0162
0163 *PhaseShiftWeight *= 0.012;
0164
0165
0166
0167 beta = (VertInPion->P()+VertTargProt->P())/(VertInPion->E()+VertTargProt->E());
0168 gamma = (VertInPion->E()+VertTargProt->E()) / (*VertInPion+*VertTargProt).Mag();
0169
0170
0171
0172
0173 *WilliamsWeight = *PhaseShiftWeight * (VertInPion->Vect().Mag2()/
0174 (gamma*CMOutPion->P()*
0175 (VertInPion->P()-(beta*VertInPion->E()*
0176 VertInPion->CosTheta())
0177 )
0178 )
0179 );
0180
0181
0182
0183
0184 beta_pion = CMOutPion->P() / CMOutPion->E();
0185 g = beta / beta_pion;
0186
0187
0188
0189
0190
0191 *DedrickWeight = *PhaseShiftWeight * ((Power
0192 (Power(g+CMOutPion->CosTheta(), 2)+
0193 (1 - beta * beta)*
0194 (1 - Power(CMOutPion->CosTheta(), 2)),
0195 1.5))/
0196 ((1-beta*beta)*Abs(1+g*CMOutPion->CosTheta())
0197 )
0198 );
0199
0200
0201
0202
0203
0204 *CatchenWeight = *PhaseShiftWeight * (Power(VertInPion->P(),2)*CMOutPion->E()/
0205 (Power(CMOutPion->P(),2)*VertInPion->E())
0206 );
0207
0208
0209
0210
0211 return 0;
0212
0213 }
0214
0215 int FSI::GenerateNoRandom(){
0216
0217
0218 *VertTargProt = *ProtGen->GetParticle();
0219
0220 *CMInPion = *VertInPion;
0221 *CMTargProt = *VertTargProt;
0222
0223 *CoP = ((VertInPion->Vect()+VertTargProt->Vect())*
0224 (1.0/(VertInPion->E()+VertTargProt->E())));
0225
0226 CMInPion->Boost(-(*CoP));
0227 CMTargProt->Boost(-(*CoP));
0228
0229 *CMOutPion = *VertOutPion;
0230 CMOutPion->Boost(-(*CoP));
0231
0232 CMOutProt->SetVectM(-(CMOutPion->Vect()), proton_mass_mev);
0233
0234 *VertOutProt = *CMOutProt;
0235 VertOutProt->Boost(*CoP);
0236
0237 return 0;
0238
0239 }