]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDEvent.cxx
ClassDef and ClassImp for all classes
[u/mrichter/AliRoot.git] / STEER / AliESDEvent.cxx
CommitLineData
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*/
7d44c466 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>
2a3dfb14 38#include <TROOT.h>
39#include <TInterpreter.h>
af885e0f 40
41#include "AliESDEvent.h"
42#include "AliESDfriend.h"
43#include "AliESDVZERO.h"
af885e0f 44#include "AliESDFMD.h"
45#include "AliESD.h"
f0106218 46#include "AliESDMuonTrack.h"
47#include "AliESDPmdTrack.h"
48#include "AliESDTrdTrack.h"
49#include "AliESDVertex.h"
50#include "AliESDcascade.h"
51#include "AliESDPmdTrack.h"
52#include "AliESDTrdTrack.h"
53#include "AliESDVertex.h"
518573d7 54#include "AliVertexerTracks.h"
f0106218 55#include "AliESDcascade.h"
56#include "AliESDkink.h"
57#include "AliESDtrack.h"
58#include "AliESDHLTtrack.h"
59#include "AliESDCaloCluster.h"
e649177a 60#include "AliESDCaloCells.h"
f0106218 61#include "AliESDv0.h"
62#include "AliESDFMD.h"
63#include "AliESDVZERO.h"
64#include "AliMultiplicity.h"
65#include "AliRawDataErrorLog.h"
e649177a 66#include "AliLog.h"
bd95bae7 67#include "AliESDACORDE.h"
8b12d288 68#include "AliESDHLTDecision.h"
69
af885e0f 70ClassImp(AliESDEvent)
71
60e8f114 72
73
74// here we define the names, some classes are no TNamed, therefore the classnames
75// are the Names
6989bff3 76 const char* AliESDEvent::fgkESDListName[kESDListN] = {"AliESDRun",
60e8f114 77 "AliESDHeader",
78 "AliESDZDC",
79 "AliESDFMD",
80 "AliESDVZERO",
81 "AliESDTZERO",
06cc9d95 82 "TPCVertex",
60e8f114 83 "SPDVertex",
fe25f014 84 "PrimaryVertex",
60e8f114 85 "AliMultiplicity",
86 "PHOSTrigger",
87 "EMCALTrigger",
04d01397 88 "SPDPileupVertices",
89 "TrkPileupVertices",
60e8f114 90 "Tracks",
91 "MuonTracks",
92 "PmdTracks",
93 "TrdTracks",
94 "V0s",
72da5d8c 95 "Cascades",
60e8f114 96 "Kinks",
97 "CaloClusters",
e649177a 98 "EMCALCells",
99 "PHOSCells",
bd95bae7 100 "AliRawDataErrorLogs",
101 "AliESDACORDE"};
102
af885e0f 103//______________________________________________________________________________
104AliESDEvent::AliESDEvent():
024c7734 105 AliVEvent(),
af885e0f 106 fESDObjects(new TList()),
107 fESDRun(0),
108 fHeader(0),
109 fESDZDC(0),
110 fESDFMD(0),
111 fESDVZERO(0),
112 fESDTZERO(0),
06cc9d95 113 fTPCVertex(0),
af885e0f 114 fSPDVertex(0),
115 fPrimaryVertex(0),
116 fSPDMult(0),
117 fPHOSTrigger(0),
118 fEMCALTrigger(0),
bd95bae7 119 fESDACORDE(0),
04d01397 120 fSPDPileupVertices(0),
121 fTrkPileupVertices(0),
af885e0f 122 fTracks(0),
123 fMuonTracks(0),
124 fPmdTracks(0),
125 fTrdTracks(0),
126 fV0s(0),
127 fCascades(0),
128 fKinks(0),
129 fCaloClusters(0),
e649177a 130 fEMCALCells(0), fPHOSCells(0),
af885e0f 131 fErrorLogs(0),
132 fESDOld(0),
1bd10080 133 fESDFriendOld(0),
60e8f114 134 fConnected(kFALSE),
7a54a755 135 fUseOwnList(kFALSE)
af885e0f 136{
137}
138//______________________________________________________________________________
139AliESDEvent::AliESDEvent(const AliESDEvent& esd):
024c7734 140 AliVEvent(esd),
af885e0f 141 fESDObjects(new TList()),
142 fESDRun(new AliESDRun(*esd.fESDRun)),
143 fHeader(new AliESDHeader(*esd.fHeader)),
144 fESDZDC(new AliESDZDC(*esd.fESDZDC)),
145 fESDFMD(new AliESDFMD(*esd.fESDFMD)),
146 fESDVZERO(new AliESDVZERO(*esd.fESDVZERO)),
147 fESDTZERO(new AliESDTZERO(*esd.fESDTZERO)),
06cc9d95 148 fTPCVertex(new AliESDVertex(*esd.fTPCVertex)),
af885e0f 149 fSPDVertex(new AliESDVertex(*esd.fSPDVertex)),
150 fPrimaryVertex(new AliESDVertex(*esd.fPrimaryVertex)),
151 fSPDMult(new AliMultiplicity(*esd.fSPDMult)),
152 fPHOSTrigger(new AliESDCaloTrigger(*esd.fPHOSTrigger)),
153 fEMCALTrigger(new AliESDCaloTrigger(*esd.fEMCALTrigger)),
bd95bae7 154 fESDACORDE(new AliESDACORDE(*esd.fESDACORDE)),
04d01397 155 fSPDPileupVertices(new TClonesArray(*esd.fSPDPileupVertices)),
156 fTrkPileupVertices(new TClonesArray(*esd.fTrkPileupVertices)),
af885e0f 157 fTracks(new TClonesArray(*esd.fTracks)),
158 fMuonTracks(new TClonesArray(*esd.fMuonTracks)),
159 fPmdTracks(new TClonesArray(*esd.fPmdTracks)),
160 fTrdTracks(new TClonesArray(*esd.fTrdTracks)),
161 fV0s(new TClonesArray(*esd.fV0s)),
162 fCascades(new TClonesArray(*esd.fCascades)),
163 fKinks(new TClonesArray(*esd.fKinks)),
164 fCaloClusters(new TClonesArray(*esd.fCaloClusters)),
e649177a 165 fEMCALCells(new AliESDCaloCells(*esd.fEMCALCells)),
166 fPHOSCells(new AliESDCaloCells(*esd.fPHOSCells)),
af885e0f 167 fErrorLogs(new TClonesArray(*esd.fErrorLogs)),
7251b311 168 fESDOld(esd.fESDOld ? new AliESD(*esd.fESDOld) : 0),
169 fESDFriendOld(esd.fESDFriendOld ? new AliESDfriend(*esd.fESDFriendOld) : 0),
60e8f114 170 fConnected(esd.fConnected),
7a54a755 171 fUseOwnList(esd.fUseOwnList)
af885e0f 172
173{
174 // CKB init in the constructor list and only add here ...
175 AddObject(fESDRun);
176 AddObject(fHeader);
177 AddObject(fESDZDC);
178 AddObject(fESDFMD);
179 AddObject(fESDVZERO);
180 AddObject(fESDTZERO);
06cc9d95 181 AddObject(fTPCVertex);
af885e0f 182 AddObject(fSPDVertex);
183 AddObject(fPrimaryVertex);
184 AddObject(fSPDMult);
185 AddObject(fPHOSTrigger);
186 AddObject(fEMCALTrigger);
04d01397 187 AddObject(fSPDPileupVertices);
188 AddObject(fTrkPileupVertices);
af885e0f 189 AddObject(fTracks);
190 AddObject(fMuonTracks);
191 AddObject(fPmdTracks);
192 AddObject(fTrdTracks);
193 AddObject(fV0s);
194 AddObject(fCascades);
195 AddObject(fKinks);
196 AddObject(fCaloClusters);
e649177a 197 AddObject(fEMCALCells);
198 AddObject(fPHOSCells);
af885e0f 199 AddObject(fErrorLogs);
bd95bae7 200 AddObject(fESDACORDE);
af885e0f 201
202 GetStdContent();
203
204}
205
206//______________________________________________________________________________
207AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) {
208
209 // Assignment operator
210
211 if(&source == this) return *this;
024c7734 212 AliVEvent::operator=(source);
af885e0f 213
732a24fe 214 // This assumes that the list is already created
215 // and that the virtual void Copy(Tobject&) function
216 // is correctly implemented in the derived class
217 // otherwise only TObject::Copy() will be used
218
219
102c56c8 220
732a24fe 221 if((fESDObjects->GetSize()==0)&&(source.fESDObjects->GetSize()>=kESDListN)){
222 // We cover the case that we do not yet have the
223 // standard content but the source has it
224 CreateStdContent();
225 }
226
227 TIter next(source.GetList());
228 TObject *its = 0;
229 TString name;
230 while ((its = next())) {
231 name.Form("%s", its->GetName());
232 TObject *mine = fESDObjects->FindObject(name.Data());
233 if(!mine){
102c56c8 234 TClass* pClass=TClass::GetClass(its->ClassName());
235 if (!pClass) {
236 AliWarning(Form("Can not find class description for entry %s (%s)\n",
237 its->ClassName(), name.Data()));
238 continue;
239 }
732a24fe 240
102c56c8 241 mine=(TObject*)pClass->New();
242 if(!mine){
243 // not in this: can be added to list
244 AliWarning(Form("%s:%d Could not find %s for copying \n",
245 (char*)__FILE__,__LINE__,name.Data()));
246 continue;
247 }
248 if(mine->InheritsFrom("TNamed")){
249 ((TNamed*)mine)->SetName(name);
250 }
251 else if(mine->InheritsFrom("TCollection")){
252 if(mine->InheritsFrom("TClonesArray"))
9137be62 253 dynamic_cast<TClonesArray*>(mine)->SetClass(dynamic_cast<TClonesArray*>(its)->GetClass());
102c56c8 254 dynamic_cast<TCollection*>(mine)->SetName(name);
255 }
256 AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
257 AddObject(mine);
258 }
259
732a24fe 260 if(!its->InheritsFrom("TCollection")){
261 // simple objects
262 its->Copy(*mine);
263 }
264 else if(its->InheritsFrom("TClonesArray")){
265 // Create or expand the tclonesarray pointers
266 // so we can directly copy to the object
267 TClonesArray *its_tca = (TClonesArray*)its;
268 TClonesArray *mine_tca = (TClonesArray*)mine;
269
270 // this leaves the capacity of the TClonesArray the same
271 // except for a factor of 2 increase when size > capacity
272 // does not release any memory occupied by the tca
273 mine_tca->ExpandCreate(its_tca->GetEntriesFast());
274 for(int i = 0;i < its_tca->GetEntriesFast();++i){
275 // copy
276 TObject *mine_tca_obj = mine_tca->At(i);
277 TObject *its_tca_obj = its_tca->At(i);
278 // no need to delete first
279 // pointers within the class should be handled by Copy()...
280 // Can there be Empty slots?
281 its_tca_obj->Copy(*mine_tca_obj);
282 }
283 }
284 else{
285 AliWarning(Form("%s:%d cannot copy TCollection \n",
286 (char*)__FILE__,__LINE__));
287 }
288 }
af885e0f 289
60e8f114 290 fConnected = source.fConnected;
a2fbb067 291 fUseOwnList = source.fUseOwnList;
af885e0f 292
af885e0f 293 return *this;
294
295}
296
297
298//______________________________________________________________________________
299AliESDEvent::~AliESDEvent()
300{
301 //
302 // Standard destructor
303 //
304
001b9beb 305 // everthing on the list gets deleted automatically
139f2194 306
307
60e8f114 308 if(fESDObjects&&!fConnected)
309 {
310 delete fESDObjects;
311 fESDObjects = 0;
312 }
139f2194 313
60e8f114 314
af885e0f 315}
316
732a24fe 317void AliESDEvent::Copy(TObject &obj) const {
318
319 // interface to TOBject::Copy
320 // Copies the content of this into obj!
321 // bascially obj = *this
322
323 if(this==&obj)return;
324 AliESDEvent *robj = dynamic_cast<AliESDEvent*>(&obj);
325 if(!robj)return; // not an AliESEvent
326 *robj = *this;
327 return;
328}
329
af885e0f 330//______________________________________________________________________________
331void AliESDEvent::Reset()
332{
333
102c56c8 334 // Handle the cases
335 // Std content + Non std content
336
af885e0f 337 // Reset the standard contents
338 ResetStdContent();
102c56c8 339
340 // reset for the old data without AliESDEvent...
af885e0f 341 if(fESDOld)fESDOld->Reset();
d7749dec 342 if(fESDFriendOld){
343 fESDFriendOld->~AliESDfriend();
344 new (fESDFriendOld) AliESDfriend();
345 }
102c56c8 346 //
347
348 if(fESDObjects->GetSize()>kESDListN){
349 // we have non std content
350 // this also covers esdfriends
351 for(int i = kESDListN;i < fESDObjects->GetSize();++i){
352 TObject *pObject = fESDObjects->At(i);
353 // TClonesArrays
354 if(pObject->InheritsFrom(TClonesArray::Class())){
355 ((TClonesArray*)pObject)->Delete();
356 }
357 else if(!pObject->InheritsFrom(TCollection::Class())){
358 ResetWithPlacementNew(pObject);
359 }
360 else{
65b25288 361 AliWarning(Form("No reset for %s \n",
102c56c8 362 pObject->ClassName()));
363 }
364 }
d7749dec 365 }
366
102c56c8 367}
368
369Bool_t AliESDEvent::ResetWithPlacementNew(TObject *pObject){
370 Long_t dtoronly = TObject::GetDtorOnly();
371 TClass *pClass = TClass::GetClass(pObject->ClassName());
372 TObject::SetDtorOnly(pObject);
373 delete pObject;
374 // Recreate with placement new
375 pClass->New(pObject);
376 // Restore the state.
377 TObject::SetDtorOnly((void*)dtoronly);
378 return kTRUE;
af885e0f 379}
380
381void AliESDEvent::ResetStdContent()
382{
383 // Reset the standard contents
384 if(fESDRun) fESDRun->Reset();
385 if(fHeader) fHeader->Reset();
386 if(fESDZDC) fESDZDC->Reset();
0f0eb29c 387 if(fESDFMD) {
a2fbb067 388 fESDFMD->Clear();
0f0eb29c 389 }
6989bff3 390 if(fESDVZERO){
391 // reset by callin d'to /c'tor keep the pointer
392 fESDVZERO->~AliESDVZERO();
393 new (fESDVZERO) AliESDVZERO();
394 }
bd95bae7 395 if(fESDACORDE){
396 fESDACORDE->~AliESDACORDE();
397 new (fESDACORDE) AliESDACORDE();
398 }
af885e0f 399 if(fESDTZERO) fESDTZERO->Reset();
400 // CKB no clear/reset implemented
06cc9d95 401 if(fTPCVertex){
402 fTPCVertex->~AliESDVertex();
403 new (fTPCVertex) AliESDVertex();
404 fTPCVertex->SetName(fgkESDListName[kTPCVertex]);
405 }
af885e0f 406 if(fSPDVertex){
316c6cd9 407 fSPDVertex->~AliESDVertex();
af885e0f 408 new (fSPDVertex) AliESDVertex();
6989bff3 409 fSPDVertex->SetName(fgkESDListName[kSPDVertex]);
af885e0f 410 }
411 if(fPrimaryVertex){
316c6cd9 412 fPrimaryVertex->~AliESDVertex();
af885e0f 413 new (fPrimaryVertex) AliESDVertex();
6989bff3 414 fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]);
af885e0f 415 }
316c6cd9 416 if(fSPDMult){
417 fSPDMult->~AliMultiplicity();
418 new (fSPDMult) AliMultiplicity();
419 }
af885e0f 420 if(fPHOSTrigger)fPHOSTrigger->Reset();
421 if(fEMCALTrigger)fEMCALTrigger->Reset();
04d01397 422 if(fSPDPileupVertices)fSPDPileupVertices->Delete();
423 if(fTrkPileupVertices)fTrkPileupVertices->Delete();
bc9a7b42 424 if(fTracks)fTracks->Delete();
6989bff3 425 if(fMuonTracks)fMuonTracks->Delete();
426 if(fPmdTracks)fPmdTracks->Delete();
427 if(fTrdTracks)fTrdTracks->Delete();
428 if(fV0s)fV0s->Delete();
429 if(fCascades)fCascades->Delete();
430 if(fKinks)fKinks->Delete();
bc9a7b42 431 if(fCaloClusters)fCaloClusters->Delete();
e649177a 432 if(fPHOSCells)fPHOSCells->DeleteContainer();
433 if(fEMCALCells)fEMCALCells->DeleteContainer();
16167d49 434 if(fErrorLogs) fErrorLogs->Delete();
af885e0f 435
d7749dec 436 // don't reset fconnected fConnected and the list
60e8f114 437
af885e0f 438}
439
440
441Int_t AliESDEvent::AddV0(const AliESDv0 *v) {
442 //
443 // Add V0
444 //
445 TClonesArray &fv = *fV0s;
446 Int_t idx=fV0s->GetEntriesFast();
447 new(fv[idx]) AliESDv0(*v);
448 return idx;
449}
450
451//______________________________________________________________________________
452void AliESDEvent::Print(Option_t *) const
453{
454 //
455 // Print header information of the event
456 //
457 printf("ESD run information\n");
458 printf("Event # in file %d Bunch crossing # %d Orbit # %d Period # %d Run # %d Trigger %lld Magnetic field %f \n",
459 GetEventNumberInFile(),
460 GetBunchCrossNumber(),
461 GetOrbitNumber(),
462 GetPeriodNumber(),
463 GetRunNumber(),
464 GetTriggerMask(),
465 GetMagneticField() );
c017f53f 466 if (fPrimaryVertex)
467 printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n",
af885e0f 468 fPrimaryVertex->GetXv(), fPrimaryVertex->GetXRes(),
469 fPrimaryVertex->GetYv(), fPrimaryVertex->GetYRes(),
470 fPrimaryVertex->GetZv(), fPrimaryVertex->GetZRes());
1c7554f9 471 printf("Mean vertex in RUN: X=%.4f Y=%.4f Z=%.4f cm\n",
472 GetDiamondX(),GetDiamondY(),GetDiamondZ());
c017f53f 473 if(fSPDMult)
af885e0f 474 printf("SPD Multiplicity. Number of tracklets %d \n",
475 fSPDMult->GetNumberOfTracklets());
04d01397 476 printf("Number of pileup primary vertices reconstructed with SPD %d\n",
c017f53f 477 GetNumberOfPileupVerticesSPD());
04d01397 478 printf("Number of pileup primary vertices reconstructed using the tracks %d\n",
c017f53f 479 GetNumberOfPileupVerticesTracks());
af885e0f 480 printf("Number of tracks: \n");
481 printf(" charged %d\n", GetNumberOfTracks());
482 printf(" muon %d\n", GetNumberOfMuonTracks());
483 printf(" pmd %d\n", GetNumberOfPmdTracks());
484 printf(" trd %d\n", GetNumberOfTrdTracks());
485 printf(" v0 %d\n", GetNumberOfV0s());
486 printf(" cascades %d\n", GetNumberOfCascades());
487 printf(" kinks %d\n", GetNumberOfKinks());
38f940fb 488 if(fPHOSCells)printf(" PHOSCells %d\n", fPHOSCells->GetNumberOfCells());
489 else printf(" PHOSCells not in the Event\n");
490 if(fEMCALCells)printf(" EMCALCells %d\n", fEMCALCells->GetNumberOfCells());
491 else printf(" EMCALCells not in the Event\n");
af885e0f 492 printf(" CaloClusters %d\n", GetNumberOfCaloClusters());
af885e0f 493 printf(" FMD %s\n", (fESDFMD ? "yes" : "no"));
494 printf(" VZERO %s\n", (fESDVZERO ? "yes" : "no"));
8b12d288 495 TObject* pHLTDecision=GetHLTTriggerDecision();
496 printf("HLT trigger decision: %s\n", pHLTDecision?pHLTDecision->GetOption():"not available");
497 if (pHLTDecision) pHLTDecision->Print("compact");
024c7734 498
499 return;
af885e0f 500}
501
7d44c466 502void AliESDEvent::SetESDfriend(const AliESDfriend *ev) const {
af885e0f 503 //
504 // Attaches the complementary info to the ESD
505 //
506 if (!ev) return;
507
5300bdab 508 // to be sure that we set the tracks also
509 // in case of old esds
60e8f114 510 // if(fESDOld)CopyFromOldESD();
5300bdab 511
af885e0f 512 Int_t ntrk=ev->GetNumberOfTracks();
513
514 for (Int_t i=0; i<ntrk; i++) {
515 const AliESDfriendTrack *f=ev->GetTrack(i);
516 GetTrack(i)->SetFriendTrack(f);
517 }
518}
519
7d44c466 520Bool_t AliESDEvent::RemoveKink(Int_t rm) const {
a023d8d8 521 // ---------------------------------------------------------
522 // Remove a kink candidate and references to it from ESD,
523 // if this candidate does not come from a reconstructed decay
524 // Not yet implemented...
525 // ---------------------------------------------------------
526 Int_t last=GetNumberOfKinks()-1;
527 if ((rm<0)||(rm>last)) return kFALSE;
528
529 return kTRUE;
530}
531
7d44c466 532Bool_t AliESDEvent::RemoveV0(Int_t rm) const {
a023d8d8 533 // ---------------------------------------------------------
534 // Remove a V0 candidate and references to it from ESD,
535 // if this candidate does not come from a reconstructed decay
536 // ---------------------------------------------------------
537 Int_t last=GetNumberOfV0s()-1;
538 if ((rm<0)||(rm>last)) return kFALSE;
539
540 AliESDv0 *v0=GetV0(rm);
541 Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex();
542
543 v0=GetV0(last);
544 Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex();
545
546 Int_t used=0;
547
548 // Check if this V0 comes from a reconstructed decay
549 Int_t ncs=GetNumberOfCascades();
550 for (Int_t n=0; n<ncs; n++) {
551 AliESDcascade *cs=GetCascade(n);
552
553 Int_t csIdxP=cs->GetPindex();
554 Int_t csIdxN=cs->GetNindex();
555
556 if (idxP==csIdxP)
557 if (idxN==csIdxN) return kFALSE;
558
559 if (csIdxP==lastIdxP)
560 if (csIdxN==lastIdxN) used++;
561 }
562
563 //Replace the removed V0 with the last V0
564 TClonesArray &a=*fV0s;
565 delete a.RemoveAt(rm);
566
567 if (rm==last) return kTRUE;
568
569 //v0 is pointing to the last V0 candidate...
570 new (a[rm]) AliESDv0(*v0);
571 delete a.RemoveAt(last);
572
573 if (!used) return kTRUE;
574
575
576 // Remap the indices of the daughters of reconstructed decays
577 for (Int_t n=0; n<ncs; n++) {
578 AliESDcascade *cs=GetCascade(n);
579
580
581 Int_t csIdxP=cs->GetPindex();
582 Int_t csIdxN=cs->GetNindex();
583
584 if (csIdxP==lastIdxP)
585 if (csIdxN==lastIdxN) {
586 cs->AliESDv0::SetIndex(1,idxP);
587 cs->AliESDv0::SetIndex(0,idxN);
588 used--;
589 if (!used) return kTRUE;
590 }
591 }
592
593 return kTRUE;
594}
595
7d44c466 596Bool_t AliESDEvent::RemoveTrack(Int_t rm) const {
d64bd07d 597 // ---------------------------------------------------------
7f68891d 598 // Remove a track and references to it from ESD,
599 // if this track does not come from a reconstructed decay
d64bd07d 600 // ---------------------------------------------------------
7f68891d 601 Int_t last=GetNumberOfTracks()-1;
602 if ((rm<0)||(rm>last)) return kFALSE;
603
604 Int_t used=0;
d64bd07d 605
6fca035d 606 // Check if this track comes from the reconstructed primary vertices
607 if (fTPCVertex && fTPCVertex->GetStatus()) {
608 UShort_t *primIdx=fTPCVertex->GetIndices();
609 Int_t n=fTPCVertex->GetNIndices();
610 while (n--) {
611 Int_t idx=Int_t(primIdx[n]);
612 if (rm==idx) return kFALSE;
613 if (idx==last) used++;
614 }
615 }
616 if (fPrimaryVertex && fPrimaryVertex->GetStatus()) {
617 UShort_t *primIdx=fPrimaryVertex->GetIndices();
618 Int_t n=fPrimaryVertex->GetNIndices();
619 while (n--) {
620 Int_t idx=Int_t(primIdx[n]);
621 if (rm==idx) return kFALSE;
622 if (idx==last) used++;
623 }
624 }
625
d64bd07d 626 // Check if this track comes from a reconstructed decay
7f68891d 627 Int_t nv0=GetNumberOfV0s();
628 for (Int_t n=0; n<nv0; n++) {
629 AliESDv0 *v0=GetV0(n);
630
631 Int_t idx=v0->GetNindex();
632 if (rm==idx) return kFALSE;
633 if (idx==last) used++;
634
635 idx=v0->GetPindex();
636 if (rm==idx) return kFALSE;
637 if (idx==last) used++;
638 }
639
640 Int_t ncs=GetNumberOfCascades();
641 for (Int_t n=0; n<ncs; n++) {
642 AliESDcascade *cs=GetCascade(n);
d64bd07d 643
7f68891d 644 Int_t idx=cs->GetIndex();
645 if (rm==idx) return kFALSE;
646 if (idx==last) used++;
fdbe4208 647
648 AliESDv0 *v0=cs;
649 idx=v0->GetNindex();
650 if (rm==idx) return kFALSE;
651 if (idx==last) used++;
652
653 idx=v0->GetPindex();
654 if (rm==idx) return kFALSE;
655 if (idx==last) used++;
7f68891d 656 }
657
658 Int_t nkn=GetNumberOfKinks();
659 for (Int_t n=0; n<nkn; n++) {
660 AliESDkink *kn=GetKink(n);
661
662 Int_t idx=kn->GetIndex(0);
663 if (rm==idx) return kFALSE;
664 if (idx==last) used++;
665
666 idx=kn->GetIndex(1);
667 if (rm==idx) return kFALSE;
668 if (idx==last) used++;
669 }
d64bd07d 670
8303b114 671 // Check if this track is associated with a CaloCluster
672 Int_t ncl=GetNumberOfCaloClusters();
673 for (Int_t n=0; n<ncl; n++) {
674 AliESDCaloCluster *cluster=GetCaloCluster(n);
675 TArrayI *arr=cluster->GetTracksMatched();
676 Int_t s=arr->GetSize();
677 while (s--) {
678 Int_t idx=arr->At(s);
679 if (rm==idx) return kFALSE;
680 if (idx==last) used++;
681 }
682 }
683
684
d64bd07d 685
7f68891d 686 //Replace the removed track with the last track
687 TClonesArray &a=*fTracks;
688 delete a.RemoveAt(rm);
689
690 if (rm==last) return kTRUE;
691
692 AliESDtrack *t=GetTrack(last);
693 t->SetID(rm);
694 new (a[rm]) AliESDtrack(*t);
695 delete a.RemoveAt(last);
696
6fca035d 697
7f68891d 698 if (!used) return kTRUE;
699
700
6fca035d 701 // Remap the indices of the tracks used for the primary vertex reconstruction
702 if (fTPCVertex && fTPCVertex->GetStatus()) {
703 UShort_t *primIdx=fTPCVertex->GetIndices();
704 Int_t n=fTPCVertex->GetNIndices();
705 while (n--) {
706 Int_t idx=Int_t(primIdx[n]);
707 if (idx==last) {
708 primIdx[n]=Short_t(rm);
709 used--;
710 if (!used) return kTRUE;
711 }
712 }
713 }
714 if (fPrimaryVertex && fPrimaryVertex->GetStatus()) {
715 UShort_t *primIdx=fPrimaryVertex->GetIndices();
716 Int_t n=fPrimaryVertex->GetNIndices();
717 while (n--) {
718 Int_t idx=Int_t(primIdx[n]);
719 if (idx==last) {
720 primIdx[n]=Short_t(rm);
721 used--;
722 if (!used) return kTRUE;
723 }
724 }
725 }
726
7f68891d 727 // Remap the indices of the daughters of reconstructed decays
728 for (Int_t n=0; n<nv0; n++) {
729 AliESDv0 *v0=GetV0(n);
730 if (v0->GetIndex(0)==last) {
731 v0->SetIndex(0,rm);
732 used--;
733 if (!used) return kTRUE;
734 }
735 if (v0->GetIndex(1)==last) {
736 v0->SetIndex(1,rm);
737 used--;
738 if (!used) return kTRUE;
739 }
740 }
741
742 for (Int_t n=0; n<ncs; n++) {
743 AliESDcascade *cs=GetCascade(n);
744 if (cs->GetIndex()==last) {
745 cs->SetIndex(rm);
746 used--;
747 if (!used) return kTRUE;
748 }
fdbe4208 749 AliESDv0 *v0=cs;
750 if (v0->GetIndex(0)==last) {
751 v0->SetIndex(0,rm);
752 used--;
753 if (!used) return kTRUE;
754 }
755 if (v0->GetIndex(1)==last) {
756 v0->SetIndex(1,rm);
757 used--;
758 if (!used) return kTRUE;
759 }
7f68891d 760 }
761
762 for (Int_t n=0; n<nkn; n++) {
763 AliESDkink *kn=GetKink(n);
764 if (kn->GetIndex(0)==last) {
765 kn->SetIndex(rm,0);
766 used--;
767 if (!used) return kTRUE;
768 }
769 if (kn->GetIndex(1)==last) {
770 kn->SetIndex(rm,1);
771 used--;
772 if (!used) return kTRUE;
773 }
774 }
d64bd07d 775
8303b114 776 // Remap the indices of the tracks accosicated with CaloClusters
777 for (Int_t n=0; n<ncl; n++) {
778 AliESDCaloCluster *cluster=GetCaloCluster(n);
779 TArrayI *arr=cluster->GetTracksMatched();
780 Int_t s=arr->GetSize();
781 while (s--) {
782 Int_t idx=arr->At(s);
783 if (idx==last) {
784 arr->AddAt(rm,s);
785 used--;
786 if (!used) return kTRUE;
787 }
788 }
789 }
790
d64bd07d 791 return kTRUE;
792}
793
794
7f68891d 795Bool_t AliESDEvent::Clean(Float_t *cleanPars) {
796 //
797 // Remove the data which are not needed for the physics analysis.
798 //
a023d8d8 799 // 1) Cleaning the V0 candidates
800 // ---------------------------
801 // If the cosine of the V0 pointing angle "csp" and
802 // the DCA between the daughter tracks "dca" does not satisfy
803 // the conditions
804 //
805 // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1])
806 //
807 // an attempt to remove this V0 candidate from ESD is made.
808 //
809 // The V0 candidate gets removed if it does not belong to any
810 // recosntructed cascade decay
811 //
812 // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999
813 //
814 // 2) Cleaning the tracks
815 // ----------------------
816 // If track's transverse parameter is larger than cleanPars[2]
7f68891d 817 // OR
a023d8d8 818 // track's longitudinal parameter is larger than cleanPars[3]
819 // an attempt to remove this track from ESD is made.
7f68891d 820 //
a023d8d8 821 // The track gets removed if it does not come
822 // from a reconstructed decay
7f68891d 823 //
a023d8d8 824 Bool_t rc=kFALSE;
825
826 Float_t dcaMax=cleanPars[0];
827 Float_t cspMin=cleanPars[1];
828
829 Int_t nV0s=GetNumberOfV0s();
830 for (Int_t i=nV0s-1; i>=0; i--) {
831 AliESDv0 *v0=GetV0(i);
832
833 Float_t dca=v0->GetDcaV0Daughters();
834 Float_t csp=v0->GetV0CosineOfPointingAngle();
835 Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin);
449e752b 836 if (csp > cspcut) continue;
837 if (RemoveV0(i)) rc=kTRUE;
a023d8d8 838 }
839
7f68891d 840
a023d8d8 841 Float_t dmax=cleanPars[2], zmax=cleanPars[3];
7f68891d 842
06cc9d95 843 const AliESDVertex *vertex=GetPrimaryVertexSPD();
a023d8d8 844 Bool_t vtxOK=vertex->GetStatus();
7f68891d 845
846 Int_t nTracks=GetNumberOfTracks();
847 for (Int_t i=nTracks-1; i>=0; i--) {
848 AliESDtrack *track=GetTrack(i);
849 Float_t xy,z; track->GetImpactParameters(xy,z);
850 if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) {
851 if (RemoveTrack(i)) rc=kTRUE;
852 }
853 }
854
855 return rc;
856}
857
6dc21f57 858Char_t AliESDEvent::AddPileupVertexSPD(const AliESDVertex *vtx)
04d01397 859{
860 // Add a pileup primary vertex reconstructed with SPD
861 TClonesArray &ftr = *fSPDPileupVertices;
6dc21f57 862 Char_t n=Char_t(ftr.GetEntriesFast());
863 AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
864 vertex->SetID(n);
865 return n;
04d01397 866}
867
6dc21f57 868Char_t AliESDEvent::AddPileupVertexTracks(const AliESDVertex *vtx)
04d01397 869{
870 // Add a pileup primary vertex reconstructed with SPD
871 TClonesArray &ftr = *fTrkPileupVertices;
6dc21f57 872 Char_t n=Char_t(ftr.GetEntriesFast());
873 AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
874 vertex->SetID(n);
875 return n;
04d01397 876}
877
6989bff3 878Int_t AliESDEvent::AddTrack(const AliESDtrack *t)
879{
af885e0f 880 // Add track
881 TClonesArray &ftr = *fTracks;
882 AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack(*t);
883 track->SetID(fTracks->GetEntriesFast()-1);
884 return track->GetID();
885}
886
6989bff3 887 void AliESDEvent::AddMuonTrack(const AliESDMuonTrack *t)
888{
f0106218 889 TClonesArray &fmu = *fMuonTracks;
890 new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(*t);
891}
892
6989bff3 893void AliESDEvent::AddPmdTrack(const AliESDPmdTrack *t)
894{
f0106218 895 TClonesArray &fpmd = *fPmdTracks;
896 new(fpmd[fPmdTracks->GetEntriesFast()]) AliESDPmdTrack(*t);
897}
898
6989bff3 899void AliESDEvent::AddTrdTrack(const AliESDTrdTrack *t)
900{
f0106218 901 TClonesArray &ftrd = *fTrdTracks;
902 new(ftrd[fTrdTracks->GetEntriesFast()]) AliESDTrdTrack(*t);
903}
904
905
906
907
6989bff3 908Int_t AliESDEvent::AddKink(const AliESDkink *c)
909{
af885e0f 910 // Add kink
911 TClonesArray &fk = *fKinks;
912 AliESDkink * kink = new(fk[fKinks->GetEntriesFast()]) AliESDkink(*c);
913 kink->SetID(fKinks->GetEntriesFast()); // CKB different from the other imps..
914 return fKinks->GetEntriesFast()-1;
915}
916
f0106218 917
6989bff3 918void AliESDEvent::AddCascade(const AliESDcascade *c)
919{
f0106218 920 TClonesArray &fc = *fCascades;
921 new(fc[fCascades->GetEntriesFast()]) AliESDcascade(*c);
922}
923
924
6989bff3 925Int_t AliESDEvent::AddCaloCluster(const AliESDCaloCluster *c)
926{
af885e0f 927 // Add calocluster
928 TClonesArray &fc = *fCaloClusters;
929 AliESDCaloCluster *clus = new(fc[fCaloClusters->GetEntriesFast()]) AliESDCaloCluster(*c);
930 clus->SetID(fCaloClusters->GetEntriesFast()-1);
931 return fCaloClusters->GetEntriesFast()-1;
932 }
933
934
7d44c466 935void AliESDEvent::AddRawDataErrorLog(const AliRawDataErrorLog *log) const {
6989bff3 936 TClonesArray &errlogs = *fErrorLogs;
937 new(errlogs[errlogs.GetEntriesFast()]) AliRawDataErrorLog(*log);
938}
f0106218 939
06cc9d95 940void AliESDEvent::SetPrimaryVertexTPC(const AliESDVertex *vertex)
941{
942 // Set the TPC vertex
943 // use already allocated space
944 if(fTPCVertex){
945 *fTPCVertex = *vertex;
946 fTPCVertex->SetName(fgkESDListName[kTPCVertex]);
947 }
948}
949
950void AliESDEvent::SetPrimaryVertexSPD(const AliESDVertex *vertex)
6989bff3 951{
952 // Set the SPD vertex
60e8f114 953 // use already allocated space
954 if(fSPDVertex){
316c6cd9 955 *fSPDVertex = *vertex;
6989bff3 956 fSPDVertex->SetName(fgkESDListName[kSPDVertex]);
60e8f114 957 }
958}
959
c264b61b 960void AliESDEvent::SetPrimaryVertexTracks(const AliESDVertex *vertex)
6989bff3 961{
c264b61b 962 // Set the primary vertex reconstructed using he ESD tracks.
6989bff3 963 // use already allocated space
60e8f114 964 if(fPrimaryVertex){
316c6cd9 965 *fPrimaryVertex = *vertex;
6989bff3 966 fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]);
60e8f114 967 }
968}
969
c264b61b 970const AliESDVertex * AliESDEvent::GetPrimaryVertex() const
971{
972 //
973 // Get the "best" available reconstructed primary vertex.
974 //
975 if(fPrimaryVertex){
976 if (fPrimaryVertex->GetStatus()) return fPrimaryVertex;
977 }
978 if(fSPDVertex){
979 if (fSPDVertex->GetStatus()) return fSPDVertex;
980 }
981 if(fTPCVertex) return fTPCVertex;
982
983 AliWarning("No primary vertex available. Returning the \"default\"...");
984 return fSPDVertex;
985}
986
518573d7 987AliESDVertex * AliESDEvent::PrimaryVertexTracksUnconstrained() const
988{
989 //
990 // Removes diamond constraint from fPrimaryVertex (reconstructed with tracks)
991 // Returns a AliESDVertex which has to be deleted by the user
992 //
993 if(!fPrimaryVertex) {
994 AliWarning("No primary vertex from tracks available.");
995 return 0;
996 }
997 if(!fPrimaryVertex->GetStatus()) {
998 AliWarning("No primary vertex from tracks available.");
999 return 0;
1000 }
1001
1002 AliVertexerTracks vertexer(GetMagneticField());
1003 Float_t diamondxyz[3]={(Float_t)GetDiamondX(),(Float_t)GetDiamondY(),0.};
1004 Float_t diamondcovxy[3]; GetDiamondCovXY(diamondcovxy);
1005 Float_t diamondcov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,7.};
1006 AliESDVertex *vertex =
1007 (AliESDVertex*)vertexer.RemoveConstraintFromVertex(fPrimaryVertex,diamondxyz,diamondcov);
1008
1009 return vertex;
1010}
1011
6989bff3 1012void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul)
1013{
1014 // Set the SPD Multiplicity
f0106218 1015 if(fSPDMult){
316c6cd9 1016 *fSPDMult = *mul;
f0106218 1017 }
1018}
1019
1020
6989bff3 1021void AliESDEvent::SetFMDData(AliESDFMD * obj)
1022{
af885e0f 1023 // use already allocated space
1024 if(fESDFMD){
316c6cd9 1025 *fESDFMD = *obj;
af885e0f 1026 }
1027}
1028
6989bff3 1029void AliESDEvent::SetVZEROData(AliESDVZERO * obj)
1030{
af885e0f 1031 // use already allocated space
1032 if(fESDVZERO)
6989bff3 1033 *fESDVZERO = *obj;
af885e0f 1034}
1035
bd95bae7 1036void AliESDEvent::SetACORDEData(AliESDACORDE * obj)
1037{
1038 if(fESDACORDE)
1039 *fESDACORDE = *obj;
1040}
1041
1042
6989bff3 1043void AliESDEvent::GetESDfriend(AliESDfriend *ev) const
1044{
af885e0f 1045 //
1046 // Extracts the complementary info from the ESD
1047 //
1048 if (!ev) return;
1049
1050 Int_t ntrk=GetNumberOfTracks();
1051
1052 for (Int_t i=0; i<ntrk; i++) {
80799a5f 1053 AliESDtrack *t=GetTrack(i);
af885e0f 1054 const AliESDfriendTrack *f=t->GetFriendTrack();
1055 ev->AddTrack(f);
80799a5f 1056
1057 t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack"
1058
af885e0f 1059 }
af885e0f 1060
b090e6a3 1061 AliESDfriend *fr = (AliESDfriend*)(const_cast<AliESDEvent*>(this)->FindListObject("AliESDfriend"));
1062 if (fr) ev->SetVZEROfriend(fr->GetVZEROfriend());
1063}
af885e0f 1064
1065void AliESDEvent::AddObject(TObject* obj)
1066{
1067 // Add an object to the list of object.
1068 // Please be aware that in order to increase performance you should
1069 // refrain from using TObjArrays (if possible). Use TClonesArrays, instead.
1070 fESDObjects->SetOwner(kTRUE);
1071 fESDObjects->AddLast(obj);
1072}
1073
1074
1075void AliESDEvent::GetStdContent()
1076{
1077 // set pointers for standard content
60e8f114 1078 // get by name much safer and not a big overhead since not called very often
1079
6989bff3 1080 fESDRun = (AliESDRun*)fESDObjects->FindObject(fgkESDListName[kESDRun]);
1081 fHeader = (AliESDHeader*)fESDObjects->FindObject(fgkESDListName[kHeader]);
1082 fESDZDC = (AliESDZDC*)fESDObjects->FindObject(fgkESDListName[kESDZDC]);
1083 fESDFMD = (AliESDFMD*)fESDObjects->FindObject(fgkESDListName[kESDFMD]);
1084 fESDVZERO = (AliESDVZERO*)fESDObjects->FindObject(fgkESDListName[kESDVZERO]);
1085 fESDTZERO = (AliESDTZERO*)fESDObjects->FindObject(fgkESDListName[kESDTZERO]);
06cc9d95 1086 fTPCVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kTPCVertex]);
6989bff3 1087 fSPDVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kSPDVertex]);
1088 fPrimaryVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kPrimaryVertex]);
1089 fSPDMult = (AliMultiplicity*)fESDObjects->FindObject(fgkESDListName[kSPDMult]);
1090 fPHOSTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kPHOSTrigger]);
1091 fEMCALTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kEMCALTrigger]);
04d01397 1092 fSPDPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kSPDPileupVertices]);
1093 fTrkPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrkPileupVertices]);
6989bff3 1094 fTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTracks]);
1095 fMuonTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonTracks]);
1096 fPmdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kPmdTracks]);
1097 fTrdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracks]);
1098 fV0s = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kV0s]);
1099 fCascades = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCascades]);
1100 fKinks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kKinks]);
1101 fCaloClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCaloClusters]);
e649177a 1102 fEMCALCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kEMCALCells]);
1103 fPHOSCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kPHOSCells]);
6989bff3 1104 fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]);
bd95bae7 1105 fESDACORDE = (AliESDACORDE*)fESDObjects->FindObject(fgkESDListName[kESDACORDE]);
af885e0f 1106
1107}
1108
1109void AliESDEvent::SetStdNames(){
1110 // Set the names of the standard contents
60e8f114 1111 //
102c56c8 1112 if(fESDObjects->GetEntries()>=kESDListN){
1113 for(int i = 0;i < fESDObjects->GetEntries() && i<kESDListN;i++){
60e8f114 1114 TObject *fObj = fESDObjects->At(i);
1115 if(fObj->InheritsFrom("TNamed")){
6989bff3 1116 ((TNamed*)fObj)->SetName(fgkESDListName[i]);
60e8f114 1117 }
1118 else if(fObj->InheritsFrom("TClonesArray")){
6989bff3 1119 ((TClonesArray*)fObj)->SetName(fgkESDListName[i]);
60e8f114 1120 }
1121 }
1122 }
1123 else{
90e88950 1124 AliWarning("Std Entries missing");
60e8f114 1125 }
af885e0f 1126}
1127
a2fbb067 1128
1129void AliESDEvent::CreateStdContent(Bool_t bUseThisList){
1130 fUseOwnList = bUseThisList;
1131 CreateStdContent();
1132}
1133
af885e0f 1134void AliESDEvent::CreateStdContent()
1135{
1136 // create the standard AOD content and set pointers
1137
1138 // create standard objects and add them to the TList of objects
1139 AddObject(new AliESDRun());
1140 AddObject(new AliESDHeader());
1141 AddObject(new AliESDZDC());
1142 AddObject(new AliESDFMD());
1143 AddObject(new AliESDVZERO());
1144 AddObject(new AliESDTZERO());
1145 AddObject(new AliESDVertex());
1146 AddObject(new AliESDVertex());
06cc9d95 1147 AddObject(new AliESDVertex());
af885e0f 1148 AddObject(new AliMultiplicity());
1149 AddObject(new AliESDCaloTrigger());
1150 AddObject(new AliESDCaloTrigger());
04d01397 1151 AddObject(new TClonesArray("AliESDVertex",0));
1152 AddObject(new TClonesArray("AliESDVertex",0));
af885e0f 1153 AddObject(new TClonesArray("AliESDtrack",0));
1154 AddObject(new TClonesArray("AliESDMuonTrack",0));
1155 AddObject(new TClonesArray("AliESDPmdTrack",0));
1156 AddObject(new TClonesArray("AliESDTrdTrack",0));
1157 AddObject(new TClonesArray("AliESDv0",0));
1158 AddObject(new TClonesArray("AliESDcascade",0));
1159 AddObject(new TClonesArray("AliESDkink",0));
1160 AddObject(new TClonesArray("AliESDCaloCluster",0));
e649177a 1161 AddObject(new AliESDCaloCells());
1162 AddObject(new AliESDCaloCells());
af885e0f 1163 AddObject(new TClonesArray("AliRawDataErrorLog",0));
bd95bae7 1164 AddObject(new AliESDACORDE());
af885e0f 1165
1166 // check the order of the indices against enum...
1167
af885e0f 1168 // set names
1169 SetStdNames();
60e8f114 1170 // read back pointers
1171 GetStdContent();
af885e0f 1172}
1173
2811495d 1174TObject* AliESDEvent::FindListObject(const char *name) const {
7d44c466 1175//
1176// Find object with name "name" in the list of branches
1177//
d7749dec 1178 if(fESDObjects){
1179 return fESDObjects->FindObject(name);
1180 }
001b9beb 1181 return 0;
1182}
1183
cd1d4ee0 1184Int_t AliESDEvent::GetPHOSClusters(TRefArray *clusters) const
1185{
1186 // fills the provided TRefArray with all found phos clusters
e649177a 1187
cd1d4ee0 1188 clusters->Clear();
e649177a 1189
cd1d4ee0 1190 AliESDCaloCluster *cl = 0;
1191 for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) {
e649177a 1192
1193 if ( (cl = GetCaloCluster(i)) ) {
cd1d4ee0 1194 if (cl->IsPHOS()){
1195 clusters->Add(cl);
e649177a 1196 AliDebug(1,Form("IsPHOS cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
cd1d4ee0 1197 }
1198 }
1199 }
1200 return clusters->GetEntriesFast();
1201}
1202
1203Int_t AliESDEvent::GetEMCALClusters(TRefArray *clusters) const
1204{
e649177a 1205 // fills the provided TRefArray with all found emcal clusters
cd1d4ee0 1206
1207 clusters->Clear();
1208
1209 AliESDCaloCluster *cl = 0;
1210 for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) {
1211
e649177a 1212 if ( (cl = GetCaloCluster(i)) ) {
cd1d4ee0 1213 if (cl->IsEMCAL()){
1214 clusters->Add(cl);
e649177a 1215 AliDebug(1,Form("IsEMCAL cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
cd1d4ee0 1216 }
1217 }
1218 }
1219 return clusters->GetEntriesFast();
1220}
1221
f12d42ce 1222void AliESDEvent::WriteToTree(TTree* tree) const {
38f940fb 1223 // Book the branches as in TTree::Branch(TCollection*)
1224 // but add a "." at the end of top level branches which are
1225 // not a TClonesArray
1226
1227
1228 TString branchname;
1229 TIter next(fESDObjects);
7d44c466 1230 const Int_t kSplitlevel = 99; // default value in TTree::Branch()
1231 const Int_t kBufsize = 32000; // default value in TTree::Branch()
38f940fb 1232 TObject *obj = 0;
1233
1234 while ((obj = next())) {
1235 branchname.Form("%s", obj->GetName());
32ba9c61 1236 if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend.";
7d44c466 1237 if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) {
732a24fe 1238 if(!branchname.EndsWith("."))branchname += ".";
38f940fb 1239 }
102c56c8 1240 if (!tree->FindBranch(branchname)) {
771c4f86 1241 // For the custom streamer to be called splitlevel
1242 // has to be negative, only needed for HLT
1243 Int_t splitLevel = (TString(obj->ClassName()) == "AliHLTGlobalTriggerDecision") ? -1 : kSplitlevel - 1;
1244 tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),kBufsize, splitLevel);
102c56c8 1245 }
38f940fb 1246 }
38f940fb 1247}
1248
cd1d4ee0 1249
f7ec3414 1250void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
7d44c466 1251//
1252// Connect the ESDEvent to a tree
1253//
6989bff3 1254 if(!tree){
90e88950 1255 AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n");
6989bff3 1256 return;
1257 }
024c7734 1258 // load the TTree
6989bff3 1259 if(!tree->GetTree())tree->LoadTree(0);
024c7734 1260
001b9beb 1261 // if we find the "ESD" branch on the tree we do have the old structure
1bd10080 1262 if(tree->GetBranch("ESD")) {
1263 char ** address = (char **)(tree->GetBranch("ESD")->GetAddress());
0eb6eb59 1264 // do we have the friend branch
1265 TBranch * esdFB = tree->GetBranch("ESDfriend.");
1266 char ** addressF = 0;
1267 if(esdFB)addressF = (char **)(esdFB->GetAddress());
6989bff3 1268 if (!address) {
90e88950 1269 AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
1bd10080 1270 tree->SetBranchAddress("ESD", &fESDOld);
0eb6eb59 1271 if(esdFB){
1272 tree->SetBranchAddress("ESDfriend.",&fESDFriendOld);
1273 }
6989bff3 1274 } else {
90e88950 1275 AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
1276 AliInfo("Branch already connected. Using existing branch address.");
1bd10080 1277 fESDOld = (AliESD*) (*address);
0eb6eb59 1278 // addressF can still be 0, since branch needs to switched on
1279 if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF);
6989bff3 1280 }
0eb6eb59 1281
6989bff3 1282 // have already connected the old ESD structure... ?
1283 // reuse also the pointer of the AlliESDEvent
1284 // otherwise create new ones
6989bff3 1285 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree"));
1286
1287 if(connectedList){
1288 // If connected use the connected list of objects
0eb6eb59 1289 if(fESDObjects!= connectedList){
1290 // protect when called twice
1291 fESDObjects->Delete();
1292 fESDObjects = connectedList;
1293 }
6989bff3 1294 GetStdContent();
0eb6eb59 1295
0eb6eb59 1296
d7749dec 1297 // The pointer to the friend changes when called twice via InitIO
1298 // since AliESDEvent is deleted
0eb6eb59 1299 TObject* oldf = FindListObject("AliESDfriend");
1300 TObject* newf = 0;
1301 if(addressF){
1302 newf = (TObject*)*addressF;
1303 }
1304 if(newf!=0&&oldf!=newf){
1305 // remove the old reference
1306 // Should we also delete it? Or is this handled in TTree I/O
1307 // since it is created by the first SetBranchAddress
1308 fESDObjects->Remove(oldf);
1309 // add the new one
1310 fESDObjects->Add(newf);
1311 }
1312
6989bff3 1313 fConnected = true;
b93c2026 1314 return;
6989bff3 1315 }
1316 // else...
1317 CreateStdContent(); // create for copy
0eb6eb59 1318 // if we have the esdfriend add it, so we always can access it via the userinfo
1319 if(fESDFriendOld)AddObject(fESDFriendOld);
6989bff3 1320 // we are not owner of the list objects
1321 // must not delete it
efea3f54 1322 fESDObjects->SetOwner(kTRUE);
6989bff3 1323 fESDObjects->SetName("ESDObjectsConnectedToTree");
1324 tree->GetUserInfo()->Add(fESDObjects);
1325 fConnected = true;
1326 return;
af885e0f 1327 }
0eb6eb59 1328
732a24fe 1329
1330 delete fESDOld;
1331 fESDOld = 0;
af885e0f 1332 // Try to find AliESDEvent
1333 AliESDEvent *esdEvent = 0;
1334 esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent");
001b9beb 1335 if(esdEvent){
941603c0 1336 // Check if already connected to tree
efea3f54 1337 esdEvent->Reset();
139f2194 1338 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree"));
f7ec3414 1339
1340
1341 if (connectedList && (strcmp(opt, "reconnect"))) {
139f2194 1342 // If connected use the connected list if objects
1343 fESDObjects->Delete();
b5bc83df 1344 fESDObjects = connectedList;
1345 GetStdContent();
60e8f114 1346 fConnected = true;
139f2194 1347 return;
1348 }
732a24fe 1349
139f2194 1350 // Connect to tree
001b9beb 1351 // prevent a memory leak when reading back the TList
28a79204 1352 // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete();
f7ec3414 1353
a2fbb067 1354 if(!fUseOwnList){
a2fbb067 1355 // create a new TList from the UserInfo TList...
1356 // copy constructor does not work...
1357 fESDObjects = (TList*)(esdEvent->GetList()->Clone());
efea3f54 1358 fESDObjects->SetOwner(kTRUE);
a2fbb067 1359 }
1360 else if ( fESDObjects->GetEntries()==0){
1361 // at least create the std content if we want to read to our list
1362 CreateStdContent();
1363 }
732a24fe 1364
1365 // in principle
1366 // we only need new things in the list if we do no already have it..
1367 // TODO just add new entries
1368
af885e0f 1369 if(fESDObjects->GetEntries()<kESDListN){
90e88950 1370 AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
1371 fESDObjects->GetEntries(),kESDListN));
af885e0f 1372 }
1373 // set the branch addresses
1374 TIter next(fESDObjects);
1375 TNamed *el;
1376 while((el=(TNamed*)next())){
1377 TString bname(el->GetName());
af885e0f 1378 if(bname.CompareTo("AliESDfriend")==0)
1379 {
1380 // AliESDfriend does not have a name ...
588195ca 1381 TBranch *br = tree->GetBranch(bname.Data());
1382 if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el));
af885e0f 1383 }
1384 else{
38f940fb 1385 // check if branch exists under this Name
1386 TBranch *br = tree->GetBranch(bname.Data());
1387 if(br){
1388 tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el));
1389 }
1390 else{
1391 br = tree->GetBranch(Form("%s.",bname.Data()));
1392 if(br){
1393 tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
1394 }
1395 else{
90e88950 1396 AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data()));
38f940fb 1397 }
1398
1399 }
af885e0f 1400 }
1401 }
1402 GetStdContent();
1403 // when reading back we are not owner of the list
1404 // must not delete it
efea3f54 1405 fESDObjects->SetOwner(kTRUE);
60e8f114 1406 fESDObjects->SetName("ESDObjectsConnectedToTree");
139f2194 1407 // we are not owner of the list objects
1408 // must not delete it
60e8f114 1409 tree->GetUserInfo()->Add(fESDObjects);
efea3f54 1410 tree->GetUserInfo()->SetOwner(kFALSE);
60e8f114 1411 fConnected = true;
efea3f54 1412 }// no esdEvent -->
af885e0f 1413 else {
001b9beb 1414 // we can't get the list from the user data, create standard content
1415 // and set it by hand (no ESDfriend at the moment
af885e0f 1416 CreateStdContent();
1417 TIter next(fESDObjects);
1418 TNamed *el;
1419 while((el=(TNamed*)next())){
1420 TString bname(el->GetName());
732a24fe 1421 TBranch *br = tree->GetBranch(bname.Data());
1422 if(br){
1423 tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el));
1424 }
1425 else{
1426 br = tree->GetBranch(Form("%s.",bname.Data()));
1427 if(br){
1428 tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
1429 }
1430 }
af885e0f 1431 }
1432 GetStdContent();
1433 // when reading back we are not owner of the list
1434 // must not delete it
316cf4cc 1435 fESDObjects->SetOwner(kTRUE);
af885e0f 1436 }
af885e0f 1437}
1438
1439
1440void AliESDEvent::CopyFromOldESD()
1441{
1442 // Method which copies over everthing from the old esd structure to the
1443 // new
af885e0f 1444 if(fESDOld){
1445 ResetStdContent();
1446 // Run
1447 SetRunNumber(fESDOld->GetRunNumber());
1448 SetPeriodNumber(fESDOld->GetPeriodNumber());
6ca8842a 1449 SetMagneticField(fESDOld->GetMagneticField());
af885e0f 1450
1451 // leave out diamond ...
1452 // SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);}
1453
1454 // header
1455 SetTriggerMask(fESDOld->GetTriggerMask());
1456 SetOrbitNumber(fESDOld->GetOrbitNumber());
1457 SetTimeStamp(fESDOld->GetTimeStamp());
1458 SetEventType(fESDOld->GetEventType());
1459 SetEventNumberInFile(fESDOld->GetEventNumberInFile());
1460 SetBunchCrossNumber(fESDOld->GetBunchCrossNumber());
1461 SetTriggerCluster(fESDOld->GetTriggerCluster());
1462
1463 // ZDC
1464
1465 SetZDC(fESDOld->GetZDCN1Energy(),
a85132e7 1466 fESDOld->GetZDCP1Energy(),
1467 fESDOld->GetZDCEMEnergy(),
1468 0,
1469 fESDOld->GetZDCN2Energy(),
1470 fESDOld->GetZDCP2Energy(),
2b6cdc43 1471 fESDOld->GetZDCParticipants(),
5f0ec064 1472 0,
1473 0,
1474 0,
1475 0,
1476 0,
2b6cdc43 1477 0);
af885e0f 1478
1479 // FMD
1480
cb6aa27f 1481 if(fESDOld->GetFMDData())SetFMDData(fESDOld->GetFMDData());
af885e0f 1482
1483 // T0
1484
1485 SetT0zVertex(fESDOld->GetT0zVertex());
1486 SetT0(fESDOld->GetT0());
1487 // leave amps out
1488
1489 // VZERO
c06eaba2 1490 if (fESDOld->GetVZEROData()) SetVZEROData(fESDOld->GetVZEROData());
af885e0f 1491
06cc9d95 1492 if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex());
af885e0f 1493
c264b61b 1494 if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex());
af885e0f 1495
cb6aa27f 1496 if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity());
1bd10080 1497
af885e0f 1498 for(int i = 0;i<fESDOld->GetNumberOfTracks();i++){
1499 AddTrack(fESDOld->GetTrack(i));
1500 }
1501
1502 for(int i = 0;i<fESDOld->GetNumberOfMuonTracks();i++){
1503 AddMuonTrack(fESDOld->GetMuonTrack(i));
1504 }
1505
1506 for(int i = 0;i<fESDOld->GetNumberOfPmdTracks();i++){
1507 AddPmdTrack(fESDOld->GetPmdTrack(i));
1508 }
1509
1510 for(int i = 0;i<fESDOld->GetNumberOfTrdTracks();i++){
1511 AddTrdTrack(fESDOld->GetTrdTrack(i));
1512 }
1513
1514 for(int i = 0;i<fESDOld->GetNumberOfV0s();i++){
1515 AddV0(fESDOld->GetV0(i));
1516 }
1517
1518 for(int i = 0;i<fESDOld->GetNumberOfCascades();i++){
1519 AddCascade(fESDOld->GetCascade(i));
1520 }
1521
1522 for(int i = 0;i<fESDOld->GetNumberOfKinks();i++){
1523 AddKink(fESDOld->GetKink(i));
1524 }
1525
1526
1527 for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){
1528 AddCaloCluster(fESDOld->GetCaloCluster(i));
1529 }
1bd10080 1530
af885e0f 1531 }// if fesdold
1532}
1533
2a3dfb14 1534Bool_t AliESDEvent::IsEventSelected(const char *trigExpr) const
1535{
1536 // Check if the event satisfies the trigger
1537 // selection expression trigExpr.
1538 // trigExpr can be any logical expression
1539 // of the trigger classes defined in AliESDRun
1540 // In case of wrong syntax return kTRUE.
1541
1542 TString expr(trigExpr);
1543 if (expr.IsNull()) return kTRUE;
1544
1545 ULong64_t mask = GetTriggerMask();
1546 for(Int_t itrig = 0; itrig < AliESDRun::kNTriggerClasses; itrig++) {
1547 if (mask & (1ull << itrig)) {
1548 expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"1");
1549 }
1550 else {
1551 expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"0");
1552 }
1553 }
1554
1555 Int_t error;
1556 if ((gROOT->ProcessLineFast(expr.Data(),&error) == 0) &&
1557 (error == TInterpreter::kNoError)) {
1558 return kFALSE;
1559 }
1560
1561 return kTRUE;
1562
1563}
1564
3b286f80 1565TObject* AliESDEvent::GetHLTTriggerDecision() const
1566{
1567 // get the HLT trigger decission object
1568
1569 // cast away const'nes because the FindListObject method
1570 // is not const
1571 AliESDEvent* pNonConst=const_cast<AliESDEvent*>(this);
1572 return pNonConst->FindListObject("HLTGlobalTrigger");
1573}
1574
1575TString AliESDEvent::GetHLTTriggerDescription() const
1576{
1577 // get the HLT trigger decission description
1578 TString description;
1579 TObject* pDecision=GetHLTTriggerDecision();
1580 if (pDecision) {
1581 description=pDecision->GetTitle();
1582 }
1583
1584 return description;
1585}
1586
1587Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const
1588{
1589 // get the HLT trigger decission description
1590 TObject* pDecision=GetHLTTriggerDecision();
1591 if (!pDecision) return kFALSE;
1592
1593 Option_t* option=pDecision->GetOption();
1594 if (option==NULL || *option!='1') return kFALSE;
1595
1596 if (name) {
1597 TString description=GetHLTTriggerDescription();
1598 Int_t index=description.Index(name);
1599 if (index<0) return kFALSE;
1600 index+=strlen(name);
1601 if (index>=description.Length()) return kFALSE;
1602 if (description[index]!=0 && description[index]!=' ') return kFALSE;
1603 }
1604 return kTRUE;
1605}
af885e0f 1606
a98c78e5 1607//______________________________________________________________________________
1608Bool_t AliESDEvent::IsPileupFromSPD(Int_t minContributors,
1609 Double_t minZdist,
1610 Double_t nSigmaZdist,
1611 Double_t nSigmaDiamXY,
1612 Double_t nSigmaDiamZ) const{
e741cb7c 1613 //
1614 // This function checks if there was a pile up
1615 // reconstructed with SPD
1616 //
e741cb7c 1617 Int_t nc1=fSPDVertex->GetNContributors();
1618 if(nc1<1) return kFALSE;
1619 Int_t nPileVert=GetNumberOfPileupVerticesSPD();
1620 if(nPileVert==0) return kFALSE;
a98c78e5 1621
e741cb7c 1622 for(Int_t i=0; i<nPileVert;i++){
1623 const AliESDVertex* pv=GetPileupVertexSPD(i);
e741cb7c 1624 Int_t nc2=pv->GetNContributors();
a98c78e5 1625 if(nc2>=minContributors){
1626 Double_t z1=fSPDVertex->GetZ();
1627 Double_t z2=pv->GetZ();
1628 Double_t distZ=TMath::Abs(z2-z1);
1629 Double_t distZdiam=TMath::Abs(z2-GetDiamondZ());
569d954c 1630 Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ());
a98c78e5 1631 if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information
1632 if(distZ>minZdist && distZdiam<cutZdiam){
1633 Double_t x2=pv->GetX();
1634 Double_t y2=pv->GetY();
1635 Double_t distXdiam=TMath::Abs(x2-GetDiamondX());
1636 Double_t distYdiam=TMath::Abs(y2-GetDiamondY());
1637 Double_t cov1[6],cov2[6];
1638 fSPDVertex->GetCovarianceMatrix(cov1);
1639 pv->GetCovarianceMatrix(cov2);
1640 Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX());
1641 Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY());
1642 Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]);
1643 Double_t cutXdiam=nSigmaDiamXY*errxDist;
1644 if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information
1645 Double_t cutYdiam=nSigmaDiamXY*erryDist;
1646 if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information
1647 if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){
1648 return kTRUE;
1649 }
1650 }
e741cb7c 1651 }
e741cb7c 1652 }
a98c78e5 1653 return kFALSE;
1654}
e741cb7c 1655
4ace6760 1656//______________________________________________________________________________
1657void AliESDEvent::EstimateMultiplicity(Int_t &tracklets, Int_t &trITSTPC, Int_t &trITSSApure, Double_t eta, Bool_t useDCAFlag,Bool_t useV0Flag) const
1658{
1659 //
1660 // calculates 3 estimators for the multiplicity in the -eta:eta range
1661 // tracklets : using SPD tracklets only
1662 // trITSTPC : using TPC/ITS + complementary ITS SA tracks + tracklets from clusters not used by tracks
1663 // trITSSApure : using ITS standalone tracks + tracklets from clusters not used by tracks
1664 // if useDCAFlag is true: account for the ESDtrack flag marking the tracks with large DCA
1665 // if useV0Flag is true: account for the ESDtrack flag marking conversion and K0's V0s
1666 tracklets = trITSSApure = trITSTPC = 0;
1667 int ntr = fSPDMult ? fSPDMult->GetNumberOfTracklets() : 0;
1668 //
1669 // count tracklets
1670 for (int itr=ntr;itr--;) {
1671 if (TMath::Abs(fSPDMult->GetEta(itr))>eta) continue;
1672 tracklets++;
1673 if (fSPDMult->FreeClustersTracklet(itr,0)) trITSTPC++; // not used in ITS/TPC or ITS_SA track
1674 if (fSPDMult->FreeClustersTracklet(itr,1)) trITSSApure++; // not used in ITS_SA_Pure track
1675 }
1676 //
1677 // count real tracks
1678 ntr = GetNumberOfTracks();
1679 for (int itr=ntr;itr--;) {
1680 AliESDtrack *t = GetTrack(itr);
1681 if (TMath::Abs(t->Eta())>eta) continue;
1682 if (!t->IsOn(AliESDtrack::kITSin)) continue;
1683 if (useDCAFlag && t->IsOn(AliESDtrack::kMultSec)) continue;
1684 if (useV0Flag && t->IsOn(AliESDtrack::kMultInV0)) continue;
1685 if (t->IsOn(AliESDtrack::kITSpureSA)) trITSSApure++;
1686 else trITSTPC++;
1687 }
1688 //
1689}