1 |
sixie |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
sixie |
1.12 |
// $Id: MathUtils.h,v 1.11 2009/08/13 09:50:40 loizides Exp $
|
3 |
sixie |
1.1 |
//
|
4 |
|
|
// MathUtils
|
5 |
|
|
//
|
6 |
loizides |
1.2 |
// Math utility functions.
|
7 |
sixie |
1.1 |
//
|
8 |
loizides |
1.2 |
// Authors: S.Xie, C.Loizides
|
9 |
sixie |
1.1 |
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
loizides |
1.2 |
#ifndef MITCOMMON_MATHTOOLS_MATHUTILS_H
|
12 |
|
|
#define MITCOMMON_MATHTOOLS_MATHUTILS_H
|
13 |
sixie |
1.1 |
|
14 |
loizides |
1.2 |
#include "MitCommon/DataFormats/interface/Types.h"
|
15 |
sixie |
1.1 |
#include <TMath.h>
|
16 |
|
|
|
17 |
loizides |
1.3 |
namespace mithep
|
18 |
sixie |
1.1 |
{
|
19 |
loizides |
1.2 |
class MathUtils {
|
20 |
|
|
public:
|
21 |
loizides |
1.4 |
static Double_t AddInQuadrature(Double_t a, Double_t b);
|
22 |
loizides |
1.9 |
static void CalcRatio(Double_t n1, Double_t n2,
|
23 |
sixie |
1.12 |
Double_t &r, Double_t &rlow, Double_t &rup, Int_t type);
|
24 |
loizides |
1.4 |
static Double_t DeltaPhi(Double_t phi1, Double_t phi2);
|
25 |
loizides |
1.7 |
template<class V1, class V2>
|
26 |
|
|
static Double_t DeltaPhi(const V1 &v1, const V2 &v2);
|
27 |
loizides |
1.11 |
template<class V1, class V2>
|
28 |
|
|
static Double_t DeltaPhi(const V1 *v1, const V2 *v2);
|
29 |
loizides |
1.4 |
static Double_t DeltaR(Double_t phi1, Double_t eta1, Double_t phi2, Double_t eta2);
|
30 |
loizides |
1.7 |
template<class V1, class V2>
|
31 |
loizides |
1.11 |
static Double_t DeltaR(const V1 *v1, const V2 *v2);
|
32 |
|
|
template<class V1, class V2>
|
33 |
loizides |
1.7 |
static Double_t DeltaR(const V1 &v1, const V2 &v2);
|
34 |
loizides |
1.8 |
static Double_t DeltaR2(Double_t phi1, Double_t eta1, Double_t phi2, Double_t eta2);
|
35 |
|
|
template<class V1, class V2>
|
36 |
|
|
static Double_t DeltaR2(const V1 &v1, const V2 &v2);
|
37 |
loizides |
1.11 |
template<class V1, class V2>
|
38 |
|
|
static Double_t DeltaR2(const V1 *v1, const V2 *v2);
|
39 |
loizides |
1.4 |
static Double_t Eta2Theta(Double_t eta);
|
40 |
|
|
static Double_t Theta2Eta(Double_t theta);
|
41 |
loizides |
1.10 |
|
42 |
|
|
ClassDef(MathUtils, 0) // Math utitily functions
|
43 |
loizides |
1.2 |
};
|
44 |
sixie |
1.1 |
}
|
45 |
bendavid |
1.6 |
|
46 |
|
|
//--------------------------------------------------------------------------------------------------
|
47 |
|
|
template<class V1, class V2>
|
48 |
loizides |
1.7 |
Double_t mithep::MathUtils::DeltaPhi(const V1 &v1, const V2 &v2)
|
49 |
|
|
{
|
50 |
loizides |
1.11 |
// DeltaPhi between two given objects.
|
51 |
loizides |
1.7 |
|
52 |
|
|
return mithep::MathUtils::DeltaPhi(v1.Phi(),v2.Phi());
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
//--------------------------------------------------------------------------------------------------
|
56 |
|
|
template<class V1, class V2>
|
57 |
loizides |
1.11 |
Double_t mithep::MathUtils::DeltaPhi(const V1 *v1, const V2 *v2)
|
58 |
|
|
{
|
59 |
|
|
// DeltaPhi between two given objects.
|
60 |
|
|
|
61 |
|
|
return mithep::MathUtils::DeltaPhi(v1->Phi(),v2->Phi());
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
//--------------------------------------------------------------------------------------------------
|
65 |
|
|
template<class V1, class V2>
|
66 |
bendavid |
1.6 |
Double_t mithep::MathUtils::DeltaR(const V1 &v1, const V2 &v2)
|
67 |
|
|
{
|
68 |
loizides |
1.11 |
// DeltaR between two given objects.
|
69 |
|
|
|
70 |
|
|
return mithep::MathUtils::DeltaR(v1.Phi(),v1.Eta(),v2.Phi(),v2.Eta());
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
//--------------------------------------------------------------------------------------------------
|
74 |
|
|
template<class V1, class V2>
|
75 |
|
|
Double_t mithep::MathUtils::DeltaR(const V1 *v1, const V2 *v2)
|
76 |
|
|
{
|
77 |
loizides |
1.7 |
// DeltaR between two given objects
|
78 |
bendavid |
1.6 |
|
79 |
loizides |
1.11 |
return mithep::MathUtils::DeltaR(v1->Phi(),v1->Eta(),v2->Phi(),v2->Eta());
|
80 |
bendavid |
1.6 |
}
|
81 |
loizides |
1.8 |
|
82 |
|
|
//--------------------------------------------------------------------------------------------------
|
83 |
|
|
template<class V1, class V2>
|
84 |
|
|
Double_t mithep::MathUtils::DeltaR2(const V1 &v1, const V2 &v2)
|
85 |
|
|
{
|
86 |
loizides |
1.11 |
// DeltaR between two given objects.
|
87 |
loizides |
1.8 |
|
88 |
|
|
return mithep::MathUtils::DeltaR2(v1.Phi(),v1.Eta(),v2.Phi(),v2.Eta());
|
89 |
|
|
}
|
90 |
loizides |
1.11 |
|
91 |
|
|
//--------------------------------------------------------------------------------------------------
|
92 |
|
|
template<class V1, class V2>
|
93 |
|
|
Double_t mithep::MathUtils::DeltaR2(const V1 *v1, const V2 *v2)
|
94 |
|
|
{
|
95 |
|
|
// DeltaR between two given objects.
|
96 |
|
|
|
97 |
|
|
return mithep::MathUtils::DeltaR2(v1->Phi(),v1->Eta(),v2->Phi(),v2->Eta());
|
98 |
|
|
}
|
99 |
sixie |
1.1 |
#endif
|