SND@LHC Software
Loading...
Searching...
No Matches
SpacepointMeasurement.cc
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
21
22#include <Exception.h>
23#include <RKTrackRep.h>
24#include <Tools.h>
25#include <HMatrixUV.h>
26
27#include <cassert>
28#include <TBuffer.h>
29
30
31namespace genfit {
32
34 : AbsMeasurement(nDim), weightedPlaneContruction_(true), G_(3), cutCov_(true)
35{
36 assert(nDim >= 3);
37
38 //this->initG();
39}
40
41SpacepointMeasurement::SpacepointMeasurement(const TVectorD& rawHitCoords, const TMatrixDSym& rawHitCov, int detId, int hitId, TrackPoint* trackPoint,
42 bool weightedPlaneContruction, bool cutCov)
43 : AbsMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint),
44 weightedPlaneContruction_(weightedPlaneContruction), cutCov_(cutCov)
45{
46 assert(rawHitCoords_.GetNrows() >= 3);
47
49 this->initG();
50}
51
52
54
55 // copy state. Neglect covariance.
56 StateOnPlane st(state);
57
58 const TVector3 point(rawHitCoords_(0), rawHitCoords_(1), rawHitCoords_(2));
59
61 st.extrapolateToPoint(point, G_);
62 else
63 st.extrapolateToPoint(point);
64
65 return st.getPlane();
66}
67
68
69std::vector<MeasurementOnPlane*> SpacepointMeasurement::constructMeasurementsOnPlane(const StateOnPlane& state) const
70{
71 MeasurementOnPlane* mop = new MeasurementOnPlane(TVectorD(2),
72 TMatrixDSym(3), // will be resized to 2x2 by Similarity later
73 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
74
75 TVectorD& m = mop->getState();
76 TMatrixDSym& V = mop->getCov();
77
78 const TVector3& o(state.getPlane()->getO());
79 const TVector3& u(state.getPlane()->getU());
80 const TVector3& v(state.getPlane()->getV());
81
82 // m
83 m(0) = (rawHitCoords_(0)-o.X()) * u.X() +
84 (rawHitCoords_(1)-o.Y()) * u.Y() +
85 (rawHitCoords_(2)-o.Z()) * u.Z();
86
87 m(1) = (rawHitCoords_(0)-o.X()) * v.X() +
88 (rawHitCoords_(1)-o.Y()) * v.Y() +
89 (rawHitCoords_(2)-o.Z()) * v.Z();
90
91 //
92 // V
93 //
94 V = rawHitCov_;
95
96 // jac = dF_i/dx_j = s_unitvec * t_untivec, with s=u,v and t=x,y,z
97 TMatrixD jac(3,2);
98 jac(0,0) = u.X();
99 jac(1,0) = u.Y();
100 jac(2,0) = u.Z();
101 jac(0,1) = v.X();
102 jac(1,1) = v.Y();
103 jac(2,1) = v.Z();
104
105 if (cutCov_) { // cut (default)
107 V.SimilarityT(jac);
109 }
110 else { // projection
111 V.SimilarityT(jac);
112 }
113
114 std::vector<MeasurementOnPlane*> retVal;
115 retVal.push_back(mop);
116 return retVal;
117}
118
119
121 if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
122 Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
123 throw exc;
124 }
125
126 return new HMatrixUV();
127}
128
129
131 rawHitCov_.GetSub(0, 2, G_);
133}
134
135
136// Modified from auto-generated Streamer to account for non-persistent G_
137void SpacepointMeasurement::Streamer(TBuffer &R__b)
138{
139 // Stream an object of class genfit::SpacepointMeasurement.
140
141 if (R__b.IsReading()) {
142 R__b.ReadClassBuffer(genfit::SpacepointMeasurement::Class(),this);
143
145 this->initG();
146 } else {
147 R__b.WriteClassBuffer(genfit::SpacepointMeasurement::Class(),this);
148 }
149}
150
151
152} /* End of namespace genfit */
Double_t m
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
Definition AbsHMatrix.h:37
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition Exception.h:48
AbsHMatrix implementation for two-dimensional MeasurementOnPlane and RKTrackRep parameterization.
Definition HMatrixUV.h:39
const TMatrixDSym & getCov() const
Measured coordinates on a plane.
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
Definition RKTrackRep.h:70
virtual SharedPlanePtr constructPlane(const StateOnPlane &state) const
Contruct the virtual detector plane.
virtual const AbsHMatrix * constructHMatrix(const AbsTrackRep *) const
virtual std::vector< MeasurementOnPlane * > constructMeasurementsOnPlane(const StateOnPlane &state) const
A state with arbitrary dimension defined in a DetPlane.
const TVectorD & getState() const
double extrapolateToPoint(const TVector3 &point, bool stopAtBoundary=false, bool calcJacobianNoise=false)
const AbsTrackRep * getRep() const
const SharedPlanePtr & getPlane() const
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition TrackPoint.h:50
void invertMatrix(const TMatrixDSym &mat, TMatrixDSym &inv, double *determinant=NULL)
Invert a matrix, throwing an Exception when inversion fails. Optional calculation of determinant.
Definition Tools.cc:38
Matrix inversion tools.
Definition AbsBField.h:29
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.