CMS 3D CMS Logo

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() [1/3]

MuonEtaRange::MuonEtaRange ( )

Definition at line 16 of file MuonEtaRange.cc.

Referenced by add(), and subtract().

16 : theMin(0), theMax(0) {}

◆ MuonEtaRange() [2/3]

MuonEtaRange::MuonEtaRange ( float  max,
float  min 
)

Definition at line 18 of file MuonEtaRange.cc.

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

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

◆ MuonEtaRange() [3/3]

MuonEtaRange::MuonEtaRange ( const MuonEtaRange range)

Definition at line 29 of file MuonEtaRange.cc.

◆ ~MuonEtaRange()

MuonEtaRange::~MuonEtaRange ( )
inline

Definition at line 20 of file MuonEtaRange.h.

20 {}

Member Function Documentation

◆ add()

MuonEtaRange MuonEtaRange::add ( const MuonEtaRange range) const

create maximum of ranges

Definition at line 57 of file MuonEtaRange.cc.

References max(), min(), MuonEtaRange(), isotrackApplyRegressor::range, theMax, and theMin.

Referenced by counter.Counter::register().

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

◆ isCompatible()

bool MuonEtaRange::isCompatible ( const MuonEtaRange range) const

true if this overlaps with range

Definition at line 51 of file MuonEtaRange.cc.

References max(), min(), and isotrackApplyRegressor::range.

51  {
52  if (range.min() > max() || range.max() < min())
53  return false;
54  return true;
55 }
float min() const
Definition: MuonEtaRange.h:22
float max() const
Definition: MuonEtaRange.h:23

◆ isInside() [1/2]

bool MuonEtaRange::isInside ( float  eta,
float  error = 0. 
) const

Definition at line 39 of file MuonEtaRange.cc.

References relativeConstraints::error, PVValHelper::eta, max(), and min().

Referenced by subtract().

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

◆ isInside() [2/2]

bool MuonEtaRange::isInside ( const MuonEtaRange range) const

true if this is completely inside range

Definition at line 45 of file MuonEtaRange.cc.

References max(), min(), and isotrackApplyRegressor::range.

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

◆ max()

float MuonEtaRange::max ( ) const
inline

Definition at line 23 of file MuonEtaRange.h.

References theMax.

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

23 { return theMax; }

◆ min()

float MuonEtaRange::min ( ) const
inline

Definition at line 22 of file MuonEtaRange.h.

References theMin.

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

22 { return theMin; }

◆ minRange()

MuonEtaRange MuonEtaRange::minRange ( const MuonEtaRange ) const

◆ operator=()

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

Assignment operator.

Definition at line 31 of file MuonEtaRange.cc.

References isotrackApplyRegressor::range, theMax, and theMin.

31  {
32  if (this != &range) {
33  theMin = range.theMin;
34  theMax = range.theMax;
35  }
36  return *this;
37 }

◆ subtract()

MuonEtaRange MuonEtaRange::subtract ( const MuonEtaRange range) const

create new range of size this minus range

Definition at line 63 of file MuonEtaRange.cc.

References isInside(), max(), min(), MuonEtaRange(), isotrackApplyRegressor::range, theMax, and theMin.

63  {
64  if (range.isInside(*this)) {
65  edm::LogInfo("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
66  return *this;
67  }
68  if (!range.isCompatible(*this)) {
69  edm::LogInfo("MuonEtaRange") << "MuonEtaRange: 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 MuonEtaRange(max, min);
76 }
float min() const
Definition: MuonEtaRange.h:22
Log< level::Info, false > LogInfo
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:39
float max() const
Definition: MuonEtaRange.h:23

Member Data Documentation

◆ theMax

float MuonEtaRange::theMax
private

Definition at line 33 of file MuonEtaRange.h.

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

◆ theMin

float MuonEtaRange::theMin
private

Definition at line 32 of file MuonEtaRange.h.

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