CbmRoot
CbmTrack.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmTrack source file -----
3 // ----- Created 29/11/07 by V. Friese -----
4 // ----- Modified 26/05/09 by A. Lebedev -----
5 // -------------------------------------------------------------------------
6 #include "CbmTrack.h"
7 
8 #include "CbmMatch.h" // for CbmMatch
9 
10 #include <FairTrackParam.h> // for FairTrackParam
11 
12 #include <TObject.h> // for TObject
13 
14 #include <sstream> // for operator<<, basic_ostream, stringstream
15 
16 using std::endl;
17 using std::stringstream;
18 
20  : TObject()
21  , fHitIndex()
22  , fHitType()
23  , fPidHypo(0)
24  , fParamFirst()
25  , fParamLast()
26  , fTime(0.)
27  , fTimeError(0.)
28  , fFlag(0)
29  , fChiSq(0.)
30  , fNDF(0)
31  , fPreviousTrackId(-1)
32  , fMatch(nullptr) {}
33 
34 // Only shallow copy needed
36  : TObject(rhs)
37  , fHitIndex(rhs.fHitIndex)
38  , fHitType(rhs.fHitType)
39  , fPidHypo(rhs.fPidHypo)
40  , fParamFirst(rhs.fParamFirst)
41  , fParamLast(rhs.fParamLast)
42  , fTime(rhs.fTime)
43  , fTimeError(rhs.fTimeError)
44  , fFlag(rhs.fFlag)
45  , fChiSq(rhs.fChiSq)
46  , fNDF(rhs.fNDF)
47  , fPreviousTrackId(rhs.fPreviousTrackId)
48  , fMatch(nullptr) {}
49 
50 // Only shallow copy needed
52 
53  if (this != &rhs) {
54  TObject::operator=(rhs);
55  fHitIndex = rhs.fHitIndex;
56  fHitType = rhs.fHitType;
57  fPidHypo = rhs.fPidHypo;
59  fParamLast = rhs.fParamLast;
60  fTime = rhs.fTime;
61  fTimeError = rhs.fTimeError;
62  fFlag = rhs.fFlag;
63  fChiSq = rhs.fChiSq;
64  fNDF = rhs.fNDF;
66  fMatch = nullptr;
67  }
68  return *this;
69 }
70 
72  if (fMatch) delete fMatch;
73 }
74 
75 void CbmTrack::AddHit(Int_t index, HitType type) {
76  fHitIndex.push_back(index);
77  fHitType.push_back(type);
78 }
79 
81  if (fMatch) delete fMatch;
82  fMatch = match;
83 }
84 
85 std::string CbmTrack::ToString() const {
86  stringstream ss;
87  ss << "CbmTrack: nof hits=" << fHitIndex.size() << ", chiSq=" << fChiSq
88  << ", NDF=" << fNDF << ", pidHypo=" << fPidHypo
89  << ", previousTrackId=" << fPreviousTrackId << ", flag=" << fFlag << "\n";
90  // fParamFirst.Print();
91  // fParamLast.Print();
92  return ss.str();
93 }
94 
CbmTrack::fPidHypo
Int_t fPidHypo
Definition: CbmTrack.h:91
CbmMatch
Definition: CbmMatch.h:22
CbmTrack::fTime
Double_t fTime
Definition: CbmTrack.h:98
ClassImp
ClassImp(CbmTrack)
CbmTrack::fNDF
Int_t fNDF
Definition: CbmTrack.h:106
CbmTrack::fMatch
CbmMatch * fMatch
Definition: CbmTrack.h:112
CbmMatch.h
CbmTrack::fFlag
Int_t fFlag
Definition: CbmTrack.h:102
CbmTrack
Definition: CbmTrack.h:32
CbmTrack::~CbmTrack
virtual ~CbmTrack()
Definition: CbmTrack.cxx:71
CbmTofTrack::fPidHypo
Int_t fPidHypo
PID hypothesis used for track extrapolation.
Definition: CbmTofTrack.h:117
CbmTrack::SetMatch
void SetMatch(CbmMatch *match)
Definition: CbmTrack.cxx:80
CbmTrack.h
CbmTrack::fChiSq
Double32_t fChiSq
Definition: CbmTrack.h:105
HitType
HitType
Definition: CbmHit.h:16
CbmTrack::fParamFirst
FairTrackParam fParamFirst
Definition: CbmTrack.h:94
CbmTrack::ToString
virtual std::string ToString() const
Definition: CbmTrack.cxx:85
CbmTrack::operator=
CbmTrack & operator=(const CbmTrack &)
Definition: CbmTrack.cxx:51
CbmTrack::fHitType
std::vector< HitType > fHitType
Definition: CbmTrack.h:88
CbmTrack::fHitIndex
std::vector< Int_t > fHitIndex
Definition: CbmTrack.h:85
CbmTrack::fParamLast
FairTrackParam fParamLast
Definition: CbmTrack.h:95
CbmTrack::fPreviousTrackId
Int_t fPreviousTrackId
Definition: CbmTrack.h:109
CbmTrack::AddHit
void AddHit(Int_t index, HitType type)
Definition: CbmTrack.cxx:75
CbmTrack::CbmTrack
CbmTrack()
Definition: CbmTrack.cxx:19
CbmTrack::fTimeError
Double_t fTimeError
Definition: CbmTrack.h:99