-
Notifications
You must be signed in to change notification settings - Fork 10
/
SinglePS.cc
174 lines (126 loc) · 4.94 KB
/
SinglePS.cc
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
#include <cassert>
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include "TLorentzVector.h"
#include "TLorentzRotation.h"
#include "TFile.h"
#include "IUAmpTools/Kinematics.h"
#include "AMPTOOLS_AMPS/SinglePS.h"
#include "AMPTOOLS_AMPS/clebschGordan.h"
#include "AMPTOOLS_AMPS/wignerD.h"
#include "AMPTOOLS_AMPS/barrierFactor.h"
#include "AMPTOOLS_AMPS/decayAngles.h"
#include "UTILITIES/BeamProperties.h"
SinglePS::SinglePS( const vector< string >& args ) :
UserAmplitude< SinglePS >( args )
{
m_r = atoi( args[0].c_str() ); // real (+1) or imaginary (-1)
m_s = atoi( args[1].c_str() ); // sign for polarization in amplitude
lowerVertex = args[2].c_str(); // indices of proton and pi+ from the lower vertex
// default polarization information stored in tree
m_polInTree = true;
// 2 possibilities to initialize this amplitude:
// (with <r>: +1/-1 for real/imaginary part; <s>: +1/-1 sign in P_gamma term)
// loop over any additional amplitude arguments to change defaults
for( uint ioption = 3; ioption < args.size(); ioption++ ) {
TString option = args[ioption].c_str();
// polarization provided in configuration file
if( ioption == 3 && option.IsFloat() ) {
m_polInTree = false;
polAngle = atof( args[3].c_str() );
TString polOption = args[4].c_str();
if( polOption.IsFloat() ) polFraction = atof( polOption.Data() );
else if(polOption.Contains(".root")) {
polFraction = 0.;
TFile* f = new TFile( polOption );
polFrac_vs_E = (TH1D*)f->Get( args[5].c_str() );
assert( polFrac_vs_E != NULL );
}
else {
cout << "ERROR: SinglePS beam polarization not set" <<endl;
assert(0);
}
}
}
// make sure values are reasonable
// m_r = +1 for real
// m_r = -1 for imag
assert( abs( m_r ) == 1 );
// m_s = +1 for 1 + Pgamma
// m_s = -1 for 1 - Pgamma
assert( abs( m_s ) == 1 );
}
void
SinglePS::calcUserVars( GDouble** pKin, GDouble* userVars ) const {
TLorentzVector beam;
TVector3 eps;
double beam_polFraction;
double beam_polAngle;
if(m_polInTree){
beam.SetPxPyPzE( 0., 0., pKin[0][0], pKin[0][0]);
eps.SetXYZ(pKin[0][1], pKin[0][2], 0.); // beam polarization vector;
beam_polFraction = eps.Mag();
beam_polAngle = eps.Phi()*TMath::RadToDeg();
}
else {
beam.SetPxPyPzE( pKin[0][1], pKin[0][2], pKin[0][3], pKin[0][0] );
beam_polAngle = polAngle;
if(polFraction > 0.) { // for fitting with fixed polarization
beam_polFraction = polFraction;
}
else { // for fitting with polarization vs E_gamma from input histogram
int bin = polFrac_vs_E->GetXaxis()->FindBin(pKin[0][0]);
if (bin == 0 || bin > polFrac_vs_E->GetXaxis()->GetNbins()){
beam_polFraction = 0.;
} else
beam_polFraction = polFrac_vs_E->GetBinContent(bin);
}
}
string lv1; lv1 += lowerVertex[0];
string lv2; lv2 += lowerVertex[1];
int index1 = atoi( lv1.c_str() );
int index2 = atoi( lv2.c_str() );
TLorentzVector recoil1( pKin[index1][1], pKin[index1][2], pKin[index1][3], pKin[index1][0]); // pi+
TLorentzVector recoil2( pKin[index2][1], pKin[index2][2], pKin[index2][3], pKin[index2][0]); // proton
TLorentzVector recoil = recoil1 + recoil2;
//////////////////////// Boost Particles and Get Angles//////////////////////////////////
TLorentzVector target(0,0,0,0.938);
// set beam polarization angle to 0 degrees; apply diamond orientation in calcAmplitude
double phiProd = getPhiProd( 0., recoil, beam, target, 2, false );
userVars[uv_prod_Phi] = phiProd;
userVars[uv_beam_polFraction] = beam_polFraction;
userVars[uv_beam_polAngle] = beam_polAngle;
return;
}
////////////////////////////////////////////////// Amplitude Calculation //////////////////////////////////
complex< GDouble >
SinglePS::calcAmplitude( GDouble** pKin, GDouble* userVars ) const
{
GDouble prod_angle = userVars[uv_prod_Phi];
GDouble beam_polFraction = userVars[uv_beam_polFraction];
GDouble beam_polAngle = userVars[uv_beam_polAngle];
complex <GDouble> amplitude(0,0);
complex <GDouble> i(0,1);
GDouble Factor = sqrt(1 + m_s * beam_polFraction);
complex< GDouble > rotateY = polar( (GDouble)1., (GDouble)(-1.*(prod_angle + beam_polAngle*TMath::DegToRad())) ); // - -> + in prod_angle and polAngle summing
if( m_r == 1 )
amplitude = real( rotateY );
if( m_r == -1 )
amplitude = i*imag( rotateY );
// E852 Nozar thesis has sqrt(2*s+1)*sqrt(2*l+1)*F_l(p_omega)*sqrt(omega)
// double kinFactor = barrierFactor(MX, m_l, MVec, MPs);
//kinFactor *= sqrt(3.) * sqrt(2.*m_l + 1.);
// Factor *= kinFactor;
return complex< GDouble >( static_cast< GDouble>( Factor ) * amplitude );
}
void SinglePS::updatePar( const AmpParameter& par ){
// could do expensive calculations here on parameter updates
}
#ifdef GPU_ACCELERATION
void
SinglePS::launchGPUKernel( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO ) const {
GPUSinglePS_exec( dimGrid, dimBlock, GPU_AMP_ARGS, m_r, m_s );
}
#endif