]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisManager.cxx
- Common input and output data containers are now created automatically when attachin...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.cxx
index 9be896cff3668e8e9db19878c52a0a40e41584b6..5f5c70fa76ab559c404f5aa463a6fb3e71f0bfef 100644 (file)
@@ -70,6 +70,8 @@ AliAnalysisManager::AliAnalysisManager(const char *name, const char *title)
                     fContainers(NULL),
                     fInputs(NULL),
                     fOutputs(NULL),
+                    fCommonInput(NULL),
+                    fCommonOutput(NULL),
                     fSelector(NULL),
                     fGridHandler(NULL)
 {
@@ -104,6 +106,8 @@ AliAnalysisManager::AliAnalysisManager(const AliAnalysisManager& other)
                     fContainers(NULL),
                     fInputs(NULL),
                     fOutputs(NULL),
+                    fCommonInput(NULL),
+                    fCommonOutput(NULL),
                     fSelector(NULL),
                     fGridHandler(NULL)
 {
@@ -139,6 +143,8 @@ AliAnalysisManager& AliAnalysisManager::operator=(const AliAnalysisManager& othe
       fContainers = new TObjArray(*other.fContainers);
       fInputs     = new TObjArray(*other.fInputs);
       fOutputs    = new TObjArray(*other.fOutputs);
+      fCommonInput = NULL;
+      fCommonOutput = NULL;
       fSelector   = NULL;
       fGridHandler = NULL;
       fgAnalysisManager = this;
@@ -772,14 +778,9 @@ void AliAnalysisManager::Terminate()
          tree->SetMarkerSize(0.5);
          if (!gROOT->IsBatch()) {
             tree->SetAlias("event", "id0");
-            tree->SetAlias("memUSED", "pI.fMemVirtual");
-            tree->SetAlias("userCPU", "pI.fCpuUser");
-            TCanvas *c = new TCanvas("SysInfo","SysInfo",10,10,800,600);
-            c->Divide(2,1,0.01,0.01);
-            c->cd(1);
+            tree->SetAlias("memUSED", "mi.fMemUsed");
+            new TCanvas("SysInfo","SysInfo",10,10,800,600);
             tree->Draw("memUSED:event","","", 1234567890, 0);
-            c->cd(2);
-            tree->Draw("userCPU:event","","", 1234567890, 0);
          }   
          tree->Write();
          f.Close();
@@ -846,6 +847,10 @@ Bool_t AliAnalysisManager::ConnectInput(AliAnalysisTask *task, Int_t islot,
                                         AliAnalysisDataContainer *cont)
 {
 // Connect input of an existing task to a data container.
+   if (!task) {
+      Error("ConnectInput", "Task pointer is NULL");
+      return kFALSE;
+   }   
    if (!fTasks->FindObject(task)) {
       AddTask(task);
       Info("ConnectInput", "Task %s was not registered. Now owned by analysis manager", task->GetName());
@@ -859,6 +864,10 @@ Bool_t AliAnalysisManager::ConnectOutput(AliAnalysisTask *task, Int_t islot,
                                         AliAnalysisDataContainer *cont)
 {
 // Connect output of an existing task to a data container.
+   if (!task) {
+      Error("ConnectOutput", "Task pointer is NULL");
+      return kFALSE;
+   }   
    if (!fTasks->FindObject(task)) {
       AddTask(task);
       Warning("ConnectOutput", "Task %s not registered. Now owned by analysis manager", task->GetName());
@@ -1285,3 +1294,19 @@ void AliAnalysisManager::FinishAnalysis()
 {
 // Finish analysis.
 }
+
+//______________________________________________________________________________
+void AliAnalysisManager::SetInputEventHandler(AliVEventHandler*  handler)
+{
+// Set the input event handler and create a container for it.
+   fInputEventHandler   = handler;
+   fCommonInput = CreateContainer("cinput", TChain::Class(), AliAnalysisManager::kInputContainer);
+}
+
+//______________________________________________________________________________
+void AliAnalysisManager::SetOutputEventHandler(AliVEventHandler*  handler)
+{
+// Set the input event handler and create a container for it.
+   fOutputEventHandler   = handler;
+   fCommonOutput = CreateContainer("coutput", TTree::Class(), AliAnalysisManager::kOutputContainer, "default");
+}