]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AddTaskVertexingHF.C
Dplus and Ds tasks use the new cuts classes (Francesco, Renu, Giacomo)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskVertexingHF.C
1 AliAnalysisTaskSEVertexingHF *AddTaskVertexingHF() {
2   //
3   // Creates a task for heavy flavour vertexing and adds it to the analysis manager.
4   // andrea.dainese@lnl.infn.it
5   //
6
7   // Get the pointer to the existing analysis manager via the static access method.
8   //==============================================================================
9   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10   if (!mgr) {
11     ::Error("AddTaskVertexingHF", "No analysis manager to connect to.");
12     return NULL;
13   }   
14    
15   // This task requires an ESD or AOD input handler and an AOD output handler.
16   // Check this using the analysis manager.
17   //===============================================================================
18   TString type = mgr->GetInputEventHandler()->GetDataType();
19   if (!type.Contains("ESD") && !type.Contains("AOD")) {
20     ::Error("AddTaskVertexingHF", "HF vertexing task needs the manager to have an ESD or AOD input handler.");
21     return NULL;
22   }   
23   // Check if AOD output handler exist.
24   AliAODHandler *aodh = (AliAODHandler*)mgr->GetOutputEventHandler();
25   if (!aodh) {
26     ::Error("AddTaskVertexingHF", "HF vertexing task needs the manager to have an AOD output handler.");
27     return NULL;
28   }   
29   
30   // Create the task, add it to the manager and configure it.
31   //===========================================================================
32   AliAnalysisTaskSEVertexingHF *hfTask = new AliAnalysisTaskSEVertexingHF("vertexing HF");
33   mgr->AddTask(hfTask);
34
35   //
36   // Create containers for input/output
37   mgr->ConnectInput(hfTask,0,mgr->GetCommonInputContainer());
38   mgr->ConnectOutput(hfTask,0,mgr->GetCommonOutputContainer());
39
40   return hfTask;
41 }