CMS 3D CMS Logo

MuonEtaRange Class Reference

a class to define eta range used in Muon Navigation More...

#include <RecoMuon/Navigation/interface/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 (const MuonEtaRange &range) const
 true if this is completely inside range
bool isInside (float eta, float error=0.) const
float max () const
float min () const
MuonEtaRange minRange (const MuonEtaRange &) const
 MuonEtaRange (const MuonEtaRange &)
 MuonEtaRange (float max, float min)
 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:

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

00019                            : 
00020    theMin(0), theMax(0) {}

MuonEtaRange::MuonEtaRange ( float  max,
float  min 
)

Definition at line 22 of file MuonEtaRange.cc.

References lat::endl(), theMax, theMin, and tmp.

00022                                                {
00023  if ( max < min ) {
00024    edm::LogWarning ("MuonEtaRange") << "Warning MuonEtaRange:: max < min!! correcting" <<std::endl;
00025    float tmp(min);
00026    min = max;
00027    max = tmp;
00028  }
00029  theMax = max;
00030  theMin = min;
00031 }

MuonEtaRange::MuonEtaRange ( const MuonEtaRange range  ) 

Definition at line 33 of file MuonEtaRange.cc.

00033                                                     :
00034     theMin(range.theMin), theMax(range.theMax) {}

MuonEtaRange::~MuonEtaRange (  )  [inline]

Definition at line 24 of file MuonEtaRange.h.

00024 {}


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.

00061                                                               {
00062   float max = ( theMax > range.theMax ) ? theMax : range.theMax;
00063   float min = ( theMin < range.theMin ) ? theMin : range.theMin;
00064   return MuonEtaRange(max,min);
00065 }

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

00056                                                                {
00057   if ( range.min() > max() || range.max() < min() ) return false; 
00058   return true;
00059 }

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

00051                                                            {
00052   if ( min() > range.min() && max() < range.max() ) return true;
00053   return false;
00054 }

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(), MuonTkNavigationSchool::linkEndcapLayers(), and subtract().

00045                                                         {
00046 
00047   if ( (eta+error) > max() || (eta-error) < min() ) return false;
00048   return true;
00049 }

float MuonEtaRange::max (  )  const [inline]

Definition at line 27 of file MuonEtaRange.h.

References theMax.

Referenced by add(), isCompatible(), isInside(), MuonTkNavigationSchool::linkBarrelLayers(), MuonTkNavigationSchool::linkEndcapLayers(), operator<<(), and subtract().

00027 { return theMax; }

float MuonEtaRange::min (  )  const [inline]

Definition at line 26 of file MuonEtaRange.h.

References theMin.

Referenced by add(), isCompatible(), isInside(), MuonTkNavigationSchool::linkBarrelLayers(), MuonTkNavigationSchool::linkEndcapLayers(), operator<<(), and subtract().

00026 { return theMin; }

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.

00036                                                                {
00037 
00038   if ( this != &range ) {
00039     theMin = range.theMin;
00040     theMax = range.theMax;
00041   }
00042   return *this;
00043 }

MuonEtaRange MuonEtaRange::subtract ( const MuonEtaRange range  )  const

create new range of size this minus range

Definition at line 67 of file MuonEtaRange.cc.

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

Referenced by MuonTkNavigationSchool::linkEndcapLayers().

00067                                                                    {
00068 
00069   if ( range.isInside(*this) ) {
00070     edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
00071     return *this;
00072   }
00073   if ( !range.isCompatible(*this) ) {
00074     edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: no overlap between ranges" << std::endl;
00075     return *this;
00076   }
00077 
00078   float max = isInside(range.theMin) ? range.theMin : theMax;
00079   float min = isInside(range.theMax) ? range.theMax : theMin;
00080   return MuonEtaRange(max,min);
00081 }


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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:43 2009 for CMSSW by  doxygen 1.5.4