ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Anghel/macros/interface/Utils.h
Revision: 1.1
Committed: Fri Jan 29 23:09:35 2010 UTC (15 years, 3 months ago) by anghel
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Revision 29Jan2010

File Contents

# Content
1 #include "TMath.h"
2 #include "TLorentzVector.h"
3 #include <iostream>
4
5
6 double getDeltaR(TLorentzVector a, TLorentzVector b) {
7 double dEta = (a.Eta())-(b.Eta());
8 double dPhi = (a.Phi())-(b.Phi());
9 if (dPhi < -(TMath::Pi())) dPhi = dPhi+2*(TMath::Pi());
10 if (dPhi > (TMath::Pi())) dPhi = dPhi-2*(TMath::Pi());
11 double calcDeltaR = sqrt(dEta*dEta+dPhi*dPhi);
12 double rootdeltaR = a.DeltaR(b);
13 return calcDeltaR;
14 }
15
16 double getDeltaPhi(TLorentzVector a, TLorentzVector b) {
17 double dPhi = (a.Phi())-(b.Phi());
18 if (dPhi < -(TMath::Pi())) dPhi = dPhi+2*(TMath::Pi());
19 if (dPhi > (TMath::Pi())) dPhi = dPhi-2*(TMath::Pi());
20 return dPhi;
21 }
22