Common Math Functions

The most commonly used mathematical functions are provided under the package:

• `DataFormats/Math`

All the functions below are defined in the namespace `reco`.

Below is a list of the supported functions:

ΔR

Header file: `#include "DataFormats/Math/interface/deltaR.h"`

• ΔR of two vectors:
```      template<typename T1, typename T2>
double deltaR(const T1 & t1, const T2 & t2);
```

• ΔR-squared of two vectors:
```      template<typename T1, typename T2>
double deltaR2(const T1 & t1, const T2 & t2) ;
```

• ΔR-squared of two vectors, passing eta and φ:
```      double deltaR2(double eta1, double phi1, double eta2, double phi2);
```

• ΔR of two vectors, passing eta and φ:
```      double deltaR(double eta1, double phi1, double eta2, double phi2);
```

3D angle

Header file: `#include "DataFormats/Math/interface/angle.h"`

• 3D angle between two vectors:
```      template<typename T1, typename T2>
double angle(const T1 & t1, const T2 & t2);
```

• 3D angle between two vectors, passing cartesian coordinates of the two vectors:
```      template <class T>
T angle (T x1, T y1, T z1, T x2, T y2, T z2);
```

Δφ

Header file: `#include "DataFormats/Math/interface/deltaPhi.h"`

• Δφ of two azimuthal angles:
```      double deltaPhi (double phi1, double phi2);
```

Normalized φ

Header file: `#include "DataFormats/Math/interface/normalizedPhi.h"`

• return an azimuthal angle φ normalized between -π and +π:
```      double normalizedPhi(double phi);
```

requires to link against the library `PhysicsToolsUtilities`

BenediktHegner - 06 May 2009

Responsible: LucaLista

Topic revision: r7 - 2009-05-06 - BenediktHegner

 Cern Search TWiki Search Google Search CMSPublic All webs
Copyright &© 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback