]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDanalysis.C
New MFT analysis tools
[u/mrichter/AliRoot.git] / STEER / AliESDanalysis.C
index 4e9f96745fa9730471d894e041f9316951f3837b..ec0abe296b7a5f80eff4e38c3d51d6a038b91323 100644 (file)
@@ -6,14 +6,14 @@
 
 #if !defined( __CINT__) || defined(__MAKECINT__)
   #include <Riostream.h>
-  #include "TKey.h"
+  #include <TTree.h>
   #include "TFile.h"
   #include "TH1F.h"
   #include "TCanvas.h"
   #include "TStyle.h"
   #include "TStopwatch.h"
 
-  #include "AliESD.h"
+  #include "AliESDEvent.h"
 #endif
 
 extern TStyle *gStyle;
@@ -34,17 +34,17 @@ Int_t AliESDanalysis() {
 //****** File with the ESD
    TFile *ef=TFile::Open("AliESDs.root");
    if (!ef || !ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
+   AliESDEvent* event = new AliESDEvent();
+   TTree* tree = (TTree*) ef->Get("esdTree");
+   if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
+   event->ReadFromTree(tree);
 
    Int_t n=0;
-   TKey *key=0;
-   TIter next(ef->GetListOfKeys());
 
 //******* The loop over events
-   while ((key=(TKey*)next())!=0) {
+   while (tree->GetEvent(n)) {
      cout<<endl<<"Processing event number : "<<n++<<endl;
 
-     AliESD *event=(AliESD*)key->ReadObj();
-
      Int_t ntrk=event->GetNumberOfTracks();
      cout<<"Number of ESD tracks : "<<ntrk<<endl; 
      Int_t nv0=event->GetNumberOfV0s();
@@ -92,6 +92,9 @@ Int_t AliESDanalysis() {
 
    }
 
+   delete event;
+   ef->Close();
+
    timer.Stop(); timer.Print();
 
    TCanvas *c1=new TCanvas("c1","",0,0,600,1200);