Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:16

0001 #ifndef GeometryVector_Geom_Util_h
0002 #define GeometryVector_Geom_Util_h
0003 
0004 #include "DataFormats/GeometryVector/interface/Pi.h"
0005 #include "DataFormats/Math/interface/deltaR.h"
0006 #include <cmath>
0007 
0008 namespace Geom {
0009   using reco::deltaPhi;
0010   using reco::deltaR;
0011   using reco::deltaR2;
0012 
0013   /** Definition of ordering of azimuthal angles.
0014    *  phi1 is less than phi2 if the angle covered by a point going from
0015    *  phi1 to phi2 in the counterclockwise direction is smaller than pi.
0016    *  It makes sense only if ALL phis are in a single hemisphere...
0017    */
0018   inline bool phiLess(float phi1, float phi2) { return deltaPhi(phi1, phi2) < 0; }
0019   inline bool phiLess(double phi1, double phi2) { return deltaPhi(phi1, phi2) < 0; }
0020   template <class Vector1, class Vector2>
0021   bool phiLess(const Vector1& v1, const Vector2& v2) {
0022     return deltaPhi(v1.phi(), v2.phi()) < 0.;
0023   }
0024 
0025 }  // namespace Geom
0026 
0027 #endif