move macros to macros/
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskD0Mass.C
CommitLineData
95e5b6b5 1AliAnalysisTaskSED0Mass *AddTaskD0Mass(Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kFALSE,Bool_t cutOnDistr=kFALSE)
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="",out5name="",inname="";
20 filename = AliAnalysisManager::GetCommonFileName();
21 filename += ":PWG3_D2H_";
22 if(flag==0){
23 filename+="D0InvMass";
24 if(cutOnDistr) filename+="C";
25 //list mass
26 out1name="coutputmassD0Mass";
27 if(cutOnDistr) out1name+="C";
28 //list distr
29 out2name="coutputmassD0distr";
30 if(cutOnDistr) out2name+="C";
31 //hist entries
32 out3name="nEntriesD0";
33 if(cutOnDistr) out3name+="C";
34 //list checks
35 out4name="checksD0";
36 if(cutOnDistr) out4name+="C";
37 //cuts object
38 out5name="cutsD0";
39 if(cutOnDistr) out5name+="C";
40
41 inname="cinputmassD0_0";
42 if(cutOnDistr) inname+="C";
43
44 } else {
45 filename+="D0InvMassLikeSign";
46 if(cutOnDistr) filename+="C";
47 //list mass
48 out1name="coutputmassLSMass";
49 if(cutOnDistr) out1name+="C";
50 //list distr
51 out2name="coutputmassLSdistr";
52 if(cutOnDistr) out2name+="C";
53 //hist entries
54 out3name="nEntriesLS";
55 if(cutOnDistr) out3name+="C";
56 //list checks
57 out4name="checksLS";
58 if(cutOnDistr) out4name+="C";
59 //cuts object
60 out5name="cutsLS";
61 if(cutOnDistr) out5name+="C";
62
63 inname="cinputmassD0_1";
64 if(cutOnDistr) inname+="C";
65 }
66 TString cutobjname="mycuts";
67 cutobjname+=flag;
68
69 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
70 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
71 //default
72 esdTrackCuts->SetRequireTPCRefit(kTRUE);
73 esdTrackCuts->SetRequireITSRefit(kTRUE);
74 esdTrackCuts->SetMinNClustersITS(4); // default is 5
75 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
76 AliESDtrackCuts::kAny);
77 // default is kBoth, otherwise kAny
78 esdTrackCuts->SetMinDCAToVertexXY(0.);
79 esdTrackCuts->SetPtRange(0.3,1.e10);
80
81 AliRDHFCutsD0toKpi* RDHFD0toKpi=new AliRDHFCutsD0toKpi();
82 RDHFD0toKpi->AddTrackCuts(esdTrackCuts);
83
84 //cout<<"nvars = "<<RDHFD0toKpi->GetNVars()<<endl;
85 const Int_t nvars=9;
86 //nvars=RDHFD0toKpi->GetNVars();
87 //cout<<"Nvars = "<<nvars<<"\t"<<RDHFD0toKpi->GetNVars()<<endl;
88 RDHFD0toKpi->SetName(cutobjname);
89 RDHFD0toKpi->SetTitle(cutobjname);
90
91 const Int_t nptbins=5;
92 Float_t* ptbins;
93 ptbins=new Float_t[nptbins+1];
94 ptbins[0]=0.;
95 ptbins[1]=1.;
96 ptbins[2]=2.;
97 ptbins[3]=3.;
98 ptbins[4]=5.;
99 ptbins[5]=10.;
100
101 RDHFD0toKpi->SetPtBins(nptbins+1,ptbins);
102
103
104 Float_t** rdcutsvalmine;
105 rdcutsvalmine=new Float_t*[nvars];
106 for(Int_t iv=0;iv<nvars;iv++){
107 rdcutsvalmine[iv]=new Float_t[nptbins];
108 }
109 //cout<<"\tnptbins = "<<nptbins<<endl;
110 /*
111 //setting PPR cut values
112 rdcutsvalPPR[0][0]=0.7;
113 rdcutsvalPPR[1][0]=0.04;
114 rdcutsvalPPR[2][0]=0.8;
115 rdcutsvalPPR[3][0]=0.5;
116 rdcutsvalPPR[4][0]=0.5;
117 rdcutsvalPPR[5][0]=0.05;
118 rdcutsvalPPR[6][0]=0.05;
119 rdcutsvalPPR[7][0]=-0.0002;
120 rdcutsvalPPR[8][0]=0.5;
121
122 rdcutsvalPPR[0][1]=rdcutsvalPPR[0][2]=0.7;
123 rdcutsvalPPR[1][1]=rdcutsvalPPR[1][2]=0.02;
124 rdcutsvalPPR[2][1]=rdcutsvalPPR[2][2]=0.8;
125 rdcutsvalPPR[3][1]=rdcutsvalPPR[3][2]=0.7;
126 rdcutsvalPPR[4][1]=rdcutsvalPPR[4][2]=0.7;
127 rdcutsvalPPR[5][1]=rdcutsvalPPR[5][2]=0.05;
128 rdcutsvalPPR[6][1]=rdcutsvalPPR[6][2]=0.05;
129 rdcutsvalPPR[7][1]=rdcutsvalPPR[7][2]=-0.0002;
130 rdcutsvalPPR[8][1]=rdcutsvalPPR[8][2]=0.6;
131
132 rdcutsvalPPR[0][3]=0.7;
133 rdcutsvalPPR[1][3]=0.02;
134 rdcutsvalPPR[2][3]=0.8;
135 rdcutsvalPPR[3][3]=0.7;
136 rdcutsvalPPR[4][3]=0.7;
137 rdcutsvalPPR[5][3]=0.05;
138 rdcutsvalPPR[6][3]=0.05;
139 rdcutsvalPPR[7][3]=-0.0001;
140 rdcutsvalPPR[8][3]=0.8;
141
142 rdcutsvalPPR[0][4]=0.7;
143 rdcutsvalPPR[1][4]=0.02;
144 rdcutsvalPPR[2][4]=0.8;
145 rdcutsvalPPR[3][4]=0.7;
146 rdcutsvalPPR[4][4]=0.7;
147 rdcutsvalPPR[5][4]=0.05;
148 rdcutsvalPPR[6][4]=0.05;
149 rdcutsvalPPR[7][4]=-0.00005;
150 rdcutsvalPPR[8][4]=0.8;
151 */
152 //setting my cut values
153
154 rdcutsvalmine[0][0]=0.7;
155 rdcutsvalmine[1][0]=0.04;
156 rdcutsvalmine[2][0]=0.8;
157 rdcutsvalmine[3][0]=0.5;
158 rdcutsvalmine[4][0]=0.5;
159 rdcutsvalmine[5][0]=0.05;
160 rdcutsvalmine[6][0]=0.05;
161 rdcutsvalmine[7][0]=-0.00025;
162 rdcutsvalmine[8][0]=0.7;
163
164 rdcutsvalmine[0][1]=rdcutsvalmine[0][2]=0.7;
165 rdcutsvalmine[1][1]=rdcutsvalmine[1][2]=0.02;
166 rdcutsvalmine[2][1]=rdcutsvalmine[2][2]=0.8;
167 rdcutsvalmine[3][1]=rdcutsvalmine[3][2]=0.7;
168 rdcutsvalmine[4][1]=rdcutsvalmine[4][2]=0.7;
169 rdcutsvalmine[5][1]=rdcutsvalmine[5][2]=1.;
170 rdcutsvalmine[6][1]=rdcutsvalmine[6][2]=1.;
171 rdcutsvalmine[7][1]=rdcutsvalmine[7][2]=-0.00025;
172 rdcutsvalmine[8][1]=rdcutsvalmine[8][2]=0.8;
173
174 rdcutsvalmine[0][3]=0.7;
175 rdcutsvalmine[1][3]=0.02;
176 rdcutsvalmine[2][3]=0.8;
177 rdcutsvalmine[3][3]=0.7;
178 rdcutsvalmine[4][3]=0.7;
179 rdcutsvalmine[5][3]=0.05;
180 rdcutsvalmine[6][3]=0.05;
181 rdcutsvalmine[7][3]=-0.00015;
182 rdcutsvalmine[8][3]=0.8;
183
184 rdcutsvalmine[0][4]=0.7;
185 rdcutsvalmine[1][4]=0.02;
186 rdcutsvalmine[2][4]=0.8;
187 rdcutsvalmine[3][4]=0.7;
188 rdcutsvalmine[4][4]=0.7;
189 rdcutsvalmine[5][4]=0.05;
190 rdcutsvalmine[6][4]=0.05;
191 rdcutsvalmine[7][4]=-0.00015;
192 rdcutsvalmine[8][4]=0.9;
193
194 cout<<"Filled array ("<<nvars<<","<<nptbins<<")"<<endl;
195 /*
196 for(Int_t j=0;j<nvars;j++){
197 for(Int_t k=0;k<nptbins;k++){
198 cout<<rdcutsvalmine[j][k]<<"\t";
199 }
200 cout<<endl;
201 }
202 */
203
204 //cout<<"\tbefore SetCuts : npt = "<<RDHFD0toKpi->GetNPtBins()<<endl;
205 RDHFD0toKpi->SetCuts(nvars,nptbins,rdcutsvalmine);
206 // RDHFD0toKpi->PrintAll();
207
208 // Aanalysis task
209 TString taskname="MassAndDistrAnalysis";
210 if (flag==0)taskname.Prepend("D0");
211 else taskname.Prepend("LS");
212 AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass(taskname.Data(),RDHFD0toKpi);
213 massD0Task->SetDebugLevel(0);
214 massD0Task->SetArray(flag);
215 massD0Task->SetReadMC(readMC);
216 massD0Task->SetCutOnDistr(cutOnDistr);
217 mgr->AddTask(massD0Task);
218
219 //
220 // Create containers for input/output
221 AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
222 AliAnalysisManager::kInputContainer);
223
224 AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass
225 AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //distr
226 AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
227 AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //check
228 //AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kParamContainer, filename.Data()); //cuts
229AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
230 //AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kParamContainer, filename.Data()); //cuts
231 //AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
232
233
234 mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
235
236 mgr->ConnectOutput(massD0Task,1,coutputmassD01);
237 mgr->ConnectOutput(massD0Task,2,coutputmassD02);
238 mgr->ConnectOutput(massD0Task,3,coutputmassD03);
239 mgr->ConnectOutput(massD0Task,4,coutputmassD04);
240 mgr->ConnectOutput(massD0Task,5,coutputmassD05);
241
242
243 return massD0Task;
244}