3 //_________________________________________________________________________
4 ///////////////////////////////////////////////////////////////////////////
6 // class AliJetParticlesReader //
8 // This reader reads tracks from Event Summary Data //
9 // taken from Piotr.Skowronski@cern.ch //
10 // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html //
12 // loizides@ikf.uni-frankfurt.de //
13 ///////////////////////////////////////////////////////////////////////////
16 #include <TObjArray.h>
17 #include <TClonesArray.h>
19 #include <TObjString.h>
21 #include "AliJetEventParticles.h"
22 #include "AliJetParticlesReader.h"
25 ClassImp(AliJetParticlesReader)
27 AliJetParticlesReader::AliJetParticlesReader()
37 fPtMin(0),fPtMax(1000),
38 fEtaMin(-1),fEtaMax(1),
39 fPhiMin(0),fPhiMax(2*TMath::Pi())
44 AliJetParticlesReader::AliJetParticlesReader(TObjArray *dirs)
54 fPtMin(0),fPtMax(1000),
55 fEtaMin(-1),fEtaMax(1),
56 fPhiMin(0),fPhiMax(2*TMath::Pi())
60 AliJetParticlesReader::~AliJetParticlesReader()
63 if((fOwner) && (fEventParticles)) delete fEventParticles;
66 Int_t AliJetParticlesReader::Next()
69 //if asked to read up to event nb. fLast,
70 //and it is overcome, report no more events
71 if ((fNEventsRead > fLast) && (fLast > 0) ) return kFALSE;
73 do //if asked to read from event fFirst, rewind to it
75 if ( ReadNext() == kFALSE)
76 return kFALSE; //if no more evets, return it
77 } while (fNEventsRead < fFirst);
84 TString& AliJetParticlesReader::GetDirName(Int_t entry)
86 //returns directory name of entry to read
87 TString* retval;//return value
90 retval = new TString(".");
94 if ((entry>fDirs->GetEntries()) || (entry<0))
95 //if out of bounds return empty string
96 //note that entry==0 is accepted even if array is empty (size=0)
98 Error("GetDirName","Entry out of bounds");
99 retval = new TString();
103 if (fDirs->GetEntries() == 0)
105 retval = new TString(".");
109 TClass *objclass = fDirs->At(entry)->IsA();
110 TClass *stringclass = TObjString::Class();
112 TObjString *dir = (TObjString*)objclass->DynamicCast(stringclass,fDirs->At(entry));
115 Error("GetDirName","Object in TObjArray is not a TObjString");
116 retval = new TString();
120 //Info("GetDirName","Returned ok %s",dir->String().Data());
121 return dir->String();