]>
Commit | Line | Data |
---|---|---|
af885e0f | 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 | /* $Id$ */ | |
17 | ||
18 | //----------------------------------------------------------------- | |
f56a9fa7 | 19 | // Implementation of the AliESDEvent class |
6989bff3 | 20 | // This is the class to deal with during the physics analysis of data. |
f56a9fa7 | 21 | // It also ensures the backward compatibility with the old ESD format. |
6989bff3 | 22 | /* |
23 | AliESDEvent *ev= new AliESDEvent(); | |
24 | ev->ReadFromTree(esdTree); | |
25 | ... | |
26 | for (Int_t i=0; i<nev; i++) { | |
27 | esdTree->GetEntry(i); | |
28 | if(ev->GetAliESDOld())ev->CopyFromOldESD(); | |
29 | */ | |
30 | // The AliESDInputHAndler does this automatically for you | |
f56a9fa7 | 31 | // |
32 | // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch | |
af885e0f | 33 | //----------------------------------------------------------------- |
34 | ||
35 | #include "TList.h" | |
cd1d4ee0 | 36 | #include "TRefArray.h" |
af885e0f | 37 | #include <TNamed.h> |
38 | ||
39 | #include "AliESDEvent.h" | |
40 | #include "AliESDfriend.h" | |
41 | #include "AliESDVZERO.h" | |
af885e0f | 42 | #include "AliESDFMD.h" |
43 | #include "AliESD.h" | |
f0106218 | 44 | #include "AliESDMuonTrack.h" |
45 | #include "AliESDPmdTrack.h" | |
46 | #include "AliESDTrdTrack.h" | |
47 | #include "AliESDVertex.h" | |
48 | #include "AliESDcascade.h" | |
49 | #include "AliESDPmdTrack.h" | |
50 | #include "AliESDTrdTrack.h" | |
51 | #include "AliESDVertex.h" | |
52 | #include "AliESDcascade.h" | |
53 | #include "AliESDkink.h" | |
54 | #include "AliESDtrack.h" | |
55 | #include "AliESDHLTtrack.h" | |
56 | #include "AliESDCaloCluster.h" | |
57 | #include "AliESDv0.h" | |
58 | #include "AliESDFMD.h" | |
59 | #include "AliESDVZERO.h" | |
60 | #include "AliMultiplicity.h" | |
61 | #include "AliRawDataErrorLog.h" | |
af885e0f | 62 | |
63 | ||
64 | ClassImp(AliESDEvent) | |
65 | ||
60e8f114 | 66 | |
67 | ||
68 | // here we define the names, some classes are no TNamed, therefore the classnames | |
69 | // are the Names | |
6989bff3 | 70 | const char* AliESDEvent::fgkESDListName[kESDListN] = {"AliESDRun", |
60e8f114 | 71 | "AliESDHeader", |
72 | "AliESDZDC", | |
73 | "AliESDFMD", | |
74 | "AliESDVZERO", | |
75 | "AliESDTZERO", | |
76 | "SPDVertex", | |
77 | "PrimaryVertex", | |
78 | "AliMultiplicity", | |
79 | "PHOSTrigger", | |
80 | "EMCALTrigger", | |
81 | "Tracks", | |
82 | "MuonTracks", | |
83 | "PmdTracks", | |
84 | "TrdTracks", | |
85 | "V0s", | |
72da5d8c | 86 | "Cascades", |
60e8f114 | 87 | "Kinks", |
88 | "CaloClusters", | |
89 | "AliRawDataErrorLogs"}; | |
af885e0f | 90 | //______________________________________________________________________________ |
91 | AliESDEvent::AliESDEvent(): | |
024c7734 | 92 | AliVEvent(), |
af885e0f | 93 | fESDObjects(new TList()), |
94 | fESDRun(0), | |
95 | fHeader(0), | |
96 | fESDZDC(0), | |
97 | fESDFMD(0), | |
98 | fESDVZERO(0), | |
99 | fESDTZERO(0), | |
100 | fSPDVertex(0), | |
101 | fPrimaryVertex(0), | |
102 | fSPDMult(0), | |
103 | fPHOSTrigger(0), | |
104 | fEMCALTrigger(0), | |
105 | fTracks(0), | |
106 | fMuonTracks(0), | |
107 | fPmdTracks(0), | |
108 | fTrdTracks(0), | |
109 | fV0s(0), | |
110 | fCascades(0), | |
111 | fKinks(0), | |
112 | fCaloClusters(0), | |
113 | fErrorLogs(0), | |
114 | fESDOld(0), | |
60e8f114 | 115 | fConnected(kFALSE), |
af885e0f | 116 | fEMCALClusters(0), |
117 | fFirstEMCALCluster(-1), | |
118 | fPHOSClusters(0), | |
119 | fFirstPHOSCluster(-1) | |
120 | { | |
121 | } | |
122 | //______________________________________________________________________________ | |
123 | AliESDEvent::AliESDEvent(const AliESDEvent& esd): | |
024c7734 | 124 | AliVEvent(esd), |
af885e0f | 125 | fESDObjects(new TList()), |
126 | fESDRun(new AliESDRun(*esd.fESDRun)), | |
127 | fHeader(new AliESDHeader(*esd.fHeader)), | |
128 | fESDZDC(new AliESDZDC(*esd.fESDZDC)), | |
129 | fESDFMD(new AliESDFMD(*esd.fESDFMD)), | |
130 | fESDVZERO(new AliESDVZERO(*esd.fESDVZERO)), | |
131 | fESDTZERO(new AliESDTZERO(*esd.fESDTZERO)), | |
132 | fSPDVertex(new AliESDVertex(*esd.fSPDVertex)), | |
133 | fPrimaryVertex(new AliESDVertex(*esd.fPrimaryVertex)), | |
134 | fSPDMult(new AliMultiplicity(*esd.fSPDMult)), | |
135 | fPHOSTrigger(new AliESDCaloTrigger(*esd.fPHOSTrigger)), | |
136 | fEMCALTrigger(new AliESDCaloTrigger(*esd.fEMCALTrigger)), | |
137 | fTracks(new TClonesArray(*esd.fTracks)), | |
138 | fMuonTracks(new TClonesArray(*esd.fMuonTracks)), | |
139 | fPmdTracks(new TClonesArray(*esd.fPmdTracks)), | |
140 | fTrdTracks(new TClonesArray(*esd.fTrdTracks)), | |
141 | fV0s(new TClonesArray(*esd.fV0s)), | |
142 | fCascades(new TClonesArray(*esd.fCascades)), | |
143 | fKinks(new TClonesArray(*esd.fKinks)), | |
144 | fCaloClusters(new TClonesArray(*esd.fCaloClusters)), | |
145 | fErrorLogs(new TClonesArray(*esd.fErrorLogs)), | |
146 | fESDOld(new AliESD(*esd.fESDOld)), | |
60e8f114 | 147 | fConnected(esd.fConnected), |
af885e0f | 148 | fEMCALClusters(esd.fEMCALClusters), |
149 | fFirstEMCALCluster(esd.fFirstEMCALCluster), | |
150 | fPHOSClusters(esd.fPHOSClusters), | |
151 | fFirstPHOSCluster(esd.fFirstPHOSCluster) | |
152 | ||
153 | { | |
154 | // CKB init in the constructor list and only add here ... | |
155 | AddObject(fESDRun); | |
156 | AddObject(fHeader); | |
157 | AddObject(fESDZDC); | |
158 | AddObject(fESDFMD); | |
159 | AddObject(fESDVZERO); | |
160 | AddObject(fESDTZERO); | |
161 | AddObject(fSPDVertex); | |
162 | AddObject(fPrimaryVertex); | |
163 | AddObject(fSPDMult); | |
164 | AddObject(fPHOSTrigger); | |
165 | AddObject(fEMCALTrigger); | |
166 | AddObject(fTracks); | |
167 | AddObject(fMuonTracks); | |
168 | AddObject(fPmdTracks); | |
169 | AddObject(fTrdTracks); | |
170 | AddObject(fV0s); | |
171 | AddObject(fCascades); | |
172 | AddObject(fKinks); | |
173 | AddObject(fCaloClusters); | |
174 | AddObject(fErrorLogs); | |
175 | ||
176 | GetStdContent(); | |
177 | ||
178 | } | |
179 | ||
180 | //______________________________________________________________________________ | |
181 | AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { | |
182 | ||
183 | // Assignment operator | |
184 | ||
185 | if(&source == this) return *this; | |
024c7734 | 186 | AliVEvent::operator=(source); |
af885e0f | 187 | |
188 | fESDRun = new AliESDRun(*source.fESDRun); | |
189 | fHeader = new AliESDHeader(*source.fHeader); | |
190 | fESDZDC = new AliESDZDC(*source.fESDZDC); | |
191 | fESDFMD = new AliESDFMD(*source.fESDFMD); | |
192 | fESDVZERO = new AliESDVZERO(*source.fESDVZERO); | |
193 | fESDTZERO = new AliESDTZERO(*source.fESDTZERO); | |
194 | fSPDVertex = new AliESDVertex(*source.fSPDVertex); | |
195 | fPrimaryVertex = new AliESDVertex(*source.fPrimaryVertex); | |
196 | fSPDMult = new AliMultiplicity(*source.fSPDMult); | |
197 | fPHOSTrigger = new AliESDCaloTrigger(*source.fPHOSTrigger); | |
198 | fEMCALTrigger = new AliESDCaloTrigger(*source.fEMCALTrigger); | |
199 | fTracks = new TClonesArray(*source.fTracks); | |
200 | fMuonTracks = new TClonesArray(*source.fMuonTracks); | |
201 | fPmdTracks = new TClonesArray(*source.fPmdTracks); | |
202 | fTrdTracks = new TClonesArray(*source.fTrdTracks); | |
203 | fV0s = new TClonesArray(*source.fV0s); | |
204 | fCascades = new TClonesArray(*source.fCascades); | |
205 | fKinks = new TClonesArray(*source.fKinks); | |
206 | fCaloClusters = new TClonesArray(*source.fCaloClusters); | |
207 | fErrorLogs = new TClonesArray(*source.fErrorLogs); | |
208 | fESDOld = new AliESD(*source.fESDOld); | |
209 | // CKB this way?? or | |
210 | // or AddObject( fESDZDC = new AliESDZDC(*source.fESDZDC)); | |
211 | ||
212 | fESDObjects = new TList(); | |
213 | AddObject(fESDRun); | |
214 | AddObject(fHeader); | |
215 | AddObject(fESDZDC); | |
216 | AddObject(fESDFMD); | |
217 | AddObject(fESDVZERO); | |
218 | AddObject(fESDTZERO); | |
219 | AddObject(fSPDVertex); | |
220 | AddObject(fPrimaryVertex); | |
221 | AddObject(fSPDMult); | |
222 | AddObject(fPHOSTrigger); | |
223 | AddObject(fEMCALTrigger); | |
224 | AddObject(fTracks); | |
225 | AddObject(fMuonTracks); | |
226 | AddObject(fPmdTracks); | |
227 | AddObject(fTrdTracks); | |
228 | AddObject(fV0s); | |
229 | AddObject(fCascades); | |
230 | AddObject(fKinks); | |
231 | AddObject(fCaloClusters); | |
232 | AddObject(fErrorLogs); | |
233 | ||
60e8f114 | 234 | fConnected = source.fConnected; |
af885e0f | 235 | fEMCALClusters = source.fEMCALClusters; |
236 | fFirstEMCALCluster = source.fFirstEMCALCluster; | |
237 | fPHOSClusters = source.fPHOSClusters; | |
238 | fFirstPHOSCluster = source.fFirstPHOSCluster; | |
239 | ||
240 | ||
241 | ||
242 | return *this; | |
243 | ||
244 | } | |
245 | ||
246 | ||
247 | //______________________________________________________________________________ | |
248 | AliESDEvent::~AliESDEvent() | |
249 | { | |
250 | // | |
251 | // Standard destructor | |
252 | // | |
253 | ||
001b9beb | 254 | // everthing on the list gets deleted automatically |
139f2194 | 255 | |
256 | ||
60e8f114 | 257 | if(fESDObjects&&!fConnected) |
258 | { | |
259 | delete fESDObjects; | |
260 | fESDObjects = 0; | |
261 | } | |
139f2194 | 262 | |
60e8f114 | 263 | |
af885e0f | 264 | } |
265 | ||
266 | //______________________________________________________________________________ | |
267 | void AliESDEvent::Reset() | |
268 | { | |
269 | ||
270 | ||
271 | // Reset the standard contents | |
272 | ResetStdContent(); | |
af885e0f | 273 | if(fESDOld)fESDOld->Reset(); |
001b9beb | 274 | // call reset for user supplied data? |
af885e0f | 275 | } |
276 | ||
277 | void AliESDEvent::ResetStdContent() | |
278 | { | |
279 | // Reset the standard contents | |
280 | if(fESDRun) fESDRun->Reset(); | |
281 | if(fHeader) fHeader->Reset(); | |
282 | if(fESDZDC) fESDZDC->Reset(); | |
283 | if(fESDFMD) fESDFMD->Clear(); // why clear.... need consistend names | |
6989bff3 | 284 | if(fESDVZERO){ |
285 | // reset by callin d'to /c'tor keep the pointer | |
286 | fESDVZERO->~AliESDVZERO(); | |
287 | new (fESDVZERO) AliESDVZERO(); | |
288 | } | |
af885e0f | 289 | if(fESDTZERO) fESDTZERO->Reset(); |
290 | // CKB no clear/reset implemented | |
291 | if(fSPDVertex){ | |
316c6cd9 | 292 | fSPDVertex->~AliESDVertex(); |
af885e0f | 293 | new (fSPDVertex) AliESDVertex(); |
6989bff3 | 294 | fSPDVertex->SetName(fgkESDListName[kSPDVertex]); |
af885e0f | 295 | } |
296 | if(fPrimaryVertex){ | |
316c6cd9 | 297 | fPrimaryVertex->~AliESDVertex(); |
af885e0f | 298 | new (fPrimaryVertex) AliESDVertex(); |
6989bff3 | 299 | fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]); |
af885e0f | 300 | } |
316c6cd9 | 301 | if(fSPDMult){ |
302 | fSPDMult->~AliMultiplicity(); | |
303 | new (fSPDMult) AliMultiplicity(); | |
304 | } | |
af885e0f | 305 | if(fPHOSTrigger)fPHOSTrigger->Reset(); |
306 | if(fEMCALTrigger)fEMCALTrigger->Reset(); | |
bc9a7b42 | 307 | if(fTracks)fTracks->Delete(); |
6989bff3 | 308 | if(fMuonTracks)fMuonTracks->Delete(); |
309 | if(fPmdTracks)fPmdTracks->Delete(); | |
310 | if(fTrdTracks)fTrdTracks->Delete(); | |
311 | if(fV0s)fV0s->Delete(); | |
312 | if(fCascades)fCascades->Delete(); | |
313 | if(fKinks)fKinks->Delete(); | |
bc9a7b42 | 314 | if(fCaloClusters)fCaloClusters->Delete(); |
16167d49 | 315 | if(fErrorLogs) fErrorLogs->Delete(); |
af885e0f | 316 | |
60e8f114 | 317 | // don't reset fconnected fConnected ; |
318 | ||
af885e0f | 319 | fEMCALClusters=0; |
320 | fFirstEMCALCluster=-1; | |
321 | fPHOSClusters=0; | |
322 | fFirstPHOSCluster=-1; | |
323 | } | |
324 | ||
325 | ||
326 | Int_t AliESDEvent::AddV0(const AliESDv0 *v) { | |
327 | // | |
328 | // Add V0 | |
329 | // | |
330 | TClonesArray &fv = *fV0s; | |
331 | Int_t idx=fV0s->GetEntriesFast(); | |
332 | new(fv[idx]) AliESDv0(*v); | |
333 | return idx; | |
334 | } | |
335 | ||
336 | //______________________________________________________________________________ | |
337 | void AliESDEvent::Print(Option_t *) const | |
338 | { | |
339 | // | |
340 | // Print header information of the event | |
341 | // | |
342 | printf("ESD run information\n"); | |
343 | printf("Event # in file %d Bunch crossing # %d Orbit # %d Period # %d Run # %d Trigger %lld Magnetic field %f \n", | |
344 | GetEventNumberInFile(), | |
345 | GetBunchCrossNumber(), | |
346 | GetOrbitNumber(), | |
347 | GetPeriodNumber(), | |
348 | GetRunNumber(), | |
349 | GetTriggerMask(), | |
350 | GetMagneticField() ); | |
351 | printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n", | |
352 | fPrimaryVertex->GetXv(), fPrimaryVertex->GetXRes(), | |
353 | fPrimaryVertex->GetYv(), fPrimaryVertex->GetYRes(), | |
354 | fPrimaryVertex->GetZv(), fPrimaryVertex->GetZRes()); | |
355 | printf("Mean vertex in RUN: X=%.4f Y=%.4f cm\n", | |
356 | GetDiamondX(),GetDiamondY()); | |
357 | printf("SPD Multiplicity. Number of tracklets %d \n", | |
358 | fSPDMult->GetNumberOfTracklets()); | |
359 | printf("Number of tracks: \n"); | |
360 | printf(" charged %d\n", GetNumberOfTracks()); | |
361 | printf(" muon %d\n", GetNumberOfMuonTracks()); | |
362 | printf(" pmd %d\n", GetNumberOfPmdTracks()); | |
363 | printf(" trd %d\n", GetNumberOfTrdTracks()); | |
364 | printf(" v0 %d\n", GetNumberOfV0s()); | |
365 | printf(" cascades %d\n", GetNumberOfCascades()); | |
366 | printf(" kinks %d\n", GetNumberOfKinks()); | |
367 | printf(" CaloClusters %d\n", GetNumberOfCaloClusters()); | |
368 | printf(" phos %d\n", GetNumberOfPHOSClusters()); | |
369 | printf(" emcal %d\n", GetNumberOfEMCALClusters()); | |
370 | printf(" FMD %s\n", (fESDFMD ? "yes" : "no")); | |
371 | printf(" VZERO %s\n", (fESDVZERO ? "yes" : "no")); | |
024c7734 | 372 | |
373 | return; | |
af885e0f | 374 | } |
375 | ||
376 | void AliESDEvent::SetESDfriend(const AliESDfriend *ev) { | |
377 | // | |
378 | // Attaches the complementary info to the ESD | |
379 | // | |
380 | if (!ev) return; | |
381 | ||
5300bdab | 382 | // to be sure that we set the tracks also |
383 | // in case of old esds | |
60e8f114 | 384 | // if(fESDOld)CopyFromOldESD(); |
5300bdab | 385 | |
af885e0f | 386 | Int_t ntrk=ev->GetNumberOfTracks(); |
387 | ||
388 | for (Int_t i=0; i<ntrk; i++) { | |
389 | const AliESDfriendTrack *f=ev->GetTrack(i); | |
390 | GetTrack(i)->SetFriendTrack(f); | |
391 | } | |
392 | } | |
393 | ||
a023d8d8 | 394 | Bool_t AliESDEvent::RemoveKink(Int_t rm) { |
395 | // --------------------------------------------------------- | |
396 | // Remove a kink candidate and references to it from ESD, | |
397 | // if this candidate does not come from a reconstructed decay | |
398 | // Not yet implemented... | |
399 | // --------------------------------------------------------- | |
400 | Int_t last=GetNumberOfKinks()-1; | |
401 | if ((rm<0)||(rm>last)) return kFALSE; | |
402 | ||
403 | return kTRUE; | |
404 | } | |
405 | ||
406 | Bool_t AliESDEvent::RemoveV0(Int_t rm) { | |
407 | // --------------------------------------------------------- | |
408 | // Remove a V0 candidate and references to it from ESD, | |
409 | // if this candidate does not come from a reconstructed decay | |
410 | // --------------------------------------------------------- | |
411 | Int_t last=GetNumberOfV0s()-1; | |
412 | if ((rm<0)||(rm>last)) return kFALSE; | |
413 | ||
414 | AliESDv0 *v0=GetV0(rm); | |
415 | Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex(); | |
416 | ||
417 | v0=GetV0(last); | |
418 | Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex(); | |
419 | ||
420 | Int_t used=0; | |
421 | ||
422 | // Check if this V0 comes from a reconstructed decay | |
423 | Int_t ncs=GetNumberOfCascades(); | |
424 | for (Int_t n=0; n<ncs; n++) { | |
425 | AliESDcascade *cs=GetCascade(n); | |
426 | ||
427 | Int_t csIdxP=cs->GetPindex(); | |
428 | Int_t csIdxN=cs->GetNindex(); | |
429 | ||
430 | if (idxP==csIdxP) | |
431 | if (idxN==csIdxN) return kFALSE; | |
432 | ||
433 | if (csIdxP==lastIdxP) | |
434 | if (csIdxN==lastIdxN) used++; | |
435 | } | |
436 | ||
437 | //Replace the removed V0 with the last V0 | |
438 | TClonesArray &a=*fV0s; | |
439 | delete a.RemoveAt(rm); | |
440 | ||
441 | if (rm==last) return kTRUE; | |
442 | ||
443 | //v0 is pointing to the last V0 candidate... | |
444 | new (a[rm]) AliESDv0(*v0); | |
445 | delete a.RemoveAt(last); | |
446 | ||
447 | if (!used) return kTRUE; | |
448 | ||
449 | ||
450 | // Remap the indices of the daughters of reconstructed decays | |
451 | for (Int_t n=0; n<ncs; n++) { | |
452 | AliESDcascade *cs=GetCascade(n); | |
453 | ||
454 | ||
455 | Int_t csIdxP=cs->GetPindex(); | |
456 | Int_t csIdxN=cs->GetNindex(); | |
457 | ||
458 | if (csIdxP==lastIdxP) | |
459 | if (csIdxN==lastIdxN) { | |
460 | cs->AliESDv0::SetIndex(1,idxP); | |
461 | cs->AliESDv0::SetIndex(0,idxN); | |
462 | used--; | |
463 | if (!used) return kTRUE; | |
464 | } | |
465 | } | |
466 | ||
467 | return kTRUE; | |
468 | } | |
469 | ||
7f68891d | 470 | Bool_t AliESDEvent::RemoveTrack(Int_t rm) { |
d64bd07d | 471 | // --------------------------------------------------------- |
7f68891d | 472 | // Remove a track and references to it from ESD, |
473 | // if this track does not come from a reconstructed decay | |
d64bd07d | 474 | // --------------------------------------------------------- |
7f68891d | 475 | Int_t last=GetNumberOfTracks()-1; |
476 | if ((rm<0)||(rm>last)) return kFALSE; | |
477 | ||
478 | Int_t used=0; | |
d64bd07d | 479 | |
480 | // Check if this track comes from a reconstructed decay | |
7f68891d | 481 | Int_t nv0=GetNumberOfV0s(); |
482 | for (Int_t n=0; n<nv0; n++) { | |
483 | AliESDv0 *v0=GetV0(n); | |
484 | ||
485 | Int_t idx=v0->GetNindex(); | |
486 | if (rm==idx) return kFALSE; | |
487 | if (idx==last) used++; | |
488 | ||
489 | idx=v0->GetPindex(); | |
490 | if (rm==idx) return kFALSE; | |
491 | if (idx==last) used++; | |
492 | } | |
493 | ||
494 | Int_t ncs=GetNumberOfCascades(); | |
495 | for (Int_t n=0; n<ncs; n++) { | |
496 | AliESDcascade *cs=GetCascade(n); | |
d64bd07d | 497 | |
7f68891d | 498 | Int_t idx=cs->GetIndex(); |
499 | if (rm==idx) return kFALSE; | |
500 | if (idx==last) used++; | |
501 | } | |
502 | ||
503 | Int_t nkn=GetNumberOfKinks(); | |
504 | for (Int_t n=0; n<nkn; n++) { | |
505 | AliESDkink *kn=GetKink(n); | |
506 | ||
507 | Int_t idx=kn->GetIndex(0); | |
508 | if (rm==idx) return kFALSE; | |
509 | if (idx==last) used++; | |
510 | ||
511 | idx=kn->GetIndex(1); | |
512 | if (rm==idx) return kFALSE; | |
513 | if (idx==last) used++; | |
514 | } | |
d64bd07d | 515 | |
d64bd07d | 516 | |
7f68891d | 517 | //Replace the removed track with the last track |
518 | TClonesArray &a=*fTracks; | |
519 | delete a.RemoveAt(rm); | |
520 | ||
521 | if (rm==last) return kTRUE; | |
522 | ||
523 | AliESDtrack *t=GetTrack(last); | |
524 | t->SetID(rm); | |
525 | new (a[rm]) AliESDtrack(*t); | |
526 | delete a.RemoveAt(last); | |
527 | ||
528 | if (!used) return kTRUE; | |
529 | ||
530 | ||
531 | // Remap the indices of the daughters of reconstructed decays | |
532 | for (Int_t n=0; n<nv0; n++) { | |
533 | AliESDv0 *v0=GetV0(n); | |
534 | if (v0->GetIndex(0)==last) { | |
535 | v0->SetIndex(0,rm); | |
536 | used--; | |
537 | if (!used) return kTRUE; | |
538 | } | |
539 | if (v0->GetIndex(1)==last) { | |
540 | v0->SetIndex(1,rm); | |
541 | used--; | |
542 | if (!used) return kTRUE; | |
543 | } | |
544 | } | |
545 | ||
546 | for (Int_t n=0; n<ncs; n++) { | |
547 | AliESDcascade *cs=GetCascade(n); | |
548 | if (cs->GetIndex()==last) { | |
549 | cs->SetIndex(rm); | |
550 | used--; | |
551 | if (!used) return kTRUE; | |
552 | } | |
553 | } | |
554 | ||
555 | for (Int_t n=0; n<nkn; n++) { | |
556 | AliESDkink *kn=GetKink(n); | |
557 | if (kn->GetIndex(0)==last) { | |
558 | kn->SetIndex(rm,0); | |
559 | used--; | |
560 | if (!used) return kTRUE; | |
561 | } | |
562 | if (kn->GetIndex(1)==last) { | |
563 | kn->SetIndex(rm,1); | |
564 | used--; | |
565 | if (!used) return kTRUE; | |
566 | } | |
567 | } | |
d64bd07d | 568 | |
569 | return kTRUE; | |
570 | } | |
571 | ||
572 | ||
7f68891d | 573 | Bool_t AliESDEvent::Clean(Float_t *cleanPars) { |
574 | // | |
575 | // Remove the data which are not needed for the physics analysis. | |
576 | // | |
a023d8d8 | 577 | // 1) Cleaning the V0 candidates |
578 | // --------------------------- | |
579 | // If the cosine of the V0 pointing angle "csp" and | |
580 | // the DCA between the daughter tracks "dca" does not satisfy | |
581 | // the conditions | |
582 | // | |
583 | // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1]) | |
584 | // | |
585 | // an attempt to remove this V0 candidate from ESD is made. | |
586 | // | |
587 | // The V0 candidate gets removed if it does not belong to any | |
588 | // recosntructed cascade decay | |
589 | // | |
590 | // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999 | |
591 | // | |
592 | // 2) Cleaning the tracks | |
593 | // ---------------------- | |
594 | // If track's transverse parameter is larger than cleanPars[2] | |
7f68891d | 595 | // OR |
a023d8d8 | 596 | // track's longitudinal parameter is larger than cleanPars[3] |
597 | // an attempt to remove this track from ESD is made. | |
7f68891d | 598 | // |
a023d8d8 | 599 | // The track gets removed if it does not come |
600 | // from a reconstructed decay | |
7f68891d | 601 | // |
a023d8d8 | 602 | Bool_t rc=kFALSE; |
603 | ||
604 | Float_t dcaMax=cleanPars[0]; | |
605 | Float_t cspMin=cleanPars[1]; | |
606 | ||
607 | Int_t nV0s=GetNumberOfV0s(); | |
608 | for (Int_t i=nV0s-1; i>=0; i--) { | |
609 | AliESDv0 *v0=GetV0(i); | |
610 | ||
611 | Float_t dca=v0->GetDcaV0Daughters(); | |
612 | Float_t csp=v0->GetV0CosineOfPointingAngle(); | |
613 | Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin); | |
614 | if (csp > cspcut) continue; | |
615 | ||
616 | if (RemoveV0(i)) rc=kTRUE; | |
617 | } | |
618 | ||
7f68891d | 619 | |
a023d8d8 | 620 | Float_t dmax=cleanPars[2], zmax=cleanPars[3]; |
7f68891d | 621 | |
622 | const AliESDVertex *vertex=GetVertex(); | |
a023d8d8 | 623 | Bool_t vtxOK=vertex->GetStatus(); |
7f68891d | 624 | |
625 | Int_t nTracks=GetNumberOfTracks(); | |
626 | for (Int_t i=nTracks-1; i>=0; i--) { | |
627 | AliESDtrack *track=GetTrack(i); | |
628 | Float_t xy,z; track->GetImpactParameters(xy,z); | |
629 | if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) { | |
630 | if (RemoveTrack(i)) rc=kTRUE; | |
631 | } | |
632 | } | |
633 | ||
634 | return rc; | |
635 | } | |
636 | ||
6989bff3 | 637 | Int_t AliESDEvent::AddTrack(const AliESDtrack *t) |
638 | { | |
af885e0f | 639 | // Add track |
640 | TClonesArray &ftr = *fTracks; | |
641 | AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack(*t); | |
642 | track->SetID(fTracks->GetEntriesFast()-1); | |
643 | return track->GetID(); | |
644 | } | |
645 | ||
6989bff3 | 646 | void AliESDEvent::AddMuonTrack(const AliESDMuonTrack *t) |
647 | { | |
f0106218 | 648 | TClonesArray &fmu = *fMuonTracks; |
649 | new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(*t); | |
650 | } | |
651 | ||
6989bff3 | 652 | void AliESDEvent::AddPmdTrack(const AliESDPmdTrack *t) |
653 | { | |
f0106218 | 654 | TClonesArray &fpmd = *fPmdTracks; |
655 | new(fpmd[fPmdTracks->GetEntriesFast()]) AliESDPmdTrack(*t); | |
656 | } | |
657 | ||
6989bff3 | 658 | void AliESDEvent::AddTrdTrack(const AliESDTrdTrack *t) |
659 | { | |
f0106218 | 660 | TClonesArray &ftrd = *fTrdTracks; |
661 | new(ftrd[fTrdTracks->GetEntriesFast()]) AliESDTrdTrack(*t); | |
662 | } | |
663 | ||
664 | ||
665 | ||
666 | ||
6989bff3 | 667 | Int_t AliESDEvent::AddKink(const AliESDkink *c) |
668 | { | |
af885e0f | 669 | // Add kink |
670 | TClonesArray &fk = *fKinks; | |
671 | AliESDkink * kink = new(fk[fKinks->GetEntriesFast()]) AliESDkink(*c); | |
672 | kink->SetID(fKinks->GetEntriesFast()); // CKB different from the other imps.. | |
673 | return fKinks->GetEntriesFast()-1; | |
674 | } | |
675 | ||
f0106218 | 676 | |
6989bff3 | 677 | void AliESDEvent::AddCascade(const AliESDcascade *c) |
678 | { | |
f0106218 | 679 | TClonesArray &fc = *fCascades; |
680 | new(fc[fCascades->GetEntriesFast()]) AliESDcascade(*c); | |
681 | } | |
682 | ||
683 | ||
6989bff3 | 684 | Int_t AliESDEvent::AddCaloCluster(const AliESDCaloCluster *c) |
685 | { | |
af885e0f | 686 | // Add calocluster |
687 | TClonesArray &fc = *fCaloClusters; | |
688 | AliESDCaloCluster *clus = new(fc[fCaloClusters->GetEntriesFast()]) AliESDCaloCluster(*c); | |
689 | clus->SetID(fCaloClusters->GetEntriesFast()-1); | |
690 | return fCaloClusters->GetEntriesFast()-1; | |
691 | } | |
692 | ||
693 | ||
6989bff3 | 694 | void AliESDEvent::AddRawDataErrorLog(const AliRawDataErrorLog *log) { |
695 | TClonesArray &errlogs = *fErrorLogs; | |
696 | new(errlogs[errlogs.GetEntriesFast()]) AliRawDataErrorLog(*log); | |
697 | } | |
f0106218 | 698 | |
6989bff3 | 699 | void AliESDEvent::SetVertex(const AliESDVertex *vertex) |
700 | { | |
701 | // Set the SPD vertex | |
60e8f114 | 702 | // use already allocated space |
703 | if(fSPDVertex){ | |
316c6cd9 | 704 | *fSPDVertex = *vertex; |
6989bff3 | 705 | fSPDVertex->SetName(fgkESDListName[kSPDVertex]); |
60e8f114 | 706 | } |
707 | } | |
708 | ||
6989bff3 | 709 | void AliESDEvent::SetPrimaryVertex(const AliESDVertex *vertex) |
710 | { | |
711 | // Set the primary vertex | |
712 | // use already allocated space | |
60e8f114 | 713 | if(fPrimaryVertex){ |
316c6cd9 | 714 | *fPrimaryVertex = *vertex; |
6989bff3 | 715 | fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]); |
60e8f114 | 716 | } |
717 | } | |
718 | ||
6989bff3 | 719 | void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul) |
720 | { | |
721 | // Set the SPD Multiplicity | |
f0106218 | 722 | if(fSPDMult){ |
316c6cd9 | 723 | *fSPDMult = *mul; |
f0106218 | 724 | } |
725 | } | |
726 | ||
727 | ||
6989bff3 | 728 | void AliESDEvent::SetFMDData(AliESDFMD * obj) |
729 | { | |
af885e0f | 730 | // use already allocated space |
731 | if(fESDFMD){ | |
316c6cd9 | 732 | *fESDFMD = *obj; |
af885e0f | 733 | } |
734 | } | |
735 | ||
6989bff3 | 736 | void AliESDEvent::SetVZEROData(AliESDVZERO * obj) |
737 | { | |
af885e0f | 738 | // use already allocated space |
739 | if(fESDVZERO) | |
6989bff3 | 740 | *fESDVZERO = *obj; |
af885e0f | 741 | } |
742 | ||
6989bff3 | 743 | void AliESDEvent::GetESDfriend(AliESDfriend *ev) const |
744 | { | |
af885e0f | 745 | // |
746 | // Extracts the complementary info from the ESD | |
747 | // | |
748 | if (!ev) return; | |
749 | ||
750 | Int_t ntrk=GetNumberOfTracks(); | |
751 | ||
752 | for (Int_t i=0; i<ntrk; i++) { | |
80799a5f | 753 | AliESDtrack *t=GetTrack(i); |
af885e0f | 754 | const AliESDfriendTrack *f=t->GetFriendTrack(); |
755 | ev->AddTrack(f); | |
80799a5f | 756 | |
757 | t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack" | |
758 | ||
af885e0f | 759 | } |
760 | } | |
761 | ||
762 | ||
763 | void AliESDEvent::AddObject(TObject* obj) | |
764 | { | |
765 | // Add an object to the list of object. | |
766 | // Please be aware that in order to increase performance you should | |
767 | // refrain from using TObjArrays (if possible). Use TClonesArrays, instead. | |
768 | fESDObjects->SetOwner(kTRUE); | |
769 | fESDObjects->AddLast(obj); | |
770 | } | |
771 | ||
772 | ||
773 | void AliESDEvent::GetStdContent() | |
774 | { | |
775 | // set pointers for standard content | |
60e8f114 | 776 | // get by name much safer and not a big overhead since not called very often |
777 | ||
6989bff3 | 778 | fESDRun = (AliESDRun*)fESDObjects->FindObject(fgkESDListName[kESDRun]); |
779 | fHeader = (AliESDHeader*)fESDObjects->FindObject(fgkESDListName[kHeader]); | |
780 | fESDZDC = (AliESDZDC*)fESDObjects->FindObject(fgkESDListName[kESDZDC]); | |
781 | fESDFMD = (AliESDFMD*)fESDObjects->FindObject(fgkESDListName[kESDFMD]); | |
782 | fESDVZERO = (AliESDVZERO*)fESDObjects->FindObject(fgkESDListName[kESDVZERO]); | |
783 | fESDTZERO = (AliESDTZERO*)fESDObjects->FindObject(fgkESDListName[kESDTZERO]); | |
784 | fSPDVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kSPDVertex]); | |
785 | fPrimaryVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kPrimaryVertex]); | |
786 | fSPDMult = (AliMultiplicity*)fESDObjects->FindObject(fgkESDListName[kSPDMult]); | |
787 | fPHOSTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kPHOSTrigger]); | |
788 | fEMCALTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kEMCALTrigger]); | |
789 | fTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTracks]); | |
790 | fMuonTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonTracks]); | |
791 | fPmdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kPmdTracks]); | |
792 | fTrdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracks]); | |
793 | fV0s = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kV0s]); | |
794 | fCascades = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCascades]); | |
795 | fKinks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kKinks]); | |
796 | fCaloClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCaloClusters]); | |
797 | fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]); | |
af885e0f | 798 | |
799 | } | |
800 | ||
801 | void AliESDEvent::SetStdNames(){ | |
802 | // Set the names of the standard contents | |
60e8f114 | 803 | // |
804 | if(fESDObjects->GetEntries()==kESDListN){ | |
805 | for(int i = 0;i < fESDObjects->GetEntries();i++){ | |
806 | TObject *fObj = fESDObjects->At(i); | |
807 | if(fObj->InheritsFrom("TNamed")){ | |
6989bff3 | 808 | ((TNamed*)fObj)->SetName(fgkESDListName[i]); |
60e8f114 | 809 | } |
810 | else if(fObj->InheritsFrom("TClonesArray")){ | |
6989bff3 | 811 | ((TClonesArray*)fObj)->SetName(fgkESDListName[i]); |
60e8f114 | 812 | } |
813 | } | |
814 | } | |
815 | else{ | |
816 | printf("%s:%d SetStdNames() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__); | |
817 | } | |
af885e0f | 818 | } |
819 | ||
820 | void AliESDEvent::CreateStdContent() | |
821 | { | |
822 | // create the standard AOD content and set pointers | |
823 | ||
824 | // create standard objects and add them to the TList of objects | |
825 | AddObject(new AliESDRun()); | |
826 | AddObject(new AliESDHeader()); | |
827 | AddObject(new AliESDZDC()); | |
828 | AddObject(new AliESDFMD()); | |
829 | AddObject(new AliESDVZERO()); | |
830 | AddObject(new AliESDTZERO()); | |
831 | AddObject(new AliESDVertex()); | |
832 | AddObject(new AliESDVertex()); | |
833 | AddObject(new AliMultiplicity()); | |
834 | AddObject(new AliESDCaloTrigger()); | |
835 | AddObject(new AliESDCaloTrigger()); | |
836 | AddObject(new TClonesArray("AliESDtrack",0)); | |
837 | AddObject(new TClonesArray("AliESDMuonTrack",0)); | |
838 | AddObject(new TClonesArray("AliESDPmdTrack",0)); | |
839 | AddObject(new TClonesArray("AliESDTrdTrack",0)); | |
840 | AddObject(new TClonesArray("AliESDv0",0)); | |
841 | AddObject(new TClonesArray("AliESDcascade",0)); | |
842 | AddObject(new TClonesArray("AliESDkink",0)); | |
843 | AddObject(new TClonesArray("AliESDCaloCluster",0)); | |
844 | AddObject(new TClonesArray("AliRawDataErrorLog",0)); | |
845 | ||
846 | // check the order of the indices against enum... | |
847 | ||
af885e0f | 848 | // set names |
849 | SetStdNames(); | |
60e8f114 | 850 | // read back pointers |
851 | GetStdContent(); | |
af885e0f | 852 | } |
853 | ||
001b9beb | 854 | TObject* AliESDEvent::FindListObject(const char *name){ |
855 | if(fESDObjects)return fESDObjects->FindObject(name); | |
856 | return 0; | |
857 | } | |
858 | ||
cd1d4ee0 | 859 | Int_t AliESDEvent::GetPHOSClusters(TRefArray *clusters) const |
860 | { | |
861 | // fills the provided TRefArray with all found phos clusters | |
862 | ||
863 | clusters->Clear(); | |
864 | ||
865 | AliESDCaloCluster *cl = 0; | |
866 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
867 | ||
6989bff3 | 868 | if ( (cl = GetCaloCluster(i))) { |
cd1d4ee0 | 869 | if (cl->IsPHOS()){ |
870 | clusters->Add(cl); | |
871 | printf("IsPHOS %d Size: %d \n",i,clusters->GetEntriesFast()); | |
872 | } | |
873 | } | |
874 | } | |
875 | return clusters->GetEntriesFast(); | |
876 | } | |
877 | ||
878 | Int_t AliESDEvent::GetEMCALClusters(TRefArray *clusters) const | |
879 | { | |
880 | // fills the provided TRefArray with all found phos clusters | |
881 | ||
882 | clusters->Clear(); | |
883 | ||
884 | AliESDCaloCluster *cl = 0; | |
885 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
886 | ||
6989bff3 | 887 | if ( (cl = GetCaloCluster(i))) { |
cd1d4ee0 | 888 | if (cl->IsEMCAL()){ |
889 | clusters->Add(cl); | |
890 | printf("IsEMCAL %d Size: %d \n",i,clusters->GetEntriesFast()); | |
891 | } | |
892 | } | |
893 | } | |
894 | return clusters->GetEntriesFast(); | |
895 | } | |
896 | ||
897 | ||
af885e0f | 898 | void AliESDEvent::ReadFromTree(TTree *tree){ |
024c7734 | 899 | |
6989bff3 | 900 | if(!tree){ |
901 | Printf("%s %d AliESDEvent::ReadFromTree() Zero Pointer to Tree \n",(char*)__FILE__,__LINE__); | |
902 | return; | |
903 | } | |
904 | ||
024c7734 | 905 | // load the TTree |
6989bff3 | 906 | if(!tree->GetTree())tree->LoadTree(0); |
024c7734 | 907 | |
001b9beb | 908 | // if we find the "ESD" branch on the tree we do have the old structure |
af885e0f | 909 | if(tree->GetBranch("ESD")){ |
6989bff3 | 910 | char ** address = (char **)(tree->GetBranch("ESD")->GetAddress()); |
911 | if (!address) { | |
912 | printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__); | |
913 | tree->SetBranchAddress("ESD",&fESDOld); | |
914 | } else { | |
915 | printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__); | |
916 | printf("%s %d Branch already connected. Using existing branch address. \n",(char*)__FILE__,__LINE__); | |
917 | fESDOld = (AliESD*) (*address); | |
918 | } | |
919 | ||
920 | // have already connected the old ESD structure... ? | |
921 | // reuse also the pointer of the AlliESDEvent | |
922 | // otherwise create new ones | |
923 | ||
924 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); | |
925 | ||
926 | if(connectedList){ | |
927 | // If connected use the connected list of objects | |
928 | fESDObjects->Delete(); | |
929 | fESDObjects = connectedList; | |
930 | GetStdContent(); | |
931 | fConnected = true; | |
b93c2026 | 932 | return; |
6989bff3 | 933 | } |
934 | // else... | |
935 | CreateStdContent(); // create for copy | |
936 | // we are not owner of the list objects | |
937 | // must not delete it | |
938 | fESDObjects->SetOwner(kFALSE); | |
939 | fESDObjects->SetName("ESDObjectsConnectedToTree"); | |
940 | tree->GetUserInfo()->Add(fESDObjects); | |
941 | fConnected = true; | |
942 | return; | |
af885e0f | 943 | } |
944 | ||
6989bff3 | 945 | delete fESDOld; |
af885e0f | 946 | fESDOld = 0; |
af885e0f | 947 | // Try to find AliESDEvent |
948 | AliESDEvent *esdEvent = 0; | |
949 | esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent"); | |
001b9beb | 950 | if(esdEvent){ |
941603c0 | 951 | // Check if already connected to tree |
139f2194 | 952 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); |
953 | if (connectedList) { | |
954 | // If connected use the connected list if objects | |
955 | fESDObjects->Delete(); | |
b5bc83df | 956 | fESDObjects = connectedList; |
957 | GetStdContent(); | |
60e8f114 | 958 | fConnected = true; |
139f2194 | 959 | return; |
960 | } | |
961 | // Connect to tree | |
001b9beb | 962 | // prevent a memory leak when reading back the TList |
963 | delete fESDObjects; | |
964 | fESDObjects = 0; | |
af885e0f | 965 | // create a new TList from the UserInfo TList... |
966 | // copy constructor does not work... | |
967 | fESDObjects = (TList*)(esdEvent->GetList()->Clone()); | |
139f2194 | 968 | fESDObjects->SetOwner(kFALSE); |
af885e0f | 969 | if(fESDObjects->GetEntries()<kESDListN){ |
941603c0 | 970 | printf("%s %d AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n", |
971 | (char*)__FILE__,__LINE__,fESDObjects->GetEntries(),kESDListN); | |
af885e0f | 972 | } |
973 | // set the branch addresses | |
974 | TIter next(fESDObjects); | |
975 | TNamed *el; | |
976 | while((el=(TNamed*)next())){ | |
977 | TString bname(el->GetName()); | |
af885e0f | 978 | if(bname.CompareTo("AliESDfriend")==0) |
979 | { | |
980 | // AliESDfriend does not have a name ... | |
af885e0f | 981 | tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el)); |
982 | } | |
983 | else{ | |
984 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
985 | } | |
986 | } | |
987 | GetStdContent(); | |
988 | // when reading back we are not owner of the list | |
989 | // must not delete it | |
990 | fESDObjects->SetOwner(kFALSE); | |
60e8f114 | 991 | fESDObjects->SetName("ESDObjectsConnectedToTree"); |
139f2194 | 992 | // we are not owner of the list objects |
993 | // must not delete it | |
60e8f114 | 994 | tree->GetUserInfo()->Add(fESDObjects); |
995 | fConnected = true; | |
af885e0f | 996 | }// no esdEvent |
997 | else { | |
001b9beb | 998 | // we can't get the list from the user data, create standard content |
999 | // and set it by hand (no ESDfriend at the moment | |
af885e0f | 1000 | CreateStdContent(); |
1001 | TIter next(fESDObjects); | |
1002 | TNamed *el; | |
1003 | while((el=(TNamed*)next())){ | |
1004 | TString bname(el->GetName()); | |
1005 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
1006 | } | |
1007 | GetStdContent(); | |
1008 | // when reading back we are not owner of the list | |
1009 | // must not delete it | |
1010 | fESDObjects->SetOwner(kFALSE); | |
1011 | } | |
af885e0f | 1012 | } |
1013 | ||
1014 | ||
1015 | void AliESDEvent::CopyFromOldESD() | |
1016 | { | |
1017 | // Method which copies over everthing from the old esd structure to the | |
1018 | // new | |
1019 | ||
1020 | if(fESDOld){ | |
1021 | ResetStdContent(); | |
1022 | // Run | |
1023 | SetRunNumber(fESDOld->GetRunNumber()); | |
1024 | SetPeriodNumber(fESDOld->GetPeriodNumber()); | |
6ca8842a | 1025 | SetMagneticField(fESDOld->GetMagneticField()); |
af885e0f | 1026 | |
1027 | // leave out diamond ... | |
1028 | // SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);} | |
1029 | ||
1030 | // header | |
1031 | SetTriggerMask(fESDOld->GetTriggerMask()); | |
1032 | SetOrbitNumber(fESDOld->GetOrbitNumber()); | |
1033 | SetTimeStamp(fESDOld->GetTimeStamp()); | |
1034 | SetEventType(fESDOld->GetEventType()); | |
1035 | SetEventNumberInFile(fESDOld->GetEventNumberInFile()); | |
1036 | SetBunchCrossNumber(fESDOld->GetBunchCrossNumber()); | |
1037 | SetTriggerCluster(fESDOld->GetTriggerCluster()); | |
1038 | ||
1039 | // ZDC | |
1040 | ||
1041 | SetZDC(fESDOld->GetZDCN1Energy(), | |
1042 | fESDOld->GetZDCP1Energy(), | |
1043 | fESDOld->GetZDCEMEnergy(), | |
1044 | fESDOld->GetZDCN2Energy(), | |
1045 | fESDOld->GetZDCP2Energy(), | |
1046 | fESDOld->GetZDCParticipants()); | |
1047 | ||
1048 | // FMD | |
1049 | ||
cb6aa27f | 1050 | if(fESDOld->GetFMDData())SetFMDData(fESDOld->GetFMDData()); |
af885e0f | 1051 | |
1052 | // T0 | |
1053 | ||
1054 | SetT0zVertex(fESDOld->GetT0zVertex()); | |
1055 | SetT0(fESDOld->GetT0()); | |
1056 | // leave amps out | |
1057 | ||
1058 | // VZERO | |
c06eaba2 | 1059 | if (fESDOld->GetVZEROData()) SetVZEROData(fESDOld->GetVZEROData()); |
af885e0f | 1060 | |
cb6aa27f | 1061 | if(fESDOld->GetVertex())SetVertex(fESDOld->GetVertex()); |
af885e0f | 1062 | |
cb6aa27f | 1063 | if(fESDOld->GetPrimaryVertex())SetPrimaryVertex(fESDOld->GetPrimaryVertex()); |
af885e0f | 1064 | |
cb6aa27f | 1065 | if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity()); |
af885e0f | 1066 | |
1067 | for(int i = 0;i<fESDOld->GetNumberOfTracks();i++){ | |
1068 | AddTrack(fESDOld->GetTrack(i)); | |
1069 | } | |
1070 | ||
1071 | for(int i = 0;i<fESDOld->GetNumberOfMuonTracks();i++){ | |
1072 | AddMuonTrack(fESDOld->GetMuonTrack(i)); | |
1073 | } | |
1074 | ||
1075 | for(int i = 0;i<fESDOld->GetNumberOfPmdTracks();i++){ | |
1076 | AddPmdTrack(fESDOld->GetPmdTrack(i)); | |
1077 | } | |
1078 | ||
1079 | for(int i = 0;i<fESDOld->GetNumberOfTrdTracks();i++){ | |
1080 | AddTrdTrack(fESDOld->GetTrdTrack(i)); | |
1081 | } | |
1082 | ||
1083 | for(int i = 0;i<fESDOld->GetNumberOfV0s();i++){ | |
1084 | AddV0(fESDOld->GetV0(i)); | |
1085 | } | |
1086 | ||
1087 | for(int i = 0;i<fESDOld->GetNumberOfCascades();i++){ | |
1088 | AddCascade(fESDOld->GetCascade(i)); | |
1089 | } | |
1090 | ||
1091 | for(int i = 0;i<fESDOld->GetNumberOfKinks();i++){ | |
1092 | AddKink(fESDOld->GetKink(i)); | |
1093 | } | |
1094 | ||
1095 | ||
1096 | for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){ | |
1097 | AddCaloCluster(fESDOld->GetCaloCluster(i)); | |
1098 | } | |
1099 | }// if fesdold | |
1100 | } | |
1101 | ||
1102 | ||
1103 |