CMS 3D CMS Logo

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

◆ rangeIntersection() [1/2]

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.

16  {
17  return Range(std::max(a.first, b.first), std::min(a.second, b.second));
18 }

References a, b, SiStripPI::max, and min().

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

◆ rangeIntersection() [2/2]

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

Definition at line 21 of file rangeIntersection.h.

21  {
22  return Range(std::max(a.first, b.first, less), std::min(a.second, b.second, less));
23 }

References a, b, SiStripPI::max, and min().

Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
min
T min(T a, T b)
Definition: MathUtil.h:58
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169