Belle II Software  release-08-01-10
ReferenceStateOnPlane.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 "ReferenceStateOnPlane.h"
21 
22 #include "IO.h"
23 
24 namespace genfit {
25 
26 ReferenceStateOnPlane::ReferenceStateOnPlane() :
27  StateOnPlane(),
28  forwardSegmentLength_(0),
29  backwardSegmentLength_(0),
30  forwardTransportMatrix_(),
31  backwardTransportMatrix_(),
32  forwardNoiseMatrix_(),
33  backwardNoiseMatrix_(),
34  forwardDeltaState_(),
35  backwardDeltaState_()
36 {
37  ;
38 }
39 
40 ReferenceStateOnPlane::ReferenceStateOnPlane(const TVectorD& state,
41  const SharedPlanePtr& plane,
42  const AbsTrackRep* rep) :
43  StateOnPlane(state, plane, rep),
44  forwardSegmentLength_(0),
45  backwardSegmentLength_(0),
46  forwardTransportMatrix_(rep->getDim(), rep->getDim()),
47  backwardTransportMatrix_(rep->getDim(), rep->getDim()),
48  forwardNoiseMatrix_(rep->getDim()),
49  backwardNoiseMatrix_(rep->getDim()),
50  forwardDeltaState_(rep->getDim()),
51  backwardDeltaState_(rep->getDim())
52 {
53  ;
54 }
55 
56 ReferenceStateOnPlane::ReferenceStateOnPlane(const TVectorD& state,
57  const SharedPlanePtr& plane,
58  const AbsTrackRep* rep,
59  const TVectorD& auxInfo) :
60  StateOnPlane(state, plane, rep, auxInfo),
61  forwardSegmentLength_(0),
62  backwardSegmentLength_(0),
63  forwardTransportMatrix_(rep->getDim(), rep->getDim()),
64  backwardTransportMatrix_(rep->getDim(), rep->getDim()),
65  forwardNoiseMatrix_(rep->getDim()),
66  backwardNoiseMatrix_(rep->getDim()),
67  forwardDeltaState_(rep->getDim()),
68  backwardDeltaState_(rep->getDim())
69 {
70  ;
71 }
72 
73 
74 ReferenceStateOnPlane::ReferenceStateOnPlane(const StateOnPlane& state) :
75  StateOnPlane(state),
76  forwardSegmentLength_(0),
77  backwardSegmentLength_(0),
78  forwardTransportMatrix_(state.getRep()->getDim(), state.getRep()->getDim()),
79  backwardTransportMatrix_(state.getRep()->getDim(), state.getRep()->getDim()),
80  forwardNoiseMatrix_(state.getRep()->getDim()),
81  backwardNoiseMatrix_(state.getRep()->getDim()),
82  forwardDeltaState_(state.getRep()->getDim()),
83  backwardDeltaState_(state.getRep()->getDim())
84 {
85  errorOut << "should never come here" << std::endl;
86  exit(0);
87 }
88 
89 
90 StateOnPlane& ReferenceStateOnPlane::operator=(ReferenceStateOnPlane other) {
91  swap(other);
92  return *this;
93 }
94 
95 void ReferenceStateOnPlane::swap(ReferenceStateOnPlane& other) {
96  StateOnPlane::swap(other);
97  std::swap(this->forwardSegmentLength_, other.forwardSegmentLength_);
98  std::swap(this->backwardSegmentLength_, other.backwardSegmentLength_);
99  this->forwardTransportMatrix_.ResizeTo(other.forwardTransportMatrix_);
100  std::swap(this->forwardTransportMatrix_, other.forwardTransportMatrix_);
101  this->backwardTransportMatrix_.ResizeTo(other.backwardTransportMatrix_);
102  std::swap(this->backwardTransportMatrix_, other.backwardTransportMatrix_);
103  this->forwardNoiseMatrix_.ResizeTo(other.forwardNoiseMatrix_);
104  std::swap(this->forwardNoiseMatrix_, other.forwardNoiseMatrix_);
105  this->backwardNoiseMatrix_.ResizeTo(other.backwardNoiseMatrix_);
106  std::swap(this->backwardNoiseMatrix_, other.backwardNoiseMatrix_);
107  this->forwardDeltaState_.ResizeTo(other.forwardDeltaState_);
108  std::swap(this->forwardDeltaState_, other.forwardDeltaState_);
109  this->backwardDeltaState_.ResizeTo(other.backwardDeltaState_);
110  std::swap(this->backwardDeltaState_, other.backwardDeltaState_);
111 }
112 
113 
114 void ReferenceStateOnPlane::resetForward() {
115  forwardSegmentLength_ = 0;
116  forwardTransportMatrix_.UnitMatrix();
117  forwardNoiseMatrix_.Zero();
118  forwardDeltaState_.Zero();
119 }
120 
121 void ReferenceStateOnPlane::resetBackward() {
122  backwardSegmentLength_ = 0;
123  backwardTransportMatrix_.UnitMatrix();
124  backwardNoiseMatrix_.Zero();
125  backwardDeltaState_.Zero();
126 }
127 
128 
129 void ReferenceStateOnPlane::Print(Option_t*) const {
130  StateOnPlane::Print();
131 
132  printOut << " forwardSegmentLength: " << forwardSegmentLength_ << "\n";
133  printOut << " forwardTransportMatrix: "; forwardTransportMatrix_.Print();
134  printOut << " forwardNoiseMatrix: "; forwardNoiseMatrix_.Print();
135  printOut << " forwardDeltaState: "; forwardDeltaState_.Print();
136 
137  printOut << " backwardSegmentLength_: " << backwardSegmentLength_ << "\n";
138  printOut << " backwardTransportMatrix: "; backwardTransportMatrix_.Print();
139  printOut << " backwardNoiseMatrix: "; backwardNoiseMatrix_.Print();
140  printOut << " backwardDeltaState: "; backwardDeltaState_.Print();
141 }
142 
143 
144 } /* End of namespace genfit */
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.
std::ostream errorOut
Default stream for error output.