FairRoot/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 
48  class State
49  {
50  public:
51 
52  typedef std::vector<State*> Vector;
53  typedef std::vector<const State*> ConstVector;
54 
55  State(): m_flags(0),
56  m_stateVector(5),
57  m_covariance(5)
58  {};
59 
60  //State(const DecayTreeFitter::StateVector& stateVec) : m_flags(0),
61  //m_stateVector(stateVec.parameters()),
62  //m_covariance() {};
63 
64  virtual ~State() {};
65 
66  inline unsigned int nParameters() const { return (unsigned int) m_stateVector.GetNrows(); };
67 
68  // void positionAndMomentum(TVector3& pos,
69  // TVector3& mom,
70  // TMatrixD& cov6D) const {
71  // pos = position();
72  // mom = momentum();
73  // cov6D = posMomCovariance();
74  // };
75 
76  // void positionAndMomentum(TVector3& pos,
77  // TVector3& mom) const {
78  // pos = position();
79  // mom = momentum();
80  // };
81 
82  inline TVector3 position() const { return TVector3( m_stateVector[0], m_stateVector[1], m_stateVector[2]); };
83 
84  inline double x() const {return m_stateVector[0];};
85  inline double y() const {return m_stateVector[1];};
86  inline double z() const {return m_z;};
87 
88  inline TVector3 slopes() const {return TVector3( m_stateVector[2], m_stateVector[3], 1.);};
89 
90  inline double tx() const {return m_stateVector[2];};
91  inline double ty() const {return m_stateVector[3];};
92 
93  inline double qOverP() const {return m_stateVector[4];};
94  // inline virtual double p() const;
95  // inline virtual double pt() const;
96 
97  // TVector3 momentum() const {
98  // TVector3 mom = slopes();
99  // mom *= ( p() / mom.Mag() );
100  // return mom;
101  // };
102 
103  // double qOverPperp() const {
104  // const double tx2 = tx() * tx();
105  // return ( qOverP() * sqrt( (1.+ tx2 + ty()*ty()) / (1. + tx2 ) ) );
106  // };
107 
108  // inline virtual TMatrixD posMomCovariance() const;
109 
110  // TMatrixD errPosition() const;
111 
112  inline double errX2() const {return m_covariance(0,0);};
113 
114  inline double errY2() const {return m_covariance(1,1);};
115 
116  //inline double errZ2() const {return 0.;};
117 
118  // TMatrixD errSlopes() const;
119 
120  inline double errTx2() const {return m_covariance(2,2);};
121 
122  inline double errTy2() const {return m_covariance(3,3);};
123 
124  inline double errQOverP2() const {return m_covariance(4,4);};
125  // inline virtual double errP2() const;
126  // inline virtual TMatrixD errMomentum() const;
127  // inline virtual double errQOverPperp2() const;
128  // inline virtual State* clone() const;
129 
130  //void setState(const DecayTreeFitter::StateVector& state) {
131  // m_stateVector = state.parameters() ;
132  //};
133 
134  inline void setState(const TVectorD& state) {m_stateVector = state;};
135 
136  inline void setState(double _x, double _y, double _z, double _tx, double _ty, double _qOverP)
137  { m_stateVector[0] = _x; m_stateVector[1] = _y; m_z = _z; m_stateVector[2] = _tx; m_stateVector[3] = _ty; m_stateVector[4] = _qOverP; };
138 
139  inline void setCovariance(const TMatrixDSym& value) {m_covariance = value;};
140 
141  inline void setX(double value) {m_stateVector[0] = value;};
142  inline void setY(double value) {m_stateVector[1] = value;};
143  inline void setZ(double value) {m_z = value;};
144  inline void setTx(double value) {m_stateVector[2] = value;};
145  inline void setTy(double value) {m_stateVector[3] = value;};
146  inline void setQOverP(double value) {m_stateVector[4] = value;};
147 
148  //inline virtual void setErrQOverP2(double value) {};
149  //inline void linearTransportTo(double az) {};
150 
151  inline virtual std::ostream& fillStream(std::ostream& os) const {os<<"DecayTreeFitter::State::fillStream() not implemented";return os;};
152 
153  inline unsigned int flags() const { return m_flags;};
154  inline void setFlags(unsigned int value) { m_flags = value;};
155 
156  inline const TVectorD& stateVector() const { return m_stateVector;};
157  inline TVectorD& stateVector() { return m_stateVector;};
158 
159  inline const TMatrixDSym& covariance() const { return m_covariance;};
160  inline TMatrixDSym& covariance() { return m_covariance;};
161 
162  protected:
163 
164  unsigned int m_flags;
165  double m_z;
166  TVectorD m_stateVector;
167  TMatrixDSym m_covariance;
168 
169  private:
170 
171  ClassDef ( State,1 )
172  }; // class State
173 
175  {
176  return obj.fillStream(str);
177  }
178 
179 } // namespace
180 
181 // -----------------------------------------------------------------------------
182 // end of class
183 // -----------------------------------------------------------------------------
184 
185 
186 //inline DecayTreeFitter::State::State(const DecayTreeFitter::StateVector& stateVec,
187 // const TMatrixDSym& cov,
188 // double z) : m_flags(0),
189 //m_stateVector(stateVec),
190 //m_covariance(cov),
191 //m_z(z)
192 //{
193 //
194 //}
195 //
196 //inline DecayTreeFitter::State::State(const DecayTreeFitter::StateVector& stateVec,
197 // double z) : m_flags(0),
198 //m_stateVector(stateVec),
199 //m_covariance(),
200 //m_z(z)
201 //{
202 //
203 //
204 //}
205 
206 
207 
208 
209 
210 
211 
212 
213 #endif
const TMatrixDSym & covariance() const
Definition: State.h:159
double errX2() const
Definition: State.h:112
std::vector< State * > Vector
Definition: State.h:52
double errQOverP2() const
Definition: State.h:124
TVector3 position() const
Definition: State.h:82
void setState(double _x, double _y, double _z, double _tx, double _ty, double _qOverP)
Definition: State.h:136
double z() const
Definition: State.h:86
double y() const
Definition: State.h:85
unsigned int flags() const
Definition: State.h:153
TVectorD m_stateVector
Definition: State.h:166
void setTx(double value)
Definition: State.h:144
virtual ~State()
Definition: State.h:64
double errY2() const
Definition: State.h:114
std::ostream & operator<<(std::ostream &os, const Line &rhs)
Definition: LineTool.h:58
void setFlags(unsigned int value)
Definition: State.h:154
TMatrixDSym m_covariance
Definition: State.h:167
virtual std::ostream & fillStream(std::ostream &os) const
Definition: State.h:151
unsigned int m_flags
Definition: State.h:160
double errTy2() const
Definition: State.h:122
void setY(double value)
Definition: State.h:142
double errTx2() const
Definition: State.h:120
unsigned int nParameters() const
Definition: State.h:66
void setCovariance(const TMatrixDSym &value)
Definition: State.h:139
void setZ(double value)
Definition: State.h:143
double ty() const
Definition: State.h:91
double tx() const
Definition: State.h:90
void setX(double value)
Definition: State.h:141
std::vector< const State * > ConstVector
Definition: State.h:53
TVectorD & stateVector()
Definition: State.h:157
void setQOverP(double value)
Definition: State.h:146
void setTy(double value)
Definition: State.h:145
double x() const
Definition: State.h:84
PndAnaPidSelector *& obj
const TVectorD & stateVector() const
Definition: State.h:156
double qOverP() const
Definition: State.h:93
TVector3 slopes() const
Definition: State.h:88
void setState(const TVectorD &state)
Definition: State.h:134