AliPhysics  63e47e1 (63e47e1)
AddTaskCFVertexingHF.C
Go to the documentation of this file.
1 //DEFINITION OF A FEW CONSTANTS
2 const Double_t ymin = -1.2 ;
3 const Double_t ymax = 1.2 ;
4 const Double_t cosminTS = -1.05;
5 const Double_t cosmaxTS = 1.05;
6 const Double_t cosmin = 0.7;
7 const Double_t cosmax = 1.02;
8 const Double_t cTmin = 0; // micron
9 const Double_t cTmax = 300; // micron
10 const Double_t dcamin = 0; // micron
11 const Double_t dcamax = 600; // micron
12 const Double_t d0xd0min = -80000; // micron
13 const Double_t d0xd0max = 100000; // micron
14 const Double_t phimin = 0.0;
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;
27 
28 const Float_t centmin_0_10 = 0.;
29 const Float_t centmax_0_10 = 10.;
30 const Float_t centmin_10_60 = 10.;
31 const Float_t centmax_10_60 = 60.;
32 const Float_t centmin_60_100 = 60.;
33 const Float_t centmax_60_100 = 100.;
34 const Float_t centmax = 100.;
35 const Float_t fakemin = -0.5;
36 const Float_t fakemax = 2.5.;
37 const Float_t cosminXY = 0.95;
38 const Float_t cosmaxXY = 1.0;
42 const Float_t multmax_0_20 = 20;
48 const Float_t multmax_80_100 = 100;
49 const Float_t multmin_100_400 = 100; // Only for pPb
50 const Float_t multmax_100_400 = 400; // Only for pPb
51 
52 //
53 // useWeight : flag for Pt weights (default are pp 2010 weights, functions per MC production existing)
54 // useFlatPtWeight : flag to test flat Pt weights (computed for LHC10f7a MC)
55 // useZWeight : flag to use z-vtx weight (used for systematics for now)
56 // useNchWeight : flag to use weights on the distribution of simulated primary particles (default pp 2010)
57 // useNtrkWeight : flag to use weights on the distribution of Ntracklets
58 // isFinePtBin : flag for fine pt bin (100 MeV from 0 to 30 GeV)
59 // multiplicityEstimator : varying the multiplicity (and not centrality) estimator
60 // isPPData : flag to switch off centrality checks when runing on pp data (reduces a lot log files)
61 // isPPbData : Flag for pPb data, changes the Ntrk bining
62 // estimatorFilename, refMult : Ntrk vs z-vtx multiplicity correction file name and average value
63 // isFineNtrkBin : gives Ntrk bins of 1 unit from 0-100 (200 for pPb)
64 //----------------------------------------------------
65 
66 AliCFTaskVertexingHF *AddTaskCFVertexingHF(const char* cutFile = "./D0toKpiCuts.root", TString cutObjectName="D0toKpiCutsStandard", TString suffix="", Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 421, Char_t isSign = 2, Bool_t useWeight=kFALSE, Bool_t useFlatPtWeight=kFALSE, Bool_t useZWeight=kFALSE, Bool_t useNchWeight=kFALSE, Bool_t useNtrkWeight=kFALSE, Bool_t isFinePtBin=kFALSE, TString estimatorFilename="", Int_t multiplicityEstimator = AliCFTaskVertexingHF::kNtrk10, Bool_t isPPData=kFALSE, Bool_t isPPbData=kFALSE, Double_t refMult = 9.26, Bool_t isFineNtrkBin=kFALSE)
67 {
68  printf("Adding CF task using cuts from file %s\n",cutFile);
69  if (configuration == AliCFTaskVertexingHF::kSnail){
70  printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
71  }
72  else if (configuration == AliCFTaskVertexingHF::kCheetah){
73  printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
74  }
75  else if (configuration == AliCFTaskVertexingHF::kFalcon){
76  printf("The configuration is set to be FAST --> using only pt, y, centrality, multiplicity to fill the CF\n");
77  }
78  else if (configuration == AliCFTaskVertexingHF::kESE){
79  printf("The configuration is set to be for ESE analysis --> using pt, y, centrality, multiplicity, local multiplicity and q2 to fill the CF\n");
80  }
81  else{
82  printf("The configuration is not defined! returning\n");
83  return;
84  }
85 
86  gSystem->Sleep(2000);
87 
88  // isSign = 0 --> D0 only
89  // isSign = 1 --> D0bar only
90  // isSign = 2 --> D0 + D0bar
91 
92  TString expected;
93  if (isSign == 0 && pdgCode < 0){
94  AliError(Form("Error setting PDG code (%d) and sign (0 --> D0 only): they are not compatible, returning"));
95  return 0x0;
96  }
97  else if (isSign == 1 && pdgCode > 0){
98  AliError(Form("Error setting PDG code (%d) and sign (1 --> D0bar only): they are not compatible, returning"));
99  return 0x0;
100  }
101  else if (isSign > 2 || isSign < 0){
102  AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning"));
103  return 0x0;
104  }
105 
106  TFile* fileCuts = TFile::Open(cutFile);
107  if(!fileCuts || (fileCuts && !fileCuts->IsOpen())){
108  AliError("Wrong cut file");
109  return 0x0;
110  }
111 
112  AliRDHFCutsD0toKpi *cutsD0toKpi = (AliRDHFCutsD0toKpi*)fileCuts->Get(cutObjectName.Data());
113 
114  // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
115  // for now the binning is the same than for all D's
116  if(isKeepDfromBOnly) isKeepDfromB = true;
117 
118  Double_t ptmin_0_6;
119  Double_t ptmax_0_6;
120  Double_t ptmin_6_8;
121  Double_t ptmax_6_8;
122  Double_t ptmin_8_16;
123  Double_t ptmax_8_16;
124  Double_t ptmin_16_24;
125  Double_t ptmax_16_24;
126 
127  ptmin_0_6 = 0.0 ;
128  ptmax_0_6 = 6.0 ;
129  ptmin_6_8 = 6.0 ;
130  ptmax_6_8 = 8.0 ;
131  ptmin_8_16 = 8.0 ;
132  ptmax_8_16 = 16.0 ;
133  ptmin_16_24 = 16.0 ;
134  ptmax_16_24 = 24.0 ;
135 
136 
137  //CONTAINER DEFINITION
138  Info("AliCFTaskVertexingHF","SETUP CONTAINER");
139  const Double_t phimax = 2*TMath::Pi();
140  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
141 
142  //const UInt_t ipT, iy, icosThetaStar, ipTpi, ipTk, icT, idca, id0xd0, ipointing, iphi, izvtx, icent, ifake, ipointingXY, iNormDecayLXY, imult;
143  const Int_t nbiny = 24 ; //bins in y
144  const Int_t nbincosThetaStar = 42 ; //bins in cosThetaStar
145  const Int_t nbincT = 15 ; //bins in cT
146  const Int_t nbindca = 20 ; //bins in dca
147  const Int_t nbind0xd0 = 90 ; //bins in d0xd0
148  const Int_t nbinpointing = 50 ; //bins in cosPointingAngle
149  const Int_t nbinphi = 18 ; //bins in Phi
150  const Int_t nbinzvtx = 30 ; //bins in z vertex
151  const Int_t nbincent = 28; //bins in centrality
152  const Int_t nbincent_0_10 = 4; //bins in centrality between 0 and 10
153  const Int_t nbincent_10_60 = 20; //bins in centrality between 10 and 60
154  const Int_t nbincent_60_100 = 4; //bins in centrality between 60 and 100
155  const Int_t nbinfake = 3; //bins in fake
156  const Int_t nbinpointingXY = 50; //bins in cosPointingAngleXY
157  const Int_t nbinnormDecayLXY = 20; //bins in NormDecayLengthXY
158  const Int_t nbinmult = 49; //bins in multiplicity (total number)
159  const Int_t nbinmult_0_20 = 20; //bins in multiplicity between 0 and 20
160  const Int_t nbinmult_20_50 = 15; //bins in multiplicity between 20 and 50
161  const Int_t nbinmult_50_80 = 10; //bins in multiplicity between 50 and 100
162  const Int_t nbinmult_80_100 = 4; //bins in multiplicity between 50 and 100
163  const Int_t nbinmult_100_400 = 6; // Only on pPb bins in multiplicity between 100 and 400
164  if(isPPbData) nbinmult += nbinmult_100_400;
165 
166  //the sensitive variables, their indices
167 
168  const Int_t nvarTot = 16 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, z, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
169 
170  // variables' indices
171  const UInt_t ipT = 0;
172  const UInt_t iy = 1;
173  const UInt_t icosThetaStar = 2;
174  const UInt_t ipTpi = 3;
175  const UInt_t ipTk = 4;
176  const UInt_t icT = 5;
177  const UInt_t idca = 6;
178  const UInt_t id0xd0 = 7;
179  const UInt_t ipointing = 8;
180  const UInt_t iphi = 9;
181  const UInt_t izvtx = 10;
182  const UInt_t icent = 11;
183  const UInt_t ifake = 12;
184  const UInt_t ipointingXY = 13;
185  const UInt_t inormDecayLXY = 14;
186  const UInt_t imult = 15;
187 
188  //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
189 
190  //arrays for the number of bins in each dimension
191  Int_t iBin[nvarTot];
192 
193  //OPTION 1: defining the pt, ptPi, ptK bins by hand...
194  /*
195  const Int_t nbinpt_0_6 = 6 ; //bins in pt from 0 to 6 GeV
196  const Int_t nbinpt_6_8 = 1 ; //bins in pt from 6 to 8 GeV
197  const Int_t nbinpt_8_16 = 2 ; //bins in pt from 8 to 16 GeV
198  const Int_t nbinpt_16_24 = 1 ; //bins in pt from 16 to 24 GeV
199  const Int_t nbinpTpi_0_6 = 6 ; //bins in ptPi from 0 to 6 GeV
200  const Int_t nbinpTpi_6_8 = 1 ; //bins in ptPi from 6 to 8 GeV
201  const Int_t nbinpTpi_8_16 = 2 ; //bins in ptPi from 8 to 16 GeV
202  const Int_t nbinpTpi_16_24 = 1 ; //bins in ptPi from 16 to 24 GeV
203  const Int_t nbinpTk_0_6 = 6 ; //bins in ptK from 0 to 6 GeV
204  const Int_t nbinpTk_6_8 = 1 ; //bins in ptK from 6 to 8 GeV
205  const Int_t nbinpTk_8_16 = 2 ; //bins in ptK from 8 to 16 GeV
206  const Int_t nbinpTk_16_24 = 1 ; //bins in ptK from 16 to 24 GeV
207  iBin[ipT]=nbinpt_0_6+nbinpt_6_8+nbinpt_8_16+nbinpt_16_24;
208  iBin[ipTpi]=nbinpTpi_0_6+nbinpTpi_6_8+nbinpTpi_8_16+nbinpTpi_16_24;
209  iBin[ipTk]=nbinpTk_0_6+nbinpTk_6_8+nbinpTk_8_16+nbinpTk_16_24;
210  Double_t *binLimpT=new Double_t[iBin[0]+1];
211  Double_t *binLimpTpi=new Double_t[iBin[3]+1];
212  Double_t *binLimpTk=new Double_t[iBin[4]+1];
213 
214  // values for bin lower bounds
215  // pt
216  for(Int_t i=0; i<=nbinpt_0_6; i++) binLimpT[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbinpt_0_6*(Double_t)i ;
217  if (binLimpT[nbinpt_0_6] != ptmin_6_8) {
218  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
219  }
220  for(Int_t i=0; i<=nbinpt_6_8; i++) binLimpT[i+nbinpt_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbinpt_6_8*(Double_t)i ;
221  if (binLimpT[nbinpt_0_6+nbinpt_6_8] != ptmin_8_16) {
222  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
223  }
224  for(Int_t i=0; i<=nbinpt_8_16; i++) binLimpT[i+nbinpt_0_6+nbinpt_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbinpt_8_16*(Double_t)i ;
225  if (binLimpT[nbinpt_0_6+nbinpt_6_8+nbinpt_8_16] != ptmin_16_24) {
226  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
227  }
228  for(Int_t i=0; i<=nbinpt_16_24; i++) binLimpT[i+nbinpt_0_6+nbinpt_6_8+nbinpt_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbinpt_16_24*(Double_t)i ;
229 
230  // ptPi
231  for(Int_t i=0; i<=nbinpTpi_0_6; i++) binLimpTpi[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbinpTpi_0_6*(Double_t)i ;
232  if (binLimpTpi[nbinpTpi_0_6] != ptmin_6_8) {
233  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
234  }
235  for(Int_t i=0; i<=nbinpTpi_6_8; i++) binLimpTpi[i+nbinpTpi_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbinpTpi_6_8*(Double_t)i ;
236  if (binLimpTpi[nbinpTpi_0_6+nbinpTpi_6_8] != ptmin_8_16) {
237  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
238  }
239  for(Int_t i=0; i<=nbinpTpi_8_16; i++) binLimpTpi[i+nbinpTpi_0_6+nbinpt_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbinpTpi_8_16*(Double_t)i ;
240  if (binLimpTpi[nbinpTpi_0_6+nbinpTpi_6_8+nbinpTpi_8_16] != ptmin_16_24) {
241  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
242  }
243  for(Int_t i=0; i<=nbinpTpi_16_24; i++) binLimpTpi[i+nbinpTpi_0_6+nbinpTpi_6_8+nbinpTpi_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbinpTpi_16_24*(Double_t)i ;
244 
245  // ptKa
246  for(Int_t i=0; i<=nbinpTk_0_6; i++) binLimpTk[i]=(Double_t)ptmin_0_6 + (ptmax_0_6-ptmin_0_6)/nbinpTk_0_6*(Double_t)i ;
247  if (binLimpTk[nbinpTk_0_6] != ptmin_6_8) {
248  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
249  }
250  for(Int_t i=0; i<=nbinpTk_6_8; i++) binLimpTk[i+nbinpTk_0_6]=(Double_t)ptmin_6_8 + (ptmax_6_8-ptmin_6_8)/nbinpTk_6_8*(Double_t)i ;
251  if (binLimpTk[nbinpTk_0_6+nbinpTk_6_8] != ptmin_8_16) {
252  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
253  }
254  for(Int_t i=0; i<=nbinpTk_8_16; i++) binLimpTk[i+nbinpTk_0_6+nbinpt_6_8]=(Double_t)ptmin_8_16 + (ptmax_8_16-ptmin_8_16)/nbinpTk_8_16*(Double_t)i ;
255  if (binLimpTk[nbinpTk_0_6+nbinpTk_6_8+nbinpTk_8_16] != ptmin_16_24) {
256  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
257  }
258  for(Int_t i=0; i<=nbinpTk_16_24; i++) binLimpTk[i+nbinpTk_0_6+nbinpTk_6_8+nbinpTk_8_16]=(Double_t)ptmin_16_24 + (ptmax_16_24-ptmin_16_24)/nbinpTk_16_24*(Double_t)i ;
259  */
260 
261  //OPTION 2: ...or from the cuts file
262 
263  const Int_t nbinpt = cutsD0toKpi->GetNPtBins(); // bins in pT
264  iBin[ipT]=nbinpt;
265  iBin[ipTpi]=nbinpt;
266  iBin[ipTk]=nbinpt;
267  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
268  Double_t *binLimpTpi=new Double_t[iBin[ipTpi]+1];
269  Double_t *binLimpTk=new Double_t[iBin[ipTk]+1];
270  // values for bin lower bounds
271  Float_t* floatbinLimpT = cutsD0toKpi->GetPtBinLimits();
272  for (Int_t ibin0 = 0 ; ibin0<iBin[ipT]+1; ibin0++){
273  binLimpT[ibin0] = (Double_t)floatbinLimpT[ibin0];
274  binLimpTpi[ibin0] = (Double_t)floatbinLimpT[ibin0];
275  binLimpTk[ibin0] = (Double_t)floatbinLimpT[ibin0];
276  }
277  for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
278 
279  printf("pT: nbin (from cuts file) = %d\n",nbinpt);
280 
281  Double_t *binLimpTFine=new Double_t[400+1];
282  if(isFinePtBin) {
283  iBin[ipT]=400.;
284  for (Int_t ibin0 = 0 ; ibin0<400+1; ibin0++){
285  binLimpTFine[ibin0] = 0.1*ibin0;
286  }
287  printf("pT: nbins fine = 400\n");
288  }
289 
290  // Fine Ntrk bining setting
291  Double_t *binLimmultFine;
292  Int_t nbinmultTmp=nbinmult;
293  if(isFineNtrkBin){
294  Int_t nbinLimmultFine=100;
295  if(isPPbData) nbinLimmultFine = 200;
296  const UInt_t nbinMultFine = nbinLimmultFine;
297  binLimmultFine = new Double_t[nbinMultFine+1];
298  for (Int_t ibin0 = 0 ; ibin0<nbinMultFine+1; ibin0++){
299  binLimmultFine[ibin0] = ibin0;
300  }
301  nbinmultTmp=nbinLimmultFine;
302  }
303  const Int_t nbinmultTot=nbinmultTmp;
304 
305  // defining now the binning for the other variables:
306 
307  iBin[iy]=nbiny;
308  iBin[icosThetaStar]=nbincosThetaStar;
309  iBin[icT]=nbincT;
310  iBin[idca]=nbindca;
311  iBin[id0xd0]=nbind0xd0;
312  iBin[ipointing]=nbinpointing;
313  iBin[iphi]=nbinphi;
314  iBin[izvtx]=nbinzvtx;
315  iBin[icent]=nbincent;
316  iBin[ifake]=nbinfake;
317  iBin[ipointingXY]=nbinpointingXY;
318  iBin[inormDecayLXY]=nbinnormDecayLXY;
319  iBin[imult]=nbinmultTot;
320 
321  //arrays for lower bounds :
322  Double_t *binLimy=new Double_t[iBin[iy]+1];
323  Double_t *binLimcosThetaStar=new Double_t[iBin[icosThetaStar]+1];
324  Double_t *binLimcT=new Double_t[iBin[icT]+1];
325  Double_t *binLimdca=new Double_t[iBin[idca]+1];
326  Double_t *binLimd0xd0=new Double_t[iBin[id0xd0]+1];
327  Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
328  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
329  Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
330  Double_t *binLimcent=new Double_t[iBin[icent]+1];
331  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
332  Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
333  Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
334  Double_t *binLimmult=new Double_t[iBin[imult]+1];
335 
336 
337  // y
338  for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
339 
340  // cosThetaStar
341  for(Int_t i=0; i<=nbincosThetaStar; i++) binLimcosThetaStar[i]=(Double_t)cosminTS + (cosmaxTS-cosminTS) /nbincosThetaStar*(Double_t)i ;
342 
343  // cT
344  for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
345 
346  // dca
347  for(Int_t i=0; i<=nbindca; i++) binLimdca[i]=(Double_t)dcamin + (dcamax-dcamin) /nbindca*(Double_t)i ;
348 
349  // d0xd0
350  for(Int_t i=0; i<=nbind0xd0; i++) binLimd0xd0[i]=(Double_t)d0xd0min + (d0xd0max-d0xd0min) /nbind0xd0*(Double_t)i ;
351 
352  // cosPointingAngle
353  for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
354 
355  // Phi
356  for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
357 
358  // z Primary Vertex
359  for(Int_t i=0; i<=nbinzvtx; i++) {
360  binLimzvtx[i]=(Double_t)zmin + (zmax-zmin) /nbinzvtx*(Double_t)i ;
361  }
362 
363  // centrality
364  for(Int_t i=0; i<=nbincent_0_10; i++) binLimcent[i]=(Double_t)centmin_0_10 + (centmax_0_10-centmin_0_10)/nbincent_0_10*(Double_t)i ;
365  if (binLimcent[nbincent_0_10] != centmin_10_60) {
366  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
367  }
368  for(Int_t i=0; i<=nbincent_10_60; i++) binLimcent[i+nbincent_0_10]=(Double_t)centmin_10_60 + (centmax_10_60-centmin_10_60)/nbincent_10_60*(Double_t)i ;
369  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
370  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
371  }
372  for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_0_10+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
373 
374  // fake
375  for(Int_t i=0; i<=nbinfake; i++) {
376  binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
377  }
378 
379  // cosPointingAngleXY
380  for(Int_t i=0; i<=nbinpointingXY; i++) binLimpointingXY[i]=(Double_t)cosminXY + (cosmaxXY-cosminXY) /nbinpointingXY*(Double_t)i ;
381 
382  // normDecayLXY
383  for(Int_t i=0; i<=nbinnormDecayLXY; i++) binLimnormDecayLXY[i]=(Double_t)normDecLXYmin + (normDecLXYmax-normDecLXYmin) /nbinnormDecayLXY*(Double_t)i ;
384 
385  // multiplicity
386  for(Int_t i=0; i<=nbinmult_0_20; i++) binLimmult[i]=(Double_t)multmin_0_20 + (multmax_0_20-multmin_0_20)/nbinmult_0_20*(Double_t)i ;
387  if (binLimmult[nbinmult_0_20] != multmin_20_50) {
388  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
389  }
390  for(Int_t i=0; i<=nbinmult_20_50; i++) binLimmult[i+nbinmult_0_20]=(Double_t)multmin_20_50 + (multmax_20_50-multmin_20_50)/nbinmult_20_50*(Double_t)i ;
391  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_80) {
392  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
393  }
394  for(Int_t i=0; i<=nbinmult_50_80; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50]=(Double_t)multmin_50_80 + (multmax_50_80-multmin_50_80)/nbinmult_50_80*(Double_t)i ;
395  if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80] != multmin_80_100) {
396  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
397  }
398  for(Int_t i=0; i<=nbinmult_80_100; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50+nbinmult_50_80]=(Double_t)multmin_80_100 + (multmax_80_100-multmin_80_100)/nbinmult_80_100*(Double_t)i ;
399  if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100] != multmin_100_400) {
400  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
401  }
402 
403  if(isPPbData){
404  for(Int_t i=0; i<=nbinmult_100_400; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100]=(Double_t)multmin_100_400 + (multmax_100_400-multmin_100_400)/nbinmult_100_400*(Double_t)i ;
405  }
406 
407  if(multiplicityEstimator==AliCFTaskVertexingHF::kVZERO) {
408  Int_t items = nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100;
409  if(isPPbData) items = nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100+nbinmult_100_400;
410  for(Int_t i=0; i<=items; i++) binLimmult[i]*= 68./12.;
411  }
412 
413  //one "container" for MC
414  TString nameContainer="";
415  if(!isKeepDfromB) {
416  nameContainer="CFHFccontainer0";
417  }
418  else if(isKeepDfromBOnly){
419  nameContainer="CFHFccontainer0DfromB";
420  }
421  else {
422  nameContainer="CFHFccontainer0allD";
423  }
424  nameContainer += suffix;
425  //Setting up the container grid...
426 
427  AliCFContainer* container;
428 
429  if (configuration == AliCFTaskVertexingHF::kSnail){
430  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
431  //setting the bin limits
432  printf("pt\n");
433  if(isFinePtBin) container -> SetBinLimits(ipT,binLimpTFine);
434  else container -> SetBinLimits(ipT,binLimpT);
435  printf("y\n");
436  container -> SetBinLimits(iy,binLimy);
437  printf("cts\n");
438  container -> SetBinLimits(icosThetaStar,binLimcosThetaStar);
439  printf("ptPi\n");
440  container -> SetBinLimits(ipTpi,binLimpTpi);
441  printf("ptK\n");
442  container -> SetBinLimits(ipTk,binLimpTk);
443  printf("cT\n");
444  container -> SetBinLimits(icT,binLimcT);
445  printf("dca\n");
446  container -> SetBinLimits(idca,binLimdca);
447  printf("d0xd0\n");
448  container -> SetBinLimits(id0xd0,binLimd0xd0);
449  printf("pointing\n");
450  container -> SetBinLimits(ipointing,binLimpointing);
451  printf("phi\n");
452  container -> SetBinLimits(iphi,binLimphi);
453  printf("z\n");
454  container -> SetBinLimits(izvtx,binLimzvtx);
455  printf("cent\n");
456  container -> SetBinLimits(icent,binLimcent);
457  printf("fake\n");
458  container -> SetBinLimits(ifake,binLimfake);
459  printf("pointingXY\n");
460  container -> SetBinLimits(ipointingXY,binLimpointingXY);
461  printf("normDecayLXY\n");
462  container -> SetBinLimits(inormDecayLXY,binLimnormDecayLXY);
463  printf("multiplicity\n");
464  if(isFineNtrkBin) container -> SetBinLimits(imult,binLimmultFine);
465  else container -> SetBinLimits(imult,binLimmult);
466 
467  container -> SetVarTitle(ipT,"pt");
468  container -> SetVarTitle(iy,"y");
469  container -> SetVarTitle(icosThetaStar, "cosThetaStar");
470  container -> SetVarTitle(ipTpi, "ptpi");
471  container -> SetVarTitle(ipTk, "ptK");
472  container -> SetVarTitle(icT, "ct");
473  container -> SetVarTitle(idca, "dca");
474  container -> SetVarTitle(id0xd0, "d0xd0");
475  container -> SetVarTitle(ipointing, "pointing");
476  container -> SetVarTitle(iphi, "phi");
477  container -> SetVarTitle(izvtx, "zvtx");
478  container -> SetVarTitle(icent, "centrality");
479  container -> SetVarTitle(ifake, "fake");
480  container -> SetVarTitle(ipointingXY, "piointingXY");
481  container -> SetVarTitle(inormDecayLXY, "normDecayLXY");
482  container -> SetVarTitle(imult, "multiplicity");
483  }
484  else if (configuration == AliCFTaskVertexingHF::kCheetah){
485  //arrays for the number of bins in each dimension
486  const Int_t nvar = 8;
487 
488  const UInt_t ipTFast = 0;
489  const UInt_t iyFast = 1;
490  const UInt_t icTFast = 2;
491  const UInt_t iphiFast = 3;
492  const UInt_t izvtxFast = 4;
493  const UInt_t icentFast = 5;
494  const UInt_t ifakeFast = 6;
495  const UInt_t imultFast = 7;
496 
497  Int_t iBinFast[nvar];
498  iBinFast[ipTFast] = iBin[ipT];
499  iBinFast[iyFast] = iBin[iy];
500  iBinFast[icTFast] = iBin[icT];
501  iBinFast[iphiFast] = iBin[iphi];
502  iBinFast[izvtxFast] = iBin[izvtx];
503  iBinFast[icentFast] = iBin[icent];
504  iBinFast[ifakeFast] = iBin[ifake];
505  iBinFast[imultFast] = iBin[imult];
506 
507  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinFast);
508  printf("pt\n");
509  if(isFinePtBin) container -> SetBinLimits(ipTFast,binLimpTFine);
510  else container -> SetBinLimits(ipTFast,binLimpT);
511  printf("y\n");
512  container -> SetBinLimits(iyFast,binLimy);
513  printf("ct\n");
514  container -> SetBinLimits(icTFast,binLimcT);
515  printf("phi\n");
516  container -> SetBinLimits(iphiFast,binLimphi);
517  printf("zvtx\n");
518  container -> SetBinLimits(izvtxFast,binLimzvtx);
519  printf("centrality\n");
520  container -> SetBinLimits(icentFast,binLimcent);
521  printf("fake\n");
522  container -> SetBinLimits(ifakeFast,binLimfake);
523  printf("multiplicity\n");
524  if(isFineNtrkBin) container -> SetBinLimits(imultFast,binLimmultFine);
525  else container -> SetBinLimits(imultFast,binLimmult);
526 
527  container -> SetVarTitle(ipTFast,"pt");
528  container -> SetVarTitle(iyFast,"y");
529  container -> SetVarTitle(icTFast, "ct");
530  container -> SetVarTitle(iphiFast, "phi");
531  container -> SetVarTitle(izvtxFast, "zvtx");
532  container -> SetVarTitle(icentFast, "centrality");
533  container -> SetVarTitle(ifakeFast, "fake");
534  container -> SetVarTitle(imultFast, "multiplicity");
535  }
536  else if (configuration == AliCFTaskVertexingHF::kFalcon){
537  //arrays for the number of bins in each dimension
538  const Int_t nvar = 4;
539 
540  const UInt_t ipTSuperFast = 0;
541  const UInt_t iySuperFast = 1;
542  const UInt_t icentSuperFast = 2;
543  const UInt_t imultSuperFast = 3;
544 
545  Int_t iBinSuperFast[nvar];
546  iBinSuperFast[ipTSuperFast] = iBin[ipT];
547  iBinSuperFast[iySuperFast] = iBin[iy];
548  iBinSuperFast[icentSuperFast] = iBin[icent];
549  iBinSuperFast[imultSuperFast] = iBin[imult];
550 
551  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinSuperFast);
552  printf("pt\n");
553  if(isFinePtBin) container -> SetBinLimits(ipTSuperFast,binLimpTFine);
554  else container -> SetBinLimits(ipTSuperFast,binLimpT);
555  printf("y\n");
556  container -> SetBinLimits(iySuperFast,binLimy);
557  printf("centrality\n");
558  container -> SetBinLimits(icentSuperFast,binLimcent);
559  printf("multiplicity\n");
560  if(isFineNtrkBin) container -> SetBinLimits(imultSuperFast,binLimmultFine);
561  else container -> SetBinLimits(imultSuperFast,binLimmult);
562 
563  container -> SetVarTitle(ipTSuperFast,"pt");
564  container -> SetVarTitle(iySuperFast,"y");
565  container -> SetVarTitle(icentSuperFast, "centrality");
566  container -> SetVarTitle(imultSuperFast, "multiplicity");
567  }
568  else if (configuration == AliCFTaskVertexingHF::kESE){
569  //arrays for the number of bins in each dimension
570  const Int_t nvar = 6;
571 
572  const UInt_t ipTESE = 0;
573  const UInt_t iyESE = 1;
574  const UInt_t icentESE = 2;
575  const UInt_t imultESE = 3;
576  const UInt_t ilocalmultESE = 4;
577  const UInt_t iq2ESE = 5;
578 
579  const Int_t iBinESE[nvar] = {iBin[ipT],iBin[iy],100,50,50,100};
580 
581  Double_t binLimcentESE[iBinESE[icentESE]+1];
582  for(Int_t iCent=0; iCent<iBinESE[icentESE]+1; iCent++) {
583  binLimcentESE[iCent] = iCent;
584  }
585  Double_t binLimmultESE[iBinESE[imultESE]+1];
586  for(Int_t iMult=0; iMult<iBinESE[imultESE]+1; iMult++) {
587  binLimmultESE[iMult] = -0.5+iMult*5000./iBinESE[imultESE];
588  }
589  Double_t binLimlocalmultESE[iBinESE[ilocalmultESE]+1];
590  for(Int_t iLocalMult=0; iLocalMult<iBinESE[ilocalmultESE]+1; iLocalMult++) {
591  binLimlocalmultESE[iLocalMult] = -0.5+iLocalMult*200./iBinESE[ilocalmultESE];
592  }
593  Double_t binLimq2ESE[iBinESE[iq2ESE]+1];
594  for(Int_t iq2=0; iq2<iBinESE[iq2ESE]+1; iq2++) {
595  binLimq2ESE[iq2] = iq2*5./iBinESE[iq2ESE];
596  }
597 
598  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinESE);
599  printf("pt\n");
600  container -> SetBinLimits(ipTESE,binLimpT);
601  printf("y\n");
602  container -> SetBinLimits(iyESE,binLimy);
603  printf("centrality\n");
604  container -> SetBinLimits(icentESE,binLimcentESE);
605  printf("multiplicity\n");
606  container -> SetBinLimits(imultESE,binLimmultESE);
607  printf("local multiplicity\n");
608  container -> SetBinLimits(ilocalmultESE,binLimlocalmultESE);
609  printf("q2\n");
610  container -> SetBinLimits(iq2ESE,binLimq2ESE);
611 
612  container -> SetVarTitle(ipTESE,"pt");
613  container -> SetVarTitle(iyESE,"y");
614  container -> SetVarTitle(icentESE, "centrality");
615  container -> SetVarTitle(imultESE, "multiplicity");
616  container -> SetVarTitle(ilocalmultESE, "local multiplicity");
617  container -> SetVarTitle(iq2ESE, "q2");
618  }
619 
620  container -> SetStepTitle(0, "MCLimAcc");
621  container -> SetStepTitle(1, "MC");
622  container -> SetStepTitle(2, "MCAcc");
623  container -> SetStepTitle(3, "RecoVertex");
624  container -> SetStepTitle(4, "RecoRefit");
625  container -> SetStepTitle(5, "Reco");
626  container -> SetStepTitle(6, "RecoAcc");
627  container -> SetStepTitle(7, "RecoITSCluster");
628  container -> SetStepTitle(8, "RecoCuts");
629  container -> SetStepTitle(9, "RecoPID");
630 
631  //return container;
632 
633  //CREATE THE CUTS -----------------------------------------------
634 
635  // Gen-Level kinematic cuts
636  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
637 
638  //Particle-Level cuts:
639  AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
640  Bool_t useAbsolute = kTRUE;
641  if (isSign != 2){
642  useAbsolute = kFALSE;
643  }
644  mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include D0_bar
645  mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
646 
647  // Acceptance cuts:
648  AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
649  AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
650  kineAccCuts->SetPtRange(ptmin,ptmax);
651  kineAccCuts->SetEtaRange(etamin,etamax);
652 
653  // Rec-Level kinematic cuts
654  AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
655 
656  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
657 
658  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
659 
660  printf("CREATE MC KINE CUTS\n");
661  TObjArray* mcList = new TObjArray(0) ;
662  mcList->AddLast(mcKineCuts);
663  mcList->AddLast(mcGenCuts);
664 
665  printf("CREATE ACCEPTANCE CUTS\n");
666  TObjArray* accList = new TObjArray(0) ;
667  accList->AddLast(kineAccCuts);
668 
669  printf("CREATE RECONSTRUCTION CUTS\n");
670  TObjArray* recList = new TObjArray(0) ; // not used!!
671  recList->AddLast(recKineCuts);
672  recList->AddLast(recQualityCuts);
673  recList->AddLast(recIsPrimaryCuts);
674 
675  TObjArray* emptyList = new TObjArray(0);
676 
677  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
678  printf("CREATE INTERFACE AND CUTS\n");
679  AliCFManager* man = new AliCFManager() ;
680  man->SetParticleContainer(container);
681  man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
682  man->SetParticleCutsList(1 , mcList); // MC
683  man->SetParticleCutsList(2 , accList); // Acceptance
684  man->SetParticleCutsList(3 , emptyList); // Vertex
685  man->SetParticleCutsList(4 , emptyList); // Refit
686  man->SetParticleCutsList(5 , emptyList); // AOD
687  man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
688  man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
689  man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
690  man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
691 
692  // Get the pointer to the existing analysis manager via the static access method.
693  //==============================================================================
694  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
695  if (!mgr) {
696  ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
697  return NULL;
698  }
699  //CREATE THE TASK
700  printf("CREATE TASK\n");
701 
702  // create the task
703  AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsD0toKpi);
704  task->SetConfiguration(configuration);
705  task->SetFillFromGenerated(kFALSE);
706  task->SetCFManager(man); //here is set the CF manager
707  task->SetDecayChannel(2);
708  task->SetUseFlatPtWeight(useFlatPtWeight);
709  task->SetUseWeight(useWeight);
710  task->SetUseZWeight(useZWeight);
711  task->SetSign(isSign);
712  task->SetCentralitySelection(kFALSE);
713  task->SetFakeSelection(0);
714  task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
715  task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
716  task->SetMultiplicityEstimator(multiplicityEstimator);
717  task->SetIsPPData(isPPData);
718 
719  if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
720  if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
721 
722  TF1* funcWeight = 0x0;
723  if (task->GetUseWeight()) {
724  funcWeight = (TF1*)fileCuts->Get("funcWeight");
725  if (funcWeight == 0x0){
726  Printf("FONLL Weights will be used");
727  }
728  else {
729  task->SetWeightFunction(funcWeight);
730  Printf("User-defined Weights will be used.");
731  }
732  }
733 
734  if(useNchWeight || useNtrkWeight){
735  TH1F *hNchPrimaries;
736  TH1F *hNchMeasured;
737  if(isPPbData) hNchPrimaries = (TH1F*)fileCuts->Get("hNtrUnCorrEvWithCandWeight");
738  else hNchPrimaries = (TH1F*)fileCuts->Get("hGenPrimaryParticlesInelGt0");
739  hNchMeasured = (TH1F*)fileCuts->Get("hNchMeasured");
740  if(hNchPrimaries) {
741  task->SetUseNchWeight(kTRUE);
742  task->SetMCNchHisto(hNchPrimaries);
743  if(isPPbData) task->SetUseNchTrackletsWeight();
744  } else {
745  AliFatal("Histogram for multiplicity weights not found");
746  return 0x0;
747  }
748  if(hNchMeasured) task->SetMeasuredNchHisto(hNchMeasured);
749  if(useNtrkWeight) task->SetUseNchTrackletsWeight();
750  }
751 
752  if(isPPbData) {
753  task->SetIsPPbData(kTRUE);
754  }
755 
756  if(estimatorFilename.EqualTo("") ) {
757  printf("Estimator file not provided, multiplicity corrected histograms will not be filled\n");
758  task->SetUseZvtxCorrectedNtrkEstimator(kFALSE);
759  } else{
760 
761  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
762  if(!fileEstimator) {
763  AliFatal("File with multiplicity estimator not found");
764  return;
765  }
766 
768  task->SetReferenceMultiplcity(refMult);
769 
770  if (isPPbData) { //Use LHC13 periods for mult correction if pPb data
771  const Char_t* periodNames[2] = {"LHC13b", "LHC13c"};
772  TProfile* multEstimatorAvg[2];
773  for(Int_t ip=0; ip<2; ip++) {
774  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
775  if (!multEstimatorAvg[ip]) {
776  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
777  return;
778  }
779  }
780  task->SetMultiplVsZProfileLHC13b(multEstimatorAvg[0]);
781  task->SetMultiplVsZProfileLHC13c(multEstimatorAvg[1]);
782  }
783  else {
784  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"}; //else, assume pp (LHC10)
785  TProfile* multEstimatorAvg[4];
786  for(Int_t ip=0; ip<4; ip++) {
787  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
788  if (!multEstimatorAvg[ip]) {
789  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
790  return;
791  }
792  }
793  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
794  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
795  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
796  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
797  }
798 
799  }
800 
801 
802  Printf("***************** CONTAINER SETTINGS *****************");
803  Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
804  Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
805  Printf("Dselection = %d",(Int_t)task->GetDselection());
806  Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
807  if (task->GetUseWeight()) {
808  if(funcWeight) Printf("User-defined Weight function");
809  else Printf("FONLL will be used for the weights");
810  }
811 
812  Printf("Use Nch weight = %d",(Int_t)task->GetUseNchWeight());
813  Printf("Sign = %d",(Int_t)task->GetSign());
814  Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
815  Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
816  Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
817  Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
818  Printf("***************END CONTAINER SETTINGS *****************\n");
819 
820  //-----------------------------------------------------------//
821  // create correlation matrix for unfolding - only eta-pt //
822  //-----------------------------------------------------------//
823 
824  Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
825 
826  Int_t thnDim[4];
827 
828  //first half : reconstructed
829  //second half : MC
830 
831  thnDim[0] = iBin[0];
832  thnDim[2] = iBin[0];
833  thnDim[1] = iBin[1];
834  thnDim[3] = iBin[1];
835 
836  TString nameCorr="";
837  if(!isKeepDfromB) {
838  nameCorr="CFHFcorr0";
839  }
840  else if(isKeepDfromBOnly){
841  nameCorr= "CFHFcorr0KeepDfromBOnly";
842  }
843  else {
844  nameCorr="CFHFcorr0allD";
845 
846  }
847  nameCorr += suffix;
848 
849  THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
850  Double_t** binEdges = new Double_t[2];
851 
852  // set bin limits
853 
854  binEdges[0]= binLimpT;
855  if(isFinePtBin) binEdges[0] = binLimpTFine;
856  binEdges[1]= binLimy;
857 
858  correlation->SetBinEdges(0,binEdges[0]);
859  correlation->SetBinEdges(2,binEdges[0]);
860 
861  correlation->SetBinEdges(1,binEdges[1]);
862  correlation->SetBinEdges(3,binEdges[1]);
863 
864  correlation->Sumw2();
865 
866  // correlation matrix ready
867  //------------------------------------------------//
868 
869  task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
870 
871  // Create and connect containers for input/output
872 
873  // ------ input data ------
874  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
875 
876  // ----- output data -----
877 
878  TString outputfile = AliAnalysisManager::GetCommonFileName();
879  TString output1name="", output2name="", output3name="",output4name="", output5name="";
880  output2name=nameContainer;
881  output3name=nameCorr;
882  output4name= "Cuts";
883  output5name= "coutProf";
884  if(!isKeepDfromB) {
885  outputfile += ":PWG3_D2H_CFtaskD0toKpi";
886  output1name="CFHFchist0";
887  output3name+="_cOnly";
888  output4name+="_cOnly";
889  output5name+="_cOnly";
890  }
891  else if(isKeepDfromBOnly){
892  outputfile += ":PWG3_D2H_CFtaskD0toKpiKeepDfromBOnly";
893  output1name="CFHFchist0DfromB";
894  output3name+="_bOnly";
895  output4name+="_bOnly";
896  output5name+="_bOnly";
897  }
898  else{
899  outputfile += ":PWG3_D2H_CFtaskD0toKpiKeepDfromB";
900  output1name="CFHFchist0allD";
901  output3name+="_all";
902  output4name+="_all";
903  output5name+="_all";
904  }
905 
906  outputfile += suffix;
907  output1name += suffix;
908  output4name += suffix;
909  output5name += suffix;
910 
911  //now comes user's output objects :
912  // output TH1I for event counting
913  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
914  // output Correction Framework Container (for acceptance & efficiency calculations)
915  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
916  // Unfolding - correlation matrix
917  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
918  // cuts
919  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
920  // estimators list
921  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
922 
923 
924  mgr->AddTask(task);
925 
926  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
927  mgr->ConnectOutput(task,1,coutput1);
928  mgr->ConnectOutput(task,2,coutput2);
929  mgr->ConnectOutput(task,3,coutput3);
930  mgr->ConnectOutput(task,4,coutput4);
931  mgr->ConnectOutput(task,5,coutput5);
932 
933  return task;
934 
935 }
936 
const Float_t multmax_20_50
const Double_t dcamax
const Float_t multmin_80_100
void SetWeightFunction(TF1 *func)
const Double_t etamax
void SetRejectCandidateIfNotFromQuark(Bool_t opt)
double Double_t
Definition: External.C:58
void SetMultiplVsZProfileLHC10e(TProfile *hprof)
const Double_t cosmin
const Double_t ptmin
const Double_t etamin
void SetCFManager(AliCFManager *io)
CORRECTION FRAMEWORK RELATED FUNCTIONS.
const Double_t phimin
const Float_t cosminXY
void SetDecayChannel(Int_t decayChannel)
TSystem * gSystem
char Char_t
Definition: External.C:18
void SetFillFromGenerated(Bool_t flag)
get corr manager
void SetUseNchTrackletsWeight(Bool_t useWeight=kTRUE)
const Double_t d0xd0min
void SetUseMCVertex(Bool_t opt)
super fast configuration, only (pt,y,centrality)
const Float_t normDecLXYmin
const Float_t normDecLXYmax
const Float_t centmin_60_100
const Float_t multmin_0_20
const Double_t cTmax
const Int_t charge
const Double_t ymin
const Double_t ymax
const Int_t minITSClusters
int Int_t
Definition: External.C:63
const Int_t mintrackrefsTPC
void SetMeasuredNchHisto(TH1F *h)
void SetIsPPData(Bool_t flag)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void SetIsPPbData(Bool_t flag)
const Float_t multmax_50_80
void SetCentralitySelection(Bool_t centSelec=kTRUE)
const Double_t ptmax
const Double_t cosmaxTS
const Float_t fakemin
const Float_t multmin_100_400
const Double_t cosmax
const Float_t fakemax
const Double_t dcamin
const Int_t mintrackrefsITS
const Float_t centmax_0_10
const Float_t centmax
const Double_t zmax
const Float_t cosmaxXY
void SetReferenceMultiplcity(Double_t rmu)
void SetUseWeight(Bool_t useWeight)
void SetUseZvtxCorrectedNtrkEstimator(Bool_t flag)
const Int_t minclustersTPC
Bool_t useWeight
Definition: anaTree.C:26
const Float_t multmin_50_80
const Double_t zmin
void SetConfiguration(Int_t configuration)
void SetDselection(UShort_t originDselection)
const Double_t cTmin
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:248
const Float_t multmax_0_20
void SetUseNchWeight(Bool_t useWeight)
void SetUseFlatPtWeight(Bool_t useWeight)
void SetCorrelationMatrix(THnSparse *h)
UNFOLDING.
void SetMultiplVsZProfileLHC10b(TProfile *hprof)
const Double_t cosminTS
void SetMultiplVsZProfileLHC10d(TProfile *hprof)
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:249
void SetSign(Char_t isSign)
Bool_t GetUseNchWeight() const
const Float_t multmax_80_100
Bool_t GetUseWeight() const
bool Bool_t
Definition: External.C:53
const Double_t d0xd0max
const Float_t centmax_10_60
void SetMultiplicityEstimator(Int_t value)
slow configuration, all variables
void SetMultiplVsZProfileLHC13b(TProfile *hprof)
Bool_t GetFillFromGenerated() const
void SetMultiplVsZProfileLHC13c(TProfile *hprof)
const Float_t multmin_20_50
const Float_t multmax_100_400
AliCFTaskVertexingHF * AddTaskCFVertexingHF(const char *cutFile="./D0toKpiCuts.root", TString cutObjectName="D0toKpiCutsStandard", TString suffix="", Int_t configuration=AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode=421, Char_t isSign=2, Bool_t useWeight=kFALSE, Bool_t useFlatPtWeight=kFALSE, Bool_t useZWeight=kFALSE, Bool_t useNchWeight=kFALSE, Bool_t useNtrkWeight=kFALSE, Bool_t isFinePtBin=kFALSE, TString estimatorFilename="", Int_t multiplicityEstimator=AliCFTaskVertexingHF::kNtrk10, Bool_t isPPData=kFALSE, Bool_t isPPbData=kFALSE, Double_t refMult=9.26, Bool_t isFineNtrkBin=kFALSE)
void SetFakeSelection(Int_t fakeSel=0)
const Float_t centmin_0_10
const Float_t centmin_10_60
void SetUseZWeight(Bool_t useWeight)
fast configuration, only a subset of variables
const Float_t centmax_60_100
void SetMultiplVsZProfileLHC10c(TProfile *hprof)