CMS 3D CMS Logo

MuonEtaRange.cc
Go to the documentation of this file.
1 
14 #include <iostream>
15 
16 MuonEtaRange::MuonEtaRange() : theMin(0), theMax(0) {}
17 
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 }
28 
29 MuonEtaRange::MuonEtaRange(const MuonEtaRange& 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 MuonEtaRange::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 MuonEtaRange(max, min);
61 }
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 }
bool isCompatible(const MuonEtaRange &range) const
true if this overlaps with range
Definition: MuonEtaRange.cc:51
float min() const
Definition: MuonEtaRange.h:22
Log< level::Info, false > LogInfo
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:39
MuonEtaRange subtract(const MuonEtaRange &) const
create new range of size this minus range
Definition: MuonEtaRange.cc:63
MuonEtaRange & operator=(const MuonEtaRange &)
Assignment operator.
Definition: MuonEtaRange.cc:31
MuonEtaRange add(const MuonEtaRange &) const
create maximum of ranges
Definition: MuonEtaRange.cc:57
float max() const
Definition: MuonEtaRange.h:23
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716