CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonEtaRange.cc
Go to the documentation of this file.
1 
16 #include<iostream>
17 
18 
20  theMin(0), theMax(0) {}
21 
23  if ( max < min ) {
24  edm::LogWarning ("MuonEtaRange") << "Warning MuonEtaRange:: max < min!! correcting" <<std::endl;
25  float tmp(min);
26  min = max;
27  max = tmp;
28  }
29  theMax = max;
30  theMin = min;
31 }
32 
34  theMin(range.theMin), theMax(range.theMax) {}
37 
38  if ( this != &range ) {
39  theMin = range.theMin;
40  theMax = range.theMax;
41  }
42  return *this;
43 }
44 
45 bool MuonEtaRange::isInside(float eta, float error) const {
46 
47  if ( (eta+error) > max() || (eta-error) < min() ) return false;
48  return true;
49 }
51 bool MuonEtaRange::isInside(const MuonEtaRange& range) const {
52  if ( min() > range.min() && max() < range.max() ) return true;
53  return false;
54 }
56 bool MuonEtaRange::isCompatible(const MuonEtaRange& range) const {
57  if ( range.min() > max() || range.max() < min() ) return false;
58  return true;
59 }
62  float max = ( theMax > range.theMax ) ? theMax : range.theMax;
63  float min = ( theMin < range.theMin ) ? theMin : range.theMin;
64  return MuonEtaRange(max,min);
65 }
68 
69  if ( range.isInside(*this) ) {
70  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: range is inside!" << std::endl;
71  return *this;
72  }
73  if ( !range.isCompatible(*this) ) {
74  edm::LogInfo ("MuonEtaRange") << "MuonEtaRange: no overlap between ranges" << std::endl;
75  return *this;
76  }
77 
78  float max = isInside(range.theMin) ? range.theMin : theMax;
79  float min = isInside(range.theMax) ? range.theMax : theMin;
80  return MuonEtaRange(max,min);
81 }
82 
83 
MuonEtaRange add(const MuonEtaRange &) const
create maximum of ranges
Definition: MuonEtaRange.cc:61
#define min(a, b)
Definition: mlp_lapack.h:161
T eta() const
const T & max(const T &a, const T &b)
float min() const
Definition: MuonEtaRange.h:26
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:45
MuonEtaRange & operator=(const MuonEtaRange &)
Assignment operator.
Definition: MuonEtaRange.cc:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool isCompatible(const MuonEtaRange &range) const
true if this overlaps with range
Definition: MuonEtaRange.cc:56
MuonEtaRange subtract(const MuonEtaRange &) const
create new range of size this minus range
Definition: MuonEtaRange.cc:67
float max() const
Definition: MuonEtaRange.h:27