Splitting pt bin 1-3 GeV in two bins (Chiara)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskD0Mass.C
1 AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/)
2 {
3   //
4   // AddTask for the AliAnalysisTaskSE for D0 candidates
5   // invariant mass histogram and association with MC truth 
6   // (using MC info in AOD) and cut variables distributions
7   // C.Bianchin  chiara.bianchin@pd.infn.it
8   //
9
10
11   // Get the pointer to the existing analysis manager via the static access method.
12   //==============================================================================
13   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14   if (!mgr) {
15     ::Error("AddTaskD0Distr", "No analysis manager to connect to.");
16     return NULL;
17   }   
18
19   TString filename="",out1name="",out2name="",out3name="",out4name="",inname="";
20   if(flag==0){
21     filename="D0InvMass.root"; 
22     out1name="coutputmassD01";
23     out2name="coutputmassD02";
24     out3name="nEntriesD0";
25     out4name="coutputmassD0distr";
26     inname="cinputmassD0_0";
27   } else {
28     filename="D0InvMassLikeSign.root";
29     out1name="coutputmassLS1";
30     out2name="coutputmassLS2";
31     out3name="nEntriesLS";
32     out4name="coutputmassLSdistr";
33     inname="cinputmassD0_1";
34   }
35
36   // Aanalysis task    
37   AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass("D0MassAndDistrAnalysis");
38   massD0Task->SetDebugLevel(0);
39   massD0Task->SetArray(flag);
40   mgr->AddTask(massD0Task);
41   
42   //
43   // Create containers for input/output
44   AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(), 
45                                                           AliAnalysisManager::kInputContainer);
46
47   AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),
48                                                            AliAnalysisManager::kOutputContainer, 
49                                                            filename.Data());
50   AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),
51                                                            AliAnalysisManager::kOutputContainer, 
52                                                            filename.Data());
53   AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),
54                                                            AliAnalysisManager::kOutputContainer, 
55                                                            filename.Data());
56   AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),
57                                                            AliAnalysisManager::kOutputContainer, 
58                                                            filename.Data());
59
60   mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
61
62   mgr->ConnectOutput(massD0Task,1,coutputmassD01);
63   mgr->ConnectOutput(massD0Task,2,coutputmassD02);
64   mgr->ConnectOutput(massD0Task,3,coutputmassD03);
65   mgr->ConnectOutput(massD0Task,4,coutputmassD04);
66
67
68   return massD0Task;
69 }