Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FullMeasurement.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FullMeasurement.cc
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 "FullMeasurement.h"
21 
22 #include <Exception.h>
23 #include <RKTrackRep.h>
24 #include <HMatrixUnit.h>
25 
26 #include <cassert>
27 #include <TBuffer.h>
28 
29 namespace genfit {
30 
32  : AbsMeasurement(nDim), plane_()
33 {
34  assert(nDim >= 1);
35 }
36 
37 
38 FullMeasurement::FullMeasurement(const MeasuredStateOnPlane& state, int detId, int hitId, TrackPoint* trackPoint)
39  : AbsMeasurement(state.getState(), state.getCov(), detId, hitId, trackPoint), plane_(state.getPlane())
40 {
41  assert(rawHitCoords_.GetNrows() == (int)state.getRep()->getDim());
42 }
43 
44 
46  if (!plane_) {
47  Exception exc("FullMeasurement::constructPlane(): No plane has been set!", __LINE__,__FILE__);
48  throw exc;
49  }
50  return plane_;
51 }
52 
53 
54 std::vector<MeasurementOnPlane*> FullMeasurement::constructMeasurementsOnPlane(const StateOnPlane& state) const {
55 
57  rawHitCov_,
58  state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
59 
60  std::vector<MeasurementOnPlane*> retVal;
61  retVal.push_back(mop);
62  return retVal;
63 }
64 
65 
67 
68  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
69  Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
70  throw exc;
71  }
72 
73  return new HMatrixUnit();
74 }
75 
76 
77 void FullMeasurement::Streamer(TBuffer &R__b)
78 {
79  // Stream an object of class genfit::FullMeasurement.
80 
81  //This works around a msvc bug and should be harmless on other platforms
82  typedef ::genfit::FullMeasurement thisClass;
83  UInt_t R__s, R__c;
84  if (R__b.IsReading()) {
85  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
86  //This works around a msvc bug and should be harmless on other platforms
87  typedef genfit::AbsMeasurement baseClass0;
88  baseClass0::Streamer(R__b);
89  char flag;
90  R__b >> flag;
91  plane_.reset();
92  if (flag) {
93  plane_.reset(new DetPlane());
94  plane_->Streamer(R__b);
95  }
96  R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
97  } else {
98  R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
99  //This works around a msvc bug and should be harmless on other platforms
100  typedef genfit::AbsMeasurement baseClass0;
101  baseClass0::Streamer(R__b);
102  if (plane_) {
103  R__b << (char)1;
104  plane_->Streamer(R__b);
105  } else {
106  R__b << (char)0;
107  }
108  R__b.SetByteCount(R__c, kTRUE);
109  }
110 }
111 
112 } /* End of namespace genfit */