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