Use MultiEventHandler instead of MultiAODHandler
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Mar 2009 14:30:43 +0000 (14:30 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Mar 2009 14:30:43 +0000 (14:30 +0000)
Allows mixing of esd events.

ANALYSIS/AliAnalysisTaskME.cxx
ANALYSIS/AliAnalysisTaskME.h
ANALYSIS/AliAnalysisTaskPhiCorr.cxx

index 4be9966..c922604 100644 (file)
@@ -25,8 +25,9 @@
 #include "AliAnalysisTaskME.h"
 #include "AliAnalysisManager.h"
 #include "AliAODEvent.h"
+#include "AliVEvent.h"
 #include "AliAODHandler.h"
-#include "AliMultiAODInputHandler.h"
+#include "AliMultiEventInputHandler.h"
 #include "AliLog.h"
 
 
@@ -99,16 +100,16 @@ void AliAnalysisTaskME::ConnectInputData(Option_t* /*option*/)
 //
 //  Multi AOD
 //
-    fInputHandler = dynamic_cast<AliMultiAODInputHandler*> 
+    fInputHandler = dynamic_cast<AliMultiEventInputHandler*> 
        ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
     if (fInputHandler == 0) {
-       AliFatal("Event Handler has to be MultiAODInputHandler !");
+       AliFatal("Event Handler has to be MultiEventInputHandler !");
     } else {
        // Check that we have an event pool
        if (!fInputHandler->GetEventPool()) {
            fInputHandler->SetEventPool(AliAnalysisManager::GetAnalysisManager()->GetEventPool());
            if (!fInputHandler->GetEventPool()) 
-               AliFatal("MultiAODInputHandler has no EventPool connected !");
+               AliFatal("MultiEventInputHandler has no EventPool connected !");
        }
     }
 }
@@ -149,11 +150,11 @@ void AliAnalysisTaskME::Exec(Option_t* option)
     if (fInputHandler->IsBufferReady()) {
        if ((fFreshBufferOnly && fInputHandler->IsFreshBuffer()) || !fFreshBufferOnly)
        {
-           outputHandler->SetFillAOD(kTRUE);
+           if (outputHandler) outputHandler->SetFillAOD(kTRUE);
            UserExec(option);
            PostData(0, fTreeA);
        } else {
-           outputHandler->SetFillAOD(kFALSE);
+           if (outputHandler) outputHandler->SetFillAOD(kFALSE);
        }
     } else {
        AliInfo(Form("Waiting for buffer to be ready !\n"));
@@ -178,7 +179,7 @@ void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj)
     }
 }
 
-AliAODEvent*  AliAnalysisTaskME::GetEvent(Int_t iev)
+AliVEvent*  AliAnalysisTaskME::GetEvent(Int_t iev)
 {
     // Get an event from the input handler
     return (fInputHandler->GetEvent(iev));
index 1bcb7bd..9f5015d 100644 (file)
@@ -7,10 +7,11 @@
 /* $Id$ */
 
 #include "AliAnalysisTask.h"
+class AliVEvent;
 class AliAODEvent;
 class AliInputEventHandler;
 class TTree;
-class AliMultiAODInputHandler;
+class AliMultiEventInputHandler;
 
 
 
@@ -36,18 +37,18 @@ class AliAnalysisTaskME : public AliAnalysisTask
    virtual void AddAODBranch(const char* cname, void* addobj);
 // Getters
     virtual Int_t          DebugLevel()              {return fDebug;     }
-    virtual AliAODEvent*   GetEvent(Int_t iev);
+    virtual AliVEvent*     GetEvent(Int_t iev);
     virtual AliAODEvent*   AODEvent()                {return fOutputAOD; }
     virtual TTree*         OutputTree()              {return fTreeA;     }
     virtual Long64_t       Entry()                   {return fEntry;     }
     virtual const char*    CurrentFileName();
   protected:
-    Int_t                    fDebug;           //  Debug flag
-    Int_t                    fEntry;           //  Current entry in the chain
-    Bool_t                   fFreshBufferOnly; //  Flag for Exec call for fresh buffer only
-    AliMultiAODInputHandler* fInputHandler;    //! Input Handler
-    AliAODEvent*             fOutputAOD;       //! AOD out 
-    TTree*                   fTreeA;           //  AOD output Tree
+    Int_t                      fDebug;           //  Debug flag
+    Int_t                      fEntry;           //  Current entry in the chain
+    Bool_t                     fFreshBufferOnly; //  Flag for Exec call for fresh buffer only
+    AliMultiEventInputHandler* fInputHandler;    //! Input Handler
+    AliAODEvent*               fOutputAOD;       //! AOD out 
+    TTree*                     fTreeA;           //  AOD output Tree
     ClassDef(AliAnalysisTaskME, 1); // Analysis task for standard jet analysis
 };
  
index 082b698..c39049b 100644 (file)
@@ -5,7 +5,7 @@
 #include "AliAODEvent.h"
 #include "AliAODTrack.h"
 #include "AliAnalysisTaskPhiCorr.h"
-#include "AliMultiAODInputHandler.h"
+#include "AliMultiEventInputHandler.h"
 
 ClassImp(AliAnalysisTaskPhiCorr)
 
@@ -51,8 +51,8 @@ void AliAnalysisTaskPhiCorr::UserExec(Option_t *)
     
     for (Int_t iev = 0; iev < nev; iev++) {
        for (Int_t jev = (iev + 1); jev < nev; jev++) {
-           AliAODEvent* aod1 = GetEvent(iev);
-           AliAODEvent* aod2 = GetEvent(jev);
+           AliAODEvent* aod1 = (AliAODEvent*)GetEvent(iev);
+           AliAODEvent* aod2 = (AliAODEvent*)GetEvent(jev);
            
            Int_t ntracks1 =  aod1->GetNumberOfTracks();
            Int_t ntracks2 =  aod2->GetNumberOfTracks();
@@ -77,9 +77,11 @@ void AliAnalysisTaskPhiCorr::UserExec(Option_t *)
     } // event loop
     
 //    Correlated 
-    AliAODEvent* aod = fInputHandler->GetLatestEvent();
-    
+    AliAODEvent* aod = (AliAODEvent*)fInputHandler->GetLatestEvent();
+
     Int_t ntracks = aod->GetNumberOfTracks();
+    printf("Number of tracks %5d: \n", ntracks);
+    
     for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
        for (Int_t jTracks = (iTracks+1); jTracks < ntracks; jTracks++) {
              AliAODTrack* track1 = aod->GetTrack(iTracks);
@@ -91,7 +93,7 @@ void AliAnalysisTaskPhiCorr::UserExec(Option_t *)
              fHistDphiCO->Fill(dphi);
        } // tracks
     }
-    
+
   // Post output data.
   PostData(1, fHists);
 }      
@@ -102,7 +104,7 @@ void AliAnalysisTaskPhiCorr::Terminate(Option_t *)
   // Draw result to the screen
   // Called once at the end of the query
 
-  TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
+  TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","corr1",10,10,510,510);
   c1->cd(1)->SetLogy();
   fHistDphiUC->DrawCopy("E");
   fHistDphiCO->DrawCopy("Esame");