Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:59

0001 /*!
0002  *  \file       SpacepointMeasurement.cc
0003  *  \brief      Handles the palnar type of measurements.
0004  *  \author     Haiwang Yu <yuhw@nmsu.edu>
0005  */
0006 
0007 #include "SpacepointMeasurement.h"
0008 
0009 #include <GenFit/SpacepointMeasurement.h>
0010 
0011 #include <TMatrixDSymfwd.h>  // for TMatrixDSym
0012 #include <TMatrixTSym.h>
0013 #include <TVector3.h>
0014 #include <TVectorDfwd.h>
0015 #include <TVectorT.h>
0016 
0017 namespace PHGenFit
0018 {
0019   void SpacepointMeasurement::init(const TVector3& pos, const TMatrixDSym& cov)
0020   {
0021     int nDim = 3;
0022     TVectorD hitCoords(nDim);
0023     TMatrixDSym hitCov(nDim);
0024 
0025     hitCoords(0) = pos.X();
0026     hitCoords(1) = pos.Y();
0027     hitCoords(2) = pos.Z();
0028 
0029     for (int i = 0; i < 3; i++)
0030     {
0031       for (int j = 0; j < 3; j++)
0032       {
0033         hitCov(i, j) = cov(i, j);
0034       }
0035     }
0036 
0037     int measurementCounter_ = 0;
0038     _measurement = new genfit::SpacepointMeasurement(hitCoords, hitCov, -1,
0039                                                      measurementCounter_,
0040                                                      nullptr);
0041   }
0042 
0043   SpacepointMeasurement::SpacepointMeasurement(const TVector3& pos, const double resolution)
0044   {
0045     TMatrixDSym cov(3);
0046     cov.Zero();
0047     cov(0, 0) = resolution * resolution;
0048     cov(1, 1) = resolution * resolution;
0049     cov(2, 2) = resolution * resolution;
0050     init(pos, cov);
0051   }
0052 
0053   SpacepointMeasurement::SpacepointMeasurement(const TVector3& pos, const TVector3& resolution)
0054   {
0055     TMatrixDSym cov(3);
0056     cov.Zero();
0057     cov(0, 0) = resolution.X() * resolution.X();
0058     cov(1, 1) = resolution.Y() * resolution.Y();
0059     cov(2, 2) = resolution.Z() * resolution.Z();
0060     init(pos, cov);
0061   }
0062 
0063   /*!
0064    * Ctor
0065    * \param pos measurement position
0066    * \param covariance matrix
0067    */
0068   SpacepointMeasurement::SpacepointMeasurement(const TVector3& pos, const TMatrixDSym& cov)
0069   {
0070     init(pos, cov);
0071   }
0072 
0073 }  // namespace PHGenFit