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

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 15 of file MuonEtaRange.h.

Constructor & Destructor Documentation

MuonEtaRange::MuonEtaRange ( )

Definition at line 17 of file MuonEtaRange.cc.

Referenced by add(), and subtract().

17  :
18  theMin(0), theMax(0) {}
MuonEtaRange::MuonEtaRange ( float  max,
float  min 
)

Definition at line 20 of file MuonEtaRange.cc.

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

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

Definition at line 31 of file MuonEtaRange.cc.

31  :
32  theMin(range.theMin), theMax(range.theMax) {}
MuonEtaRange::~MuonEtaRange ( )
inline

Definition at line 22 of file MuonEtaRange.h.

22 {}

Member Function Documentation

MuonEtaRange MuonEtaRange::add ( const MuonEtaRange range) const

create maximum of ranges

Definition at line 59 of file MuonEtaRange.cc.

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

Referenced by counter.Counter::register().

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

true if this overlaps with range

Definition at line 54 of file MuonEtaRange.cc.

References max(), and min().

Referenced by subtract().

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

Definition at line 43 of file MuonEtaRange.cc.

References max(), and min().

Referenced by subtract().

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

true if this is completely inside range

Definition at line 49 of file MuonEtaRange.cc.

References max(), and min().

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

Definition at line 25 of file MuonEtaRange.h.

References theMax.

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

25 { return theMax; }
float MuonEtaRange::min ( ) const
inline

Definition at line 24 of file MuonEtaRange.h.

References theMin.

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

24 { return theMin; }
MuonEtaRange MuonEtaRange::minRange ( const MuonEtaRange ) const
MuonEtaRange & MuonEtaRange::operator= ( const MuonEtaRange range)

Assignment operator.

Definition at line 34 of file MuonEtaRange.cc.

References theMax, and theMin.

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

create new range of size this minus range

Definition at line 65 of file MuonEtaRange.cc.

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

65  {
66 
67  if ( range.isInside(*this) ) {
68  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
69  return *this;
70  }
71  if ( !range.isCompatible(*this) ) {
72  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: 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 MuonEtaRange(max,min);
79 }
float min() const
Definition: MuonEtaRange.h:24
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:43
bool isCompatible(const MuonEtaRange &range) const
true if this overlaps with range
Definition: MuonEtaRange.cc:54
float max() const
Definition: MuonEtaRange.h:25

Member Data Documentation

float MuonEtaRange::theMax
private

Definition at line 35 of file MuonEtaRange.h.

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

float MuonEtaRange::theMin
private

Definition at line 34 of file MuonEtaRange.h.

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