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

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

Referenced by add(), and subtract().

◆ MuonEtaRange() [2/3]

MuonEtaRange::MuonEtaRange ( float  max,
float  min 
)

Definition at line 18 of file MuonEtaRange.cc.

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 }

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

◆ MuonEtaRange() [3/3]

MuonEtaRange::MuonEtaRange ( const MuonEtaRange range)

Definition at line 29 of file MuonEtaRange.cc.

29 : theMin(range.theMin), theMax(range.theMax) {}

◆ ~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.

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 }

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

Referenced by counter.Counter::register().

◆ isCompatible()

bool MuonEtaRange::isCompatible ( const MuonEtaRange range) const

true if this overlaps with range

Definition at line 51 of file MuonEtaRange.cc.

51  {
52  if (range.min() > max() || range.max() < min())
53  return false;
54  return true;
55 }

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

◆ isInside() [1/2]

bool MuonEtaRange::isInside ( const MuonEtaRange range) const

true if this is completely inside range

Definition at line 45 of file MuonEtaRange.cc.

45  {
46  if (min() > range.min() && max() < range.max())
47  return true;
48  return false;
49 }

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

◆ isInside() [2/2]

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

Definition at line 39 of file MuonEtaRange.cc.

39  {
40  if ((eta + error) > max() || (eta - error) < min())
41  return false;
42  return true;
43 }

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

Referenced by subtract().

◆ max()

float MuonEtaRange::max ( ) const
inline

Definition at line 23 of file MuonEtaRange.h.

23 { return theMax; }

References theMax.

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

◆ min()

float MuonEtaRange::min ( ) const
inline

Definition at line 22 of file MuonEtaRange.h.

22 { return theMin; }

References theMin.

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

◆ minRange()

MuonEtaRange MuonEtaRange::minRange ( const MuonEtaRange ) const

◆ operator=()

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

Assignment operator.

Definition at line 31 of file MuonEtaRange.cc.

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

References FastTimerService_cff::range, theMax, and theMin.

◆ subtract()

MuonEtaRange MuonEtaRange::subtract ( const MuonEtaRange range) const

create new range of size this minus range

Definition at line 63 of file MuonEtaRange.cc.

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 }

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

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

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MuonEtaRange::MuonEtaRange
MuonEtaRange()
Definition: MuonEtaRange.cc:16
MuonEtaRange::isInside
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:39
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MuonEtaRange::theMin
float theMin
Definition: MuonEtaRange.h:32
MuonEtaRange::max
float max() const
Definition: MuonEtaRange.h:23
PVValHelper::eta
Definition: PVValidationHelpers.h:69
MuonEtaRange::theMax
float theMax
Definition: MuonEtaRange.h:33
MuonEtaRange::min
float min() const
Definition: MuonEtaRange.h:22