-
Notifications
You must be signed in to change notification settings - Fork 10
/
TwoPSAngles.cc
81 lines (60 loc) · 2.41 KB
/
TwoPSAngles.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
#include <cassert>
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include "TLorentzVector.h"
#include "TLorentzRotation.h"
#include "IUAmpTools/Kinematics.h"
#include "AMPTOOLS_AMPS/TwoPSAngles.h"
#include "AMPTOOLS_AMPS/clebschGordan.h"
#include "AMPTOOLS_AMPS/wignerD.h"
TwoPSAngles::TwoPSAngles( const vector< string >& args ) :
UserAmplitude< TwoPSAngles >( args )
{
assert( args.size() == 3 );
m_j = atoi( args[0].c_str() );
m_m = atoi( args[1].c_str() );
m_e = atoi( args[2].c_str() );
// make sure values are reasonable
assert( abs( m_e ) == 1 );
assert( m_m <= m_j );
if( m_m == 0 ) m_bigTheta = 0.5;
if( m_m > 0 ) m_bigTheta = sqrt( 0.5 );
if( m_m < 0 ) m_bigTheta = 0;
// the "reflectivity factor" is e*(-1)^(m)
m_reflectivityFactor = ( m_m % 2 == 0 ? m_e : -m_e );
}
complex< GDouble >
TwoPSAngles::calcAmplitude( GDouble** pKin ) const {
TLorentzVector beam ( pKin[0][1], pKin[0][2], pKin[0][3], pKin[0][0] );
TLorentzVector recoil ( pKin[1][1], pKin[1][2], pKin[1][3], pKin[1][0] );
TLorentzVector p1 ( pKin[2][1], pKin[2][2], pKin[2][3], pKin[2][0] );
TLorentzVector p2 ( pKin[3][1], pKin[3][2], pKin[3][3], pKin[3][0] );
TLorentzVector resonance = p1 + p2;
TLorentzRotation resRestBoost( -resonance.BoostVector() );
TLorentzVector beam_res = resRestBoost * beam;
TLorentzVector recoil_res = resRestBoost * recoil;
TLorentzVector p1_res = resRestBoost * p1;
TVector3 z = beam_res.Vect().Unit();
TVector3 y = recoil_res.Vect().Cross(z).Unit();
TVector3 x = y.Cross(z);
TVector3 angles( (p1_res.Vect()).Dot(x),
(p1_res.Vect()).Dot(y),
(p1_res.Vect()).Dot(z) );
GDouble cosTheta = angles.CosTheta();
GDouble phi = angles.Phi();
GDouble coef = sqrt( ( 2. * m_j + 1 ) / ( 4 * 3.1416 ) );
return complex< GDouble >( coef * m_bigTheta *
( wignerD( m_j, m_m, 0, cosTheta, phi ) -
static_cast< GDouble>( m_reflectivityFactor ) *
wignerD( m_j, -m_m, 0, cosTheta, phi ) ) );
}
#ifdef GPU_ACCELERATION
void
TwoPSAngles::launchGPUKernel( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO ) const {
GPUTwoPSAngles_exec( dimGrid, dimBlock, GPU_AMP_ARGS,
m_j, m_m, m_bigTheta,
static_cast< GDouble >( m_reflectivityFactor ) );
}
#endif //GPU_ACCELERATION