-
Notifications
You must be signed in to change notification settings - Fork 1
/
etaPhiFunc.h
32 lines (24 loc) · 869 Bytes
/
etaPhiFunc.h
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
#ifndef etaPhiFunc_h
#define etaPhiFunc_h
#include "TMath.h"
#include <iostream>
Float_t getDPHI(Float_t phi1, Float_t phi2, Int_t tag, Int_t tag2 = -1, Int_t tag3 = -1)
{
Float_t dphi = phi1 - phi2;
if(dphi > TMath::Pi())
dphi = dphi - 2. * TMath::Pi();
if(dphi <= -TMath::Pi())
dphi = dphi + 2. * TMath::Pi();
if(TMath::Abs(dphi) > TMath::Pi()) {
std::cout << phi1 << ", " << phi2 << std::endl;
std::cout << "Tag: " << tag << ", " << tag2 << ", " << tag3 << " commonUtility::getDPHI error!!! dphi is bigger than TMath::Pi() " << std::endl;
}
return dphi;
}
Float_t getDR(Float_t eta1, Float_t phi1, Float_t eta2, Float_t phi2, Int_t tag, Int_t tag2 = -1, Int_t tag3 = -1)
{
Float_t theDphi = getDPHI(phi1, phi2, tag, tag2, tag3);
Float_t theDeta = eta1 - eta2;
return TMath::Sqrt(theDphi*theDphi + theDeta*theDeta);
}
#endif