SND@LHC Software
Loading...
Searching...
No Matches
PlanarMeasurement.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
20#include "PlanarMeasurement.h"
21
22#include <Exception.h>
23#include <RKTrackRep.h>
24#include <HMatrixU.h>
25#include <HMatrixV.h>
26#include <HMatrixUV.h>
27
28#include <cassert>
29#include <TBuffer.h>
30
31
32namespace genfit {
33
35 : AbsMeasurement(nDim), physicalPlane_(), planeId_(-1), stripV_(false)
36{
37 assert(nDim >= 1);
38}
39
40PlanarMeasurement::PlanarMeasurement(const TVectorD& rawHitCoords, const TMatrixDSym& rawHitCov, int detId, int hitId, TrackPoint* trackPoint)
41 : AbsMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint), physicalPlane_(), planeId_(-1), stripV_(false)
42{
43 assert(rawHitCoords_.GetNrows() >= 1);
44}
45
46
48 if (!physicalPlane_) {
49 Exception exc("PlanarMeasurement::constructPlane(): No plane has been set!", __LINE__,__FILE__);
50 throw exc;
51 }
52 return physicalPlane_;
53}
54
55
56std::vector<MeasurementOnPlane*> PlanarMeasurement::constructMeasurementsOnPlane(const StateOnPlane& state) const {
57
60 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
61
62 std::vector<MeasurementOnPlane*> retVal;
63 retVal.push_back(mop);
64 return retVal;
65}
66
67
69
70 if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
71 Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
72 throw exc;
73 }
74
75 switch(rawHitCoords_.GetNrows()) {
76 case 1:
77 if (stripV_)
78 return new HMatrixV();
79 return new HMatrixU();
80
81 case 2:
82 return new HMatrixUV();
83
84 default:
85 Exception exc("PlanarMeasurement default implementation can only handle 1D (strip) or 2D (pixel) measurements!", __LINE__,__FILE__);
86 throw exc;
87 }
88
89}
90
91void PlanarMeasurement::Streamer(TBuffer &R__b)
92{
93 // Stream an object of class genfit::PlanarMeasurement.
94
95 //This works around a msvc bug and should be harmless on other platforms
96 typedef ::genfit::PlanarMeasurement thisClass;
97 UInt_t R__s, R__c;
98 if (R__b.IsReading()) {
99 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
100 //This works around a msvc bug and should be harmless on other platforms
101 typedef genfit::AbsMeasurement baseClass0;
102 baseClass0::Streamer(R__b);
103 char flag;
104 R__b >> flag;
105 physicalPlane_.reset();
106 if (flag) {
107 physicalPlane_.reset(new DetPlane());
108 physicalPlane_->Streamer(R__b);
109 }
110 R__b >> planeId_;
111 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
112 } else {
113 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
114 //This works around a msvc bug and should be harmless on other platforms
115 typedef genfit::AbsMeasurement baseClass0;
116 baseClass0::Streamer(R__b);
117 if (physicalPlane_) {
118 R__b << (char)1;
119 physicalPlane_->Streamer(R__b);
120 } else {
121 R__b << (char)0;
122 }
123 R__b << planeId_;
124 R__b.SetByteCount(R__c, kTRUE);
125 }
126}
127
128} /* End of namespace genfit */
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
AbsHMatrix implementation for one-dimensional MeasurementOnPlane and RKTrackRep parameterization.
Definition HMatrixU.h:37
AbsHMatrix implementation for one-dimensional MeasurementOnPlane and RKTrackRep parameterization.
Definition HMatrixV.h:37
Measured coordinates on a plane.
Measurement class implementing a planar hit geometry (1 or 2D).
int planeId_
This is persistent, but '!' makes ROOT shut up.
virtual const AbsHMatrix * constructHMatrix(const AbsTrackRep *) const
virtual SharedPlanePtr constructPlane(const StateOnPlane &state) const
virtual std::vector< MeasurementOnPlane * > constructMeasurementsOnPlane(const StateOnPlane &state) const
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
Definition RKTrackRep.h:70
A state with arbitrary dimension defined in a DetPlane.
const AbsTrackRep * getRep() const
const SharedPlanePtr & getPlane() const
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition TrackPoint.h:50
Matrix inversion tools.
Definition AbsBField.h:29
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.