ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/interface/VHbbNameSpace.h
Revision: 1.4
Committed: Tue Jan 15 13:01:10 2013 UTC (12 years, 3 months ago) by nmohr
Content type: text/plain
Branch: MAIN
Changes since 1.3: +47 -0 lines
Log Message:
Add angular likelihood vars

File Contents

# User Rev Content
1 bortigno 1.2 #include "TLorentzVector.h"
2     #include "TVector3.h"
3 bortigno 1.1 #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 bortigno 1.3 return TMath::Sqrt(deta*deta + dphi*dphi);
20 bortigno 1.1 }
21 bortigno 1.2
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 bortigno 1.3 float mass=TMath::Sqrt( TMath::Power( (H1.Mag()+H2.Mag()),2 ) - TMath::Power(( ( H1+H2 ).Mag()),2) );
47 bortigno 1.2
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 nmohr 1.4
75     double ANGLELZ(double pt, double eta, double phi, double mass, double pt2, double eta2, double phi2, double mass2){
76     TLorentzVector m1, m2, msum;
77     m1.SetPtEtaPhiM(pt, eta, phi, mass);
78     m2.SetPtEtaPhiM(pt2, eta2, phi2, mass2);
79     msum = m1 + m2;
80    
81     TVector3 bZ = msum.BoostVector();
82    
83     m1.Boost(-bZ);
84     m2.Boost(-bZ);
85    
86     TVector3 b1;
87    
88    
89     if((int) (pt) % 2 == 0)
90     b1 = m1.BoostVector();
91     else
92     b1 = m2.BoostVector();
93    
94     float cosTheta = b1.Dot(msum.BoostVector()) / (b1.Mag()*msum.BoostVector().Mag());
95     return(cosTheta);
96     }
97    
98    
99     double ANGLEHB(double pt, double eta, double phi, double e, double pt2, double eta2, double phi2, double e2){
100     TLorentzVector m1, m2, msum;
101     m1.SetPtEtaPhiE(pt, eta, phi, e);
102     m2.SetPtEtaPhiE(pt2, eta2, phi2, e2);
103     msum = m1 + m2;
104    
105     TVector3 bZ = msum.BoostVector();
106    
107     m1.Boost(-bZ);
108     m2.Boost(-bZ);
109    
110     TVector3 b1;
111    
112     if((int) (pt) % 2 == 0)
113     b1 = m1.BoostVector();
114     else
115     b1 = m2.BoostVector();
116    
117     float cosTheta = b1.Dot(msum.BoostVector()) / (b1.Mag()*msum.BoostVector().Mag());
118     return(cosTheta);
119     }
120    
121 bortigno 1.2
122    
123 bortigno 1.1 }
124