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