Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:21

0001 /* Copyright 2008-2010, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 /** @addtogroup genfit
0021  * @{
0022  */
0023 
0024 #ifndef genfit_MeasurementOnPlane_h
0025 #define genfit_MeasurementOnPlane_h
0026 
0027 #include "MeasuredStateOnPlane.h"
0028 #include "AbsHMatrix.h"
0029 
0030 #include <TMatrixD.h>
0031 
0032 #include <cmath>
0033 #include <memory>
0034 
0035 
0036 namespace genfit {
0037 
0038 /**
0039  * @brief Measured coordinates on a plane.
0040  *
0041  * The dimensionality will usually be 1 or 2.
0042  * The HMatrix corresponds to a projection matrix, which is used to
0043  * project the track parameters with the original dimensionality down
0044  * to the measured dimensionality.
0045  */
0046 class MeasurementOnPlane : public MeasuredStateOnPlane {
0047 
0048  public:
0049 
0050   MeasurementOnPlane(const AbsTrackRep* rep = nullptr) :
0051     MeasuredStateOnPlane(rep), hMatrix_(nullptr), weight_(0) {}
0052   MeasurementOnPlane(const TVectorD& state, const TMatrixDSym& cov, SharedPlanePtr plane, const AbsTrackRep* rep, const AbsHMatrix* hMatrix, double weight = 1.) :
0053     MeasuredStateOnPlane(state, cov, plane, rep), hMatrix_(hMatrix), weight_(weight) {}
0054 
0055   //! copy constructor
0056   MeasurementOnPlane(const MeasurementOnPlane& other);
0057   //! assignment operator
0058   MeasurementOnPlane& operator=(MeasurementOnPlane other);
0059   void swap(MeasurementOnPlane& other);
0060 
0061   virtual ~MeasurementOnPlane() {}
0062 
0063   const AbsHMatrix* getHMatrix() const {return hMatrix_.get();}
0064   double getWeight() const {return weight_;}
0065 
0066   TMatrixDSym getWeightedCov() {return weight_*cov_;}
0067 
0068   void setHMatrix(const AbsHMatrix* hMatrix) {hMatrix_.reset(hMatrix);}
0069   void setWeight(double weight) {weight_ = fmax(weight, 1.E-10);}
0070 
0071   void Print(Option_t* option = "") const override ;
0072 
0073  private:
0074   TVector3 getPos() const;
0075   TVector3 getMom() const;
0076   TVector3 getDir() const;
0077   void getPosMom(TVector3& pos, TVector3& mom) const;
0078   void getPosDir(TVector3& pos, TVector3& dir) const;
0079   TVectorD get6DState() const;
0080   double getMomMag() const;
0081   int getPDG() const;
0082   double getCharge() const;
0083   double getQop() const;
0084   double getMass() const;
0085   double getTime() const;
0086 
0087   void setPosMom(const TVector3& pos, const TVector3& mom);
0088   void setPosMom(const TVectorD& state6);
0089   void setChargeSign(double charge);
0090   void setQop(double qop);
0091   void setTime(double time);
0092 
0093 
0094  protected:
0095 
0096   std::unique_ptr<const AbsHMatrix> hMatrix_; // Ownership
0097   double weight_;
0098 
0099  public:
0100   ClassDefOverride(MeasurementOnPlane,1)
0101 
0102 };
0103 
0104 } /* End of namespace   */
0105 /** @} */
0106 
0107 #endif //  _MeasurementOnPlane_h