CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
rangeIntersection.h File Reference
#include "TrackingTools/DetLayers/interface/rangesIntersect.h"
#include <algorithm>

Go to the source code of this file.

Functions

template<class Range >
Range rangeIntersection (const Range &a, const Range &b)
 
template<class Range , class Less >
Range rangeIntersection (const Range &a, const Range &b, const Less &less)
 

Function Documentation

template<class Range >
Range rangeIntersection ( const Range a,
const Range b 
)
inline

Utility for computing efficiently the intersection of two one-dimantional intervals.

Pre-condition and expected template argument Range interface: as for function rangesIntersect. If the intervals don't intersect an empty interval is returned.

Definition at line 16 of file rangeIntersection.h.

References max(), and min.

Referenced by PixelRecoRange< float >::intersection().

16  {
17 
18  return Range( std::max(a.first,b.first),
19  std::min(a.second,b.second));
20 }
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
PixelRecoRange< float > Range
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
template<class Range , class Less >
Range rangeIntersection ( const Range a,
const Range b,
const Less &  less 
)
inline

Definition at line 23 of file rangeIntersection.h.

References max(), and min.

24  {
25 
26  return Range( std::max( a.first, b.first, less),
27  std::min( a.second, b.second, less));
28 }
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
PixelRecoRange< float > Range
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121