CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MTDEtaRange Class Reference

#include <MTDEtaRange.h>

Public Member Functions

MTDEtaRange add (const MTDEtaRange &) const
 create maximum of ranges More...
 
bool isCompatible (const MTDEtaRange &range) const
 true if this overlaps with range More...
 
bool isInside (float eta, float error=0.) const
 
bool isInside (const MTDEtaRange &range) const
 true if this is completely inside range More...
 
float max () const
 
float min () const
 
MTDEtaRange minRange (const MTDEtaRange &) const
 
 MTDEtaRange ()
 
 MTDEtaRange (float max, float min)
 
 MTDEtaRange (const MTDEtaRange &)
 
MTDEtaRangeoperator= (const MTDEtaRange &)
 Assignment operator. More...
 
MTDEtaRange subtract (const MTDEtaRange &) const
 create new range of size this minus range More...
 
 ~MTDEtaRange ()
 

Private Attributes

float theMax
 
float theMin
 

Detailed Description

a class to define eta range used in Muon Navigation

Author
: Stefano Lacaprara - INFN Padova stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t

Modification:

a class to define eta range used in MTD Navigation

Author
: L. Gray - FNAL

Modification:

Definition at line 15 of file MTDEtaRange.h.

Constructor & Destructor Documentation

MTDEtaRange::MTDEtaRange ( )

Definition at line 17 of file MTDEtaRange.cc.

Referenced by add(), and subtract().

17  :
18  theMin(0), theMax(0) {}
float theMin
Definition: MTDEtaRange.h:34
float theMax
Definition: MTDEtaRange.h:35
MTDEtaRange::MTDEtaRange ( float  max,
float  min 
)

Definition at line 20 of file MTDEtaRange.cc.

References max(), min(), theMax, theMin, and tmp.

20  {
21  if ( max < min ) {
22  edm::LogWarning ("MTDEtaRange") << "Warning MTDEtaRange:: max < min!! correcting" <<std::endl;
23  float tmp(min);
24  min = max;
25  max = tmp;
26  }
27  theMax = max;
28  theMin = min;
29 }
float theMin
Definition: MTDEtaRange.h:34
float min() const
Definition: MTDEtaRange.h:24
float theMax
Definition: MTDEtaRange.h:35
float max() const
Definition: MTDEtaRange.h:25
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
MTDEtaRange::MTDEtaRange ( const MTDEtaRange range)

Definition at line 31 of file MTDEtaRange.cc.

31  :
32  theMin(range.theMin), theMax(range.theMax) {}
float theMin
Definition: MTDEtaRange.h:34
float theMax
Definition: MTDEtaRange.h:35
MTDEtaRange::~MTDEtaRange ( )
inline

Definition at line 22 of file MTDEtaRange.h.

References operator=().

22 {}

Member Function Documentation

MTDEtaRange MTDEtaRange::add ( const MTDEtaRange range) const

create maximum of ranges

Definition at line 59 of file MTDEtaRange.cc.

References max(), min(), MTDEtaRange(), theMax, and theMin.

Referenced by MTDNavigationSchool::linkEndcapLayers(), max(), and counter.Counter::register().

59  {
60  float max = ( theMax > range.theMax ) ? theMax : range.theMax;
61  float min = ( theMin < range.theMin ) ? theMin : range.theMin;
62  return MTDEtaRange(max,min);
63 }
float theMin
Definition: MTDEtaRange.h:34
float min() const
Definition: MTDEtaRange.h:24
float theMax
Definition: MTDEtaRange.h:35
float max() const
Definition: MTDEtaRange.h:25
bool MTDEtaRange::isCompatible ( const MTDEtaRange range) const

true if this overlaps with range

Definition at line 54 of file MTDEtaRange.cc.

References max(), and min().

Referenced by MTDNavigationSchool::linkEndcapLayers(), max(), and subtract().

54  {
55  if ( range.min() > max() || range.max() < min() ) return false;
56  return true;
57 }
float min() const
Definition: MTDEtaRange.h:24
float max() const
Definition: MTDEtaRange.h:25
bool MTDEtaRange::isInside ( float  eta,
float  error = 0. 
) const

Definition at line 43 of file MTDEtaRange.cc.

References max(), and min().

Referenced by MTDNavigationSchool::linkEndcapLayers(), max(), and subtract().

43  {
44 
45  if ( (eta+error) > max() || (eta-error) < min() ) return false;
46  return true;
47 }
float min() const
Definition: MTDEtaRange.h:24
float max() const
Definition: MTDEtaRange.h:25
bool MTDEtaRange::isInside ( const MTDEtaRange range) const

true if this is completely inside range

Definition at line 49 of file MTDEtaRange.cc.

References max(), and min().

49  {
50  if ( min() > range.min() && max() < range.max() ) return true;
51  return false;
52 }
float min() const
Definition: MTDEtaRange.h:24
float max() const
Definition: MTDEtaRange.h:25
float MTDEtaRange::max ( ) const
inline
float MTDEtaRange::min ( ) const
inline

Definition at line 24 of file MTDEtaRange.h.

References theMin.

Referenced by add(), isCompatible(), isInside(), MTDEtaRange(), operator<<(), and subtract().

24 { return theMin; }
float theMin
Definition: MTDEtaRange.h:34
MTDEtaRange MTDEtaRange::minRange ( const MTDEtaRange ) const

Referenced by max().

MTDEtaRange & MTDEtaRange::operator= ( const MTDEtaRange range)

Assignment operator.

Definition at line 34 of file MTDEtaRange.cc.

References theMax, and theMin.

Referenced by ~MTDEtaRange().

34  {
35 
36  if ( this != &range ) {
37  theMin = range.theMin;
38  theMax = range.theMax;
39  }
40  return *this;
41 }
float theMin
Definition: MTDEtaRange.h:34
float theMax
Definition: MTDEtaRange.h:35
MTDEtaRange MTDEtaRange::subtract ( const MTDEtaRange range) const

create new range of size this minus range

Definition at line 65 of file MTDEtaRange.cc.

References isCompatible(), isInside(), max(), min(), MTDEtaRange(), theMax, and theMin.

Referenced by MTDNavigationSchool::linkEndcapLayers(), and max().

65  {
66 
67  if ( range.isInside(*this) ) {
68  edm::LogInfo ("MTDEtaRange") << "MTDEtaRange: range is inside!" << std::endl;
69  return *this;
70  }
71  if ( !range.isCompatible(*this) ) {
72  edm::LogInfo ("MTDEtaRange") << "MTDEtaRange: no overlap between ranges" << std::endl;
73  return *this;
74  }
75 
76  float max = isInside(range.theMin) ? range.theMin : theMax;
77  float min = isInside(range.theMax) ? range.theMax : theMin;
78  return MTDEtaRange(max,min);
79 }
float theMin
Definition: MTDEtaRange.h:34
float min() const
Definition: MTDEtaRange.h:24
float theMax
Definition: MTDEtaRange.h:35
float max() const
Definition: MTDEtaRange.h:25
bool isInside(float eta, float error=0.) const
Definition: MTDEtaRange.cc:43
bool isCompatible(const MTDEtaRange &range) const
true if this overlaps with range
Definition: MTDEtaRange.cc:54

Member Data Documentation

float MTDEtaRange::theMax
private

Definition at line 35 of file MTDEtaRange.h.

Referenced by add(), max(), MTDEtaRange(), operator=(), and subtract().

float MTDEtaRange::theMin
private

Definition at line 34 of file MTDEtaRange.h.

Referenced by add(), min(), MTDEtaRange(), operator=(), and subtract().