-
Notifications
You must be signed in to change notification settings - Fork 1
/
calcEnu.cxx
62 lines (49 loc) · 1.3 KB
/
calcEnu.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
#ifndef CALCENU_CXX
#define CALCENU_CXX
#include "calcEnu.h"
float calcEnu(float lpmom, TVector3 ldir, int muflg){
// t2k beam coordinates in SK frame
float beam_x = 0.669764;
float beam_y = -0.7421791;
float beam_z = 0.024228;
TVector3 beamdir;
beamdir.SetXYZ(beam_x,beam_y,beam_z);
// binding energy
float Eb = 27.; //< in MeV
// masses
float Me = 0.511;
float Mmu = 105.658;
float Mp = 938.28;
float Mn = 939.57;
// energy
float Ml = 0.;
if (muflg==1){
Ml = Mmu;
}
else{
Ml = Me;
}
float El = TMath::Sqrt( (lpmom*lpmom) + (Ml*Ml));
// cosine to beam
// float angle = ldir.Angle(beamdir);
float cosbeam = ldir.Unit().Dot(beamdir.Unit());
// float cosbeam = TMath::Cos(angle);
// calculate E
// float Enu = (Mp*Mp) - ((Mn-Eb)*(Mn-Eb)) - (Ml*Ml) + (2.*(Mn-Eb)*El);
float Enu = ((Mp*Mp) + (2.*(Mn-Eb)*El) - (Mn*Mn) - (Eb*Eb) + (2.*Mn*Eb)) /
(2.*(Mn - Eb - El + (lpmom*cosbeam) ) );
if (Enu<0.){
float num = (Mp*Mp) - ((Mn-Eb)*(Mn-Eb)) - (Ml*Ml) + (2.*(Mn-Eb)*El);
float denom = (2.*(Mn - Eb - El + (lpmom*cosbeam)));
// cout<<"num: "<<num<<endl;
// cout<<"Ml: "<<Ml<<endl;
// cout<<"ismu?: "<<muflg<<endl;
// cout<<"El: "<<El<<endl;
// cout<<"pl: "<<lpmom<<endl;
// cout<<"denom: "<<denom<<endl;
// cout<<"cospibm: "<<cosbeam<<endl;
}
//
return Enu;
}
#endif