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