]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDfriendTrack.cxx
modification(by Levente) to solve the problem in the QA mentioned in the bug report...
[u/mrichter/AliRoot.git] / STEER / AliESDfriendTrack.cxx
CommitLineData
1d99986f 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//-------------------------------------------------------------------------
17// Implementation of the AliESDfriendTrack class
18// This class keeps complementary to the AliESDtrack information
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
20//-------------------------------------------------------------------------
21#include "AliTrackPointArray.h"
22#include "AliESDfriendTrack.h"
00dce61a 23#include "TObjArray.h"
be713d4d 24#include "AliKalmanTrack.h"
1d99986f 25
26ClassImp(AliESDfriendTrack)
27
15e85efa 28AliESDfriendTrack::AliESDfriendTrack():
29TObject(),
30f1P(0),
6d3a7bbf 31fnMaxITScluster(0),
32fnMaxTPCcluster(0),
33fnMaxTRDcluster(0),
34fITSindex(0x0),
35fTPCindex(0x0),
36fTRDindex(0x0),
00dce61a 37fPoints(0),
38fCalibContainer(0),
15e85efa 39fITStrack(0),
ded25cc6 40fTRDtrack(0),
41fTPCOut(0),
42fITSOut(0),
43fTRDIn(0)
15e85efa 44{
1d99986f 45 //
46 // Default constructor
47 //
6d3a7bbf 48 // Int_t i;
49 // fITSindex = new Int_t[fnMaxITScluster];
50 //fTPCindex = new Int_t[fnMaxTPCcluster];
51 //fTRDindex = new Int_t[fnMaxTRDcluster];
52 //for (i=0; i<kMaxITScluster; i++) fITSindex[i]=-2;
53 //for (i=0; i<kMaxTPCcluster; i++) fTPCindex[i]=-2;
54 //for (i=0; i<kMaxTRDcluster; i++) fTRDindex[i]=-2;
1d99986f 55}
56
57AliESDfriendTrack::AliESDfriendTrack(const AliESDfriendTrack &t):
58TObject(t),
59f1P(t.f1P),
6d3a7bbf 60fnMaxITScluster(t.fnMaxITScluster),
61fnMaxTPCcluster(t.fnMaxTPCcluster),
62fnMaxTRDcluster(t.fnMaxTRDcluster),
63fITSindex(0x0),
64fTPCindex(0x0),
65fTRDindex(0x0),
15e85efa 66fPoints(0),
00dce61a 67fCalibContainer(0),
15e85efa 68fITStrack(0),
ded25cc6 69fTRDtrack(0),
70fTPCOut(0),
71fITSOut(0),
72fTRDIn(0)
1d99986f 73{
74 //
75 // Copy constructor
76 //
6d3a7bbf 77 AliDebug(2,"Calling copy constructor");
78
1d99986f 79 Int_t i;
6d3a7bbf 80 if (fnMaxITScluster != 0){
81 fITSindex = new Int_t[fnMaxITScluster];
82 for (i=0; i<fnMaxITScluster; i++) fITSindex[i]=t.fITSindex[i];
83 }
84 if (fnMaxTPCcluster != 0){
85 fTPCindex = new Int_t[fnMaxTPCcluster];
86 for (i=0; i<fnMaxTPCcluster; i++) fTPCindex[i]=t.fTPCindex[i];
87 }
88 if (fnMaxTRDcluster != 0){
89 fTRDindex = new Int_t[fnMaxTRDcluster];
90 for (i=0; i<fnMaxTRDcluster; i++) fTRDindex[i]=t.fTRDindex[i];
91 }
92 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
93 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
94 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
1d99986f 95 if (t.fPoints) fPoints=new AliTrackPointArray(*t.fPoints);
f333ed51 96 if (t.fCalibContainer) {
97 fCalibContainer = new TObjArray(5);
98 Int_t no=t.fCalibContainer->GetEntriesFast();
6c27b212 99 for (i=0; i<no; i++) {
f333ed51 100 TObject *o=t.fCalibContainer->At(i);
101 fCalibContainer->AddLast(o->Clone());
102 }
103 }
ded25cc6 104
105 if (t.fTPCOut) fTPCOut = new AliExternalTrackParam(*(t.fTPCOut));
106 if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut));
107 if (t.fTRDIn) fTRDIn = new AliExternalTrackParam(*(t.fTRDIn));
6d3a7bbf 108
1d99986f 109}
110
15e85efa 111AliESDfriendTrack::~AliESDfriendTrack() {
1d99986f 112 //
15e85efa 113 // Simple destructor
1d99986f 114 //
15e85efa 115 delete fPoints;
f333ed51 116 if (fCalibContainer) fCalibContainer->Delete();
2c56c9f6 117 delete fCalibContainer;
15e85efa 118 delete fITStrack;
119 delete fTRDtrack;
ded25cc6 120 delete fTPCOut;
121 delete fITSOut;
122 delete fTRDIn;
82c82b62 123 delete[] fITSindex;
124 delete[] fTPCindex;
125 delete[] fTRDindex;
1d99986f 126}
00dce61a 127
128
129void AliESDfriendTrack::AddCalibObject(TObject * calibObject){
130 //
131 // add calibration object to array -
132 // track is owner of the objects in the container
133 //
134 if (!fCalibContainer) fCalibContainer = new TObjArray(5);
135 fCalibContainer->AddLast(calibObject);
136}
137
138TObject * AliESDfriendTrack::GetCalibObject(Int_t index){
139 //
140 //
141 //
142 if (!fCalibContainer) return 0;
143 if (index>=fCalibContainer->GetEntriesFast()) return 0;
144 return fCalibContainer->At(index);
145}
ded25cc6 146
147
148void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam &param) {
149 //
150 // backup TPC out track
151 //
152 delete fTPCOut;
153 fTPCOut=new AliExternalTrackParam(param);
154}
155void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam &param) {
156 //
157 // backup ITS out track
158 //
159 delete fITSOut;
160 fITSOut=new AliExternalTrackParam(param);
161}
162void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam &param) {
163 //
164 // backup TRD in track
165 //
166 delete fTRDIn;
167 fTRDIn=new AliExternalTrackParam(param);
168}
169
6d3a7bbf 170void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n){
171
172 //
173 // setting fITSindex
174 // instantiating the pointer if still NULL
175 //
176
177 fnMaxITScluster = n;
178 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
179 if (fITSindex == 0x0){
180 fITSindex = new Int_t[fnMaxITScluster];
181 }
182 for (Int_t i = 0; i < fnMaxITScluster; i++){
183 fITSindex[i] = indices[i];
184 }
185}
186
187void AliESDfriendTrack::SetTPCIndices(Int_t* indices, Int_t n){
188
189 //
190 // setting fTPCindex
191 // instantiating the pointer if still NULL
192 //
193
194 fnMaxTPCcluster = n;
195 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
196 if (fTPCindex == 0x0){
197 fTPCindex = new Int_t[fnMaxTPCcluster];
198 }
199 for (Int_t i = 0; i < fnMaxTPCcluster; i++){
200 fTPCindex[i] = indices[i];
201 }
202}
203
204void AliESDfriendTrack::SetTRDIndices(Int_t* indices, Int_t n){
205
206 //
207 // setting fTRDindex
208 // instantiating the pointer if still NULL
209 //
210
211 fnMaxTRDcluster = n;
212 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
213 if (fTRDindex == 0x0){
214 fTRDindex = new Int_t[fnMaxTRDcluster];
215 }
216 for (Int_t i = 0; i < fnMaxTRDcluster; i++){
217 fTRDindex[i] = indices[i];
218 }
219}
220