CMS 3D CMS Logo

EtaDepResElement.cc
Go to the documentation of this file.
1 //
2 //
3 //
4 // File : src/EtaDepResolution.cc
5 // Author : Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
6 // Purpose: Hold on to an element eta-dependent resolution.
7 //
8 
26 #include <sstream>
27 #include <stdexcept>
29 
30 namespace hitfit {
31 
32  EtaDepResElement::EtaDepResElement(double eta1, double eta2, const Vector_Resolution& res) : _Vector_Resolution(res) {
33  SetEta(eta1, eta2);
34  }
35 
36  EtaDepResElement::EtaDepResElement(double eta1, double eta2, std::string res) : _Vector_Resolution(res) {
37  SetEta(eta1, eta2);
38  }
39 
41  double eta2,
42  const Resolution& p_res,
43  const Resolution& eta_res,
44  const Resolution& phi_res,
45  bool use_et)
46  : _Vector_Resolution(p_res, eta_res, phi_res, use_et) {
47  SetEta(eta1, eta2);
48  }
49 
51 
52  void EtaDepResElement::SetEta(double eta1, double eta2) {
53  if (fabs(eta1 - eta2) < (1.0 / double(InverseEtaPrecision))) {
54  throw std::runtime_error("EtaDepResElement::equal EtaMin and EtaMax");
55  }
56 
57  if (eta1 < eta2) {
58  _EtaMin = eta1;
59  _EtaMax = eta2;
60  } else {
61  _EtaMin = eta2;
62  _EtaMax = eta1;
63  }
64  }
65 
80  if (a.IsOverlap(b)) {
81  return false;
82  }
83  return !(a._EtaMax > b._EtaMin);
84  }
85 
86  const double EtaDepResElement::EtaMin() const { return _EtaMin; }
87 
88  const double EtaDepResElement::EtaMax() const { return _EtaMax; }
89 
91  return (IsInInterval(e._EtaMin) || IsInInterval(e._EtaMax));
92  }
93 
94  bool EtaDepResElement::IsNotOverlap(const EtaDepResElement& e) const { return !(IsOverlap(e)); }
95 
96  bool EtaDepResElement::IsInInterval(const double& eta) const { return ((_EtaMin < eta) && (eta < _EtaMax)); }
97 
98  bool EtaDepResElement::IsOnEdge(const double& eta) const {
99  bool nearEtaMin = fabs(eta - _EtaMin) < (1.0 / double(InverseEtaPrecision));
100  bool nearEtaMax = fabs(eta - _EtaMax) < (1.0 / double(InverseEtaPrecision));
101  return nearEtaMin || nearEtaMax;
102  }
103 
105  return (e.IsOnEdge(_EtaMin) || e.IsOnEdge(_EtaMax));
106  }
107 
109 
110  std::ostream& operator<<(std::ostream& s, const EtaDepResElement& e) {
111  s << "(" << e._EtaMin << " to " << e._EtaMax << ")"
112  << " / " << e.GetResolution();
113  return s;
114  }
115 
116 } // namespace hitfit
hitfit::EtaDepResElement::SetEta
void SetEta(double eta1, double eta2)
Definition: EtaDepResElement.cc:52
hitfit
Definition: Base_Constrainer.h:43
hitfit::Vector_Resolution
Definition: Vector_Resolution.h:89
hitfit::EtaDepResElement::IsOnEdge
bool IsOnEdge(const double &eta) const
Check if an value is at the edge/boundary of this instance's valid range.
Definition: EtaDepResElement.cc:98
hitfit::EtaDepResElement::IsInInterval
bool IsInInterval(const double &eta) const
Check if an value is within this instance's range.
Definition: EtaDepResElement.cc:96
hitfit::EtaDepResElement::GetResolution
const Vector_Resolution GetResolution() const
Access the resolution.
Definition: EtaDepResElement.cc:108
hitfit::operator<
bool operator<(const EtaDepResElement &a, const EtaDepResElement &b)
Comparison operator, compare two EtaDepResElement instances based on their respective valid ranges.
Definition: EtaDepResElement.cc:79
EtaDepResElement.h
Hold on to an element of -dependent resolution object, namely a resolution and range in which the r...
hitfit::EtaDepResElement::IsOverlap
bool IsOverlap(const EtaDepResElement &e) const
Check if this instance has overlapping range with another instance of EtaDepResElement.
Definition: EtaDepResElement.cc:90
alignCSCRings.s
s
Definition: alignCSCRings.py:92
hitfit::EtaDepResElement::InverseEtaPrecision
static const int InverseEtaPrecision
Constant, the inverse of precision expected.
Definition: EtaDepResElement.h:234
hitfit::EtaDepResElement::~EtaDepResElement
~EtaDepResElement()
Definition: EtaDepResElement.cc:50
PVValHelper::eta
Definition: PVValidationHelpers.h:70
hitfit::EtaDepResElement::EtaMax
const double EtaMax() const
Return the lower limit of valid range.
Definition: EtaDepResElement.cc:88
HLT_FULL_cff.eta2
eta2
Definition: HLT_FULL_cff.py:9542
hitfit::operator<<
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream.
Definition: Constraint_Intermed.cc:268
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.eta1
eta1
Definition: HLT_FULL_cff.py:9541
hitfit::EtaDepResElement::_EtaMax
double _EtaMax
Definition: EtaDepResElement.h:71
hitfit::EtaDepResElement::_Vector_Resolution
Vector_Resolution _Vector_Resolution
Definition: EtaDepResElement.h:85
a
double a
Definition: hdecay.h:119
hitfit::EtaDepResElement::_EtaMin
double _EtaMin
Definition: EtaDepResElement.h:66
res
Definition: Electron.h:6
hitfit::Resolution
Definition: Resolution.h:98
hitfit::EtaDepResElement::IsNotOverlap
bool IsNotOverlap(const EtaDepResElement &e) const
Check if this instance does not have overlapping range with another instance.
Definition: EtaDepResElement.cc:94
hitfit::EtaDepResElement::EtaDepResElement
EtaDepResElement(double eta1, double eta2, const Vector_Resolution &res)
Construct an instance of EtaDepResElement from the lower limit, upper limit, and the resolution....
Definition: EtaDepResElement.cc:32
hitfit::EtaDepResElement
Represent a resolution and an range in which the resolution is valid.
Definition: EtaDepResElement.h:61
hitfit::EtaDepResElement::EtaMin
const double EtaMin() const
Return the lower limit of valid range.
Definition: EtaDepResElement.cc:86
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37