e47b85dcfd89288e34cc4358ea4b50c433c45f32
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskDplus.C
1 AliAnalysisTaskSEDplus *AddTaskDplus(Bool_t storeNtuple=kFALSE,
2                                      Bool_t readMC=kTRUE)
3 {
4   //                                                                                                                                    
5   // Test macro for the AliAnalysisTaskSE for D+ candidates 
6
7   //Invariant mass histogram and                                                 
8   // association with MC truth (using MC info in AOD)                                                                                   
9   //  R. Bala, bala@to.infn.it                                                                                                                                  
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->SetReadMC(readMC);
22   dplusTask->SetDoLikeSign(kTRUE);
23   dplusTask->SetDebugLevel(0);
24   mgr->AddTask(dplusTask);
25
26   //                                                                                                                                    
27   // Create containers for input/output                                                                                                 
28   AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer("cinputDplus",TChain::Class(),
29                                                           AliAnalysisManager::kInputContainer);
30   TString outputfile = AliAnalysisManager::GetCommonFileName();
31   outputfile += ":PWG3_D2H_InvMassDplus";
32   AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
33                                                            AliAnalysisManager::kOutputContainer,
34                                                                 outputfile.Data());
35   if(storeNtuple){
36     AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
37                                                            AliAnalysisManager::kOutputContainer,
38                                                                  "InvMassDplus_nt1.root");
39
40     coutputDplus2->SetSpecialOutput();
41   }
42   mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
43
44   mgr->ConnectOutput(dplusTask,1,coutputDplus);
45   
46   if(storeNtuple){
47     mgr->ConnectOutput(dplusTask,2,coutputDplus2);
48   }
49   return dplusTask;
50 }