]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG0/CreateESDChain.C
Update for Ds
[u/mrichter/AliRoot.git] / PWG0 / CreateESDChain.C
index 157849980327eeb4ed1d15e973c8aa890b1e611e..e356e95cabb04c230b014fd54be66ab24b57bd7c 100644 (file)
@@ -95,16 +95,16 @@ TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20,
 
     // Read the input list of files and add them to the chain
     TString line;
-    while(in.good()) 
+    while (in.good())
     {
       in >> line;
-      
+
       if (line.Length() == 0)
-        continue;      
-      
+        continue;
+
       if (offset > 0)
       {
-        --offset;
+        offset--;
         continue;
       }
 
@@ -172,8 +172,6 @@ void ChainToTextFile(TChain* chain, const char* target)
   while ((obj = iter->Next())) {
     TString fileName(obj->GetTitle());
     
-    fileName.Remove(fileName.Length()-13);
-
     outfile << fileName.Data() << endl;
   }
 
@@ -182,6 +180,18 @@ void ChainToTextFile(TChain* chain, const char* target)
   delete iter;
 } 
 
+TObjArray* Chain2List(TChain* chain)
+{
+  // returns a TObjArray of TObjStrings of the file names in the chain
+
+  TObjArray* result = new TObjArray;
+
+  for (Int_t i=0; i<chain->GetListOfFiles()->GetEntries(); i++)
+    result->Add(new TObjString(chain->GetListOfFiles()->At(i)->GetTitle()));
+
+  return result;
+}
+
 void LookupWrite(TChain* chain, const char* target)
 {
   // looks up the chain and writes the remaining files to the text file target