]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDfriendTrack.cxx
Added the 'const' keyword to the pointer-returning getters in AliRsnCutESD2010 and...
[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"
5637918c 24#include "TClonesArray.h"
be713d4d 25#include "AliKalmanTrack.h"
1d99986f 26
27ClassImp(AliESDfriendTrack)
28
15e85efa 29AliESDfriendTrack::AliESDfriendTrack():
30TObject(),
31f1P(0),
5637918c 32fHmpPhotClus(new TClonesArray("AliHMPIDCluster",1000)),
6d3a7bbf 33fnMaxITScluster(0),
34fnMaxTPCcluster(0),
35fnMaxTRDcluster(0),
36fITSindex(0x0),
37fTPCindex(0x0),
38fTRDindex(0x0),
00dce61a 39fPoints(0),
40fCalibContainer(0),
15e85efa 41fITStrack(0),
ded25cc6 42fTRDtrack(0),
43fTPCOut(0),
44fITSOut(0),
45fTRDIn(0)
15e85efa 46{
1d99986f 47 //
48 // Default constructor
49 //
6d3a7bbf 50 // Int_t i;
51 // fITSindex = new Int_t[fnMaxITScluster];
52 //fTPCindex = new Int_t[fnMaxTPCcluster];
53 //fTRDindex = new Int_t[fnMaxTRDcluster];
54 //for (i=0; i<kMaxITScluster; i++) fITSindex[i]=-2;
55 //for (i=0; i<kMaxTPCcluster; i++) fTPCindex[i]=-2;
56 //for (i=0; i<kMaxTRDcluster; i++) fTRDindex[i]=-2;
5637918c 57
58 //fHmpPhotClus->SetOwner(kTRUE);
59
1d99986f 60}
61
62AliESDfriendTrack::AliESDfriendTrack(const AliESDfriendTrack &t):
63TObject(t),
64f1P(t.f1P),
5637918c 65fHmpPhotClus(t.fHmpPhotClus),
6d3a7bbf 66fnMaxITScluster(t.fnMaxITScluster),
67fnMaxTPCcluster(t.fnMaxTPCcluster),
68fnMaxTRDcluster(t.fnMaxTRDcluster),
69fITSindex(0x0),
70fTPCindex(0x0),
71fTRDindex(0x0),
15e85efa 72fPoints(0),
00dce61a 73fCalibContainer(0),
15e85efa 74fITStrack(0),
ded25cc6 75fTRDtrack(0),
76fTPCOut(0),
77fITSOut(0),
78fTRDIn(0)
1d99986f 79{
80 //
81 // Copy constructor
82 //
6d3a7bbf 83 AliDebug(2,"Calling copy constructor");
84
1d99986f 85 Int_t i;
6d3a7bbf 86 if (fnMaxITScluster != 0){
87 fITSindex = new Int_t[fnMaxITScluster];
88 for (i=0; i<fnMaxITScluster; i++) fITSindex[i]=t.fITSindex[i];
89 }
90 if (fnMaxTPCcluster != 0){
91 fTPCindex = new Int_t[fnMaxTPCcluster];
92 for (i=0; i<fnMaxTPCcluster; i++) fTPCindex[i]=t.fTPCindex[i];
93 }
94 if (fnMaxTRDcluster != 0){
95 fTRDindex = new Int_t[fnMaxTRDcluster];
96 for (i=0; i<fnMaxTRDcluster; i++) fTRDindex[i]=t.fTRDindex[i];
97 }
98 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
99 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
100 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
1d99986f 101 if (t.fPoints) fPoints=new AliTrackPointArray(*t.fPoints);
f333ed51 102 if (t.fCalibContainer) {
103 fCalibContainer = new TObjArray(5);
104 Int_t no=t.fCalibContainer->GetEntriesFast();
6c27b212 105 for (i=0; i<no; i++) {
f333ed51 106 TObject *o=t.fCalibContainer->At(i);
107 fCalibContainer->AddLast(o->Clone());
108 }
109 }
ded25cc6 110
111 if (t.fTPCOut) fTPCOut = new AliExternalTrackParam(*(t.fTPCOut));
112 if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut));
113 if (t.fTRDIn) fTRDIn = new AliExternalTrackParam(*(t.fTRDIn));
6d3a7bbf 114
5637918c 115 fHmpPhotClus = new TClonesArray(*t.fHmpPhotClus);
116
1d99986f 117}
118
15e85efa 119AliESDfriendTrack::~AliESDfriendTrack() {
1d99986f 120 //
15e85efa 121 // Simple destructor
1d99986f 122 //
15e85efa 123 delete fPoints;
f333ed51 124 if (fCalibContainer) fCalibContainer->Delete();
2c56c9f6 125 delete fCalibContainer;
5637918c 126 delete fHmpPhotClus;
15e85efa 127 delete fITStrack;
128 delete fTRDtrack;
ded25cc6 129 delete fTPCOut;
130 delete fITSOut;
131 delete fTRDIn;
82c82b62 132 delete[] fITSindex;
133 delete[] fTPCindex;
134 delete[] fTRDindex;
1d99986f 135}
00dce61a 136
137
138void AliESDfriendTrack::AddCalibObject(TObject * calibObject){
139 //
140 // add calibration object to array -
141 // track is owner of the objects in the container
142 //
143 if (!fCalibContainer) fCalibContainer = new TObjArray(5);
144 fCalibContainer->AddLast(calibObject);
145}
146
147TObject * AliESDfriendTrack::GetCalibObject(Int_t index){
148 //
149 //
150 //
151 if (!fCalibContainer) return 0;
152 if (index>=fCalibContainer->GetEntriesFast()) return 0;
153 return fCalibContainer->At(index);
154}
ded25cc6 155
156
157void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam &param) {
158 //
159 // backup TPC out track
160 //
161 delete fTPCOut;
162 fTPCOut=new AliExternalTrackParam(param);
163}
164void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam &param) {
165 //
166 // backup ITS out track
167 //
168 delete fITSOut;
169 fITSOut=new AliExternalTrackParam(param);
170}
171void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam &param) {
172 //
173 // backup TRD in track
174 //
175 delete fTRDIn;
176 fTRDIn=new AliExternalTrackParam(param);
177}
178
5637918c 179
180void AliESDfriendTrack::SetHmpPhotClus(TClonesArray *array) {
181 //
182 //
183 //
184 fHmpPhotClus->Clear("C");
185 for(Int_t iClu=0; iClu<array->GetEntriesFast(); iClu++){
186 TObject *pClu = (TObject*)array->UncheckedAt(iClu);
187 new ((*fHmpPhotClus)[iClu]) TObject(*pClu);
188 }
189}
190
6d3a7bbf 191void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n){
192
193 //
194 // setting fITSindex
195 // instantiating the pointer if still NULL
196 //
197
198 fnMaxITScluster = n;
199 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
200 if (fITSindex == 0x0){
201 fITSindex = new Int_t[fnMaxITScluster];
202 }
203 for (Int_t i = 0; i < fnMaxITScluster; i++){
204 fITSindex[i] = indices[i];
205 }
206}
207
208void AliESDfriendTrack::SetTPCIndices(Int_t* indices, Int_t n){
209
210 //
211 // setting fTPCindex
212 // instantiating the pointer if still NULL
213 //
214
215 fnMaxTPCcluster = n;
216 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
217 if (fTPCindex == 0x0){
218 fTPCindex = new Int_t[fnMaxTPCcluster];
219 }
220 for (Int_t i = 0; i < fnMaxTPCcluster; i++){
221 fTPCindex[i] = indices[i];
222 }
223}
224
225void AliESDfriendTrack::SetTRDIndices(Int_t* indices, Int_t n){
226
227 //
228 // setting fTRDindex
229 // instantiating the pointer if still NULL
230 //
231
232 fnMaxTRDcluster = n;
233 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
234 if (fTRDindex == 0x0){
235 fTRDindex = new Int_t[fnMaxTRDcluster];
236 }
237 for (Int_t i = 0; i < fnMaxTRDcluster; i++){
238 fTRDindex[i] = indices[i];
239 }
240}
241