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