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