+TString& AliGenReaderTreeK::GetDirName(Int_t entry)
+ {
+// Get the current directory name
+
+ TString* retval;//return value
+ if (fDirs == 0x0)
+ {
+ retval = new TString(".");
+ return *retval;
+ }
+
+ if ( (entry>fDirs->GetEntries()) || (entry<0))//if out of bounds return empty string
+ { //note that entry==0 is accepted even if array is empty (size=0)
+ Error("GetDirName","Name out of bounds");
+ retval = new TString();
+ return *retval;
+ }
+
+ if (fDirs->GetEntries() == 0)
+ {
+ retval = new TString(".");
+ return *retval;
+ }
+
+ TObjString *dir = dynamic_cast<TObjString*>(fDirs->At(entry));
+ if(dir == 0x0)
+ {
+ Error("GetDirName","Object in TObjArray is not a TObjString or its descendant");
+ retval = new TString();
+ return *retval;
+ }
+ if (gDebug > 0) Info("GetDirName","Returned ok %s",dir->String().Data());
+ return dir->String();
+ }
+
+void AliGenReaderTreeK::AddDir(const char* dirname)
+{
+ //adds a directory to the list of directories where data are looked for
+ if(fDirs == 0x0)
+ {
+ fDirs = new TObjArray();
+ fDirs->SetOwner(kTRUE);
+ }
+ TObjString *odir= new TObjString(dirname);
+ fDirs->Add(odir);
+}