ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/MathTools/src/MathUtils.cc
(Generate patch)

Comparing UserCode/MitCommon/MathTools/src/MathUtils.cc (file contents):
Revision 1.4 by loizides, Mon Nov 24 14:23:01 2008 UTC vs.
Revision 1.5 by loizides, Wed Feb 18 15:38:26 2009 UTC

# Line 7 | Line 7 | using namespace mithep;
7   //--------------------------------------------------------------------------------------------------
8   Double_t MathUtils::AddInQuadrature(Double_t a, Double_t b)
9   {
10 +  // Add quantities in quadrature.
11 +
12    return(TMath::Sqrt(a*a + b*b));
13   }
14  
15   //--------------------------------------------------------------------------------------------------
16   Double_t MathUtils::DeltaPhi(Double_t phi1, Double_t phi2)
17   {
18 +  // Compute DeltaPhi between two given angles. Results is in [-pi/2,pi/2].
19 +
20    Double_t dphi = TMath::Abs(phi1-phi2);
21    while (dphi>TMath::Pi())
22      dphi = TMath::Abs(dphi - TMath::TwoPi());
# Line 22 | Line 26 | Double_t MathUtils::DeltaPhi(Double_t ph
26   //--------------------------------------------------------------------------------------------------
27   Double_t MathUtils::DeltaPhi(const FourVector &v1, const FourVector &v2)
28   {
29 +  // Compute DeltaPhi between two given angles. Results is in [-pi/2,pi/2].
30 +
31 +  return DeltaPhi(v1.Phi(),v2.Phi());
32 + }
33 +
34 + //--------------------------------------------------------------------------------------------------
35 + Double_t MathUtils::DeltaPhi(const FourVectorM &v1, const FourVectorM &v2)
36 + {
37 +  // Compute DeltaPhi between two given angles. Results is in [-pi/2,pi/2].
38 +
39    return DeltaPhi(v1.Phi(),v2.Phi());
40   }
41  
42   //--------------------------------------------------------------------------------------------------
43   Double_t MathUtils::DeltaR(Double_t phi1, Double_t eta1, Double_t phi2, Double_t eta2)
44   {
45 +  // Compute DeltaR between two given points in the eta/phi plane.
46 +
47    Double_t dphi = DeltaPhi(phi1, phi2);
48    Double_t deta = eta1-eta2;
49    Double_t dR = TMath::Sqrt(dphi*dphi + deta*deta);
# Line 37 | Line 53 | Double_t MathUtils::DeltaR(Double_t phi1
53   //--------------------------------------------------------------------------------------------------
54   Double_t MathUtils::DeltaR(const FourVector &v1, const FourVector &v2)
55   {
56 +  // Compute DeltaR between two given points in the eta/phi plane.
57 +
58 +  return MathUtils::DeltaR(v1.Phi(),v1.Eta(),v2.Phi(),v2.Eta());
59 + }
60 +
61 + //--------------------------------------------------------------------------------------------------
62 + Double_t MathUtils::DeltaR(const FourVectorM &v1, const FourVectorM &v2)
63 + {
64 +  // Compute DeltaR between two given points in the eta/phi plane.
65 +
66    return MathUtils::DeltaR(v1.Phi(),v1.Eta(),v2.Phi(),v2.Eta());
67   }
68  
69   //--------------------------------------------------------------------------------------------------
70   Double_t MathUtils::Eta2Theta(Double_t eta)
71   {
72 +  // Compute theta from given eta value.
73 +
74    return 2.*TMath::ATan(exp(-eta));
75   }
76  
77   //--------------------------------------------------------------------------------------------------
78   Double_t MathUtils::Theta2Eta(Double_t theta)
79   {
80 +  // Compute eta from given theta value.
81 +
82    return -TMath::Log(TMath::Tan(theta/2.));
83   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines