Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GFRaveTrackParameters.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GFRaveTrackParameters.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 
21 #include "GFRaveTrackParameters.h"
22 #include "GFRaveConverters.h"
23 #include "Exception.h"
24 
25 #include <iostream>
26 
27 
28 namespace genfit {
29 
30 
32  originalTrack_(nullptr),
33  weight_(0),
34  state_(6),
35  cov_(6,6),
36  hasSmoothedData_(false)
37 {
38  ;
39 }
40 
41 
42 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* /*originalState*/, double weight, const TVectorD & state6, const TMatrixDSym & cov6x6, bool isSmoothed) :
43  originalTrack_(const_cast<Track*>(track)),
44  weight_(weight),
45  state_(state6),
46  cov_(cov6x6),
47  hasSmoothedData_(isSmoothed)
48 {
49  if (state_.GetNrows() != 6) {
50  Exception exc("GFRaveTrackParameters ==> State is not 6D!",__LINE__,__FILE__);
51  throw exc;
52  }
53  if (cov_.GetNrows()!=6) {
54  Exception exc("GFRaveTrackParameters ==> Covariance is not 6D!",__LINE__,__FILE__);
55  throw exc;
56  }
57 
58 }
59 
60 
61 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* /*originalState*/, double weight) :
62  originalTrack_(const_cast<Track*>(track)),
63  weight_(weight),
64  state_(1,6),
65  cov_(6,6),
66  hasSmoothedData_(false)
67 {
68  ;
69 }
70 
71 
72 TVector3
74  return TVector3(state_[0], state_[1], state_[2]);
75 }
76 
77 
78 TVector3
80  return TVector3(state_[3], state_[4], state_[5]);
81 }
82 
83 
84 double
86  return getTrack()->getFitStatus()->getCharge();
87 }
88 
89 
90 double
92  if (hasTrack())
93  return getTrack()->getCardinalRep()->getPDG();
94  else {
95  Exception exc("GFRaveTrackParameters::getPdg() ==> no genfit::Track available!",__LINE__,__FILE__);
96  throw exc;
97  }
98 }
99 
100 
101 void
102 GFRaveTrackParameters::Print(const Option_t*) const {
103  std::cout << "weight: " << getWeight() << "\n";
104  if (!hasSmoothedData_) std::cout << "state and cov are NOT smoothed! \n";
105  std::cout << "state: "; getState().Print();
106  std::cout << "cov: "; getCov().Print();
107  if (hasTrack()) {std::cout << "genfit::Track: "; getTrack()->Print();}
108  else std::cout << "NO genfit::Track pointer \n";
109 }
110 
111 
112 } /* End of namespace genfit */