1 |
#include "TLorentzVector.h"
|
2 |
#include "TVector3.h"
|
3 |
#include "TMath.h"
|
4 |
|
5 |
namespace VHbb {
|
6 |
|
7 |
double deltaPhi(double phi1,double phi2)
|
8 |
{
|
9 |
double result = phi1 - phi2;
|
10 |
while (result > TMath::Pi()) result -= 2*TMath::Pi();
|
11 |
while (result <= -TMath::Pi()) result += 2*TMath::Pi();
|
12 |
return result;
|
13 |
}
|
14 |
|
15 |
inline double deltaR(double eta1,double phi1,double eta2,double phi2)
|
16 |
{
|
17 |
double deta = eta1 - eta2;
|
18 |
double dphi = deltaPhi(phi1, phi2);
|
19 |
return std::sqrt(deta*deta + dphi*dphi);
|
20 |
}
|
21 |
|
22 |
|
23 |
double Hmass( double V_eta,double V_phi,double V_pt,
|
24 |
double hJet1_eta,double hJet1_phi,double hJet1_pt,
|
25 |
double hJet2_eta,double hJet2_phi,double hJet2_pt ){
|
26 |
|
27 |
TVector3 V(1,1,1);
|
28 |
V.SetPtEtaPhi(V_pt,V_eta,V_phi);
|
29 |
|
30 |
TVector3 H1(1,1,1);
|
31 |
H1.SetPtEtaPhi(hJet1_pt,hJet1_eta,hJet1_phi);
|
32 |
H1.SetMag(1/sin(H1.Theta()));
|
33 |
|
34 |
TVector3 H2(1,1,1);
|
35 |
H2.SetPtEtaPhi(hJet2_pt,hJet2_eta,hJet2_phi);
|
36 |
H2.SetMag(1/sin(H2.Theta()));
|
37 |
|
38 |
TVector3 n1(H1);
|
39 |
TVector3 n2(H2);
|
40 |
|
41 |
float det= n1.Px() * n2.Py() - n2.Px() * n1.Py();
|
42 |
|
43 |
H1.SetMag( ( - n2.Py() * V.Px() + n2.Px() * V.Py() ) / (sin(n1.Theta()) *det ) );
|
44 |
H2.SetMag( ( + n1.Py() * V.Px() - n1.Px() * V.Py() ) / (sin(n2.Theta()) *det ) );
|
45 |
|
46 |
float mass=std::sqrt( TMath::Power( (H1.Mag()+H2.Mag()),2 ) - TMath::Power(( ( H1+H2 ).Mag()),2) );
|
47 |
|
48 |
return mass;
|
49 |
|
50 |
}
|
51 |
|
52 |
double Hmass_comb(double hJet1_eta,double hJet1_phi,double hJet1_pt, double hJet1_mass,
|
53 |
double hJet2_eta,double hJet2_phi,double hJet2_pt, double hJet2_mass){
|
54 |
|
55 |
TLorentzVector H1, H2;
|
56 |
H1.SetPtEtaPhiM(hJet1_pt,hJet1_eta,hJet1_phi, hJet1_mass);;
|
57 |
H2.SetPtEtaPhiM(hJet2_pt,hJet2_eta,hJet2_phi, hJet2_mass);
|
58 |
|
59 |
return (H1 + H2).M();
|
60 |
|
61 |
}
|
62 |
|
63 |
double Hmass_3j(double h_eta,double h_phi,double h_pt, double h_mass,
|
64 |
double aJet_eta,double aJet_phi,double aJet_pt, double aJet_mass){
|
65 |
|
66 |
TLorentzVector H, H3;
|
67 |
H.SetPtEtaPhiM( h_pt,h_eta,h_phi, h_mass);;
|
68 |
H3.SetPtEtaPhiM(aJet_pt,aJet_eta,aJet_phi, aJet_mass);
|
69 |
|
70 |
return (H + H3).M();
|
71 |
|
72 |
|
73 |
}
|
74 |
|
75 |
|
76 |
}
|
77 |
|