PandaRoot
State.h
Go to the documentation of this file.
1 // ******************************************************
2 // DecayTreeFitter Package
3 // We thank the original author Wouter Hulsbergen
4 // (BaBar, LHCb) for providing the sources.
5 // http://arxiv.org/abs/physics/0503191v1 (2005)
6 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
7 // ******************************************************
8 //
9 // State.h
10 // TreeFitter
11 //
12 // Created by Ralf Kliemt on 13/02/15.
13 // Copyright (c) 2015 Ralf Kliemt. All rights reserved.
14 //
15 
16 #ifndef DECAYTREEFITTER_State_h
17 #define DECAYTREEFITTER_State_h 1
18 
19 // **************************************************************************
20 // * *
21 // * ! ! ! A T T E N T I O N ! ! ! *
22 // * *
23 // * This file was created automatically by GaudiObjDesc, please do not *
24 // * delete it or edit it by hand. *
25 // * *
26 // * If you want to change this file, first change the corresponding *
27 // * xml-file and rerun the tools from GaudiObjDesc (or run make if you *
28 // * are using it from inside a Gaudi-package). *
29 // * *
30 // **************************************************************************
31 
32 // Include files
33 #include <cmath>
34 #include <vector>
35 #include <ostream>
36 //#include "StateVector.h"
37 #include "Rtypes.h"
38 #include "TVector3.h"
39 #include "TVectorD.h"
40 #include "TMatrixD.h"
41 #include "TMatrixDSym.h"
42 
43 // Forward declarations
44 
45 namespace DecayTreeFitter {
46 
47 class State {
48  public:
49  typedef std::vector<State *> Vector;
50  typedef std::vector<const State *> ConstVector;
51 
53 
54  // State(const DecayTreeFitter::StateVector& stateVec) : m_flags(0),
55  // m_stateVector(stateVec.parameters()),
56  // m_covariance() {};
57 
58  virtual ~State(){};
59 
60  inline unsigned int nParameters() const { return (unsigned int)m_stateVector.GetNrows(); };
61 
62  // void positionAndMomentum(TVector3& pos,
63  // TVector3& mom,
64  // TMatrixD& cov6D) const {
65  // pos = position();
66  // mom = momentum();
67  // cov6D = posMomCovariance();
68  // };
69 
70  // void positionAndMomentum(TVector3& pos,
71  // TVector3& mom) const {
72  // pos = position();
73  // mom = momentum();
74  // };
75 
76  inline TVector3 position() const { return TVector3(m_stateVector[0], m_stateVector[1], m_stateVector[2]); };
77 
78  inline double x() const { return m_stateVector[0]; };
79  inline double y() const { return m_stateVector[1]; };
80  inline double z() const { return m_z; };
81 
82  inline TVector3 slopes() const { return TVector3(m_stateVector[2], m_stateVector[3], 1.); };
83 
84  inline double tx() const { return m_stateVector[2]; };
85  inline double ty() const { return m_stateVector[3]; };
86 
87  inline double qOverP() const { return m_stateVector[4]; };
88  // inline virtual double p() const;
89  // inline virtual double pt() const;
90 
91  // TVector3 momentum() const {
92  // TVector3 mom = slopes();
93  // mom *= ( p() / mom.Mag() );
94  // return mom;
95  // };
96 
97  // double qOverPperp() const {
98  // const double tx2 = tx() * tx();
99  // return ( qOverP() * sqrt( (1.+ tx2 + ty()*ty()) / (1. + tx2 ) ) );
100  // };
101 
102  // inline virtual TMatrixD posMomCovariance() const;
103 
104  // TMatrixD errPosition() const;
105 
106  inline double errX2() const { return m_covariance(0, 0); };
107 
108  inline double errY2() const { return m_covariance(1, 1); };
109 
110  // inline double errZ2() const {return 0.;};
111 
112  // TMatrixD errSlopes() const;
113 
114  inline double errTx2() const { return m_covariance(2, 2); };
115 
116  inline double errTy2() const { return m_covariance(3, 3); };
117 
118  inline double errQOverP2() const { return m_covariance(4, 4); };
119  // inline virtual double errP2() const;
120  // inline virtual TMatrixD errMomentum() const;
121  // inline virtual double errQOverPperp2() const;
122  // inline virtual State* clone() const;
123 
124  // void setState(const DecayTreeFitter::StateVector& state) {
125  // m_stateVector = state.parameters() ;
126  //};
127 
128  inline void setState(const TVectorD &state) { m_stateVector = state; };
129 
130  inline void setState(double _x, double _y, double _z, double _tx, double _ty, double _qOverP)
131  {
132  m_stateVector[0] = _x;
133  m_stateVector[1] = _y;
134  m_z = _z;
135  m_stateVector[2] = _tx;
136  m_stateVector[3] = _ty;
137  m_stateVector[4] = _qOverP;
138  };
139 
140  inline void setCovariance(const TMatrixDSym &value) { m_covariance = value; };
141 
142  inline void setX(double value) { m_stateVector[0] = value; };
143  inline void setY(double value) { m_stateVector[1] = value; };
144  inline void setZ(double value) { m_z = value; };
145  inline void setTx(double value) { m_stateVector[2] = value; };
146  inline void setTy(double value) { m_stateVector[3] = value; };
147  inline void setQOverP(double value) { m_stateVector[4] = value; };
148 
149  // inline virtual void setErrQOverP2(double value) {};
150  // inline void linearTransportTo(double az) {};
151 
152  inline virtual std::ostream &fillStream(std::ostream &os) const
153  {
154  os << "DecayTreeFitter::State::fillStream() not implemented";
155  return os;
156  };
157 
158  inline unsigned int flags() const { return m_flags; };
159  inline void setFlags(unsigned int value) { m_flags = value; };
160 
161  inline const TVectorD &stateVector() const { return m_stateVector; };
162  inline TVectorD &stateVector() { return m_stateVector; };
163 
164  inline const TMatrixDSym &covariance() const { return m_covariance; };
165  inline TMatrixDSym &covariance() { return m_covariance; };
166 
167  protected:
168  unsigned int m_flags;
169  double m_z;
170  TVectorD m_stateVector;
171  TMatrixDSym m_covariance;
172 
173  private:
174  ClassDef(State, 1)
175 }; // class State
176 
177 inline std::ostream &operator<<(std::ostream &str, const State &obj)
178 {
179  return obj.fillStream(str);
180 }
181 
182 } // namespace DecayTreeFitter
183 
184 // -----------------------------------------------------------------------------
185 // end of class
186 // -----------------------------------------------------------------------------
187 
188 // inline DecayTreeFitter::State::State(const DecayTreeFitter::StateVector& stateVec,
189 // const TMatrixDSym& cov,
190 // double z) : m_flags(0),
191 // m_stateVector(stateVec),
192 // m_covariance(cov),
193 // m_z(z)
194 //{
195 //
196 //}
197 //
198 // inline DecayTreeFitter::State::State(const DecayTreeFitter::StateVector& stateVec,
199 // double z) : m_flags(0),
200 // m_stateVector(stateVec),
201 // m_covariance(),
202 // m_z(z)
203 //{
204 //
205 //
206 //}
207 
208 #endif
double y() const
Definition: State.h:79
double qOverP() const
Definition: State.h:87
std::vector< const State * > ConstVector
Definition: State.h:50
void setState(double _x, double _y, double _z, double _tx, double _ty, double _qOverP)
Definition: State.h:130
const TVectorD & stateVector() const
Definition: State.h:161
double ty() const
Definition: State.h:85
double tx() const
Definition: State.h:84
TVectorD m_stateVector
Definition: State.h:170
void setTx(double value)
Definition: State.h:145
virtual ~State()
Definition: State.h:58
unsigned int flags() const
Definition: State.h:158
std::ostream & operator<<(std::ostream &os, const Line &rhs)
Definition: LineTool.h:51
double errTx2() const
Definition: State.h:114
unsigned int nParameters() const
Definition: State.h:60
void setFlags(unsigned int value)
Definition: State.h:159
std::vector< State * > Vector
Definition: State.h:49
TMatrixDSym m_covariance
Definition: State.h:171
double errTy2() const
Definition: State.h:116
unsigned int m_flags
Definition: State.h:165
TVector3 position() const
Definition: State.h:76
virtual std::ostream & fillStream(std::ostream &os) const
Definition: State.h:152
void setY(double value)
Definition: State.h:143
double errQOverP2() const
Definition: State.h:118
void setCovariance(const TMatrixDSym &value)
Definition: State.h:140
double z() const
Definition: State.h:80
void setZ(double value)
Definition: State.h:144
double x() const
Definition: State.h:78
double errX2() const
Definition: State.h:106
TVector3 slopes() const
Definition: State.h:82
void setX(double value)
Definition: State.h:142
TVectorD & stateVector()
Definition: State.h:162
void setQOverP(double value)
Definition: State.h:147
void setTy(double value)
Definition: State.h:146
double errY2() const
Definition: State.h:108
const TMatrixDSym & covariance() const
Definition: State.h:164
void setState(const TVectorD &state)
Definition: State.h:128