fe237feae4196701affc5c329efe1c9415fddbd9
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskDplus.C
1 AliAnalysisTaskSEDplus *AddTaskDplus(Bool_t storeNtuple=kFALSE)
2 {
3   //                                                                                                                                    
4   // Test macro for the AliAnalysisTaskSE for heavy-flavour candidates                                                                  
5   // association with MC truth (using MC info in AOD)                                                                                   
6                                                                                                
7   //                                                                                                                                    
8
9
10   // Get the pointer to the existing analysis manager via the static access method.                                                     
11   //==============================================================================                                                      
12   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13   if (!mgr) {
14     ::Error("AddTaskDplus", "No analysis manager to connect to.");
15     return NULL;
16   }
17
18
19   // Aanalysis task                                                                                                                     
20   AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",storeNtuple);
21   dplusTask->SetDebugLevel(0);
22   mgr->AddTask(dplusTask);
23
24   //                                                                                                                                    
25   // Create containers for input/output                                                                                                 
26   AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer("cinputDplus",TChain::Class(),
27                                                           AliAnalysisManager::kInputContainer);
28   AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
29                                                            AliAnalysisManager::kOutputContainer,
30                                                            "InvMassDplus.root");
31   if(storeNtuple){
32     AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
33                                                            AliAnalysisManager::kOutputContainer,
34                                                                  "InvMassDplus_nt1.root");
35     AliAnalysisDataContainer *coutputDplus3 = mgr->CreateContainer("coutputDplus3",TNtuple::Class(),
36                                                            AliAnalysisManager::kOutputContainer,
37                                                                  "InvMassDplus_nt2.root");
38     coutputDplus2->SetSpecialOutput();
39     coutputDplus3->SetSpecialOutput();
40   }
41   mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
42
43   mgr->ConnectOutput(dplusTask,1,coutputDplus);
44   
45   if(storeNtuple){
46     mgr->ConnectOutput(dplusTask,2,coutputDplus2);
47     mgr->ConnectOutput(dplusTask,3,coutputDplus3);
48   }
49   return dplusTask;
50 }