New task for Lc->pKpi (Rossella)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskLambdac.C
1 AliAnalysisTaskSELambdac *AddTaskLambdac(const char *name,Bool_t storeNtuple,Bool_t readMC,Bool_t MCPid,Bool_t realPid,Bool_t resPid,Bool_t useKF)
2 {
3   //==============================================================================                                                      
4   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5   if (!mgr) {
6     ::Error("AddTaskLambdac", "No analysis manager to connect to.");
7     return NULL;
8   }
9
10   //pt bins
11   const Int_t nptbins=4;
12     Float_t* ptbins;
13     ptbins=new Float_t[nptbins+1];
14     ptbins[0]=0.;
15     ptbins[1]=2.;
16     ptbins[2]=3.;
17     ptbins[3]=5.;
18     ptbins[4]=99999.;
19     const Int_t nvars=12;
20
21   Float_t** prodcutsval;
22   prodcutsval=new Float_t*[nvars];
23   for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
24   for(Int_t ipt=0;ipt<nptbins;ipt++){
25    prodcutsval[0][ipt]=0.2;
26    prodcutsval[1][ipt]=0.4;
27    prodcutsval[2][ipt]=0.4;
28    prodcutsval[3][ipt]=0.;
29    prodcutsval[4][ipt]=0.;
30    prodcutsval[5][ipt]=0.01;
31    prodcutsval[6][ipt]=0.06;
32    prodcutsval[7][ipt]=0.02;
33    prodcutsval[8][ipt]=0.;
34    prodcutsval[9][ipt]=0.85;
35    prodcutsval[10][ipt]=0.;
36    prodcutsval[11][ipt]=0.1;
37   }
38
39   Float_t** anacutsval;
40   anacutsval=new Float_t*[nvars];
41   for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
42   Int_t ic=0;
43   for(Int_t ipt=0;ipt<nptbins;ipt++){
44        anacutsval[ic][ipt]=0.2;
45           }
46   Int_t ic=1;
47      for(Int_t ipt=0;ipt<nptbins;ipt++){
48           anacutsval[ic][ipt]=0.8;
49              }
50   Int_t ic=2;
51      for(Int_t ipt=0;ipt<nptbins;ipt++){
52           anacutsval[ic][ipt]=0.4;
53              }
54   Int_t ic=3;
55      for(Int_t ipt=0;ipt<nptbins;ipt++){
56           anacutsval[ic][ipt]=0.;
57              }
58   Int_t ic=4;
59      for(Int_t ipt=0;ipt<nptbins;ipt++){
60           anacutsval[ic][ipt]=0.;
61              }
62   Int_t ic=5;
63      for(Int_t ipt=0;ipt<nptbins;ipt++){
64           anacutsval[ic][ipt]=0.;
65              }
66   Int_t ic=6;
67      for(Int_t ipt=0;ipt<nptbins;ipt++){
68           anacutsval[ic][ipt]=0.1;
69              }
70   Int_t ic=7;
71      for(Int_t ipt=0;ipt<nptbins;ipt++){
72           anacutsval[ic][ipt]=0.;
73              }
74   Int_t ic=8;
75      for(Int_t ipt=0;ipt<nptbins;ipt++){
76           anacutsval[ic][ipt]=0.;
77              }
78   Int_t ic=9;
79      for(Int_t ipt=0;ipt<nptbins;ipt++){
80           anacutsval[ic][ipt]=0.;
81              }
82   Int_t ic=10;
83      for(Int_t ipt=0;ipt<nptbins;ipt++){
84           anacutsval[ic][ipt]=0.;
85              }
86   Int_t ic=11;
87      for(Int_t ipt=0;ipt<nptbins;ipt++){
88           anacutsval[ic][ipt]=0.1;
89              }
90
91   anacutsval[1][0]=0.6;
92
93   anacutsval[2][2]=0.5;
94   anacutsval[2][3]=0.5;
95
96   anacutsval[9][2]=0.9;
97   anacutsval[9][3]=0.9;
98
99
100   AliRDHFCutsLctopKpi *prodcuts = new AliRDHFCutsLctopKpi();
101     prodcuts->SetPtBins(nptbins+1,ptbins);
102       prodcuts->SetCuts(nvars,nptbins,prodcutsval);
103   //Analysis cuts
104   AliRDHFCutsLctopKpi *analysiscuts = new AliRDHFCutsLctopKpi();
105   ((AliRDHFCuts*)analysiscuts)->SetPtBins(nptbins+1,ptbins);
106   ((AliRDHFCuts*)analysiscuts)->SetCuts(nvars,nptbins,anacutsval);
107   // Aanalysis task                                                                                                                     
108   AliAnalysisTaskSELambdac *lambdacTask = new AliAnalysisTaskSELambdac("LambdacAnalysis",storeNtuple,analysiscuts,prodcuts);
109   lambdacTask->SetReadMC(readMC);
110   if(MCPid) lambdacTask->SetMCPid();
111   if(resPid) lambdacTask->SetResonantPid();
112   if(realPid) lambdacTask->SetRealPid();
113   lambdacTask->SetDebugLevel(0);
114   if(useKF) {
115     lambdacTask->SetUseKF();
116      Float_t cuts[10]={0.1,0.1,1.5,0.5,0.1,1.5,0.5,0.1,1.5,0.5};
117       lambdacTask->SetCutsKF(cuts);
118        }
119   mgr->AddTask(lambdacTask);
120
121   //                                                                                                                                    
122   // Create containers for input/output                                                                                                 
123   TString outputfile = AliAnalysisManager::GetCommonFileName();
124   outputfile += ":PWG3_D2H_InvMassLambdac";
125   AliAnalysisDataContainer *cinputLambdac = mgr->CreateContainer("cinputLambdac",TChain::Class(),
126                                                           AliAnalysisManager::kInputContainer);
127   AliAnalysisDataContainer *coutputLambdacCuts = mgr->CreateContainer("coutputLambdacCuts",TList::Class(),
128                                                            AliAnalysisManager::kOutputContainer,
129                                                                 outputfile.Data());
130   AliAnalysisDataContainer *coutputLambdac = mgr->CreateContainer("coutputLambdac",TList::Class(),
131                                                            AliAnalysisManager::kOutputContainer,
132                                                                 outputfile.Data());
133   if(storeNtuple){
134     AliAnalysisDataContainer *coutputLambdac2 = mgr->CreateContainer("coutputLambdac2",TNtuple::Class(),
135                                                            AliAnalysisManager::kOutputContainer,
136                                                                  "InvMassLambdac_nt1.root");
137
138     coutputLambdac2->SetSpecialOutput();
139   }
140
141   mgr->ConnectInput(lambdacTask,0,mgr->GetCommonInputContainer());
142
143   mgr->ConnectOutput(lambdacTask,1,coutputLambdac);
144   mgr->ConnectOutput(lambdacTask,2,coutputLambdacCuts);
145   
146   if(storeNtuple){
147     mgr->ConnectOutput(lambdacTask,3,coutputLambdac2);
148   }
149   return lambdacTask;
150 }