]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliReaderESDTree.cxx
Use new naming conventions from QuadSet.
[u/mrichter/AliRoot.git] / ANALYSIS / AliReaderESDTree.cxx
index 6c7650cf6e73e09236d116de353ccb11637ac45b..fba42416399236ad12a0fcf226d5bb04a58bbd7f 100644 (file)
@@ -1,25 +1,36 @@
-#include "AliReaderESDTree.h"
-//_______________________________________________________________________
-/////////////////////////////////////////////////////////////////////////
-//
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//***********************************************************************
 // class AliReaderESDTree
-//
 // Reader for MUON ESD Tree (only for rec)
-//
 // finck@subatech.in2p3.fr
-//
-/////////////////////////////////////////////////////////////////////////
+//***********************************************************************
 
 #include <TString.h>
 #include <TTree.h>
 #include <TFile.h>
 
-
-#include <AliRun.h>
-#include <AliRunLoader.h>
-
-#include <AliESD.h>
 #include "AliAOD.h"
+#include "AliESD.h"
+#include "AliLog.h"
+#include "AliReaderESDTree.h"
+#include "AliRunLoader.h"
+
 
 ClassImp(AliReaderESDTree)
 
@@ -43,8 +54,7 @@ Int_t AliReaderESDTree::ReadNext()
 //reads next event from fFile
 //fRunLoader is for reading Kine
   
-  if (AliVAODParticle::GetDebug())
-    Info("ReadNext","Entered");
+  AliDebug(1,"Entered");
     
   if (fEventSim == 0x0)  fEventSim = new AliAOD();
   if (fEventRec == 0x0)  fEventRec = new AliAOD();
@@ -55,34 +65,33 @@ Int_t AliReaderESDTree::ReadNext()
   do  //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
     {
       if (fFile == 0x0)
-       {
-         fFile = OpenFile(fCurrentDir);//rl is opened here
-         if (fFile == 0x0)
-           {
-             Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
-             fCurrentDir++;
-             continue;
-           }
-         fCurrentEvent = 0;
-       }
+        {
+          fFile = OpenFile(fCurrentDir);//rl is opened here
+          if (fFile == 0x0)
+            {
+              Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
+              fCurrentDir++;
+              continue;
+            }
+          fCurrentEvent = 0;
+        }
 
       static AliESD* esd = 0x0;
       fTree->SetBranchAddress("ESD", &esd);
       Int_t status = fTree->GetEvent(fCurrentEvent);
 
       if (!status)
-       {
-         if (AliVAODParticle::GetDebug() > 2 )
-           {
-             Info("ReadNext","Can not find event# %d in Tree", fCurrentEvent);
-           }
-         fCurrentDir++;
-         delete fFile;//we have to assume there is no more ESD objects in the fFile
-         fFile = 0x0;
-         delete fRunLoader;
-         fRunLoader = 0x0;
-         continue;
-       }
+        {
+          AliDebug(2,Form("Cannot find event# %d in Tree", fCurrentEvent));
+          fCurrentDir++;
+          delete fTree;
+          fTree = 0x0;
+          delete fFile;//we have to assume there is no more ESD objects in the fFile
+          fFile = 0x0;
+          delete fRunLoader;
+          fRunLoader = 0x0;
+          continue;
+        }
 
       ReadESD(esd);
       
@@ -125,6 +134,7 @@ TFile* AliReaderESDTree::OpenFile(Int_t n)
  if (!fTree)
   {
     Error("OpenFiles","Can't open ESD Tree %s",esdname.Data());
+    delete ret;
     return 0x0;
 
   }
@@ -135,6 +145,7 @@ TFile* AliReaderESDTree::OpenFile(Int_t n)
    if (fRunLoader == 0x0)
     {
       Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data());
+      delete fTree;
       delete ret;
       return 0x0;
     }
@@ -144,6 +155,7 @@ TFile* AliReaderESDTree::OpenFile(Int_t n)
     {
       Error("Next","Error occured while loading kinematics.");
       delete fRunLoader;
+      delete fTree;
       delete ret;
       return 0x0;
     }