File indexing completed on 2025-08-05 08:18:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "FullMeasurement.h"
0021
0022 #include <Exception.h>
0023 #include <RKTrackRep.h>
0024 #include <HMatrixUnit.h>
0025
0026 #include <cassert>
0027 #include <TBuffer.h>
0028
0029 namespace genfit {
0030
0031 FullMeasurement::FullMeasurement(int nDim)
0032 : AbsMeasurement(nDim), plane_()
0033 {
0034 assert(nDim >= 1);
0035 }
0036
0037
0038 FullMeasurement::FullMeasurement(const MeasuredStateOnPlane& state, int detId, int hitId, TrackPoint* trackPoint)
0039 : AbsMeasurement(state.getState(), state.getCov(), detId, hitId, trackPoint), plane_(state.getPlane())
0040 {
0041 assert(rawHitCoords_.GetNrows() == (int)state.getRep()->getDim());
0042 }
0043
0044
0045 SharedPlanePtr FullMeasurement::constructPlane(const StateOnPlane&) const {
0046 if (!plane_) {
0047 Exception exc("FullMeasurement::constructPlane(): No plane has been set!", __LINE__,__FILE__);
0048 throw exc;
0049 }
0050 return plane_;
0051 }
0052
0053
0054 std::vector<MeasurementOnPlane*> FullMeasurement::constructMeasurementsOnPlane(const StateOnPlane& state) const {
0055
0056 MeasurementOnPlane* mop = new MeasurementOnPlane(rawHitCoords_,
0057 rawHitCov_,
0058 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
0059
0060 std::vector<MeasurementOnPlane*> retVal;
0061 retVal.push_back(mop);
0062 return retVal;
0063 }
0064
0065
0066 const AbsHMatrix* FullMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
0067
0068 if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
0069 Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
0070 throw exc;
0071 }
0072
0073 return new HMatrixUnit();
0074 }
0075
0076
0077 void FullMeasurement::Streamer(TBuffer &R__b)
0078 {
0079
0080
0081
0082 typedef ::genfit::FullMeasurement thisClass;
0083 UInt_t R__s, R__c;
0084 if (R__b.IsReading()) {
0085 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
0086
0087 typedef genfit::AbsMeasurement baseClass0;
0088 baseClass0::Streamer(R__b);
0089 char flag;
0090 R__b >> flag;
0091 plane_.reset();
0092 if (flag) {
0093 plane_.reset(new DetPlane());
0094 plane_->Streamer(R__b);
0095 }
0096 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
0097 } else {
0098 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
0099
0100 typedef genfit::AbsMeasurement baseClass0;
0101 baseClass0::Streamer(R__b);
0102 if (plane_) {
0103 R__b << (char)1;
0104 plane_->Streamer(R__b);
0105 } else {
0106 R__b << (char)0;
0107 }
0108 R__b.SetByteCount(R__c, kTRUE);
0109 }
0110 }
0111
0112 }