CMS 3D CMS Logo

Public Member Functions | Private Attributes

MuonEtaRange Class Reference

#include <MuonEtaRange.h>

List of all members.

Public Member Functions

MuonEtaRange add (const MuonEtaRange &) const
 create maximum of ranges
bool isCompatible (const MuonEtaRange &range) const
 true if this overlaps with range
bool isInside (float eta, float error=0.) const
bool isInside (const MuonEtaRange &range) const
 true if this is completely inside range
float max () const
float min () const
MuonEtaRange minRange (const MuonEtaRange &) const
 MuonEtaRange (float max, float min)
 MuonEtaRange (const MuonEtaRange &)
 MuonEtaRange ()
MuonEtaRangeoperator= (const MuonEtaRange &)
 Assignment operator.
MuonEtaRange subtract (const MuonEtaRange &) const
 create new range of size this minus range
 ~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 <stefano.lacaprara@pd.infn.it>

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 <stefano.lacaprara@pd.infn.it>

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().

                           : 
   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.

                                               {
 if ( max < min ) {
   edm::LogWarning ("MuonEtaRange") << "Warning MuonEtaRange:: max < min!! correcting" <<std::endl;
   float tmp(min);
   min = max;
   max = tmp;
 }
 theMax = max;
 theMin = min;
}
MuonEtaRange::MuonEtaRange ( const MuonEtaRange range)

Definition at line 33 of file MuonEtaRange.cc.

                                                    :
    theMin(range.theMin), theMax(range.theMax) {}
MuonEtaRange::~MuonEtaRange ( ) [inline]

Definition at line 24 of file MuonEtaRange.h.

{}

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().

                                                              {
  float max = ( theMax > range.theMax ) ? theMax : range.theMax;
  float min = ( theMin < range.theMin ) ? theMin : range.theMin;
  return MuonEtaRange(max,min);
}
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().

                                                               {
  if ( range.min() > max() || range.max() < min() ) return false; 
  return true;
}
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().

                                                           {
  if ( min() > range.min() && max() < range.max() ) return true;
  return false;
}
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().

                                                        {

  if ( (eta+error) > max() || (eta-error) < min() ) return false;
  return true;
}
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.

                                                               {

  if ( this != &range ) {
    theMin = range.theMin;
    theMax = range.theMax;
  }
  return *this;
}
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().

                                                                   {

  if ( range.isInside(*this) ) {
    edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
    return *this;
  }
  if ( !range.isCompatible(*this) ) {
    edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: no overlap between ranges" << std::endl;
    return *this;
  }

  float max = isInside(range.theMin) ? range.theMin : theMax;
  float min = isInside(range.theMax) ? range.theMax : theMin;
  return MuonEtaRange(max,min);
}

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().