]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskRhoBase.C
create general emcal task lib
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskRhoBase.C
1 // $Id$
2
3 AliAnalysisTaskRhoBase* AddTaskRhoBase(
4    const char *rhoname        = "Rho",
5    TF1        *rfunc          = 0,
6    const char *taskname       = "Rho_Base"
7 )
8 {  
9   // Get the pointer to the existing analysis manager via the static access method.
10   //==============================================================================
11   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12   if (!mgr)
13   {
14     ::Error("AddTaskRhoBase", "No analysis manager to connect to.");
15     return NULL;
16   }  
17   
18   // Check the analysis type using the event handlers connected to the analysis manager.
19   //==============================================================================
20   if (!mgr->GetInputEventHandler())
21   {
22     ::Error("AddTaskRho", "This task requires an input event handler");
23     return NULL;
24   }
25   
26   //-------------------------------------------------------
27   // Init the task and do settings
28   //-------------------------------------------------------
29
30   AliAnalysisTaskRhoBase *rhotask = new AliAnalysisTaskRhoBase(taskname);
31   rhotask->SetRhoName(rhoname);
32   rhotask->SetRhoFunction(rfunc);
33
34   //-------------------------------------------------------
35   // Final settings, pass to manager and set the containers
36   //-------------------------------------------------------
37
38   mgr->AddTask(rhotask);
39
40   // Create containers for input/output
41   mgr->ConnectInput (rhotask, 0, mgr->GetCommonInputContainer() );
42
43   return rhotask;
44 }