EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GFSpacepointHitPolicy.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GFSpacepointHitPolicy.cxx
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
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 #include "GFSpacepointHitPolicy.h"
20 
21 #include "assert.h"
22 
23 #include "TMath.h"
24 
25 #include "GFAbsRecoHit.h"
26 
27 const std::string GFSpacepointHitPolicy::fPolicyName = "GFSpacepointHitPolicy";
28 
29 TMatrixT<double>
31 {
32  TMatrixT<double> returnMat(2,1);
33 
34  TMatrixT<double> _D(3,1);
35  TVector3 _U;
36  TVector3 _V;
37 
38  _D[0][0] = (plane.getO())[0];
39  _D[1][0] = (plane.getO())[1];
40  _D[2][0] = (plane.getO())[2];
41 
42  _D *= -1.;
43  _D += hit->getRawHitCoord();
44  //now the vector _D points from the origin of the plane to the hit point
45 
46 
47  _U = plane.getU();
48  _V = plane.getV();
49 
50 
51  returnMat[0][0] = _D[0][0] * _U[0] + _D[1][0] * _U[1] + _D[2][0] * _U[2];
52  returnMat[1][0] = _D[0][0] * _V[0] + _D[1][0] * _V[1] + _D[2][0] * _V[2];
53  //std::cout << "hitCoord="<<std::endl;
54  //returnMat.Print();
55  return returnMat;
56 }
57 
58 TMatrixT<double>
60 {
61  TVector3 _U;
62  TVector3 _V;
63 
64  _U = plane.getU();
65  _V = plane.getV();
66 
67  TMatrixT<double> rawCov = hit->getRawHitCov();
68 
69  TMatrixT<double> jac(3,2);
70 
71  // jac = dF_i/dx_j = s_unitvec * t_untivec, with s=u,v and t=x,y,z
72  jac[0][0] = _U[0];
73  jac[1][0] = _U[1];
74  jac[2][0] = _U[2];
75  jac[0][1] = _V[0];
76  jac[1][1] = _V[1];
77  jac[2][1] = _V[2];
78 
79  TMatrixT<double> jac_orig = jac;
80  TMatrixT<double> jac_t = jac.T();
81 
82  TMatrixT<double> result=jac_t * (rawCov * jac_orig);
83  //std::cout << "hitCov="<<std::endl;
84  //result.Print();
85  return result;
86 }
87 
88 const GFDetPlane&
90 {
91  TMatrixT<double> rawcoord = hit->getRawHitCoord();
92  TVector3 point(rawcoord[0][0],rawcoord[1][0],rawcoord[2][0]);
93 
94  TVector3 poca,dirInPoca;
95  rep->extrapolateToPoint(point,poca,dirInPoca);
96 
97  fPlane.setO(point);
98  fPlane.setNormal(dirInPoca);
99 
100  return fPlane;
101 }
102