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