]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/rec/AliHLTOnlineESDtrack.cxx
adding helper classes for optimized streaming of ESDs, not yet included in build
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTOnlineESDtrack.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8 //*                  for The ALICE HLT Project.                            *
9 //*                                                                        *
10 //* Permission to use, copy, modify and distribute this software and its   *
11 //* documentation strictly for non-commercial purposes is hereby granted   *
12 //* without fee, provided that the above copyright notice appears in all   *
13 //* copies and that both the copyright notice and this permission notice   *
14 //* appear in the supporting documentation. The authors make no claims     *
15 //* about the suitability of this software for any purpose. It is          *
16 //* provided "as is" without express or implied warranty.                  *
17 //**************************************************************************
18
19 /// @file   AliHLTOnlineESDtrack.cxx
20 /// @author Matthias Richter
21 /// @date   2010-10-29
22 /// @brief  A streamlined container class for AliESDtrack.
23 /// @note   
24
25 #include "AliHLTOnlineESDtrack.h"
26 #include "AliESDtrack.h"
27 #include <cerrno>
28 #include <cstdio>
29 #include <cstdlib>
30 #include <iostream>
31
32 using namespace std;
33
34 /** ROOT macro for the implementation of ROOT specific class methods */
35 ClassImp(AliHLTOnlineESDtrack)
36
37 AliHLTOnlineESDtrack::AliHLTOnlineESDtrack()
38   : AliExternalTrackParam()
39   , fCp(NULL)
40   , fIp(NULL)
41   , fTPCInner(NULL)
42   , fOp(NULL)
43   , fFlags(0)
44   , fID(0)
45   , fLabel(0)
46   , fITSLabel(0)
47   , fTPCLabel(0)
48   , fTRDLabel(0)
49   , fTrackLength(0)
50   , fdTPC(0),fzTPC(0)
51   , fCddTPC(0),fCdzTPC(0),fCzzTPC(0)
52   , fCchi2TPC(0)
53   , fD(0),fZ(0)
54   , fCdd(0),fCdz(0),fCzz(0)
55   , fCchi2(0)
56   , fITSchi2(0)
57   , fTPCchi2(0)
58   , fTPCchi2Iter1(0)
59   , fTPCncls(0)
60   , fTPCnclsF(0)
61   , fTPCnclsIter1(0)
62   , fTPCnclsFIter1(0)
63   , fITSncls(0)
64   , fITSClusterMap(0)
65   , fTRDncls(0)
66   , fTRDncls0(0)
67 {
68   // see header file for class documentation
69   // or
70   // refer to README to build package
71   // or
72   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
73
74 }
75
76 AliHLTOnlineESDtrack::AliHLTOnlineESDtrack(const AliHLTOnlineESDtrack& t)
77   : AliExternalTrackParam(t)
78   , fCp(t.fCp?(new AliExternalTrackParam(*t.fCp)):NULL)
79   , fIp(t.fIp?(new AliExternalTrackParam(*t.fIp)):NULL)
80   , fTPCInner(t.fTPCInner?(new AliExternalTrackParam(*t.fTPCInner)):NULL)
81   , fOp(t.fOp?(new AliExternalTrackParam(*t.fOp)):NULL)
82   , fFlags(t.fFlags)
83   , fID(t.fID)
84   , fLabel(t.fLabel)
85   , fITSLabel(t.fITSLabel)
86   , fTPCLabel(t.fTPCLabel)
87   , fTRDLabel(t.fTRDLabel)
88   , fTrackLength(t.fTrackLength)
89   , fdTPC(t.fdTPC),fzTPC(t.fzTPC)
90   , fCddTPC(t.fCddTPC),fCdzTPC(t.fCdzTPC),fCzzTPC(t.fCzzTPC)
91   , fCchi2TPC(t.fCchi2TPC)
92   , fD(t.fD),fZ(t.fZ)
93   , fCdd(t.fCdd),fCdz(t.fCdz),fCzz(t.fCzz)
94   , fCchi2(t.fCchi2)
95   , fITSchi2(t.fITSchi2)
96   , fTPCchi2(t.fTPCchi2)
97   , fTPCchi2Iter1(t.fTPCchi2Iter1)
98   , fTPCncls(t.fTPCncls)
99   , fTPCnclsF(t.fTPCnclsF)
100   , fTPCnclsIter1(t.fTPCnclsIter1)
101   , fTPCnclsFIter1(t.fTPCnclsFIter1)
102   , fITSncls(t.fITSncls)
103   , fITSClusterMap(t.fITSClusterMap)
104   , fTRDncls(t.fTRDncls)
105   , fTRDncls0(t.fTRDncls0)
106 {
107   // copy constructor
108 }
109
110 AliHLTOnlineESDtrack::~AliHLTOnlineESDtrack()
111 {
112   // destructor
113   if (fCp) delete fCp; fCp=NULL;
114   if (fIp) delete fIp; fIp=NULL;
115   if (fTPCInner) delete fTPCInner; fTPCInner=NULL;
116   if (fOp) delete fOp; fOp=NULL;
117 }
118
119 AliHLTOnlineESDtrack& AliHLTOnlineESDtrack::operator=(const AliHLTOnlineESDtrack& t)
120 {
121   // assignment operator
122   if (this==&t) return *this;
123
124   AliExternalTrackParam::operator=(t);
125
126   return *this;
127 }
128
129 AliHLTOnlineESDtrack& AliHLTOnlineESDtrack::operator=(const AliESDtrack& t)
130 {
131   // assignment operator from AliESDtrack
132
133   AliExternalTrackParam::operator=(t);
134
135   CopyInternalParam(fCp, t.GetConstrainedParam());
136   CopyInternalParam(fIp, t.GetInnerParam());
137   CopyInternalParam(fTPCInner, t.GetTPCInnerParam());
138   CopyInternalParam(fOp, t.GetOuterParam());
139
140   fFlags=t.GetStatus();
141   fID=t.GetID();
142   fLabel=t.GetLabel();
143   fITSLabel=t.GetITSLabel();
144   fTPCLabel=t.GetTPCLabel();
145   fTRDLabel=t.GetTRDLabel();
146   fTrackLength=t.GetIntegratedLength();
147
148   Float_t p[2]; Float_t cov[3];
149
150   // copy impact parameters for TPC
151   t.GetImpactParametersTPC(p, cov);
152   fdTPC=p[0]; fzTPC=p[1]; fCddTPC=cov[0]; fCdzTPC=cov[1]; fCzzTPC=cov[2];
153   fCchi2TPC=t.GetConstrainedChi2TPC();
154
155   // copy impact parameters
156   t.GetImpactParameters(p, cov);
157   fD=p[0]; fZ=p[1]; fCdd=cov[0]; fCdz=cov[1]; fCzz=cov[2];
158   fCchi2=t.GetConstrainedChi2();
159
160   fITSchi2=t.GetITSchi2();
161   fTPCchi2=t.GetTPCchi2();
162   fTPCchi2Iter1=t.GetTPCchi2Iter1();
163   fTPCncls=t.GetTPCNcls();
164   fTPCnclsF=t.GetTPCNclsF();
165   fTPCnclsIter1=t.GetTPCNclsIter1();
166   fTPCnclsFIter1=t.GetTPCNclsFIter1();
167   fITSncls=t.GetNcls(0);
168   fITSClusterMap=t.GetITSClusterMap();
169   fTRDncls=t.GetTRDncls();
170   fTRDncls0=t.GetTRDncls0();
171
172   return *this;
173 }
174
175 void AliHLTOnlineESDtrack::CopyInternalParam(AliExternalTrackParam* &internalParam, const AliExternalTrackParam* pSrc)
176 {
177   // copy one of the internal AliExternalTrackParam members
178   if (pSrc) {
179     if (!internalParam) internalParam=new AliExternalTrackParam(*pSrc);
180     else (*internalParam)=(*pSrc);
181   } else if (internalParam) {
182     internalParam->Reset();
183   }
184 }
185
186 void AliHLTOnlineESDtrack::Print(const char* options) const
187 {
188   /// overloaded from TObject, print info
189   AliExternalTrackParam::Print(options);
190 }
191
192 void AliHLTOnlineESDtrack::Dump() const
193 {
194   /// overloaded from TObject, more crude data dump
195   AliExternalTrackParam::Dump();
196 }
197
198 void AliHLTOnlineESDtrack::Clear(Option_t * option)
199 {
200   /// overloaded from TObject, clear object
201   
202   AliExternalTrackParam::Clear(option);
203 }
204
205 TObject * AliHLTOnlineESDtrack::Clone(const char */*newname*/) const
206 {
207   /// overloaded from TObject, clone object
208
209   AliESDtrack* track=new AliESDtrack(this);
210
211   return track;
212 }
213
214 void AliHLTOnlineESDtrack::Copy(TObject &object) const
215 {
216   /// overloaded from TObject, copy object
217
218   AliESDtrack* pESDTrack=dynamic_cast<AliESDtrack*>(&object);
219   if (pESDTrack) {
220     pESDTrack->Set(GetX(), GetAlpha(), GetParameter(), GetCovariance());
221   }
222   AliExternalTrackParam::Copy(object);
223 }