1 /*************************************************************************
2 * Copyright(c) 1998-2009, 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 ///////////////////////////////////////////////////////////////////////////
17 // Dielectron Event //
26 ///////////////////////////////////////////////////////////////////////////
28 #include <TObjArray.h>
30 #include <AliVTrack.h>
31 #include <AliESDtrack.h>
32 #include <AliAODTrack.h>
34 #include "AliDielectronEvent.h"
36 ClassImp(AliDielectronEvent)
38 AliDielectronEvent::AliDielectronEvent() :
40 fArrTrackP("AliESDtrack",1000),
41 fArrTrackN("AliESDtrack",1000),
42 fArrPairs("AliKFParticle",0),
49 // Default Constructor
54 //______________________________________________
55 AliDielectronEvent::AliDielectronEvent(const char* name, const char* title) :
57 fArrTrackP("AliESDtrack",1000),
58 fArrTrackN("AliESDtrack",1000),
59 fArrPairs("AliKFParticle",0),
70 //______________________________________________
71 AliDielectronEvent::~AliDielectronEvent()
81 //______________________________________________
82 void AliDielectronEvent::SetTracks(const TObjArray &arrP, const TObjArray &arrN, const TObjArray &/*arrPairs*/)
85 // Setup AliKFParticles
86 // assumes that the objects in arrP and arrN are AliVTracks
89 //Clear out old entries before filling new ones
91 // we keep the tracks buffered to minimise new / delete operations
95 //check size of the arrays
96 if (fArrTrackP.GetSize()<arrP.GetSize()) fArrTrackP.Expand(arrP.GetSize());
97 if (fArrTrackN.GetSize()<arrN.GetSize()) fArrTrackN.Expand(arrN.GetSize());
101 for (Int_t itrack=0; itrack<arrP.GetEntriesFast(); ++itrack){
103 AliESDtrack *track=dynamic_cast<AliESDtrack*>(arrP.At(itrack));
104 if (!track) continue;
105 new (fArrTrackP[tracks]) AliESDtrack(*track);
108 AliAODTrack *track=dynamic_cast<AliAODTrack*>(arrP.At(itrack));
109 if (!track) continue;
110 new (fArrTrackP[tracks]) AliAODTrack(*track);
117 for (Int_t itrack=0; itrack<arrN.GetEntriesFast(); ++itrack){
119 AliESDtrack *track=dynamic_cast<AliESDtrack*>(arrN.At(itrack));
120 if (!track) continue;
121 new (fArrTrackN[tracks]) AliESDtrack(*track);
124 AliAODTrack *track=dynamic_cast<AliAODTrack*>(arrN.At(itrack));
125 if (!track) continue;
126 new (fArrTrackN[tracks]) AliAODTrack(*track);
135 //______________________________________________
136 void AliDielectronEvent::Clear(Option_t *opt)
141 // fArrTrackP.Clear(opt);
142 // fArrTrackN.Clear(opt);
144 for (Int_t i=fArrTrackP.GetEntriesFast()-1; i>=0; --i){
145 delete fArrTrackP.RemoveAt(i);
148 for (Int_t i=fArrTrackN.GetEntriesFast()-1; i>=0; --i){
149 delete fArrTrackN.RemoveAt(i);
152 fArrPairs.Clear(opt);
156 //______________________________________________
157 void AliDielectronEvent::SetAOD()
162 fArrTrackP.SetClass("AliAODTrack");
163 fArrTrackN.SetClass("AliAODTrack");
167 //______________________________________________
168 void AliDielectronEvent::SetEventData(const Double_t data[AliDielectronVarManager::kNMaxValues])
171 // copy only evnet variables
173 for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues;++i) fEventData[i]=data[i];