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()),
46 AliJetParticlesReader::AliJetParticlesReader(TObjArray *dirs)
56 fPtMin(0),fPtMax(1000),
57 fEtaMin(-1),fEtaMax(1),
58 fPhiMin(0),fPhiMax(2*TMath::Pi()),
64 AliJetParticlesReader::~AliJetParticlesReader()
67 if((fOwner) && (fEventParticles)) delete fEventParticles;
70 Int_t AliJetParticlesReader::Next()
73 //if asked to read up to event nb. fLast,
74 //and it is overcome, report no more events
75 if ((fNEventsRead > fLast) && (fLast > 0) ) return kFALSE;
77 do //if asked to read from event fFirst, rewind to it
79 if ( ReadNext() == kFALSE)
80 return kFALSE; //if no more evets, return it
81 } while (fNEventsRead < fFirst);
84 if(fTree && fEventParticles){
86 fTree->Branch("particles","AliJetEventParticles",&fEventParticles,32000,1);
89 fEventParticles->SetEventNr(fCurrentDir*1000+fCurrentEvent);
95 TString& AliJetParticlesReader::GetDirName(Int_t entry)
97 //returns directory name of entry to read
98 TString* retval;//return value
101 retval = new TString(".");
105 if ((entry>fDirs->GetEntries()) || (entry<0))
106 //if out of bounds return empty string
107 //note that entry==0 is accepted even if array is empty (size=0)
109 Error("GetDirName","Entry out of bounds");
110 retval = new TString();
114 if (fDirs->GetEntries() == 0)
116 retval = new TString(".");
120 TClass *objclass = fDirs->At(entry)->IsA();
121 TClass *stringclass = TObjString::Class();
123 TObjString *dir = (TObjString*)objclass->DynamicCast(stringclass,fDirs->At(entry));
126 Error("GetDirName","Object in TObjArray is not a TObjString");
127 retval = new TString();
131 //Info("GetDirName","Returned ok %s",dir->String().Data());
132 return dir->String();