CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MuonEtaRange Class Reference

#include <MuonEtaRange.h>

Public Member Functions

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

Private Attributes

float theMax
 
float theMin
 

Detailed Description

a class to define eta range used in Muon Navigation

Date:
2006/04/24 18:58:15
Revision:
1.4
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 Muon Navigation

Date:
2006/04/24 20:00:05
Revision:
1.2
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:

Definition at line 17 of file MuonEtaRange.h.

Constructor & Destructor Documentation

MuonEtaRange::MuonEtaRange ( )

Definition at line 19 of file MuonEtaRange.cc.

Referenced by add(), and subtract().

19  :
20  theMin(0), theMax(0) {}
MuonEtaRange::MuonEtaRange ( float  max,
float  min 
)

Definition at line 22 of file MuonEtaRange.cc.

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

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

Definition at line 33 of file MuonEtaRange.cc.

33  :
34  theMin(range.theMin), theMax(range.theMax) {}
MuonEtaRange::~MuonEtaRange ( )
inline

Definition at line 24 of file MuonEtaRange.h.

24 {}

Member Function Documentation

MuonEtaRange MuonEtaRange::add ( const MuonEtaRange range) const

create maximum of ranges

Definition at line 61 of file MuonEtaRange.cc.

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

Referenced by MuonNavigationSchool::linkEndcapLayers().

61  {
62  float max = ( theMax > range.theMax ) ? theMax : range.theMax;
63  float min = ( theMin < range.theMin ) ? theMin : range.theMin;
64  return MuonEtaRange(max,min);
65 }
float min() const
Definition: MuonEtaRange.h:26
float max() const
Definition: MuonEtaRange.h:27
bool MuonEtaRange::isCompatible ( const MuonEtaRange range) const

true if this overlaps with range

Definition at line 56 of file MuonEtaRange.cc.

References max(), and min().

Referenced by MuonNavigationSchool::linkEndcapLayers(), and subtract().

56  {
57  if ( range.min() > max() || range.max() < min() ) return false;
58  return true;
59 }
float min() const
Definition: MuonEtaRange.h:26
float max() const
Definition: MuonEtaRange.h:27
bool MuonEtaRange::isInside ( float  eta,
float  error = 0. 
) const

Definition at line 45 of file MuonEtaRange.cc.

References max(), and min().

Referenced by MuonTkNavigationSchool::linkBarrelLayers(), MuonNavigationSchool::linkEndcapLayers(), MuonTkNavigationSchool::linkEndcapLayers(), and subtract().

45  {
46 
47  if ( (eta+error) > max() || (eta-error) < min() ) return false;
48  return true;
49 }
T eta() const
float min() const
Definition: MuonEtaRange.h:26
float max() const
Definition: MuonEtaRange.h:27
bool MuonEtaRange::isInside ( const MuonEtaRange range) const

true if this is completely inside range

Definition at line 51 of file MuonEtaRange.cc.

References max(), and min().

51  {
52  if ( min() > range.min() && max() < range.max() ) return true;
53  return false;
54 }
float min() const
Definition: MuonEtaRange.h:26
float max() const
Definition: MuonEtaRange.h:27
float MuonEtaRange::max ( ) const
inline
float MuonEtaRange::min ( ) const
inline
MuonEtaRange MuonEtaRange::minRange ( const MuonEtaRange ) const
MuonEtaRange & MuonEtaRange::operator= ( const MuonEtaRange range)

Assignment operator.

Definition at line 36 of file MuonEtaRange.cc.

References theMax, and theMin.

36  {
37 
38  if ( this != &range ) {
39  theMin = range.theMin;
40  theMax = range.theMax;
41  }
42  return *this;
43 }
MuonEtaRange MuonEtaRange::subtract ( const MuonEtaRange range) const

create new range of size this minus range

Definition at line 67 of file MuonEtaRange.cc.

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

Referenced by MuonNavigationSchool::linkEndcapLayers(), and MuonTkNavigationSchool::linkEndcapLayers().

67  {
68 
69  if ( range.isInside(*this) ) {
70  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
71  return *this;
72  }
73  if ( !range.isCompatible(*this) ) {
74  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: no overlap between ranges" << std::endl;
75  return *this;
76  }
77 
78  float max = isInside(range.theMin) ? range.theMin : theMax;
79  float min = isInside(range.theMax) ? range.theMax : theMin;
80  return MuonEtaRange(max,min);
81 }
float min() const
Definition: MuonEtaRange.h:26
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:45
bool isCompatible(const MuonEtaRange &range) const
true if this overlaps with range
Definition: MuonEtaRange.cc:56
float max() const
Definition: MuonEtaRange.h:27

Member Data Documentation

float MuonEtaRange::theMax
private

Definition at line 37 of file MuonEtaRange.h.

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

float MuonEtaRange::theMin
private

Definition at line 36 of file MuonEtaRange.h.

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