Belle II Software  release-08-01-10
MeasurementOnPlane.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 "MeasurementOnPlane.h"
21 
22 #include "IO.h"
23 
24 #include <TClass.h>
25 #include <TBuffer.h>
26 
27 namespace genfit {
28 
29 MeasurementOnPlane::MeasurementOnPlane(const MeasurementOnPlane& other) :
30  MeasuredStateOnPlane(other),
31  weight_(other.weight_)
32 {
33  hMatrix_.reset(other.hMatrix_->clone());
34 }
35 
36 
38  swap(other);
39  return *this;
40 }
41 
42 
43 void MeasurementOnPlane::swap(MeasurementOnPlane& other) {
44  MeasuredStateOnPlane::swap(other);
45  this->hMatrix_.swap(other.hMatrix_);
46  std::swap(this->weight_, other.weight_);
47 }
48 
49 
50 void MeasurementOnPlane::Print(Option_t*) const
51 {
52  printOut << "genfit::MeasurementOnPlane, weight = " << weight_ << "\n";
53  printOut << " state vector: "; state_.Print();
54  printOut << " covariance matrix: "; cov_.Print();
55  if (sharedPlane_ != nullptr) {
56  printOut << " defined in plane ";
57  sharedPlane_->Print();
58  }
59  printOut << " hMatrix: "; hMatrix_->Print();
60 
61 }
62 
63 
64 void MeasurementOnPlane::Streamer(TBuffer &R__b)
65 {
66  // Stream an object of class genfit::MeasurementOnPlane.
67 
68  //This works around a msvc bug and should be harmless on other platforms
69  typedef ::genfit::MeasurementOnPlane thisClass;
70  UInt_t R__s, R__c;
71  if (R__b.IsReading()) {
72  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
73  MeasuredStateOnPlane::Streamer(R__b);
74  hMatrix_.reset();
75  char flag;
76  R__b.ReadChar(flag);
77  if (flag) {
78  AbsHMatrix *h = 0;
79  R__b >> h;
80  hMatrix_.reset(h);
81  }
82  R__b >> weight_;
83  R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
84  } else {
85  R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
86  MeasuredStateOnPlane::Streamer(R__b);
87  if (hMatrix_) {
88  R__b.WriteChar(1);
89  R__b << hMatrix_.get();
90  } else {
91  R__b.WriteChar(0);
92  }
93  R__b << weight_;
94  R__b.SetByteCount(R__c, kTRUE);
95  }
96 }
97 
98 } /* End of namespace genfit */
#StateOnPlane with additional covariance matrix.
Measured coordinates on a plane.
MeasurementOnPlane & operator=(MeasurementOnPlane other)
assignment operator
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.