AliRoot Core  3dc7879 (3dc7879)
AliESDfriend.cxx
Go to the documentation of this file.
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 AliESDfriend class
18 // This class contains some additional to the ESD information like
19 // the clusters associated to tracks.
20 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
21 //-------------------------------------------------------------------------
22 
23 #include "AliESDfriend.h"
24 #include "AliESDVZEROfriend.h"
25 #include "AliESDTZEROfriend.h"
26 #include "AliESDADfriend.h"
27 #include "AliESDCalofriend.h"
28 
29 ClassImp(AliESDfriend)
30 
32  fESDIndicesStored(kFALSE),
33  fTracks("AliESDfriendTrack",1),
34  fESDVZEROfriend(NULL),
35  fESDTZEROfriend(NULL),
36  fESDADfriend(NULL),
37  fESDCalofriend(NULL)
38 {
39  //
40  // Default constructor
41  //
42  fTracks.SetOwner(kTRUE);
43  memset(fNclustersTPC,0,sizeof(fNclustersTPC));
44  memset(fNclustersTPCused,0,sizeof(fNclustersTPCused));
45 }
46 
48  AliVfriendEvent(f),
49  fESDIndicesStored(f.fESDIndicesStored),
50  fTracks(f.fTracks),
51  fESDVZEROfriend(f.fESDVZEROfriend ? new AliESDVZEROfriend(*f.fESDVZEROfriend) : NULL),
52  fESDTZEROfriend(f.fESDTZEROfriend ? new AliESDTZEROfriend(*f.fESDTZEROfriend) : NULL),
53  fESDADfriend(f.fESDADfriend ? new AliESDADfriend(*f.fESDADfriend) : NULL),
54  fESDCalofriend(f.fESDCalofriend ? new AliESDCalofriend(*f.fESDCalofriend) : NULL)
55 {
56  //
57  // Copy constructor
58  //
59  memcpy(fNclustersTPC,f.fNclustersTPC,sizeof(fNclustersTPC));
61 
62 }
63 
65 {
66 
67  // Assignment operator
68  if(&esd == this) return *this;
69  TObject::operator=(esd);
71  // Clean up the old TClonesArray
73  // fTracks.Delete();
74  // Assign the new one
75  fTracks = esd.fTracks;
76 
77  if(fESDVZEROfriend)
78  delete fESDVZEROfriend;
80  if(esd.fESDVZEROfriend)
82 
83  if(fESDTZEROfriend)
84  delete fESDTZEROfriend;
86  if(esd.fESDTZEROfriend)
88 
89  if(fESDADfriend)
90  delete fESDADfriend;
91  fESDADfriend=0;
92  if(esd.fESDADfriend)
94 
95  if(fESDCalofriend)
96  delete fESDCalofriend;
98  if(esd.fESDCalofriend)
100 
101  memcpy(fNclustersTPC,esd.fNclustersTPC,sizeof(fNclustersTPC));
103 
104 
105  return *this;
106 }
107 
108 
109 
111  //
112  // Destructor
113  //
115  //fTracks.Delete();
116  if(fESDVZEROfriend)
117  delete fESDVZEROfriend;
118  fESDVZEROfriend=0;
119  if(fESDTZEROfriend)
120  delete fESDTZEROfriend;
121  fESDTZEROfriend=0;
122  if(fESDADfriend)
123  delete fESDADfriend;
124  fESDADfriend=0;
125  if(fESDCalofriend)
126  delete fESDCalofriend;
127  fESDCalofriend=0;
128 }
129 
131 {
132  // delete tracks taking care of eventual shared objects in the tracks (e.g. TPCclusters)
133  int ntr=fTracks.GetEntriesFast();
134  for (int i=0;i<ntr;i++) {
137  }
138  fTracks.Delete();
139 }
140 
142 {
143  // Reset friend information, used for the shalow copy
144  for (int i=fTracks.GetEntriesFast();i--;) fTracks[i]->Clear();
145  fTracks.Clear();
146  for (Int_t i=0;i<72;i++)
147  {
148  fNclustersTPC[i]=0;
149  fNclustersTPCused[i]=0;
150  }
153  delete fESDADfriend; fESDADfriend=0;
154  if (fESDCalofriend) {
156  delete fESDCalofriend; fESDCalofriend=0;
157  }
158 }
159 
160 
162 {
163  //
164  // Reset friend information
165  //
167  // fTracks.Delete();
168  for (Int_t i=0;i<72;i++)
169  {
170  fNclustersTPC[i]=0;
171  fNclustersTPCused[i]=0;
172  }
175  delete fESDADfriend; fESDADfriend=0;
176  if (fESDCalofriend) {
178  delete fESDCalofriend; fESDCalofriend=0;
179  }
180 }
181 
183 {
184  //
185  // Set the VZERO friend data object
186  // (complete raw data)
188  if (obj) *fESDVZEROfriend = *obj;
189 }
191 {
192  //
193  // Set the Calo friend data object
194  // (complete raw data)
196  if (obj) *fESDCalofriend = *obj;
197 }
199 {
200  //
201  // Set the TZERO friend data object
202  // (complete raw data)
204  if (obj) *fESDTZEROfriend = *obj;
205 }
207 {
208  //
209  // Set the AD friend data object
210  // (complete raw data)
212  if (obj) *fESDADfriend = *obj;
213 }
void SetTZEROfriend(AliESDTZEROfriend *obj)
void TagSuppressSharedObjectsBeforeDeletion()
Int_t fNclustersTPC[72]
Definition: AliESDfriend.h:100
Bool_t fESDIndicesStored
Definition: AliESDfriend.h:93
void SetVZEROfriend(const AliESDVZEROfriend *obj)
AliESDTZEROfriend * fESDTZEROfriend
Definition: AliESDfriend.h:96
void Clear()
Add comment.
AliESDVZEROfriend * fESDVZEROfriend
Definition: AliESDfriend.h:95
AliESDCalofriend * fESDCalofriend
Definition: AliESDfriend.h:98
Int_t fNclustersTPCused[72]
Definition: AliESDfriend.h:101
TF1 * f
Definition: interpolTest.C:21
void SetCalofriend(AliESDCalofriend *obj)
void DeleteTracksSafe()
AliESDADfriend * fESDADfriend
Definition: AliESDfriend.h:97
virtual ~AliESDfriend()
void SetADfriend(AliESDADfriend *obj)
AliESDfriend & operator=(const AliESDfriend &esd)
TClonesArray fTracks
Definition: AliESDfriend.h:94