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 
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 }
float theMin
Definition: MTDEtaRange.h:32
MTDEtaRange add(const MTDEtaRange &) const
create maximum of ranges
Definition: MTDEtaRange.cc:57
MTDEtaRange & operator=(const MTDEtaRange &)
Assignment operator.
Definition: MTDEtaRange.cc:31
float min() const
Definition: MTDEtaRange.h:22
float theMax
Definition: MTDEtaRange.h:33
float max() const
Definition: MTDEtaRange.h:23
bool isInside(float eta, float error=0.) const
Definition: MTDEtaRange.cc:39
MTDEtaRange subtract(const MTDEtaRange &) const
create new range of size this minus range
Definition: MTDEtaRange.cc:63
tmp
align.sh
Definition: createJobs.py:716
bool isCompatible(const MTDEtaRange &range) const
true if this overlaps with range
Definition: MTDEtaRange.cc:51