Belle II Software  release-08-01-10
StateOnPlane.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 "StateOnPlane.h"
21 #include "AbsTrackRep.h"
22 #include "IO.h"
23 
24 #include <cassert>
25 #include <TBuffer.h>
26 
27 namespace genfit {
28 
29 
30 void StateOnPlane::Print(Option_t*) const {
31  printOut << "genfit::StateOnPlane ";
32  printOut << " state vector: "; state_.Print();
33  if (sharedPlane_ != nullptr) {
34  printOut << " defined in plane "; sharedPlane_->Print();
35  TVector3 pos(0,0,0), mom(0,0,0);
36  getRep()->getPosMom(*this, pos, mom);
37  printOut << " 3D position: "; pos.Print();
38  printOut << " 3D momentum: "; mom.Print();
39  }
40 }
41 
42 
43 // Modified from auto-generated Streamer to account for sharedPlane_
44 // Ignores rep_ and sharedPlane_, the owner has to take care of them.
45 void StateOnPlane::Streamer(TBuffer &R__b)
46 {
47  // Stream an object of class genfit::StateOnPlane.
48 
49  //This works around a msvc bug and should be harmless on other platforms
50  typedef ::genfit::StateOnPlane thisClass;
51  UInt_t R__s, R__c;
52  if (R__b.IsReading()) {
53  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
54  state_.Streamer(R__b);
55  auxInfo_.Streamer(R__b);
56  sharedPlane_.reset(); // needs to be set by owner;
57  rep_ = nullptr; // needs to be set by owner
58  R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
59  } else {
60  R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
61  state_.Streamer(R__b);
62  auxInfo_.Streamer(R__b);
63  R__b.SetByteCount(R__c, kTRUE);
64  }
65 }
66 
67 
68 } /* End of namespace genfit */
virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const =0
Get cartesian position and momentum vector of a state.
const AbsTrackRep * rep_
Shared ownership. '!' in order to silence ROOT, custom streamer writes and reads this.
Definition: StateOnPlane.h:146
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.