GENFIT  Rev:NoNumberAvailable
MeasuredStateOnPlane.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
24 #ifndef genfit_MeasuredStateOnPlane_h
25 #define genfit_MeasuredStateOnPlane_h
26 
27 #include "StateOnPlane.h"
28 #include "AbsTrackRep.h"
29 
30 #include <TMatrixDSym.h>
31 
32 
33 namespace genfit {
34 
39 
40  public:
41 
42  MeasuredStateOnPlane(const AbsTrackRep* rep = NULL);
43  MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const genfit::SharedPlanePtr& plane, const AbsTrackRep* rep);
44  MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const genfit::SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
46  MeasuredStateOnPlane(const StateOnPlane& state, const TMatrixDSym& cov);
47 
49  void swap(MeasuredStateOnPlane& other); // nothrow
50 
51  virtual ~MeasuredStateOnPlane() {}
52  virtual MeasuredStateOnPlane* clone() const {return new MeasuredStateOnPlane(*this);}
53 
54 
55  const TMatrixDSym& getCov() const {return cov_;}
56  TMatrixDSym& getCov() {return cov_;}
57 
59  void blowUpCov(double blowUpFac, bool resetOffDiagonals = true, double maxVal = -1.);
60 
61  void setStateCov(const TVectorD& state, const TMatrixDSym& cov) {setState(state); setCov(cov);}
62  void setStateCovPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane) {setStatePlane(state, plane); setCov(cov);}
63  void setCov(const TMatrixDSym& cov) {if(cov_.GetNrows() == 0) cov_.ResizeTo(cov); cov_ = cov;}
64 
65  // Shortcuts to TrackRep functions
66  TMatrixDSym get6DCov() const {return getRep()->get6DCov(*this);};
67  void getPosMomCov(TVector3& pos, TVector3& mom, TMatrixDSym& cov) const {getRep()->getPosMomCov(*this, pos, mom, cov);}
68  void get6DStateCov(TVectorD& stateVec, TMatrixDSym& cov) const {getRep()->get6DStateCov(*this, stateVec, cov);}
69  double getMomVar() const {return getRep()->getMomVar(*this);}
70 
71  void setPosMomErr(const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) {getRep()->setPosMomErr(*this, pos, mom, posErr, momErr);}
72  void setPosMomCov(const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) {getRep()->setPosMomCov(*this, pos, mom, cov6x6);}
73  void setPosMomCov(const TVectorD& state6, const TMatrixDSym& cov6x6) {getRep()->setPosMomCov(*this, state6, cov6x6);}
74 
75 
76  virtual void Print(Option_t* option = "") const;
77 
78  protected:
79 
80  TMatrixDSym cov_;
81 
82  public:
83  ClassDef(MeasuredStateOnPlane,1)
84 
85 };
86 
87 
91 MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane& forwardState, const MeasuredStateOnPlane& backwardState);
92 
93 
95  StateOnPlane::swap(other);
96  this->cov_.ResizeTo(other.cov_);
97  std::swap(this->cov_, other.cov_);
98 }
99 
101  StateOnPlane(rep), cov_(0,0)
102 {
103  if (rep != NULL) {
104  cov_.ResizeTo(rep->getDim(), rep->getDim());
105  }
106 }
107 
108 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
109  StateOnPlane(state, plane, rep), cov_(cov)
110 {
111  assert(rep != NULL);
112  //assert(cov_.GetNcols() == (signed)rep->getDim());
113 }
114 
115 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
116  StateOnPlane(state, plane, rep, auxInfo), cov_(cov)
117 {
118  assert(rep != NULL);
119  //assert(cov_.GetNcols() == (signed)rep->getDim());
120 }
121 
123  StateOnPlane(o), cov_(o.cov_)
124 {
125 }
126 
127 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const StateOnPlane& state, const TMatrixDSym& cov) :
128  StateOnPlane(state), cov_(cov)
129 {
130  //assert(cov_.GetNcols() == (signed)getRep()->getDim());
131 }
132 
134  swap(other);
135  return *this;
136 }
137 
138 
139 } /* End of namespace genfit */
142 #endif // genfit_MeasuredStateOnPlane_h
genfit::MeasuredStateOnPlane::getPosMomCov
void getPosMomCov(TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const
Definition: MeasuredStateOnPlane.h:67
genfit::StateOnPlane::setState
void setState(const TVectorD &state)
Definition: StateOnPlane.h:68
genfit::AbsTrackRep::getPosMomCov
virtual void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
genfit::SharedPlanePtr
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Definition: SharedPlanePtr.h:43
genfit::MeasuredStateOnPlane::~MeasuredStateOnPlane
virtual ~MeasuredStateOnPlane()
Definition: MeasuredStateOnPlane.h:51
genfit::AbsTrackRep::setPosMomErr
virtual void setPosMomErr(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const =0
Set position and momentum and error of state.
genfit::MeasuredStateOnPlane::swap
void swap(MeasuredStateOnPlane &other)
Definition: MeasuredStateOnPlane.h:94
genfit::MeasuredStateOnPlane::getCov
const TMatrixDSym & getCov() const
Definition: MeasuredStateOnPlane.h:55
genfit::MeasuredStateOnPlane::setStateCov
void setStateCov(const TVectorD &state, const TMatrixDSym &cov)
Definition: MeasuredStateOnPlane.h:61
genfit::MeasuredStateOnPlane
StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:38
genfit::MeasuredStateOnPlane::Print
virtual void Print(Option_t *option="") const
Definition: MeasuredStateOnPlane.cc:32
genfit::MeasuredStateOnPlane::setStateCovPlane
void setStateCovPlane(const TVectorD &state, const TMatrixDSym &cov, const SharedPlanePtr &plane)
Definition: MeasuredStateOnPlane.h:62
AbsTrackRep.h
genfit
Defines for I/O streams used for error and debug printing.
Definition: AbsFinitePlane.cc:22
genfit::AbsTrackRep::setPosMomCov
virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const =0
Set position, momentum and covariance of state.
genfit::MeasuredStateOnPlane::setPosMomCov
void setPosMomCov(const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6)
Definition: MeasuredStateOnPlane.h:72
genfit::MeasuredStateOnPlane::operator=
MeasuredStateOnPlane & operator=(MeasuredStateOnPlane other)
Definition: MeasuredStateOnPlane.h:133
genfit::AbsTrackRep
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
genfit::MeasuredStateOnPlane::get6DCov
TMatrixDSym get6DCov() const
Definition: MeasuredStateOnPlane.h:66
StateOnPlane.h
genfit::MeasuredStateOnPlane::getMomVar
double getMomVar() const
Definition: MeasuredStateOnPlane.h:69
genfit::MeasuredStateOnPlane::MeasuredStateOnPlane
MeasuredStateOnPlane(const AbsTrackRep *rep=NULL)
Definition: MeasuredStateOnPlane.h:100
genfit::MeasuredStateOnPlane::setPosMomCov
void setPosMomCov(const TVectorD &state6, const TMatrixDSym &cov6x6)
Definition: MeasuredStateOnPlane.h:73
genfit::StateOnPlane
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:45
genfit::MeasuredStateOnPlane::get6DStateCov
void get6DStateCov(TVectorD &stateVec, TMatrixDSym &cov) const
Definition: MeasuredStateOnPlane.h:68
genfit::AbsTrackRep::get6DCov
virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane &state) const =0
Get the 6D covariance.
genfit::MeasuredStateOnPlane::blowUpCov
void blowUpCov(double blowUpFac, bool resetOffDiagonals=true, double maxVal=-1.)
Blow up covariance matrix with blowUpFac. Per default, off diagonals are reset to 0 and the maximum v...
Definition: MeasuredStateOnPlane.cc:48
genfit::AbsTrackRep::getMomVar
virtual double getMomVar(const MeasuredStateOnPlane &state) const =0
get the variance of the absolute value of the momentum .
genfit::MeasuredStateOnPlane::setCov
void setCov(const TMatrixDSym &cov)
Definition: MeasuredStateOnPlane.h:63
genfit::MeasuredStateOnPlane::clone
virtual MeasuredStateOnPlane * clone() const
Definition: MeasuredStateOnPlane.h:52
genfit::MeasuredStateOnPlane::cov_
TMatrixDSym cov_
Definition: MeasuredStateOnPlane.h:80
genfit::calcAverageState
MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane &forwardState, const MeasuredStateOnPlane &backwardState)
Calculate weighted average between two MeasuredStateOnPlanes.
Definition: MeasuredStateOnPlane.cc:76
genfit::StateOnPlane::swap
void swap(StateOnPlane &other)
Definition: StateOnPlane.h:180
genfit::AbsTrackRep::getDim
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
genfit::MeasuredStateOnPlane::setPosMomErr
void setPosMomErr(const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr)
Definition: MeasuredStateOnPlane.h:71
genfit::MeasuredStateOnPlane::getCov
TMatrixDSym & getCov()
Definition: MeasuredStateOnPlane.h:56
genfit::StateOnPlane::setStatePlane
void setStatePlane(const TVectorD &state, const SharedPlanePtr &plane)
Definition: StateOnPlane.h:70
genfit::AbsTrackRep::get6DStateCov
virtual void get6DStateCov(const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const
Translates MeasuredStateOnPlane into 6D state vector (x, y, z, p_x, p_y, p_z) and 6x6 covariance.
Definition: AbsTrackRep.cc:77
genfit::StateOnPlane::getRep
const AbsTrackRep * getRep() const
Definition: StateOnPlane.h:66