]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliRunAnalysis.cxx
Change in the signature of base class method Use to avoid compilation warnings (icc)
[u/mrichter/AliRoot.git] / ANALYSIS / AliRunAnalysis.cxx
index 4f3ecd6f95c4db86127813e5d7cb8a748fef2b3f..48be0c367d62b2c3aa501d5bfce6bf43d0af1ddc 100644 (file)
@@ -1,38 +1,37 @@
-#include "AliRunAnalysis.h"
-//________________________________
-///////////////////////////////////////////////////////////
-//
-// class AliRunAnalysis
-//
-//
-//
-// Piotr.Skowronski@cern.ch
-//
-///////////////////////////////////////////////////////////
-
-#include <stdlib.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.                  *
+ **************************************************************************/
 
-#include <TString.h>
-#include <TObjString.h>
-#include <TClass.h>
-#include <TFile.h>
-#include <TKey.h>
-#include <TObjArray.h>
+/* $Id$ */
 
-#include <AliRun.h>
-#include <AliRunLoader.h>
-#include <AliStack.h>
-#include <AliESDtrack.h>
-#include <AliESD.h>
+//********************************************************
+// class AliRunAnalysis                                  *
+// Analysis manager                                      *
+// Author: Piotr.Skowronski@cern.ch                      *
+//********************************************************
 
+#include "AliRunAnalysis.h"
+#include "AliLog.h"
+#include "AliAnalysis.h"
 #include "AliEventCut.h"
 #include "AliReader.h"
-#include "AliVAODParticle.h"
 
 
 ClassImp(AliRunAnalysis)
 AliRunAnalysis::AliRunAnalysis():
- TTask("RunAnalysis","Alice Analysis Manager") ,
+ TTask("RunAnalysis","Alice Analysis Manager"),
+ fAnalysies(10),
  fReader(0x0),
  fEventCut(0x0),
  fCutOnSim(kFALSE),
@@ -54,52 +53,69 @@ Int_t AliRunAnalysis::Run()
 {
  //makes analysis
 
-  if (fReader == 0x0)
-   {
-     Error("Run","Reader is not set");
-     return 1;
-   }
+ if (fReader == 0x0)
+  {
+    AliError("Reader is not set");
+    return 1;
+  }
+ TDirectory* cwd = gDirectory; 
+ Int_t nanal = fAnalysies.GetEntries();
+ AliDebug(1,Form("There are %d analyses",nanal));
  /******************************/ 
  /*  Init Event                */ 
  /******************************/ 
- for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
-  {
+ AliDebug(1,"Intializing analyses...");
+ for (Int_t an = 0; an < nanal; an++)
+  {   
       AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
+      AliDebug(1,Form("Intializing analysis %d,address=%#x, name=%s", 
+                     an, analysis, analysis->GetName()));
       analysis->Init();
+      AliDebug(1,Form("Init done for analysis %d",an));
   }
+ AliDebug(1,"Intializing analyses... Done.");
+  
  while (fReader->Next() == kFALSE)
   {
-   AliAOD* eventsim = fReader->GetEventSim();
-   AliAOD* eventrec = fReader->GetEventRec();
-   
-      /******************************/ 
-      /*  Event Cut                 */ 
-      /******************************/ 
-      if ( Pass(eventrec,eventsim) )
-       {
-         if (AliVAODParticle::GetDebug()) Info("Run","Event rejected by Event Cut");
-         continue; //Did not pass the 
-       }
-      /******************************/ 
-      /*  Process Event             */ 
-      /******************************/ 
-      for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
-       {
-           AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
-           analysis->ProcessEvent(eventrec,eventsim);
-       }
+     AliAOD* eventrec = fReader->GetEventRec();
+     AliAOD* eventsim = fReader->GetEventSim();
+
+     /******************************/ 
+     /*  Event Cut                 */ 
+     /******************************/ 
+     if ( Rejected(eventrec,eventsim) )
+      {
+        AliDebug(1,"Event rejected by Event Cut");
+        continue; //Did not pass the 
+      }
+      
+     /******************************/ 
+     /*  Process Event             */ 
+     /******************************/ 
+     AliDebug(1,Form("There is %d analyses",fAnalysies.GetEntries()));
+     
+     for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
+      {
+          AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
+          analysis->ProcessEvent(eventrec,eventsim);
+      }
     
   }//end of loop over events
 
  /******************************/ 
  /*  Finish Event              */ 
  /******************************/ 
+ AliDebug(1,Form("Finishing analyses...\n There are %d anlyses",fAnalysies.GetEntries()));
+ if (cwd) cwd->cd();
  for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
   {
       AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
+      AliDebug(1,Form("Calling Finish for analysis %d address %#x name=%s", 
+                     an, analysis,analysis->GetName()));
       analysis->Finish();
+      AliDebug(1,Form("Called Finish for analysis %d",an));
   }
+ AliDebug(1,"Finishing done");
 
  return 0;   
 }
@@ -122,16 +138,16 @@ void AliRunAnalysis::SetEventCut(AliEventCut* evcut)
 
 /*********************************************************/
 
-Bool_t AliRunAnalysis::Pass(AliAOD* recevent, AliAOD* simevent)
+Bool_t AliRunAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
 {
   //checks the event cut
   if (fEventCut == 0x0) return kFALSE;
   
   if (fCutOnRec)
-    if (fEventCut->Pass(recevent)) return kTRUE;
+    if (fEventCut->Rejected(recevent)) return kTRUE;
     
   if (fCutOnSim)
-    if (fEventCut->Pass(simevent)) return kTRUE;
+    if (fEventCut->Rejected(simevent)) return kTRUE;
   
   return kFALSE;
 }