]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/macros/AddTaskCFVertexingHFCascade.C
introduce the option to analyze with PROOF, plus cosmetics
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskCFVertexingHFCascade.C
CommitLineData
367e9aa3 1//DEFINITION OF A FEW CONSTANTS
2const Double_t ymin = -2.1 ;
3const Double_t ymax = 2.1 ;
4const Double_t cosmin = -1.05;
5const Double_t cosmax = 1.05;
6const Double_t cTmin = 0; // micron
7const Double_t cTmax = 500; // micron
8const Double_t dcamin = 0; // micron
9const Double_t dcamax = 500; // micron
10const Double_t d0min = -1000; // micron
11const Double_t d0max = 1000; // micron
12const Double_t d0xd0min = -100000; // micron
13const Double_t d0xd0max = 100000; // micron
14const Double_t phimin = 0.0;
15const Int_t mintrackrefsTPC = 2 ;
16const Int_t mintrackrefsITS = 3 ;
17const Int_t charge = 1 ;
18const Int_t minclustersTPC = 50 ;
19// cuts
20const Double_t ptmin = 0.1;
21const Double_t ptmax = 9999.;
22const Double_t etamin = -0.9;
23const Double_t etamax = 0.9;
24const Double_t zmin = -15;
25const Double_t zmax = 15;
26const Int_t minITSClusters = 1;
27
28//----------------------------------------------------
29
30AliCFTaskVertexingHF *AddTaskCFVertexingHFCascade(const char* cutFile = "./DStartoKpipiCuts.root",Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 413, Char_t isSign = 2)
31{
32 printf("Addig CF task using cuts from file %s\n",cutFile);
33
34 // isSign = 0 --> D0 only
35 // isSign = 1 --> D0bar only
36 // isSign = 2 --> D0 + D0bar
37
38 TString expected;
39 if (isSign == 0 && pdgCode < 0){
40 AliError(Form("Error setting PDG code (%d) and sign (0 --> D0 only): they are not compatible, returning"));
41 return 0x0;
42 }
43 else if (isSign == 1 && pdgCode > 0){
44 AliError(Form("Error setting PDG code (%d) and sign (1 --> D0bar only): they are not compatible, returning"));
45 return 0x0;
46 }
47 else if (isSign > 2 || isSign < 0){
48 AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning"));
49 return 0x0;
50 }
51
52 TFile* fileCuts = new TFile(cutFile);
53 AliRDHFCutsDStartoKpipi *cutsD0toKpi = (AliRDHFCutsDStartoKpipi*)fileCuts->Get("DStartoKpipiCuts");
54
55 // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
56 // for now the binning is the same than for all D's
57 if(isKeepDfromBOnly) isKeepDfromB = true;
58
59 Double_t ptmin_0_6;
60 Double_t ptmax_0_6;
61 Double_t ptmin_6_8;
62 Double_t ptmax_6_8;
63 Double_t ptmin_8_16;
64 Double_t ptmax_8_16;
65 Double_t ptmin_16_24;
66 Double_t ptmax_16_24;
67
68 ptmin_0_6 = 0.0 ;
69 ptmax_0_6 = 6.0 ;
70 ptmin_6_8 = 6.0 ;
71 ptmax_6_8 = 8.0 ;
72 ptmin_8_16 = 8.0 ;
73 ptmax_8_16 = 16.0 ;
74 ptmin_16_24 = 16.0 ;
75 ptmax_16_24 = 24.0 ;
76
77 //CONTAINER DEFINITION
78 Info("AliCFTaskVertexingHF","SETUP CONTAINER");
79 //the sensitive variables, their indices
80 UInt_t ipt = 0;
81 UInt_t iy = 1;
82 UInt_t icosThetaStar = 2;
83 UInt_t ipTpi = 3;
84 UInt_t ipTk = 4;
85 UInt_t icT = 5;
86 UInt_t idca = 6;
87 UInt_t id0pi = 7;
88 UInt_t id0K = 8;
89 UInt_t id0xd0 = 9;
90 UInt_t ipointing = 10;
91 UInt_t iphi = 11;
92 UInt_t iz = 12;
93
94 const Double_t phimax = 2*TMath::Pi();
95
96 //Setting up the container grid...
97 UInt_t nstep = 10;
98 const Int_t nvar = 13;
99
100 //arrays for the number of bins in each dimension
101 Int_t iBin[nvar];
102
103 //OPTION 1: defining the pt, ptPi, ptK bins by hand...
104 const Int_t nbin0_0_6 = 6 ; //bins in pt from 0 to 6 GeV
105 const Int_t nbin0_6_8 = 1 ; //bins in pt from 6 to 8 GeV
106 const Int_t nbin0_8_16 = 2 ; //bins in pt from 8 to 16 GeV
107 const Int_t nbin0_16_24 = 1 ; //bins in pt from 16 to 24 GeV
108 const Int_t nbin3_0_6 = 6 ; //bins in ptPi from 0 to 6 GeV
109 const Int_t nbin3_6_8 = 1 ; //bins in ptPi from 6 to 8 GeV
110 const Int_t nbin3_8_16 = 2 ; //bins in ptPi from 8 to 16 GeV
111 const Int_t nbin3_16_24 = 1 ; //bins in ptPi from 16 to 24 GeV
112 const Int_t nbin4_0_6 = 6 ; //bins in ptK from 0 to 6 GeV
113 const Int_t nbin4_6_8 = 1 ; //bins in ptK from 6 to 8 GeV
114 const Int_t nbin4_8_16 = 2 ; //bins in ptK from 8 to 16 GeV
115 const Int_t nbin4_16_24 = 1 ; //bins in ptK from 16 to 24 GeV
116 iBin[0]=nbin0_0_6+nbin0_6_8+nbin0_8_16+nbin0_16_24;
117 iBin[3]=nbin3_0_6+nbin3_6_8+nbin3_8_16+nbin3_16_24;
118 iBin[4]=nbin4_0_6+nbin4_6_8+nbin4_8_16+nbin4_16_24;
119 Double_t *binLim0=new Double_t[iBin[0]+1];
120 Double_t *binLim3=new Double_t[iBin[3]+1];
121 Double_t *binLim4=new Double_t[iBin[4]+1];
122
123 // values for bin lower bounds
124 // pt
125 for(Int_t i=0; i<=nbin0_0_6; i++) binLim0[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbin0_0_6*(Double_t)i ;
126 if (binLim0[nbin0_0_6] != ptmin_6_8) {
127 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
128 }
129 for(Int_t i=0; i<=nbin0_6_8; i++) binLim0[i+nbin0_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbin0_6_8*(Double_t)i ;
130 if (binLim0[nbin0_0_6+nbin0_6_8] != ptmin_8_16) {
131 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
132 }
133 for(Int_t i=0; i<=nbin0_8_16; i++) binLim0[i+nbin0_0_6+nbin0_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbin0_8_16*(Double_t)i ;
134 if (binLim0[nbin0_0_6+nbin0_6_8+nbin0_8_16] != ptmin_16_24) {
135 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
136 }
137 for(Int_t i=0; i<=nbin0_16_24; i++) binLim0[i+nbin0_0_6+nbin0_6_8+nbin0_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbin0_16_24*(Double_t)i ;
138
139 // ptPi
140 for(Int_t i=0; i<=nbin3_0_6; i++) binLim3[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbin3_0_6*(Double_t)i ;
141 if (binLim3[nbin3_0_6] != ptmin_6_8) {
142 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
143 }
144 for(Int_t i=0; i<=nbin3_6_8; i++) binLim3[i+nbin3_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbin3_6_8*(Double_t)i ;
145 if (binLim3[nbin3_0_6+nbin3_6_8] != ptmin_8_16) {
146 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
147 }
148 for(Int_t i=0; i<=nbin3_8_16; i++) binLim3[i+nbin3_0_6+nbin0_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbin3_8_16*(Double_t)i ;
149 if (binLim3[nbin3_0_6+nbin3_6_8+nbin3_8_16] != ptmin_16_24) {
150 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
151 }
152 for(Int_t i=0; i<=nbin3_16_24; i++) binLim3[i+nbin3_0_6+nbin3_6_8+nbin3_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbin3_16_24*(Double_t)i ;
153
154 // ptKa
155 for(Int_t i=0; i<=nbin4_0_6; i++) binLim4[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbin4_0_6*(Double_t)i ;
156 if (binLim4[nbin4_0_6] != ptmin_6_8) {
157 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
158 }
159 for(Int_t i=0; i<=nbin4_6_8; i++) binLim4[i+nbin4_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbin4_6_8*(Double_t)i ;
160 if (binLim4[nbin4_0_6+nbin4_6_8] != ptmin_8_16) {
161 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
162 }
163 for(Int_t i=0; i<=nbin4_8_16; i++) binLim4[i+nbin4_0_6+nbin0_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbin4_8_16*(Double_t)i ;
164 if (binLim4[nbin4_0_6+nbin4_6_8+nbin4_8_16] != ptmin_16_24) {
165 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
166 }
167 for(Int_t i=0; i<=nbin4_16_24; i++) binLim4[i+nbin4_0_6+nbin4_6_8+nbin4_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbin4_16_24*(Double_t)i ;
168
169 //OPTION 2: ...or from the cuts file
5b805cec 170/*
171 const Int_t nbin0 = cutsD0toKpi->GetNPtBins(); // bins in pT
172 iBin[0]=nbin0;
173 iBin[3]=nbin0;
174 iBin[4]=nbin0;
175
176 Double_t *binLim0=new Double_t[iBin[0]+1]; //ONLY UNCOMMENT THESE LINES IF LINES 119-121 ARE COMMENTED
177 Double_t *binLim3=new Double_t[iBin[3]+1];
178 Double_t *binLim4=new Double_t[iBin[4]+1];
179
367e9aa3 180 // values for bin lower bounds
5b805cec 181 Float_t* floatbinLim0 = cutsD0toKpi->GetPtBinLimits();
182 for (Int_t ibin0 = 0 ; ibin0<iBin[0]+1; ibin0++){
183 binLim0[ibin0] = (Double_t)floatbinLim0[ibin0];
184 binLim3[ibin0] = (Double_t)floatbinLim0[ibin0];
185 binLim4[ibin0] = (Double_t)floatbinLim0[ibin0];
186 }
187 for(Int_t i=0; i<=nbin0; i++) printf("binLim0[%d]=%f\n",i,binLim0[i]);
367e9aa3 188
5b805cec 189 printf("pT: nbin (from cuts file) = %d\n",nbin0);
190*/
367e9aa3 191 // defining now the binning for the other variables:
192
193 const Int_t nbin1 = 42 ; //bins in y
194 const Int_t nbin2 = 42 ; //bins in cosThetaStar
195 const Int_t nbin5 = 24 ; //bins in cT
196 const Int_t nbin6 = 24 ; //bins in dca
197 const Int_t nbin7 = 100 ; //bins in d0pi
198 const Int_t nbin8 = 100 ; //bins in d0K
199 const Int_t nbin9 = 80 ; //bins in d0xd0
200 const Int_t nbin10 = 1050 ; //bins in cosPointingAngle
201 const Int_t nbin11 = 20 ; //bins in Phi
202 const Int_t nbin12 = 60 ; //bins in z vertex
203
204 iBin[1]=nbin1;
205 iBin[2]=nbin2;
206 iBin[5]=nbin5;
207 iBin[6]=nbin6;
208 iBin[7]=nbin7;
209 iBin[8]=nbin8;
210 iBin[9]=nbin9;
211 iBin[10]=nbin10;
212 iBin[11]=nbin11;
213 iBin[12]=nbin12;
214
215 //arrays for lower bounds :
216 Double_t *binLim1=new Double_t[iBin[1]+1];
217 Double_t *binLim2=new Double_t[iBin[2]+1];
218 Double_t *binLim5=new Double_t[iBin[5]+1];
219 Double_t *binLim6=new Double_t[iBin[6]+1];
220 Double_t *binLim7=new Double_t[iBin[7]+1];
221 Double_t *binLim8=new Double_t[iBin[8]+1];
222 Double_t *binLim9=new Double_t[iBin[9]+1];
223 Double_t *binLim10=new Double_t[iBin[10]+1];
224 Double_t *binLim11=new Double_t[iBin[11]+1];
225 Double_t *binLim12=new Double_t[iBin[12]+1];
226
227 // y
228 for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ymin + (ymax-ymin) /nbin1*(Double_t)i ;
229
230 // cosThetaStar
231 for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)cosmin + (cosmax-cosmin) /nbin2*(Double_t)i ;
232
233 // cT
234 for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)cTmin + (cTmax-cTmin) /nbin5*(Double_t)i ;
235
236 // dca
237 for(Int_t i=0; i<=nbin6; i++) binLim6[i]=(Double_t)dcamin + (dcamax-dcamin) /nbin6*(Double_t)i ;
238
239 // d0pi
240 for(Int_t i=0; i<=nbin7; i++) binLim7[i]=(Double_t)d0min + (d0max-d0min) /nbin7*(Double_t)i ;
241
242 // d0K
243 for(Int_t i=0; i<=nbin8; i++) binLim8[i]=(Double_t)d0min + (d0max-d0min) /nbin8*(Double_t)i ;
244
245 // d0xd0
246 for(Int_t i=0; i<=nbin9; i++) binLim9[i]=(Double_t)d0xd0min + (d0xd0max-d0xd0min) /nbin9*(Double_t)i ;
247
248 // cosPointingAngle
249 for(Int_t i=0; i<=nbin10; i++) binLim10[i]=(Double_t)cosmin + (cosmax-cosmin) /nbin10*(Double_t)i ;
250
251 // Phi
252 for(Int_t i=0; i<=nbin11; i++) binLim11[i]=(Double_t)phimin + (phimax-phimin) /nbin11*(Double_t)i ;
253
254 // z Primary Vertex
255 for(Int_t i=0; i<=nbin12; i++) {
256 binLim12[i]=(Double_t)zmin + (zmax-zmin) /nbin12*(Double_t)i ;
257 }
258
259 //one "container" for MC
260 TString nameContainer="";
261 if(!isKeepDfromB) {
262 nameContainer="CFHFccontainer0_CommonFramework";
263 }
264 else if(isKeepDfromBOnly){
265 nameContainer="CFHFccontainer0DfromB_CommonFramework";
266 }
267 else {
268 nameContainer="CFHFccontainer0allD_CommonFramework";
269 }
270
271 AliCFContainer* container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBin);
272 //setting the bin limits
273 printf("pt\n");
274 container -> SetBinLimits(ipt,binLim0);
275 printf("y\n");
276 container -> SetBinLimits(iy,binLim1);
277 printf("cts\n");
278 container -> SetBinLimits(icosThetaStar,binLim2);
279 printf("ptPi\n");
280 container -> SetBinLimits(ipTpi,binLim3);
281 printf("ptK\n");
282 container -> SetBinLimits(ipTk,binLim4);
283 printf("cT\n");
284 container -> SetBinLimits(icT,binLim5);
285 printf("dca\n");
286 container -> SetBinLimits(idca,binLim6);
287 printf("d0Pi\n");
288 container -> SetBinLimits(id0pi,binLim7);
289 printf("d0K\n");
290 container -> SetBinLimits(id0K,binLim8);
291 printf("d0xd0\n");
292 container -> SetBinLimits(id0xd0,binLim9);
293 printf("pointing\n");
294 container -> SetBinLimits(ipointing,binLim10);
295 printf("phi\n");
296 container -> SetBinLimits(iphi,binLim11);
297 printf("z\n");
298 container -> SetBinLimits(iz,binLim12);
299
300 container -> SetStepTitle(0, "MCLimAcc");
301 container -> SetStepTitle(1, "MC");
302 container -> SetStepTitle(2, "MCAcc");
303 container -> SetStepTitle(3, "RecoVertex");
304 container -> SetStepTitle(4, "RecoRefit");
305 container -> SetStepTitle(5, "Reco");
306 container -> SetStepTitle(6, "RecoAcc");
307 container -> SetStepTitle(7, "RecoITSCluster");
308 container -> SetStepTitle(8, "RecoCuts");
309 container -> SetStepTitle(8, "RecoPID");
310
311 container -> SetVarTitle(ipt,"pt");
312 container -> SetVarTitle(iy,"y");
313 container -> SetVarTitle(icosThetaStar, "cosThetaStar");
314 container -> SetVarTitle(ipTpi, "ptpi");
315 container -> SetVarTitle(ipTk, "ptK");
316 container -> SetVarTitle(icT, "ct");
317 container -> SetVarTitle(idca, "dca");
318 container -> SetVarTitle(id0pi, "d0pi");
319 container -> SetVarTitle(id0K, "d0K");
320 container -> SetVarTitle(id0xd0, "d0xd0");
321 container -> SetVarTitle(ipointing, "piointing");
322 container -> SetVarTitle(iphi, "phi");
323 container -> SetVarTitle(iz, "z");
324
325
326 //CREATE THE CUTS -----------------------------------------------
327
328 // Gen-Level kinematic cuts
329 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
330
331 //Particle-Level cuts:
332 AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
333 Bool_t useAbsolute = kTRUE;
334 if (isSign != 2){
335 useAbsolute = kFALSE;
336 }
337 mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include D0_bar
338 mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
339
340 // Acceptance cuts:
341 AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
342 AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
343 kineAccCuts->SetPtRange(ptmin,ptmax);
344 kineAccCuts->SetEtaRange(etamin,etamax);
345
346 // Rec-Level kinematic cuts
347 AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
348
349 AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
350
351 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
352
353 printf("CREATE MC KINE CUTS\n");
354 TObjArray* mcList = new TObjArray(0) ;
355 mcList->AddLast(mcKineCuts);
356 mcList->AddLast(mcGenCuts);
357
358 printf("CREATE ACCEPTANCE CUTS\n");
359 TObjArray* accList = new TObjArray(0) ;
360 accList->AddLast(kineAccCuts);
361
362 printf("CREATE RECONSTRUCTION CUTS\n");
363 TObjArray* recList = new TObjArray(0) ; // not used!!
364 recList->AddLast(recKineCuts);
365 recList->AddLast(recQualityCuts);
366 recList->AddLast(recIsPrimaryCuts);
367
368 TObjArray* emptyList = new TObjArray(0);
369
370 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
371 printf("CREATE INTERFACE AND CUTS\n");
372 AliCFManager* man = new AliCFManager() ;
373 man->SetParticleContainer(container);
374 man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
375 man->SetParticleCutsList(1 , mcList); // MC
376 man->SetParticleCutsList(2 , accList); // Acceptance
377 man->SetParticleCutsList(3 , emptyList); // Vertex
378 man->SetParticleCutsList(4 , emptyList); // Refit
379 man->SetParticleCutsList(5 , emptyList); // AOD
380 man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
381 man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
382 man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
383 man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
384
385 // Get the pointer to the existing analysis manager via the static access method.
386 //==============================================================================
387 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
388 if (!mgr) {
389 ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
390 return NULL;
391 }
392 //CREATE THE TASK
393 printf("CREATE TASK\n");
394
395 // create the task
396 AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsD0toKpi);
397 task->SetFillFromGenerated(kFALSE);
398 task->SetCFManager(man); //here is set the CF manager
399 task->SetDecayChannel(21);
400 task->SetUseWeight(kFALSE);
401 task->SetSign(isSign);
402 task->SetDebugLevel(10);
403 if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
404 if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
405
406 Printf("***************** CONTAINER SETTINGS *****************");
407 Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
408 Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
409 Printf("Dselection = %d",(Int_t)task->GetDselection());
410 Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
411 Printf("Sign = %d",(Int_t)task->GetSign());
412 Printf("***************END CONTAINER SETTINGS *****************\n");
413
414 //-----------------------------------------------------------//
415 // create correlation matrix for unfolding - only eta-pt //
416 //-----------------------------------------------------------//
417
418 Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
419
420 Int_t thnDim[4];
421
422 //first half : reconstructed
423 //second half : MC
424
425 thnDim[0] = iBin[0];
426 thnDim[2] = iBin[0];
427 thnDim[1] = iBin[1];
428 thnDim[3] = iBin[1];
429
430 TString nameCorr="";
431 if(!isKeepDfromB) {
432 nameCorr="CFHFcorr0_CommonFramework";
433 }
434 else if(isKeepDfromBOnly){
435 nameCorr= "CFHFcorr0KeepDfromBOnly_CommonFramework";
436 }
437 else {
438 nameCorr="CFHFcorr0allD_CommonFramework";
439
440 }
441
442 THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
443 Double_t** binEdges = new Double_t[2];
444
445 // set bin limits
446
447 binEdges[0]= binLim0;
448 binEdges[1]= binLim1;
449
450 correlation->SetBinEdges(0,binEdges[0]);
451 correlation->SetBinEdges(2,binEdges[0]);
452
453 correlation->SetBinEdges(1,binEdges[1]);
454 correlation->SetBinEdges(3,binEdges[1]);
455
456 correlation->Sumw2();
457
458 // correlation matrix ready
459 //------------------------------------------------//
460
461 task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
462
463 // Create and connect containers for input/output
464
465 // ------ input data ------
466 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
467
468 // ----- output data -----
469
470 TString outputfile = AliAnalysisManager::GetCommonFileName();
471 TString output1name="", output2name="", output3name="",output4name="";
472 output2name=nameContainer;
473 output3name=nameCorr;
474 if(!isKeepDfromB) {
475 outputfile += ":PWG3_D2H_CFtaskD0toKpi_CommonFramework";
476 output1name="CFHFchist0_CommonFramework";
477 }
478 else if(isKeepDfromBOnly){
479 outputfile += ":PWG3_D2H_CFtaskD0toKpiKeepDfromBOnly_CommonFramework";
480 output1name="CFHFchist0DfromB_CommonFramework";
481 }
482 else{
483 outputfile += ":PWG3_D2H_CFtaskD0toKpiKeepDfromB_CommonFramework";
484 output1name="CFHFchist0allD_CommonFramework";
485 }
486 output4name= "Cuts_CommonFramework";
487
488 //now comes user's output objects :
489 // output TH1I for event counting
490 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
491 // output Correction Framework Container (for acceptance & efficiency calculations)
492 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
493 // Unfolding - correlation matrix
494 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
495 // cuts
496 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
497
498 mgr->AddTask(task);
499
500 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
501 mgr->ConnectOutput(task,1,coutput1);
502 mgr->ConnectOutput(task,2,coutput2);
503 mgr->ConnectOutput(task,3,coutput3);
504 mgr->ConnectOutput(task,4,coutput4);
505 return task;
506}
507