SND@LHC Software
Loading...
Searching...
No Matches
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
33namespace 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
52
53 const TMatrixDSym& getCov() const {return cov_;}
54 TMatrixDSym& getCov() {return cov_;}
55
56 void blowUpCov(double blowUpFac, bool resetOffDiagonals = true);
57
58 void setStateCov(const TVectorD& state, const TMatrixDSym& cov) {setState(state); setCov(cov);}
59 void setStateCovPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane) {setStatePlane(state, plane); setCov(cov);}
60 void setCov(const TMatrixDSym& cov) {if(cov_.GetNrows() == 0) cov_.ResizeTo(cov); cov_ = cov;}
61
62 // Shortcuts to TrackRep functions
63 TMatrixDSym get6DCov() const {return getRep()->get6DCov(*this);};
64 void getPosMomCov(TVector3& pos, TVector3& mom, TMatrixDSym& cov) const {getRep()->getPosMomCov(*this, pos, mom, cov);}
65 void get6DStateCov(TVectorD& stateVec, TMatrixDSym& cov) const {getRep()->get6DStateCov(*this, stateVec, cov);}
66 double getMomVar() const {return getRep()->getMomVar(*this);}
67
68 void setPosMomErr(const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) {getRep()->setPosMomErr(*this, pos, mom, posErr, momErr);}
69 void setPosMomCov(const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) {getRep()->setPosMomCov(*this, pos, mom, cov6x6);}
70 void setPosMomCov(const TVectorD& state6, const TMatrixDSym& cov6x6) {getRep()->setPosMomCov(*this, state6, cov6x6);}
71
72
73 virtual void Print(Option_t* option = "") const;
74
75 protected:
76
77 TMatrixDSym cov_;
78
79 public:
80 ClassDef(MeasuredStateOnPlane,1)
81
82};
83
84
89
90
92 StateOnPlane::swap(other);
93 this->cov_.ResizeTo(other.cov_);
94 std::swap(this->cov_, other.cov_);
95}
96
98 StateOnPlane(rep), cov_(0,0)
99{
100 if (rep != NULL) {
101 cov_.ResizeTo(rep->getDim(), rep->getDim());
102 }
103}
104
105inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
106 StateOnPlane(state, plane, rep), cov_(cov)
107{
108 assert(rep != NULL);
109 //assert(cov_.GetNcols() == (signed)rep->getDim());
110}
111
112inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
113 StateOnPlane(state, plane, rep, auxInfo), cov_(cov)
114{
115 assert(rep != NULL);
116 //assert(cov_.GetNcols() == (signed)rep->getDim());
117}
118
120 StateOnPlane(o), cov_(o.cov_)
121{
122}
123
124inline MeasuredStateOnPlane::MeasuredStateOnPlane(const StateOnPlane& state, const TMatrixDSym& cov) :
125 StateOnPlane(state), cov_(cov)
126{
127 //assert(cov_.GetNcols() == (signed)getRep()->getDim());
128}
129
131 swap(other);
132 return *this;
133}
134
135
136} /* End of namespace genfit */
139#endif // genfit_MeasuredStateOnPlane_h
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
virtual double getMomVar(const MeasuredStateOnPlane &state) const =0
get the variance of the absolute value of the momentum .
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.
virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const =0
Set position, momentum and covariance of state.
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
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.
virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane &state) const =0
Get the 6D covariance.
virtual void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
StateOnPlane with additional covariance matrix.
void getPosMomCov(TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const
MeasuredStateOnPlane & operator=(MeasuredStateOnPlane other)
void setStateCovPlane(const TVectorD &state, const TMatrixDSym &cov, const SharedPlanePtr &plane)
void setPosMomCov(const TVectorD &state6, const TMatrixDSym &cov6x6)
void setPosMomErr(const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr)
void setPosMomCov(const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6)
void setCov(const TMatrixDSym &cov)
const TMatrixDSym & getCov() const
void setStateCov(const TVectorD &state, const TMatrixDSym &cov)
void swap(MeasuredStateOnPlane &other)
void get6DStateCov(TVectorD &stateVec, TMatrixDSym &cov) const
void blowUpCov(double blowUpFac, bool resetOffDiagonals=true)
virtual void Print(Option_t *option="") const
MeasuredStateOnPlane(const AbsTrackRep *rep=NULL)
A state with arbitrary dimension defined in a DetPlane.
void swap(StateOnPlane &other)
void setState(const TVectorD &state)
void setStatePlane(const TVectorD &state, const SharedPlanePtr &plane)
const AbsTrackRep * getRep() const
Matrix inversion tools.
Definition AbsBField.h:29
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane &forwardState, const MeasuredStateOnPlane &backwardState)
Calculate weighted average between two MeasuredStateOnPlanes.