CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MTDEtaRange Class Reference

#include <MTDEtaRange.h>

Public Member Functions

MTDEtaRange add (const MTDEtaRange &) const
 create maximum of ranges More...
 
bool isCompatible (const MTDEtaRange &range) const
 true if this overlaps with range More...
 
bool isInside (const MTDEtaRange &range) const
 true if this is completely inside range More...
 
bool isInside (float eta, float error=0.) const
 
float max () const
 
float min () const
 
MTDEtaRange minRange (const MTDEtaRange &) const
 
 MTDEtaRange ()
 
 MTDEtaRange (const MTDEtaRange &)
 
 MTDEtaRange (float max, float min)
 
MTDEtaRangeoperator= (const MTDEtaRange &)
 Assignment operator. More...
 
MTDEtaRange subtract (const MTDEtaRange &) const
 create new range of size this minus range More...
 
 ~MTDEtaRange ()
 

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:

a class to define eta range used in MTD Navigation

Author
: L. Gray - FNAL

Modification:

Definition at line 15 of file MTDEtaRange.h.

Constructor & Destructor Documentation

◆ MTDEtaRange() [1/3]

MTDEtaRange::MTDEtaRange ( )

Definition at line 16 of file MTDEtaRange.cc.

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

Referenced by add(), and subtract().

◆ MTDEtaRange() [2/3]

MTDEtaRange::MTDEtaRange ( float  max,
float  min 
)

Definition at line 18 of file MTDEtaRange.cc.

18  {
19  if (max < min) {
20  edm::LogWarning("MTDEtaRange") << "Warning MTDEtaRange:: 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.

◆ MTDEtaRange() [3/3]

MTDEtaRange::MTDEtaRange ( const MTDEtaRange range)

Definition at line 29 of file MTDEtaRange.cc.

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

◆ ~MTDEtaRange()

MTDEtaRange::~MTDEtaRange ( )
inline

Definition at line 20 of file MTDEtaRange.h.

20 {}

Member Function Documentation

◆ add()

MTDEtaRange MTDEtaRange::add ( const MTDEtaRange range) const

create maximum of ranges

Definition at line 57 of file MTDEtaRange.cc.

57  {
58  float max = (theMax > range.theMax) ? theMax : range.theMax;
59  float min = (theMin < range.theMin) ? theMin : range.theMin;
60  return MTDEtaRange(max, min);
61 }

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

Referenced by counter.Counter::register().

◆ isCompatible()

bool MTDEtaRange::isCompatible ( const MTDEtaRange range) const

true if this overlaps with range

Definition at line 51 of file MTDEtaRange.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 MTDEtaRange::isInside ( const MTDEtaRange range) const

true if this is completely inside range

Definition at line 45 of file MTDEtaRange.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 MTDEtaRange::isInside ( float  eta,
float  error = 0. 
) const

Definition at line 39 of file MTDEtaRange.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 MTDEtaRange::max ( ) const
inline

Definition at line 23 of file MTDEtaRange.h.

23 { return theMax; }

References theMax.

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

◆ min()

float MTDEtaRange::min ( ) const
inline

Definition at line 22 of file MTDEtaRange.h.

22 { return theMin; }

References theMin.

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

◆ minRange()

MTDEtaRange MTDEtaRange::minRange ( const MTDEtaRange ) const

◆ operator=()

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

Assignment operator.

Definition at line 31 of file MTDEtaRange.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()

MTDEtaRange MTDEtaRange::subtract ( const MTDEtaRange range) const

create new range of size this minus range

Definition at line 63 of file MTDEtaRange.cc.

63  {
64  if (range.isInside(*this)) {
65  edm::LogInfo("MTDEtaRange") << "MTDEtaRange: range is inside!" << std::endl;
66  return *this;
67  }
68  if (!range.isCompatible(*this)) {
69  edm::LogInfo("MTDEtaRange") << "MTDEtaRange: 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 MTDEtaRange(max, min);
76 }

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

Member Data Documentation

◆ theMax

float MTDEtaRange::theMax
private

Definition at line 33 of file MTDEtaRange.h.

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

◆ theMin

float MTDEtaRange::theMin
private

Definition at line 32 of file MTDEtaRange.h.

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

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MTDEtaRange::isInside
bool isInside(float eta, float error=0.) const
Definition: MTDEtaRange.cc:39
MTDEtaRange::MTDEtaRange
MTDEtaRange()
Definition: MTDEtaRange.cc:16
MTDEtaRange::theMin
float theMin
Definition: MTDEtaRange.h:32
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
MTDEtaRange::min
float min() const
Definition: MTDEtaRange.h:22
MTDEtaRange::max
float max() const
Definition: MTDEtaRange.h:23
MTDEtaRange::theMax
float theMax
Definition: MTDEtaRange.h:33
PVValHelper::eta
Definition: PVValidationHelpers.h:69