CMS 3D CMS Logo

LocalError.h
Go to the documentation of this file.
1 #ifndef Geom_LocalError_H
2 #define Geom_LocalError_H
3 
9 #include <cmath>
10 #include <iosfwd>
11 
12 class LocalError {
13 public:
14  LocalError() : thexx(0), thexy(0), theyy(0) {}
15  LocalError(InvalidError) : thexx(-9999.e10f), thexy(0), theyy(-9999.e10f) {}
16 
17  LocalError(float xx, float xy, float yy) : thexx(xx), thexy(xy), theyy(yy) {}
18 
19  bool invalid() const { return thexx < -1.e10f; }
20  bool valid() const { return !invalid(); }
21 
22  float xx() const { return thexx; }
23  float xy() const { return thexy; }
24  float yy() const { return theyy; }
25 
31  LocalError scale(float s) const {
32  float s2 = s * s;
33  return LocalError(s2 * xx(), s2 * xy(), s2 * yy());
34  }
35 
37  LocalError rotate(float x, float y) const { return rotateCosSin(x, y, 1.f / (x * x + y * y)); }
38 
40  LocalError rotate(float phi) const { return rotateCosSin(cos(phi), sin(phi)); }
41 
43  LocalError rotateCosSin(float c, float s, float mag2i = 1.f) const {
44  return LocalError(mag2i * ((c * c) * xx() + (s * s) * yy() - 2.f * (c * s) * xy()),
45  mag2i * ((c * s) * (xx() - yy()) + (c * c - s * s) * xy()),
46  mag2i * ((s * s) * xx() + (c * c) * yy() + 2.f * (c * s) * xy()));
47  }
48 
49 private:
50  float thexx;
51  float thexy;
52  float theyy;
53 };
54 
55 std::ostream& operator<<(std::ostream& s, const LocalError& err);
56 
57 #endif // LocalError_H
DDAxes::y
LocalError::xy
float xy() const
Definition: LocalError.h:23
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
DDAxes::x
indexGen.s2
s2
Definition: indexGen.py:107
LocalError::thexx
float thexx
Definition: LocalError.h:50
TrivialError.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
alignCSCRings.s
s
Definition: alignCSCRings.py:92
LocalError::theyy
float theyy
Definition: LocalError.h:52
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
LocalError::rotate
LocalError rotate(float phi) const
Return a new LocalError, rotated by an angle phi.
Definition: LocalError.h:40
LocalError::xx
float xx() const
Definition: LocalError.h:22
LocalError::invalid
bool invalid() const
Definition: LocalError.h:19
operator<<
std::ostream & operator<<(std::ostream &s, const LocalError &err)
Definition: LocalError.cc:4
LocalError::LocalError
LocalError(float xx, float xy, float yy)
Definition: LocalError.h:17
LocalError::scale
LocalError scale(float s) const
Definition: LocalError.h:31
runTheMatrix.err
err
Definition: runTheMatrix.py:288
LocalError
Definition: LocalError.h:12
LocalError::thexy
float thexy
Definition: LocalError.h:51
LocalError::rotate
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:37
LocalError::valid
bool valid() const
Definition: LocalError.h:20
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
LocalError::LocalError
LocalError()
Definition: LocalError.h:14
DDAxes::phi
LocalError::rotateCosSin
LocalError rotateCosSin(float c, float s, float mag2i=1.f) const
Return a new LocalError, rotated by an angle defined by it's cosine and sine.
Definition: LocalError.h:43
LocalError::LocalError
LocalError(InvalidError)
Definition: LocalError.h:15
LocalError::yy
float yy() const
Definition: LocalError.h:24
InvalidError
Definition: TrivialError.h:8