CMS 3D CMS Logo

MTDEtaRange.cc
Go to the documentation of this file.
1 
14 #include <iostream>
15 
16 MTDEtaRange::MTDEtaRange() : theMin(0), theMax(0) {}
17 
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 }
28 
29 MTDEtaRange::MTDEtaRange(const MTDEtaRange& range) : theMin(range.theMin), theMax(range.theMax) {}
32  if (this != &range) {
33  theMin = range.theMin;
34  theMax = range.theMax;
35  }
36  return *this;
37 }
38 
39 bool MTDEtaRange::isInside(float eta, float error) const {
40  if ((eta + error) > max() || (eta - error) < min())
41  return false;
42  return true;
43 }
46  if (min() > range.min() && max() < range.max())
47  return true;
48  return false;
49 }
52  if (range.min() > max() || range.max() < min())
53  return false;
54  return true;
55 }
58  float max = (theMax > range.theMax) ? theMax : range.theMax;
59  float min = (theMin < range.theMin) ? theMin : range.theMin;
60  return MTDEtaRange(max, min);
61 }
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 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MessageLogger.h
MTDEtaRange::isInside
bool isInside(float eta, float error=0.) const
Definition: MTDEtaRange.cc:39
min
T min(T a, T b)
Definition: MathUtil.h:58
MTDEtaRange::MTDEtaRange
MTDEtaRange()
Definition: MTDEtaRange.cc:16
edm::LogInfo
Definition: MessageLogger.h:254
MTDEtaRange::theMin
float theMin
Definition: MTDEtaRange.h:32
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
relativeConstraints.error
error
Definition: relativeConstraints.py:53
MTDEtaRange
Definition: MTDEtaRange.h:15
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
MTDEtaRange::add
MTDEtaRange add(const MTDEtaRange &) const
create maximum of ranges
Definition: MTDEtaRange.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:69
edm::LogWarning
Definition: MessageLogger.h:141
MTDEtaRange::subtract
MTDEtaRange subtract(const MTDEtaRange &) const
create new range of size this minus range
Definition: MTDEtaRange.cc:63
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDEtaRange::operator=
MTDEtaRange & operator=(const MTDEtaRange &)
Assignment operator.
Definition: MTDEtaRange.cc:31
MTDEtaRange::isCompatible
bool isCompatible(const MTDEtaRange &range) const
true if this overlaps with range
Definition: MTDEtaRange.cc:51
MTDEtaRange.h