1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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"
23 #include "TObjArray.h"
24 #include "TClonesArray.h"
25 #include "AliKalmanTrack.h"
27 ClassImp(AliESDfriendTrack)
29 AliESDfriendTrack::AliESDfriendTrack():
32 fHmpPhotClus(new TClonesArray("AliHMPIDCluster",1000)),
48 // Default constructor
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;
58 //fHmpPhotClus->SetOwner(kTRUE);
62 AliESDfriendTrack::AliESDfriendTrack(const AliESDfriendTrack &t):
65 fHmpPhotClus(t.fHmpPhotClus),
66 fnMaxITScluster(t.fnMaxITScluster),
67 fnMaxTPCcluster(t.fnMaxTPCcluster),
68 fnMaxTRDcluster(t.fnMaxTRDcluster),
83 AliDebug(2,"Calling copy constructor");
86 if (fnMaxITScluster != 0){
87 fITSindex = new Int_t[fnMaxITScluster];
88 for (i=0; i<fnMaxITScluster; i++) fITSindex[i]=t.fITSindex[i];
90 if (fnMaxTPCcluster != 0){
91 fTPCindex = new Int_t[fnMaxTPCcluster];
92 for (i=0; i<fnMaxTPCcluster; i++) fTPCindex[i]=t.fTPCindex[i];
94 if (fnMaxTRDcluster != 0){
95 fTRDindex = new Int_t[fnMaxTRDcluster];
96 for (i=0; i<fnMaxTRDcluster; i++) fTRDindex[i]=t.fTRDindex[i];
98 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
99 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
100 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
101 if (t.fPoints) fPoints=new AliTrackPointArray(*t.fPoints);
102 if (t.fCalibContainer) {
103 fCalibContainer = new TObjArray(5);
104 Int_t no=t.fCalibContainer->GetEntriesFast();
105 for (i=0; i<no; i++) {
106 TObject *o=t.fCalibContainer->At(i);
107 fCalibContainer->AddLast(o->Clone());
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));
115 fHmpPhotClus = new TClonesArray(*t.fHmpPhotClus);
119 AliESDfriendTrack::~AliESDfriendTrack() {
124 if (fCalibContainer) fCalibContainer->Delete();
125 delete fCalibContainer;
138 void AliESDfriendTrack::AddCalibObject(TObject * calibObject){
140 // add calibration object to array -
141 // track is owner of the objects in the container
143 if (!fCalibContainer) fCalibContainer = new TObjArray(5);
144 fCalibContainer->AddLast(calibObject);
147 TObject * AliESDfriendTrack::GetCalibObject(Int_t index){
151 if (!fCalibContainer) return 0;
152 if (index>=fCalibContainer->GetEntriesFast()) return 0;
153 return fCalibContainer->At(index);
157 void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam ¶m) {
159 // backup TPC out track
162 fTPCOut=new AliExternalTrackParam(param);
164 void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam ¶m) {
166 // backup ITS out track
169 fITSOut=new AliExternalTrackParam(param);
171 void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam ¶m) {
173 // backup TRD in track
176 fTRDIn=new AliExternalTrackParam(param);
180 void AliESDfriendTrack::SetHmpPhotClus(TClonesArray *array) {
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);
191 void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n){
195 // instantiating the pointer if still NULL
199 AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster));
200 if (fITSindex == 0x0){
201 fITSindex = new Int_t[fnMaxITScluster];
203 for (Int_t i = 0; i < fnMaxITScluster; i++){
204 fITSindex[i] = indices[i];
208 void AliESDfriendTrack::SetTPCIndices(Int_t* indices, Int_t n){
212 // instantiating the pointer if still NULL
216 AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster));
217 if (fTPCindex == 0x0){
218 fTPCindex = new Int_t[fnMaxTPCcluster];
220 for (Int_t i = 0; i < fnMaxTPCcluster; i++){
221 fTPCindex[i] = indices[i];
225 void AliESDfriendTrack::SetTRDIndices(Int_t* indices, Int_t n){
229 // instantiating the pointer if still NULL
233 AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster));
234 if (fTRDindex == 0x0){
235 fTRDindex = new Int_t[fnMaxTRDcluster];
237 for (Int_t i = 0; i < fnMaxTRDcluster; i++){
238 fTRDindex[i] = indices[i];