CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetUtil.h
Go to the documentation of this file.
1 #ifndef JET_JETUTIL_H
2 #define JET_JETUTIL_H 1
3 
4 #include <cmath>
5 
6 class PtGreater {
7  public:
8  template <typename T> bool operator () (const T& i, const T& j) {
9  return (i.pt() > j.pt());
10  }
11 };
12 
13 class EtGreater {
14  public:
15  template <typename T> bool operator () (const T& i, const T& j) {
16  return (i.et() > j.et());
17  }
18 };
19 
20 class JetUtil{
21  public:
22 
23 static double Phi_0_2pi(double x) {
24  while (x >= 2*M_PI) x -= 2*M_PI;
25  while (x < 0.) x += 2*M_PI;
26  return x;
27 }
28 
29 static double Phi_mpi_pi(double x) {
30  while (x >= M_PI) x -= 2*M_PI;
31  while (x < -M_PI) x += 2*M_PI;
32  return x;
33 }
34 
35 static double dPhi(double phi1,double phi2){
36  phi1=Phi_0_2pi(phi1);
37  phi2=Phi_0_2pi(phi2);
38  return Phi_mpi_pi(phi1-phi2);
39 }
40 
41 static double radius(double eta1, double phi1,double eta2, double phi2){
42 
43  const double TWOPI= 2.0*M_PI;
44 
45  phi1=Phi_0_2pi(phi1);
46  phi2=Phi_0_2pi(phi2);
47 
48  double dphi=Phi_0_2pi(phi1-phi2);
49  dphi = TMath::Min(dphi,TWOPI-dphi);
50  double deta = eta1-eta2;
51 
52  return sqrt(deta*deta+dphi*dphi);
53 }
54 
55 template <typename T1,typename T2> static double radius(const T1& t1,const T2& t2){
56  return radius(t1->eta(),t1->phi(),t2->eta(),t2->phi());
57 }
58 };
59 #endif
int i
Definition: DBlmapReader.cc:9
bool operator()(const T &i, const T &j)
Definition: JetUtil.h:15
#define TWOPI
EgammaCoreTools.
static double radius(double eta1, double phi1, double eta2, double phi2)
Definition: JetUtil.h:41
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
static double Phi_mpi_pi(double x)
Definition: JetUtil.h:29
#define M_PI
Definition: BFit3D.cc:3
static double radius(const T1 &t1, const T2 &t2)
Definition: JetUtil.h:55
static double dPhi(double phi1, double phi2)
Definition: JetUtil.h:35
x
Definition: VDTMath.h:216
long double T
bool operator()(const T &i, const T &j)
Definition: SusyDQM.h:45
static double Phi_0_2pi(double x)
Definition: JetUtil.h:23