ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/MathTools/interface/MathUtils.h
Revision: 1.12
Committed: Tue Nov 3 10:27:41 2009 UTC (15 years, 6 months ago) by sixie
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, HEAD
Branch point for: Mit_025c_branch
Changes since 1.11: +2 -2 lines
Error occurred while calculating annotation data.
Log Message:
Add Clopper Pearson interval, and Feldman Cousins interval calculations to the CalcRatio function

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: MathUtils.h,v 1.11 2009/08/13 09:50:40 loizides Exp $
3 //
4 // MathUtils
5 //
6 // Math utility functions.
7 //
8 // Authors: S.Xie, C.Loizides
9 //--------------------------------------------------------------------------------------------------
10
11 #ifndef MITCOMMON_MATHTOOLS_MATHUTILS_H
12 #define MITCOMMON_MATHTOOLS_MATHUTILS_H
13
14 #include "MitCommon/DataFormats/interface/Types.h"
15 #include <TMath.h>
16
17 namespace mithep
18 {
19 class MathUtils {
20 public:
21 static Double_t AddInQuadrature(Double_t a, Double_t b);
22 static void CalcRatio(Double_t n1, Double_t n2,
23 Double_t &r, Double_t &rlow, Double_t &rup, Int_t type);
24 static Double_t DeltaPhi(Double_t phi1, Double_t phi2);
25 template<class V1, class V2>
26 static Double_t DeltaPhi(const V1 &v1, const V2 &v2);
27 template<class V1, class V2>
28 static Double_t DeltaPhi(const V1 *v1, const V2 *v2);
29 static Double_t DeltaR(Double_t phi1, Double_t eta1, Double_t phi2, Double_t eta2);
30 template<class V1, class V2>
31 static Double_t DeltaR(const V1 *v1, const V2 *v2);
32 template<class V1, class V2>
33 static Double_t DeltaR(const V1 &v1, const V2 &v2);
34 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 template<class V1, class V2>
38 static Double_t DeltaR2(const V1 *v1, const V2 *v2);
39 static Double_t Eta2Theta(Double_t eta);
40 static Double_t Theta2Eta(Double_t theta);
41
42 ClassDef(MathUtils, 0) // Math utitily functions
43 };
44 }
45
46 //--------------------------------------------------------------------------------------------------
47 template<class V1, class V2>
48 Double_t mithep::MathUtils::DeltaPhi(const V1 &v1, const V2 &v2)
49 {
50 // DeltaPhi between two given objects.
51
52 return mithep::MathUtils::DeltaPhi(v1.Phi(),v2.Phi());
53 }
54
55 //--------------------------------------------------------------------------------------------------
56 template<class V1, class V2>
57 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 Double_t mithep::MathUtils::DeltaR(const V1 &v1, const V2 &v2)
67 {
68 // 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 // DeltaR between two given objects
78
79 return mithep::MathUtils::DeltaR(v1->Phi(),v1->Eta(),v2->Phi(),v2->Eta());
80 }
81
82 //--------------------------------------------------------------------------------------------------
83 template<class V1, class V2>
84 Double_t mithep::MathUtils::DeltaR2(const V1 &v1, const V2 &v2)
85 {
86 // DeltaR between two given objects.
87
88 return mithep::MathUtils::DeltaR2(v1.Phi(),v1.Eta(),v2.Phi(),v2.Eta());
89 }
90
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 #endif