]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Reading files from TGliteXmlEventlist implemented in Reader ESD
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Nov 2004 18:07:02 +0000 (18:07 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Nov 2004 18:07:02 +0000 (18:07 +0000)
ANALYSIS/AliReader.cxx
ANALYSIS/AliReader.h
ANALYSIS/AliReaderESD.cxx

index ff29a5765d98673aeafa434d68c587440642c723..434f747f8c20ae3d3c9c65679e2b4e07779c78dc 100644 (file)
@@ -56,6 +56,8 @@
 #include <TRandom.h>
 #include <TH1.h>
 
+#include <TGliteXmlEventlist.h>
+
 #include "AliAODParticleCut.h"
 #include "AliAOD.h"
 #include "AliAODRun.h"
@@ -66,6 +68,7 @@ ClassImp(AliReader)
 /*************************************************************************************/
 
 AliReader::AliReader():
+ fEventList(0x0),
  fCuts(new TObjArray()),
  fDirs(0x0),
  fCurrentEvent(0),
@@ -87,6 +90,7 @@ AliReader::AliReader():
 /*************************************************************************************/
 
 AliReader::AliReader(TObjArray* dirs):
+ fEventList(0x0),
  fCuts(new TObjArray()),
  fDirs(dirs),
  fCurrentEvent(0),
@@ -108,6 +112,7 @@ AliReader::AliReader(TObjArray* dirs):
 /*************************************************************************************/
 AliReader::AliReader(const AliReader& in):
  TNamed(in),
+ fEventList((in.fEventList)?(TGliteXmlEventlist*)in.fEventList->Clone():0x0),
  fCuts((in.fCuts)?(TObjArray*)in.fCuts->Clone():0x0),
  fDirs((in.fDirs)?(TObjArray*)in.fDirs->Clone():0x0),
  fCurrentEvent(0),
@@ -138,6 +143,7 @@ AliReader::~AliReader()
  delete fEventSim;
  delete fEventRec;
  delete fTrackCounter;
+ delete fEventList;
 }
 /*************************************************************************************/
 
index fd04fcde9ea70b99988f0eada9abb6324aa9dd39..b4b4f246cae0fee1f5542bb2a266191d5f652444 100644 (file)
@@ -53,6 +53,8 @@
 #include <TNamed.h>
 #include <TObjArray.h>
 
+class TGliteXmlEventlist;
+    
 class AliAODRun;
 class AliAOD;
 class AliAODParticleCut;
@@ -89,7 +91,9 @@ class AliReader: public TNamed
     virtual Int_t        GetNumberOfRecEvents();//Returns number of available events -> usually conncected with reading all events
                                                 //may be time consuming
     virtual Int_t        GetNumberOfSimEvents();// 
-    
+     
+    void                 SetEventList(TGliteXmlEventlist* evl){fEventList = evl;}
+         
     void                 SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
     void                 SetEventBuffering(Bool_t flag){fBufferEvents = flag;}//switches on/off buffering - read data are kept in local buffer
     void                 SetBlend(Bool_t flag = kTRUE){fBlend=flag;} //set blending - randomizing particle order
@@ -100,6 +104,8 @@ class AliReader: public TNamed
     
   protected:
     
+    TGliteXmlEventlist*  fEventList;//Event list delivered by GLite/AliEn
+    
     TObjArray*           fCuts;//array with particle cuts
     TObjArray*           fDirs;//arry with directories to read data from
     
index e63db3e870d5a95ebbdce47670d6ae2db63c8d76..28a1346cf5ba5974f703389d3ae6cf98cbc99b43 100644 (file)
@@ -19,6 +19,8 @@
 #include <TParticle.h>
 #include <TH1.h>
 
+#include <TGliteXmlEventlist.h>
+
 #include <AliRun.h>
 #include <AliRunLoader.h>
 #include <AliStack.h>
@@ -645,6 +647,7 @@ void AliReaderESD::Rewind()
   fRunLoader = 0x0;
   fCurrentDir = 0;
   fNEventsRead = 0;
+  if (fEventList) fEventList->Reset(); 
   if (fTrackCounter) fTrackCounter->Reset();
 }
 /**********************************************************/
@@ -652,14 +655,39 @@ void AliReaderESD::Rewind()
 TFile* AliReaderESD::OpenFile(Int_t n)
 {
 //opens fFile with  tree
-
+ if (fEventList)
+  { 
+    if (fCurrentDir > n)
+     {
+       fEventList->Reset();
+       fCurrentDir = 0;
+     }
+    
+    while (fCurrentDir < n)
+     {
+       fEventList->Next();
+       fCurrentDir++;
+     }
+    fEventList->Next();
+  }
  const TString& dirname = GetDirName(n);
  if (dirname == "")
   {
    Error("OpenFiles","Can not get directory name");
    return 0x0;
   }
- TString filename = dirname +"/"+ fESDFileName;
+ TString filename;
+ if (fEventList)
+  {
+    filename = fEventList->GetURL(fESDFileName);
+  }
+ else
+  {
+    filename = dirname +"/"+ fESDFileName;
+  }
+ Info("OpenFile","%s ==> %s",fESDFileName.Data(),filename.Data()); 
  TFile *ret = TFile::Open(filename.Data()); 
 
  if ( ret == 0x0)
@@ -675,7 +703,19 @@ TFile* AliReaderESD::OpenFile(Int_t n)
  
  if (fReadSim )
   {
-   fRunLoader = AliRunLoader::Open(dirname +"/"+ fGAlFileName);
+    TString gafilename;
+    if (fEventList)
+     {
+       gafilename = fEventList->GetURL(fGAlFileName);
+     }
+    else
+     {
+       gafilename = dirname +"/"+ fGAlFileName;
+     }
+   Info("OpenFile","%s ==> %s",fGAlFileName.Data(),gafilename.Data()); 
+
+   fRunLoader = AliRunLoader::Open(gafilename);
+   
    if (fRunLoader == 0x0)
     {
       Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data());
@@ -684,6 +724,14 @@ TFile* AliReaderESD::OpenFile(Int_t n)
     }
     
    fRunLoader->LoadHeader();
+   
+   if (fEventList)
+    {
+      TString kinefilename = fEventList->GetURL("Kinematics.root");
+      fRunLoader->SetKineFileName(kinefilename);
+      Info("OpenFile","%s ==> %s","Kinematics.root",kinefilename.Data()); 
+    } 
+   
    if (fRunLoader->LoadKinematics())
     {
       Error("Next","Error occured while loading kinematics.");