1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /* $Id: AliAnalysisTaskESDfilter.cxx 24535 2008-03-16 22:43:30Z fca $ */
21 #include "AliAnalysisTaskESDfilter.h"
22 #include "AliAnalysisManager.h"
23 #include "AliESDEvent.h"
24 #include "AliAODEvent.h"
25 #include "AliESDInputHandler.h"
26 #include "AliAODHandler.h"
27 #include "AliAnalysisFilter.h"
28 #include "AliESDtrack.h"
29 #include "AliESDMuonTrack.h"
30 #include "AliESDVertex.h"
32 #include "AliESDkink.h"
33 #include "AliESDcascade.h"
34 #include "AliESDPmdTrack.h"
35 #include "AliESDCaloCluster.h"
36 #include "AliESDCaloCells.h"
37 #include "AliMultiplicity.h"
40 ClassImp(AliAnalysisTaskESDfilter)
42 ////////////////////////////////////////////////////////////////////////
44 AliAnalysisTaskESDfilter::AliAnalysisTaskESDfilter():
50 // Default constructor
53 AliAnalysisTaskESDfilter::AliAnalysisTaskESDfilter(const char* name):
54 AliAnalysisTaskSE(name),
62 void AliAnalysisTaskESDfilter::UserCreateOutputObjects()
64 // Create the output container
65 OutputTree()->GetUserInfo()->Add(fTrackFilter);
68 void AliAnalysisTaskESDfilter::Init()
71 if (fDebug > 1) AliInfo("Init() \n");
72 // Call configuration file
76 void AliAnalysisTaskESDfilter::UserExec(Option_t */*option*/)
78 // Execute analysis for current event
81 Long64_t ientry = Entry();
82 printf("Filter: Analysing event # %5d\n", (Int_t) ientry);
87 void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
88 // ESD Filter analysis task executed for each event
89 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
90 AliESD* old = esd->GetAliESDOld();
92 // set arrays and pointers
102 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
103 for (Int_t i = 0; i < 21; i++) covTr [i] = 0.;
106 // loop over events and fill them
108 // Multiplicity information needed by the header (to be revised!)
109 Int_t nTracks = esd->GetNumberOfTracks();
110 Int_t nPosTracks = 0;
111 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack)
112 if (esd->GetTrack(iTrack)->GetSign()> 0) nPosTracks++;
116 AliAODHeader* header = AODEvent()->GetHeader();
117 header->SetRunNumber(esd->GetRunNumber());
119 header->SetBunchCrossNumber(0);
120 header->SetOrbitNumber(0);
121 header->SetPeriodNumber(0);
122 header->SetEventType(0);
123 header->SetMuonMagFieldScale(-999.); // FIXME
124 header->SetCentrality(-999.); // FIXME
126 header->SetBunchCrossNumber(esd->GetBunchCrossNumber());
127 header->SetOrbitNumber(esd->GetOrbitNumber());
128 header->SetPeriodNumber(esd->GetPeriodNumber());
129 header->SetEventType(esd->GetEventType());
130 header->SetMuonMagFieldScale(-999.); // FIXME
131 header->SetCentrality(-999.); // FIXME
134 header->SetTriggerMask(esd->GetTriggerMask());
135 header->SetTriggerCluster(esd->GetTriggerCluster());
136 header->SetMagneticField(esd->GetMagneticField());
137 header->SetZDCN1Energy(esd->GetZDCN1Energy());
138 header->SetZDCP1Energy(esd->GetZDCP1Energy());
139 header->SetZDCN2Energy(esd->GetZDCN2Energy());
140 header->SetZDCP2Energy(esd->GetZDCP2Energy());
141 header->SetZDCEMEnergy(esd->GetZDCEMEnergy(0),esd->GetZDCEMEnergy(1));
142 header->SetRefMultiplicity(nTracks);
143 header->SetRefMultiplicityPos(nPosTracks);
144 header->SetRefMultiplicityNeg(nTracks - nPosTracks);
147 Int_t nV0s = esd->GetNumberOfV0s();
148 Int_t nCascades = esd->GetNumberOfCascades();
149 Int_t nKinks = esd->GetNumberOfKinks();
150 Int_t nVertices = nV0s + 2*nCascades /*could lead to two vertices, one V0 and the Xi */+ nKinks + 1 /* = prim. vtx*/;
152 Int_t nCaloClus = esd->GetNumberOfCaloClusters();
154 Int_t nPmdClus = esd->GetNumberOfPmdTracks();
156 printf(" NV0=%d NCASCADES=%d NKINKS=%d\n", nV0s, nCascades, nKinks);
158 AODEvent()->ResetStd(nTracks, nVertices, nV0s+nCascades, nJets, nCaloClus, nFmdClus, nPmdClus);
160 AliAODTrack *aodTrack = 0x0;
162 // Array to take into account the tracks already added to the AOD
163 Bool_t * usedTrack = NULL;
165 usedTrack = new Bool_t[nTracks];
166 for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) usedTrack[iTrack]=kFALSE;
168 // Array to take into account the V0s already added to the AOD
169 Bool_t * usedV0 = NULL;
171 usedV0 = new Bool_t[nV0s];
172 for (Int_t iV0=0; iV0<nV0s; ++iV0) usedV0[iV0]=kFALSE;
174 // Array to take into account the kinks already added to the AOD
175 Bool_t * usedKink = NULL;
177 usedKink = new Bool_t[nKinks];
178 for (Int_t iKink=0; iKink<nKinks; ++iKink) usedKink[iKink]=kFALSE;
181 // Access to the AOD container of vertices
182 TClonesArray &vertices = *(AODEvent()->GetVertices());
185 // Access to the AOD container of tracks
186 TClonesArray &tracks = *(AODEvent()->GetTracks());
189 // Access to the AOD container of V0s
190 TClonesArray &V0s = *(AODEvent()->GetV0s());
193 // Add primary vertex. The primary tracks will be defined
194 // after the loops on the composite objects (V0, cascades, kinks)
195 const AliESDVertex *vtx = esd->GetPrimaryVertex();
197 vtx->GetXYZ(pos); // position
198 vtx->GetCovMatrix(covVtx); //covariance matrix
200 AliAODVertex * primary = new(vertices[jVertices++])
201 AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, AliAODVertex::kPrimary);
204 // Create vertices starting from the most complex objects
208 for (Int_t nCascade = 0; nCascade < nCascades; ++nCascade) {
209 AliESDcascade *cascade = esd->GetCascade(nCascade);
211 cascade->GetXYZ(pos[0], pos[1], pos[2]);
214 chi2 = cascade->GetChi2Xi(); // = chi2/NDF since NDF = 2*2-3
215 cascade->GetPosCovXi(covVtx);
218 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
220 // Add the cascade vertex
221 AliAODVertex * vcascade = new(vertices[jVertices++]) AliAODVertex(pos,
226 AliAODVertex::kCascade);
228 primary->AddDaughter(vcascade);
230 // Add the V0 from the cascade. The ESD class have to be optimized...
231 // Now we have to search for the corresponding Vo in the list of V0s
232 // using the indeces of the positive and negative tracks
234 Int_t posFromV0 = cascade->GetPindex();
235 Int_t negFromV0 = cascade->GetNindex();
241 for (Int_t iV0=0; iV0<nV0s; ++iV0) {
243 v0 = esd->GetV0(iV0);
244 Int_t posV0 = v0->GetPindex();
245 Int_t negV0 = v0->GetNindex();
247 if (posV0==posFromV0 && negV0==negFromV0) {
253 AliAODVertex * vV0FromCascade = 0x0;
255 if (indV0>-1 && !usedV0[indV0] ) {
257 // the V0 exists in the array of V0s and is not used
259 usedV0[indV0] = kTRUE;
261 v0->GetXYZ(pos[0], pos[1], pos[2]);
263 chi2 = v0->GetChi2V0(); // = chi2/NDF since NDF = 2*2-3
264 v0->GetPosCov(covVtx);
267 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
270 vV0FromCascade = new(vertices[jVertices++]) AliAODVertex(pos,
278 // the V0 doesn't exist in the array of V0s or was used
279 // cerr << "Error: event " << esd->GetEventNumberInFile() << " cascade " << nCascade
280 // << " The V0 " << indV0
281 // << " doesn't exist in the array of V0s or was used!" << endl;
283 cascade->GetXYZ(pos[0], pos[1], pos[2]);
286 chi2 = v0->GetChi2V0();
287 cascade->GetPosCov(covVtx);
290 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
293 vV0FromCascade = new(vertices[jVertices++]) AliAODVertex(pos,
295 chi2, // = chi2/NDF since NDF = 2*2-3 (AM)
299 vcascade->AddDaughter(vV0FromCascade);
302 // Add the positive tracks from the V0
304 if (posFromV0>-1 && !usedTrack[posFromV0]) {
306 usedTrack[posFromV0] = kTRUE;
308 AliESDtrack *esdTrack = esd->GetTrack(posFromV0);
309 esdTrack->GetPxPyPz(p_pos);
310 esdTrack->GetXYZ(pos);
311 esdTrack->GetCovarianceXYZPxPyPz(covTr);
312 esdTrack->GetESDpid(pid);
314 vV0FromCascade->AddDaughter(aodTrack =
315 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
316 esdTrack->GetLabel(),
322 (Short_t)esdTrack->GetSign(),
323 esdTrack->GetITSClusterMap(),
326 kTRUE, // check if this is right
327 kFALSE, // check if this is right
328 AliAODTrack::kSecondary)
330 aodTrack->ConvertAliPIDtoAODPID();
333 // cerr << "Error: event " << esd->GetEventNumberInFile() << " cascade " << nCascade
334 // << " track " << posFromV0 << " has already been used!" << endl;
337 // Add the negative tracks from the V0
339 if (negFromV0>-1 && !usedTrack[negFromV0]) {
341 usedTrack[negFromV0] = kTRUE;
343 AliESDtrack *esdTrack = esd->GetTrack(negFromV0);
344 esdTrack->GetPxPyPz(p_neg);
345 esdTrack->GetXYZ(pos);
346 esdTrack->GetCovarianceXYZPxPyPz(covTr);
347 esdTrack->GetESDpid(pid);
349 vV0FromCascade->AddDaughter(aodTrack =
350 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
351 esdTrack->GetLabel(),
357 (Short_t)esdTrack->GetSign(),
358 esdTrack->GetITSClusterMap(),
361 kTRUE, // check if this is right
362 kFALSE, // check if this is right
363 AliAODTrack::kSecondary)
365 aodTrack->ConvertAliPIDtoAODPID();
368 // cerr << "Error: event " << esd->GetEventNumberInFile() << " cascade " << nCascade
369 // << " track " << negFromV0 << " has already been used!" << endl;
372 // add it to the V0 array as well
373 Double_t d0[2] = { -999., -99.};
374 // counting is probably wrong
375 new(V0s[jV0s++]) AliAODv0(vV0FromCascade, -999., -99., p_pos, p_neg, d0); // to be refined
377 // Add the bachelor track from the cascade
379 Int_t bachelor = cascade->GetBindex();
381 if(bachelor>-1 && !usedTrack[bachelor]) {
383 usedTrack[bachelor] = kTRUE;
385 AliESDtrack *esdTrack = esd->GetTrack(bachelor);
386 esdTrack->GetPxPyPz(p);
387 esdTrack->GetXYZ(pos);
388 esdTrack->GetCovarianceXYZPxPyPz(covTr);
389 esdTrack->GetESDpid(pid);
391 vcascade->AddDaughter(aodTrack =
392 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
393 esdTrack->GetLabel(),
399 (Short_t)esdTrack->GetSign(),
400 esdTrack->GetITSClusterMap(),
403 kTRUE, // check if this is right
404 kFALSE, // check if this is right
405 AliAODTrack::kSecondary)
407 aodTrack->ConvertAliPIDtoAODPID();
410 // cerr << "Error: event " << esd->GetEventNumberInFile() << " cascade " << nCascade
411 // << " track " << bachelor << " has already been used!" << endl;
414 // Add the primary track of the cascade (if any)
416 } // end of the loop on cascades
420 for (Int_t nV0 = 0; nV0 < nV0s; ++nV0) {
422 if (usedV0[nV0]) continue; // skip if aready added to the AOD
424 AliESDv0 *v0 = esd->GetV0(nV0);
426 v0->GetXYZ(pos[0], pos[1], pos[2]);
429 chi2 = v0->GetChi2V0(); // = chi2/NDF since NDF = 2*2-3
430 v0->GetPosCov(covVtx);
433 for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
438 new(vertices[jVertices++]) AliAODVertex(pos,
444 primary->AddDaughter(vV0);
446 Int_t posFromV0 = v0->GetPindex();
447 Int_t negFromV0 = v0->GetNindex();
449 // Add the positive tracks from the V0
451 if (posFromV0>-1 && !usedTrack[posFromV0]) {
453 usedTrack[posFromV0] = kTRUE;
455 AliESDtrack *esdTrack = esd->GetTrack(posFromV0);
456 esdTrack->GetPxPyPz(p_pos);
457 esdTrack->GetXYZ(pos);
458 esdTrack->GetCovarianceXYZPxPyPz(covTr);
459 esdTrack->GetESDpid(pid);
461 vV0->AddDaughter(aodTrack =
462 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
463 esdTrack->GetLabel(),
469 (Short_t)esdTrack->GetSign(),
470 esdTrack->GetITSClusterMap(),
473 kTRUE, // check if this is right
474 kFALSE, // check if this is right
475 AliAODTrack::kSecondary)
477 aodTrack->ConvertAliPIDtoAODPID();
480 // cerr << "Error: event " << esd->GetEventNumberInFile() << " V0 " << nV0
481 // << " track " << posFromV0 << " has already been used!" << endl;
484 // Add the negative tracks from the V0
486 if (negFromV0>-1 && !usedTrack[negFromV0]) {
488 usedTrack[negFromV0] = kTRUE;
490 AliESDtrack *esdTrack = esd->GetTrack(negFromV0);
491 esdTrack->GetPxPyPz(p_neg);
492 esdTrack->GetXYZ(pos);
493 esdTrack->GetCovarianceXYZPxPyPz(covTr);
494 esdTrack->GetESDpid(pid);
496 vV0->AddDaughter(aodTrack =
497 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
498 esdTrack->GetLabel(),
504 (Short_t)esdTrack->GetSign(),
505 esdTrack->GetITSClusterMap(),
508 kTRUE, // check if this is right
509 kFALSE, // check if this is right
510 AliAODTrack::kSecondary)
512 aodTrack->ConvertAliPIDtoAODPID();
515 // cerr << "Error: event " << esd->GetEventNumberInFile() << " V0 " << nV0
516 // << " track " << negFromV0 << " has already been used!" << endl;
519 // add it to the V0 array as well
520 Double_t d0[2] = { 999., 99.};
521 new(V0s[jV0s++]) AliAODv0(vV0, 999., 99., p_pos, p_neg, d0); // to be refined
524 // end of the loop on V0s
526 // Kinks: it is a big mess the access to the information in the kinks
527 // The loop is on the tracks in order to find the mother and daugther of each kink
530 for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) {
532 AliESDtrack * esdTrack = esd->GetTrack(iTrack);
534 Int_t ikink = esdTrack->GetKinkIndex(0);
536 if (ikink && nKinks) {
537 // Negative kink index: mother, positive: daughter
539 // Search for the second track of the kink
541 for (Int_t jTrack = iTrack+1; jTrack<nTracks; ++jTrack) {
543 AliESDtrack * esdTrack1 = esd->GetTrack(jTrack);
545 Int_t jkink = esdTrack1->GetKinkIndex(0);
547 if ( TMath::Abs(ikink)==TMath::Abs(jkink) ) {
549 // The two tracks are from the same kink
551 if (usedKink[TMath::Abs(ikink)-1]) continue; // skip used kinks
554 Int_t idaughter = -1;
556 if (ikink<0 && jkink>0) {
561 else if (ikink>0 && jkink<0) {
567 // cerr << "Error: Wrong combination of kink indexes: "
568 // << ikink << " " << jkink << endl;
572 // Add the mother track
574 AliAODTrack * mother = NULL;
576 if (!usedTrack[imother]) {
578 usedTrack[imother] = kTRUE;
580 AliESDtrack *esdTrack = esd->GetTrack(imother);
581 esdTrack->GetPxPyPz(p);
582 esdTrack->GetXYZ(pos);
583 esdTrack->GetCovarianceXYZPxPyPz(covTr);
584 esdTrack->GetESDpid(pid);
587 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
588 esdTrack->GetLabel(),
594 (Short_t)esdTrack->GetSign(),
595 esdTrack->GetITSClusterMap(),
598 kTRUE, // check if this is right
599 kTRUE, // check if this is right
600 AliAODTrack::kPrimary);
601 primary->AddDaughter(mother);
602 mother->ConvertAliPIDtoAODPID();
605 // cerr << "Error: event " << esd->GetEventNumberInFile() << " kink " << TMath::Abs(ikink)-1
606 // << " track " << imother << " has already been used!" << endl;
609 // Add the kink vertex
610 AliESDkink * kink = esd->GetKink(TMath::Abs(ikink)-1);
612 AliAODVertex * vkink =
613 new(vertices[jVertices++]) AliAODVertex(kink->GetPosition(),
617 esdTrack->GetID(), // This is the track ID of the mother's track!
618 AliAODVertex::kKink);
619 // Add the daughter track
621 AliAODTrack * daughter = NULL;
623 if (!usedTrack[idaughter]) {
625 usedTrack[idaughter] = kTRUE;
627 AliESDtrack *esdTrack = esd->GetTrack(idaughter);
628 esdTrack->GetPxPyPz(p);
629 esdTrack->GetXYZ(pos);
630 esdTrack->GetCovarianceXYZPxPyPz(covTr);
631 esdTrack->GetESDpid(pid);
634 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
635 esdTrack->GetLabel(),
641 (Short_t)esdTrack->GetSign(),
642 esdTrack->GetITSClusterMap(),
645 kTRUE, // check if this is right
646 kTRUE, // check if this is right
647 AliAODTrack::kPrimary);
648 vkink->AddDaughter(daughter);
649 daughter->ConvertAliPIDtoAODPID();
652 // cerr << "Error: event " << esd->GetEventNumberInFile() << " kink " << TMath::Abs(ikink)-1
653 // << " track " << idaughter << " has already been used!" << endl;
661 // Tracks (primary and orphan)
663 printf("NUMBER OF TRACKS %5d\n", nTracks);
665 for (Int_t nTrack = 0; nTrack < nTracks; ++nTrack) {
668 if (usedTrack[nTrack]) continue;
670 AliESDtrack *esdTrack = esd->GetTrack(nTrack);
671 UInt_t selectInfo = 0;
675 selectInfo = fTrackFilter->IsSelected(esdTrack);
676 if (!selectInfo) continue;
680 esdTrack->GetPxPyPz(p);
681 esdTrack->GetXYZ(pos);
682 esdTrack->GetCovarianceXYZPxPyPz(covTr);
683 esdTrack->GetESDpid(pid);
685 Float_t impactXY, impactZ;
687 esdTrack->GetImpactParameters(impactXY,impactZ);
690 // track inside the beam pipe
692 primary->AddDaughter(aodTrack =
693 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
694 esdTrack->GetLabel(),
700 (Short_t)esdTrack->GetSign(),
701 esdTrack->GetITSClusterMap(),
704 kTRUE, // check if this is right
705 kTRUE, // check if this is right
706 AliAODTrack::kPrimary,
709 aodTrack->ConvertAliPIDtoAODPID();
712 // outside the beam pipe: orphan track
713 // Don't write them anymore!
717 new(tracks[jTracks++]) AliAODTrack(esdTrack->GetID(),
718 esdTrack->GetLabel(),
724 (Short_t)esdTrack->GetSign(),
725 esdTrack->GetITSClusterMap(),
728 kFALSE, // check if this is right
729 kFALSE, // check if this is right
730 AliAODTrack::kOrphan,
732 aodTrack->ConvertAliPIDtoAODPID();
735 } // end of loop on tracks
738 Int_t nMuTracks = esd->GetNumberOfMuonTracks();
739 for (Int_t nMuTrack = 0; nMuTrack < nMuTracks; ++nMuTrack) {
741 AliESDMuonTrack *esdMuTrack = esd->GetMuonTrack(nMuTrack);
742 p[0] = esdMuTrack->Px();
743 p[1] = esdMuTrack->Py();
744 p[2] = esdMuTrack->Pz();
745 pos[0] = primary->GetX();
746 pos[1] = primary->GetY();
747 pos[2] = primary->GetZ();
749 // has to be changed once the muon pid is provided by the ESD
750 for (Int_t i = 0; i < 10; pid[i++] = 0.); pid[AliAODTrack::kMuon]=1.;
752 primary->AddDaughter(
753 new(tracks[jTracks++]) AliAODTrack(0, // no ID provided
754 0, // no label provided
759 NULL, // no covariance matrix provided
760 (Short_t)-99, // no charge provided
761 0, // no ITSClusterMap
764 kTRUE, // check if this is right
765 kTRUE, // not used for vertex fit
766 AliAODTrack::kPrimary)
769 aodTrack->SetHitsPatternInTrigCh(esdMuTrack->GetHitsPatternInTrigCh());
770 Int_t track2Trigger = esdMuTrack->GetMatchTrigger();
771 aodTrack->SetMatchTrigger(track2Trigger);
773 aodTrack->SetChi2MatchTrigger(esdMuTrack->GetChi2MatchTrigger());
775 aodTrack->SetChi2MatchTrigger(0.);
777 tracks.Expand(jTracks); // remove 'empty slots' due to unwritten tracks
779 // Access to the AOD container of PMD clusters
780 TClonesArray &pmdClusters = *(AODEvent()->GetPmdClusters());
781 Int_t jPmdClusters=0;
783 for (Int_t iPmd = 0; iPmd < nPmdClus; ++iPmd) {
784 // file pmd clusters, to be revised!
785 AliESDPmdTrack *pmdTrack = esd->GetPmdTrack(iPmd);
788 Double_t pos[3] = { pmdTrack->GetClusterX(), pmdTrack->GetClusterY(), pmdTrack->GetClusterZ() };
789 Double_t pid[9] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. }; // to be revised!
791 // assoc cluster not set
792 new(pmdClusters[jPmdClusters++]) AliAODPmdCluster(iPmd, nLabel, label, pmdTrack->GetClusterADC(), pos, pid);
795 // Access to the AOD container of clusters
796 TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters());
799 for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
801 AliESDCaloCluster * cluster = esd->GetCaloCluster(iClust);
803 Int_t id = cluster->GetID();
806 Float_t energy = cluster->E();
807 cluster->GetPosition(posF);
808 Char_t ttype=AliAODCluster::kUndef;
810 if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) {
811 ttype=AliAODCluster::kPHOSNeutral;
813 else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) {
814 ttype = AliAODCluster::kEMCALClusterv1;
818 AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id,
826 caloCluster->SetCaloCluster(); // to be refined!
829 caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters
830 // end of loop on calo clusters
832 // fill EMCAL cell info
833 if (esd->GetEMCALCells()) { // protection against missing ESD information
834 AliESDCaloCells &esdEMcells = *(esd->GetEMCALCells());
835 Int_t nEMcell = esdEMcells.GetNumberOfCells() ;
837 AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
838 aodEMcells.CreateContainer(nEMcell);
839 aodEMcells.SetType(AliAODCaloCells::kEMCAL);
840 for (Int_t iCell = 0; iCell < nEMcell; iCell++) {
841 aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell));
846 // fill PHOS cell info
847 if (esd->GetPHOSCells()) { // protection against missing ESD information
848 AliESDCaloCells &esdPHcells = *(esd->GetPHOSCells());
849 Int_t nPHcell = esdPHcells.GetNumberOfCells() ;
851 AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
852 aodPHcells.CreateContainer(nPHcell);
853 aodPHcells.SetType(AliAODCaloCells::kPHOS);
854 for (Int_t iCell = 0; iCell < nPHcell; iCell++) {
855 aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));
861 AliAODTracklets &SPDTracklets = *(AODEvent()->GetTracklets());
862 const AliMultiplicity *mult = esd->GetMultiplicity();
864 if (mult->GetNumberOfTracklets()>0) {
865 SPDTracklets.CreateContainer(mult->GetNumberOfTracklets());
867 for (Int_t n=0; n<mult->GetNumberOfTracklets(); n++) {
868 SPDTracklets.SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n));
872 //Printf("ERROR: AliMultiplicity could not be retrieved from ESD");
882 void AliAnalysisTaskESDfilter::Terminate(Option_t */*option*/)
884 // Terminate analysis
886 if (fDebug > 1) printf("AnalysisESDfilter: Terminate() \n");