CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BasicSingleVertexState.cc
Go to the documentation of this file.
3 
4 BasicSingleVertexState::BasicSingleVertexState()
5  : thePos(GlobalPoint(0, 0, 0)),
6  theErr(AlgebraicSymMatrix33()),
7  theWeight(AlgebraicSymMatrix33()),
8  theWeightTimesPos(AlgebraicVector3()), theWeightInMix(0.) ,
9  thePosAvailable(false), theErrAvailable(false),theWeightAvailable(false), theWeightTimesPosAvailable(false),
10  valid(false)
11 {}
12 
13 
14 BasicSingleVertexState::BasicSingleVertexState(const GlobalPoint & pos,
15  const GlobalError & posErr,
16  const double & weightInMix)
17  : thePos(pos),
18  theErr(posErr),
19  theWeight(AlgebraicSymMatrix33()),
20  theWeightTimesPos(AlgebraicVector3()),
21  theWeightInMix(weightInMix),
22  thePosAvailable(true), theErrAvailable(true),theWeightAvailable(false), theWeightTimesPosAvailable(false),
23  valid(true)
24 {}
25 
26 
27 BasicSingleVertexState::BasicSingleVertexState(const GlobalPoint & pos,
28  const GlobalWeight & posWeight,
29  const double & weightInMix)
30  : thePos(pos),
31  theErr(AlgebraicSymMatrix33()),
32  theWeight(posWeight),
33  theWeightTimesPos(AlgebraicVector3()),
34  theWeightInMix(weightInMix),
35  thePosAvailable(true), theErrAvailable(false),theWeightAvailable(true), theWeightTimesPosAvailable(false),
36  valid(true)
37 {}
38 
39 
40 BasicSingleVertexState::BasicSingleVertexState(const AlgebraicVector3 & weightTimesPosition,
41  const GlobalWeight & posWeight,
42  const double & weightInMix)
43  : thePos(GlobalPoint(0, 0, 0)),
44  theErr(AlgebraicSymMatrix33()),
45  theWeight(posWeight),
46  theWeightTimesPos(weightTimesPosition),
47  theWeightInMix(weightInMix),
48  thePosAvailable(false), theErrAvailable(false),theWeightAvailable(true), theWeightTimesPosAvailable(true),
49  valid(true)
50 {}
51 
52 
54 {
55  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
56  if (!thePosAvailable) computePosition();
57  return thePos;
58 }
59 
60 
62 {
63  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
64  if (!theErrAvailable) computeError();
65  return theErr;
66 }
67 
68 
70 {
71  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
72  if (!theWeightAvailable) computeWeight();
73  return theWeight;
74 }
75 
76 
77 AlgebraicVector3 BasicSingleVertexState::weightTimesPosition() const
78 {
79  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
80  if (!theWeightTimesPosAvailable) computeWeightTimesPos();
81  return theWeightTimesPos;
82 }
83 
84 
85 double BasicSingleVertexState::weightInMixture() const
86 {
87  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
88  return theWeightInMix;
89 }
90 // RefCountedVertexSeed BasicSingleVertexState::seedWithoutTracks() const
91 // {
92 // RefCountedVertexSeed v = new VertexSeed(position(), error());
93 // return v;
94 // }
95 
96 
97 
98 void BasicSingleVertexState::computePosition() const
99 {
100  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
101  AlgebraicVector3 pos = error().matrix_new()*weightTimesPosition();
102  thePos = GlobalPoint(pos[0], pos[1], pos[2]);
103  thePosAvailable = true;
104 }
105 
106 
107 void BasicSingleVertexState::computeError() const
108 {
109  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
110  int ifail;
111  theErr = weight().matrix().Inverse(ifail);
112  if (ifail != 0) throw VertexException("BasicSingleVertexState::could not invert weight matrix");
113  theErrAvailable = true;
114 }
115 
116 
117 void BasicSingleVertexState::computeWeight() const
118 {
119  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
120  int ifail;
121  theWeight = error().matrix().Inverse(ifail);
122  if (ifail != 0) throw VertexException("BasicSingleVertexState::could not invert error matrix");
123  theWeightAvailable = true;
124 }
125 
126 
127 void BasicSingleVertexState::computeWeightTimesPos() const
128 {
129  if (!valid) throw VertexException("BasicSingleVertexState::invalid");
130  AlgebraicVector3 pos; pos(0) = position().x();
131  pos(1) = position().y(); pos(2) = position().z();
132  theWeightTimesPos = weight().matrix_new()*pos;
133  theWeightTimesPosAvailable = true;
134 }
135 
136 
Common base class.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
ROOT::Math::SVector< double, 3 > AlgebraicVector3
volatile std::atomic< bool > shutdown_flag false
int weight
Definition: histoStyle.py:50