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 16 of file MTDEtaRange.cc.

Referenced by add(), and subtract().

16 : theMin(0), theMax(0) {}
float theMin
Definition: MTDEtaRange.h:32
float theMax
Definition: MTDEtaRange.h:33
MTDEtaRange::MTDEtaRange ( float  max,
float  min 
)

Definition at line 18 of file MTDEtaRange.cc.

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

18  {
19  if (max < min) {
20  edm::LogWarning("MTDEtaRange") << "Warning MTDEtaRange:: max < min!! correcting" << std::endl;
21  float tmp(min);
22  min = max;
23  max = tmp;
24  }
25  theMax = max;
26  theMin = min;
27 }
float theMin
Definition: MTDEtaRange.h:32
float min() const
Definition: MTDEtaRange.h:22
float theMax
Definition: MTDEtaRange.h:33
float max() const
Definition: MTDEtaRange.h:23
tmp
align.sh
Definition: createJobs.py:716
MTDEtaRange::MTDEtaRange ( const MTDEtaRange range)

Definition at line 29 of file MTDEtaRange.cc.

29 : theMin(range.theMin), theMax(range.theMax) {}
float theMin
Definition: MTDEtaRange.h:32
float theMax
Definition: MTDEtaRange.h:33
MTDEtaRange::~MTDEtaRange ( )
inline

Definition at line 20 of file MTDEtaRange.h.

References operator=().

20 {}

Member Function Documentation

MTDEtaRange MTDEtaRange::add ( const MTDEtaRange range) const

create maximum of ranges

Definition at line 57 of file MTDEtaRange.cc.

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

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

57  {
58  float max = (theMax > range.theMax) ? theMax : range.theMax;
59  float min = (theMin < range.theMin) ? theMin : range.theMin;
60  return MTDEtaRange(max, min);
61 }
float theMin
Definition: MTDEtaRange.h:32
float min() const
Definition: MTDEtaRange.h:22
float theMax
Definition: MTDEtaRange.h:33
float max() const
Definition: MTDEtaRange.h:23
bool MTDEtaRange::isCompatible ( const MTDEtaRange range) const

true if this overlaps with range

Definition at line 51 of file MTDEtaRange.cc.

References max(), and min().

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

51  {
52  if (range.min() > max() || range.max() < min())
53  return false;
54  return true;
55 }
float min() const
Definition: MTDEtaRange.h:22
float max() const
Definition: MTDEtaRange.h:23
bool MTDEtaRange::isInside ( float  eta,
float  error = 0. 
) const

Definition at line 39 of file MTDEtaRange.cc.

References max(), and min().

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

39  {
40  if ((eta + error) > max() || (eta - error) < min())
41  return false;
42  return true;
43 }
float min() const
Definition: MTDEtaRange.h:22
float max() const
Definition: MTDEtaRange.h:23
bool MTDEtaRange::isInside ( const MTDEtaRange range) const

true if this is completely inside range

Definition at line 45 of file MTDEtaRange.cc.

References max(), and min().

45  {
46  if (min() > range.min() && max() < range.max())
47  return true;
48  return false;
49 }
float min() const
Definition: MTDEtaRange.h:22
float max() const
Definition: MTDEtaRange.h:23
float MTDEtaRange::max ( ) const
inline
float MTDEtaRange::min ( ) const
inline

Definition at line 22 of file MTDEtaRange.h.

References theMin.

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

22 { return theMin; }
float theMin
Definition: MTDEtaRange.h:32
MTDEtaRange MTDEtaRange::minRange ( const MTDEtaRange ) const

Referenced by max().

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

Assignment operator.

Definition at line 31 of file MTDEtaRange.cc.

References theMax, and theMin.

Referenced by ~MTDEtaRange().

31  {
32  if (this != &range) {
33  theMin = range.theMin;
34  theMax = range.theMax;
35  }
36  return *this;
37 }
float theMin
Definition: MTDEtaRange.h:32
float theMax
Definition: MTDEtaRange.h:33
MTDEtaRange MTDEtaRange::subtract ( const MTDEtaRange range) const

create new range of size this minus range

Definition at line 63 of file MTDEtaRange.cc.

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

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

63  {
64  if (range.isInside(*this)) {
65  edm::LogInfo("MTDEtaRange") << "MTDEtaRange: range is inside!" << std::endl;
66  return *this;
67  }
68  if (!range.isCompatible(*this)) {
69  edm::LogInfo("MTDEtaRange") << "MTDEtaRange: no overlap between ranges" << std::endl;
70  return *this;
71  }
72 
73  float max = isInside(range.theMin) ? range.theMin : theMax;
74  float min = isInside(range.theMax) ? range.theMax : theMin;
75  return MTDEtaRange(max, min);
76 }
float theMin
Definition: MTDEtaRange.h:32
float min() const
Definition: MTDEtaRange.h:22
float theMax
Definition: MTDEtaRange.h:33
float max() const
Definition: MTDEtaRange.h:23
bool isInside(float eta, float error=0.) const
Definition: MTDEtaRange.cc:39
bool isCompatible(const MTDEtaRange &range) const
true if this overlaps with range
Definition: MTDEtaRange.cc:51

Member Data Documentation

float MTDEtaRange::theMax
private

Definition at line 33 of file MTDEtaRange.h.

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

float MTDEtaRange::theMin
private

Definition at line 32 of file MTDEtaRange.h.

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