Bug fix. Removed delete statement
[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),
00dce61a 31fPoints(0),
32fCalibContainer(0),
15e85efa 33fITStrack(0),
ded25cc6 34fTRDtrack(0),
35fTPCOut(0),
36fITSOut(0),
37fTRDIn(0)
15e85efa 38{
1d99986f 39 //
40 // Default constructor
41 //
42 Int_t i;
15e85efa 43 for (i=0; i<kMaxITScluster; i++) fITSindex[i]=-2;
44 for (i=0; i<kMaxTPCcluster; i++) fTPCindex[i]=-2;
45 for (i=0; i<kMaxTRDcluster; i++) fTRDindex[i]=-2;
1d99986f 46}
47
48AliESDfriendTrack::AliESDfriendTrack(const AliESDfriendTrack &t):
49TObject(t),
50f1P(t.f1P),
15e85efa 51fPoints(0),
00dce61a 52fCalibContainer(0),
15e85efa 53fITStrack(0),
ded25cc6 54fTRDtrack(0),
55fTPCOut(0),
56fITSOut(0),
57fTRDIn(0)
1d99986f 58{
59 //
60 // Copy constructor
61 //
62 Int_t i;
15e85efa 63 for (i=0; i<kMaxITScluster; i++) fITSindex[i]=t.fITSindex[i];
64 for (i=0; i<kMaxTPCcluster; i++) fTPCindex[i]=t.fTPCindex[i];
65 for (i=0; i<kMaxTRDcluster; i++) fTRDindex[i]=t.fTRDindex[i];
1d99986f 66 if (t.fPoints) fPoints=new AliTrackPointArray(*t.fPoints);
f333ed51 67 if (t.fCalibContainer) {
68 fCalibContainer = new TObjArray(5);
69 Int_t no=t.fCalibContainer->GetEntriesFast();
6c27b212 70 for (i=0; i<no; i++) {
f333ed51 71 TObject *o=t.fCalibContainer->At(i);
72 fCalibContainer->AddLast(o->Clone());
73 }
74 }
ded25cc6 75
76 if (t.fTPCOut) fTPCOut = new AliExternalTrackParam(*(t.fTPCOut));
77 if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut));
78 if (t.fTRDIn) fTRDIn = new AliExternalTrackParam(*(t.fTRDIn));
1d99986f 79}
80
15e85efa 81AliESDfriendTrack::~AliESDfriendTrack() {
1d99986f 82 //
15e85efa 83 // Simple destructor
1d99986f 84 //
15e85efa 85 delete fPoints;
f333ed51 86 if (fCalibContainer) fCalibContainer->Delete();
2c56c9f6 87 delete fCalibContainer;
15e85efa 88 delete fITStrack;
89 delete fTRDtrack;
ded25cc6 90 delete fTPCOut;
91 delete fITSOut;
92 delete fTRDIn;
1d99986f 93}
00dce61a 94
95
96void AliESDfriendTrack::AddCalibObject(TObject * calibObject){
97 //
98 // add calibration object to array -
99 // track is owner of the objects in the container
100 //
101 if (!fCalibContainer) fCalibContainer = new TObjArray(5);
102 fCalibContainer->AddLast(calibObject);
103}
104
105TObject * AliESDfriendTrack::GetCalibObject(Int_t index){
106 //
107 //
108 //
109 if (!fCalibContainer) return 0;
110 if (index>=fCalibContainer->GetEntriesFast()) return 0;
111 return fCalibContainer->At(index);
112}
ded25cc6 113
114
115void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam &param) {
116 //
117 // backup TPC out track
118 //
119 delete fTPCOut;
120 fTPCOut=new AliExternalTrackParam(param);
121}
122void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam &param) {
123 //
124 // backup ITS out track
125 //
126 delete fITSOut;
127 fITSOut=new AliExternalTrackParam(param);
128}
129void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam &param) {
130 //
131 // backup TRD in track
132 //
133 delete fTRDIn;
134 fTRDIn=new AliExternalTrackParam(param);
135}
136