Belle II Software  release-08-01-10
MeasurementOnPlane.h
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_MeasurementOnPlane_h
25 #define genfit_MeasurementOnPlane_h
26 
27 #include "MeasuredStateOnPlane.h"
28 #include "AbsHMatrix.h"
29 
30 #include <TMatrixD.h>
31 
32 #include <cmath>
33 #include <memory>
34 
35 
36 namespace genfit {
37 
47 
48  public:
49 
50  MeasurementOnPlane(const AbsTrackRep* rep = nullptr) :
51  MeasuredStateOnPlane(rep), hMatrix_(nullptr), weight_(0) {}
52  MeasurementOnPlane(const TVectorD& state, const TMatrixDSym& cov, SharedPlanePtr plane, const AbsTrackRep* rep, const AbsHMatrix* hMatrix, double weight = 1.) :
53  MeasuredStateOnPlane(state, cov, plane, rep), hMatrix_(hMatrix), weight_(weight) {}
54 
59  void swap(MeasurementOnPlane& other);
60 
61  virtual ~MeasurementOnPlane() {}
62 
63  const AbsHMatrix* getHMatrix() const {return hMatrix_.get();}
64  double getWeight() const {return weight_;}
65 
66  TMatrixDSym getWeightedCov() {return weight_*cov_;}
67 
68  void setHMatrix(const AbsHMatrix* hMatrix) {hMatrix_.reset(hMatrix);}
69  void setWeight(double weight) {weight_ = fmax(weight, 1.E-10);}
70 
71  void Print(Option_t* option = "") const override ;
72 
73  private:
74  TVector3 getPos() const;
75  TVector3 getMom() const;
76  TVector3 getDir() const;
77  void getPosMom(TVector3& pos, TVector3& mom) const;
78  void getPosDir(TVector3& pos, TVector3& dir) const;
79  TVectorD get6DState() const;
80  double getMomMag() const;
81  int getPDG() const;
82  double getCharge() const;
83  double getQop() const;
84  double getMass() const;
85  double getTime() const;
86 
87  void setPosMom(const TVector3& pos, const TVector3& mom);
88  void setPosMom(const TVectorD& state6);
89  void setChargeSign(double charge);
90  void setQop(double qop);
91  void setTime(double time);
92 
93 
94  protected:
95 
96  std::unique_ptr<const AbsHMatrix> hMatrix_; // Ownership
97  double weight_;
98 
99  public:
100  ClassDefOverride(MeasurementOnPlane,1)
101 
102 };
103 
104 } /* End of namespace */
107 #endif // _MeasurementOnPlane_h
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
Definition: AbsHMatrix.h:37
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
#StateOnPlane with additional covariance matrix.
Measured coordinates on a plane.
MeasurementOnPlane & operator=(MeasurementOnPlane other)
assignment operator
Defines for I/O streams used for error and debug printing.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.