AliPhysics  master (3d17d9d)
AddTaskCFVertexingHFLctoV0bachelorTMVA_PbPb.C
Go to the documentation of this file.
1 
2 //----------------------------------------------------
3 
4 AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelorTMVA_PbPb(Bool_t isCent = kFALSE, const char* cutFile = "CutsLc2pK0STMVA_20140311.root",
5  TString cutObjectName = "LctoV0AnalysisCuts",
6  TString suffix = "TMVA",
8  Bool_t rejectIfNotFromQuark = kTRUE,
9  Bool_t isKeepDfromB = kTRUE,
10  Bool_t isKeepDfromBOnly = kFALSE,
11  Float_t cutOnMomConservation = 1000.,
12  Int_t pdgCode = 4122,
13  Char_t isSign = 2,
14  Bool_t useWeight = kFALSE,
15  Bool_t useFlatPtWeight = kFALSE,
16  Bool_t useZWeight = kFALSE,
17  const char* weightHistoName = "")
18 {
19 const Double_t ymin = -1.2 ;
20 const Double_t ymax = 1.2 ;
21 const Double_t cosminTS = -1.05;
22 const Double_t cosmaxTS = 1.05;
23 const Double_t cosmin = 0.7;
24 const Double_t cosmax = 1.02;
25 const Double_t cTmin = 0; // micron
26 const Double_t cTmax = 300000; // micron
27 const Double_t dcamin = 0; // micron
28 const Double_t dcamax = 600; // micron
29 const Double_t d0xd0min = -80000; // micron
30 const Double_t d0xd0max = 100000; // micron
31 const Double_t phimin = 0.0;
32 const Int_t mintrackrefsTPC = 2 ;
33 const Int_t mintrackrefsITS = 3 ;
34 const Int_t charge = 1 ;
35 const Int_t minclustersTPC = 50 ;
36 // cuts
37 const Double_t ptmin = 0.1;
38 const Double_t ptmax = 9999.;
39 const Double_t etamin = -0.9;
40 const Double_t etamax = 0.9;
41 const Double_t zmin = -15;
42 const Double_t zmax = 15;
43 const Int_t minITSClusters = 5;
44 
45 const Float_t centmin_0_10 = 0.;
46 const Float_t centmax_0_10 = 10.;
47 const Float_t centmin_10_60 = 10.;
48 const Float_t centmax_10_60 = 60.;
49 const Float_t centmin_60_100 = 60.;
50 const Float_t centmax_60_100 = 100.;
51 const Float_t centmax = 100.;
52 const Float_t fakemin = -0.5;
53 const Float_t fakemax = 2.5;
54 const Float_t cosminXY = 0.95;
55 const Float_t cosmaxXY = 1.0;
56 const Float_t normDecLXYmin = 0;
57 const Float_t normDecLXYmax = 20;
58 
59  printf("Adding CF task using cuts from file %s\n",cutFile);
60  if (configuration == AliCFTaskVertexingHF::kSnail){
61  printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
62  }
63  else if (configuration == AliCFTaskVertexingHF::kCheetah){
64  printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
65  }
66  else if (configuration == AliCFTaskVertexingHF::kFalcon){
67  printf("The configuration is set to be FAST --> using only pt, y, centrality, multiplicity to fill the CF\n");
68  }
69  else{
70  printf("The configuration is not defined! returning\n");
71  return NULL;
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  Printf("ERROR:Error setting PDG code (%d) and sign (0 --> D* only): they are not compatible, returning",pdgCode);
83  return 0x0;
84  }
85  else if (isSign == 1 && pdgCode > 0){
86  Printf("ERROR:Error setting PDG code (%d) and sign (1 --> D*bar only): they are not compatible, returning",pdgCode);
87  return 0x0;
88  }
89  else if (isSign > 2 || isSign < 0){
90  Printf("ERROR:Sign not valid (%d, possible values are 0, 1, 2), returning",isSign);
91  return 0x0;
92  }
93 
94  TFile* fileCuts = TFile::Open(cutFile);
95  if(!fileCuts || (fileCuts && !fileCuts->IsOpen())){
96  Printf("ERROR: Wrong cut file");
97  return 0x0;
98  }
99 
100  AliRDHFCutsLctoV0 *cutsLcTMVA = (AliRDHFCutsLctoV0*)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  //CONTAINER DEFINITION
125  Info("AliCFTaskVertexingHF","SETUP CONTAINER");
126  const Double_t phimax = 2*TMath::Pi();
127  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
128 
129  //const UInt_t ipT, iy, icosThetaStar, ipTpi, ipTk, icT, idca, id0xd0, ipointing, iphi, izvtx, icent, ifake, ipointingXY, iNormDecayLXY, imult;
130  const Int_t nbiny = 24 ; //bins in y
131  const Int_t nbincosThetaStar = 42 ; //bins in cosThetaStar
132  const Int_t nbincT = 15 ; //bins in cT
133  const Int_t nbindca = 20 ; //bins in dca
134  const Int_t nbind0xd0 = 90 ; //bins in d0xd0
135  const Int_t nbinpointing = 50 ; //bins in cosPointingAngle
136  const Int_t nbinphi = 18 ; //bins in Phi
137  const Int_t nbinzvtx = 30 ; //bins in z vertex
138  const Int_t nbincent = 28; //bins in centrality
139  const Int_t nbincent_0_10 = 4; //bins in centrality between 0 and 10
140  const Int_t nbincent_10_60 = 20; //bins in centrality between 10 and 60
141  const Int_t nbincent_60_100 = 4; //bins in centrality between 60 and 100
142  const Int_t nbinfake = 3; //bins in fake
143  const Int_t nbinpointingXY = 50; //bins in cosPointingAngleXY
144  const Int_t nbinnormDecayLXY = 20; //bins in NormDecayLengthXY
145  const Int_t nbinmult = 21; //bins in NormDecayLengthXY
146 
147  //the sensitive variables, their indices
148 
149  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
150 
151  // variables' indices
152  const UInt_t ipT = 0;
153  const UInt_t iy = 1;
154  const UInt_t icosThetaStar = 2;
155  const UInt_t ipTpi = 3;
156  const UInt_t ipTk = 4;
157  const UInt_t icT = 5;
158  const UInt_t idca = 6;
159  const UInt_t id0xd0 = 7;
160  const UInt_t ipointing = 8;
161  const UInt_t iphi = 9;
162  const UInt_t izvtx = 10;
163  const UInt_t icent = 11;
164  const UInt_t ifake = 12;
165  const UInt_t ipointingXY = 13;
166  const UInt_t inormDecayLXY = 14;
167  const UInt_t imult = 15;
168 
169  //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
170 
171  //arrays for the number of bins in each dimension
172  Int_t iBin[nvarTot];
173 
174  const Int_t nbinpt = cutsLcTMVA->GetNPtBins(); // bins in pT
175  iBin[ipT] = nbinpt;
176  iBin[ipTpi] = nbinpt;
177  iBin[ipTk] = nbinpt;
178  Double_t *binLimpT = new Double_t[iBin[ipT]+1];
179  Double_t *binLimpTpi = new Double_t[iBin[ipTpi]+1];
180  Double_t *binLimpTk = new Double_t[iBin[ipTk]+1];
181  // values for bin lower bounds
182  Float_t* floatbinLimpT = cutsLcTMVA->GetPtBinLimits();
183  for (Int_t ibin0 = 0 ; ibin0<iBin[ipT]+1; ibin0++){
184  binLimpT[ibin0] = (Double_t)floatbinLimpT[ibin0];
185  binLimpTpi[ibin0] = (Double_t)floatbinLimpT[ibin0];
186  binLimpTk[ibin0] = (Double_t)floatbinLimpT[ibin0];
187  }
188  for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
189 
190  printf("pT: nbin (from cuts file) = %d\n",nbinpt);
191 
192  // defining now the binning for the other variables:
193 
194  AliLog::SetClassDebugLevel("AliCFManager",AliLog::kInfo);
195 
196  iBin[iy] = nbiny;
197  iBin[icosThetaStar] = nbincosThetaStar;
198  iBin[icT] = nbincT;
199  iBin[idca] = nbindca;
200  iBin[id0xd0] = nbind0xd0;
201  iBin[ipointing] = nbinpointing;
202  iBin[iphi] = nbinphi;
203  iBin[izvtx] = nbinzvtx;
204  iBin[icent] = nbincent;
205  iBin[ifake] = nbinfake;
206  iBin[ipointingXY] = nbinpointingXY;
207  iBin[inormDecayLXY] = nbinnormDecayLXY;
208  iBin[imult] = nbinmult;
209 
210  //arrays for lower bounds :
211  Double_t *binLimy = new Double_t[iBin[iy]+1];
212  Double_t *binLimcosThetaStar = new Double_t[iBin[icosThetaStar]+1];
213  Double_t *binLimcT = new Double_t[iBin[icT]+1];
214  Double_t *binLimdca = new Double_t[iBin[idca]+1];
215  Double_t *binLimd0xd0 = new Double_t[iBin[id0xd0]+1];
216  Double_t *binLimpointing = new Double_t[iBin[ipointing]+1];
217  Double_t *binLimphi = new Double_t[iBin[iphi]+1];
218  Double_t *binLimzvtx = new Double_t[iBin[izvtx]+1];
219  Double_t *binLimcent = new Double_t[iBin[icent]+1];
220  Double_t *binLimfake = new Double_t[iBin[ifake]+1];
221  Double_t *binLimpointingXY = new Double_t[iBin[ipointingXY]+1];
222  Double_t *binLimnormDecayLXY = new Double_t[iBin[inormDecayLXY]+1];
223  Double_t *binLimmult = new Double_t[iBin[imult]+1];
224 
225  // muliplicity
226  for (Int_t i = 0; i <= 8; i++) binLimmult[i] = 300 + i*100;
227  for (Int_t i = 9; i <= 18; i++) binLimmult[i] = binLimmult[8] + (i-8)*100;
228  for (Int_t i = 19; i <= 21; i++) binLimmult[i] = binLimmult[18] + (i-18)*500;
229  if (isCent) {
230  for (Int_t i = 0; i <= 18; i++) binLimmult[i] = 2000 + i*200;
231  for (Int_t i = 19; i <= 21; i++) binLimmult[i] = binLimmult[18] + (i-18)*500;
232  }
233 
234  for (Int_t i = 0; i < iBin[imult]+1; i++){ Printf("binLimmult[%d] = %f", i, binLimmult[i]);}
235  // y
236  for(Int_t i=0; i<=nbiny; i++) binLimy[i] = (Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
237 
238  // cosThetaStar
239  for(Int_t i=0; i<=nbincosThetaStar; i++) binLimcosThetaStar[i] = (Double_t)cosminTS + (cosmaxTS-cosminTS) /nbincosThetaStar*(Double_t)i ;
240 
241  // cT
242  for(Int_t i=0; i<=nbincT; i++) binLimcT[i] = (Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
243 
244  // dca
245  for(Int_t i=0; i<=nbindca; i++) binLimdca[i] = (Double_t)dcamin + (dcamax-dcamin) /nbindca*(Double_t)i ;
246 
247  // d0xd0
248  for(Int_t i=0; i<=nbind0xd0; i++) binLimd0xd0[i] = (Double_t)d0xd0min + (d0xd0max-d0xd0min) /nbind0xd0*(Double_t)i ;
249 
250  // cosPointingAngle
251  for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i] = (Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
252 
253  // Phi
254  for(Int_t i=0; i<=nbinphi; i++) binLimphi[i] = (Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
255 
256  // z Primary Vertex
257  for(Int_t i=0; i<=nbinzvtx; i++) {
258  binLimzvtx[i] = (Double_t)zmin + (zmax-zmin) /nbinzvtx*(Double_t)i ;
259  }
260 
261  // centrality
262  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 ;
263  if (binLimcent[nbincent_0_10] != centmin_10_60) {
264  Printf("Error: Calculated bin lim for cent - 1st range - differs from expected!\n");
265  }
266  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 ;
267  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
268  Printf("Error: Calculated bin lim for cent - 2st range - differs from expected!\n");
269  }
270  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 ;
271 
272  // fake
273  for(Int_t i=0; i<=nbinfake; i++) {
274  binLimfake[i] = (Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
275  }
276 
277  // cosPointingAngleXY
278  for(Int_t i=0; i<=nbinpointingXY; i++) binLimpointingXY[i] = (Double_t)cosminXY + (cosmaxXY-cosminXY) /nbinpointingXY*(Double_t)i ;
279 
280  // normDecayLXY
281  for(Int_t i=0; i<=nbinnormDecayLXY; i++) binLimnormDecayLXY[i] = (Double_t)normDecLXYmin + (normDecLXYmax-normDecLXYmin) /nbinnormDecayLXY*(Double_t)i ;
282 
283  //one "container" for MC
284  TString nameContainer="";
285  if(!isKeepDfromB) {
286  nameContainer = "CFHFccontainer0";
287  }
288  else if(isKeepDfromBOnly){
289  nameContainer = "CFHFccontainer0DfromB";
290  }
291  else {
292  nameContainer = "CFHFccontainer0allD";
293  }
294  nameContainer += suffix;
295  //Setting up the container grid...
296 
297  AliCFContainer* container;
298 
299  if (configuration == AliCFTaskVertexingHF::kSnail){
300  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
301  //setting the bin limits
302  printf("pt\n");
303  container -> SetBinLimits(ipT, binLimpT);
304  printf("y\n");
305  container -> SetBinLimits(iy, binLimy);
306  printf("cts\n");
307  container -> SetBinLimits(icosThetaStar, binLimcosThetaStar);
308  printf("ptPi\n");
309  container -> SetBinLimits(ipTpi, binLimpTpi);
310  printf("ptK\n");
311  container -> SetBinLimits(ipTk, binLimpTk);
312  printf("cT\n");
313  container -> SetBinLimits(icT, binLimcT);
314  printf("dca\n");
315  container -> SetBinLimits(idca, binLimdca);
316  printf("d0xd0\n");
317  container -> SetBinLimits(id0xd0, binLimd0xd0);
318  printf("pointing\n");
319  container -> SetBinLimits(ipointing, binLimpointing);
320  printf("phi\n");
321  container -> SetBinLimits(iphi, binLimphi);
322  printf("z\n");
323  container -> SetBinLimits(izvtx, binLimzvtx);
324  printf("cent\n");
325  container -> SetBinLimits(icent, binLimcent);
326  printf("fake\n");
327  container -> SetBinLimits(ifake, binLimfake);
328  printf("pointingXY\n");
329  container -> SetBinLimits(ipointingXY, binLimpointingXY);
330  printf("normDecayLXY\n");
331  container -> SetBinLimits(inormDecayLXY, binLimnormDecayLXY);
332  printf("multiplicity\n");
333 
334  container -> SetVarTitle(ipT,"pt");
335  container -> SetVarTitle(iy,"y");
336  container -> SetVarTitle(icosThetaStar, "cosThetaStar");
337  container -> SetVarTitle(ipTpi, "ptpi");
338  container -> SetVarTitle(ipTk, "ptK");
339  container -> SetVarTitle(icT, "ct");
340  container -> SetVarTitle(idca, "dca");
341  container -> SetVarTitle(id0xd0, "d0xd0");
342  container -> SetVarTitle(ipointing, "pointing");
343  container -> SetVarTitle(iphi, "phi");
344  container -> SetVarTitle(izvtx, "zvtx");
345  container -> SetVarTitle(icent, "centrality");
346  container -> SetVarTitle(ifake, "fake");
347  container -> SetVarTitle(ipointingXY, "piointingXY");
348  container -> SetVarTitle(inormDecayLXY, "normDecayLXY");
349  container -> SetVarTitle(imult, "multiplicity");
350  }
351  else if (configuration == AliCFTaskVertexingHF::kCheetah){
352  //arrays for the number of bins in each dimension
353  const Int_t nvar = 8;
354 
355  const UInt_t ipTFast = 0;
356  const UInt_t iyFast = 1;
357  const UInt_t icTFast = 2;
358  const UInt_t iphiFast = 3;
359  const UInt_t izvtxFast = 4;
360  const UInt_t icentFast = 5;
361  const UInt_t ifakeFast = 6;
362  const UInt_t imultFast = 7;
363 
364  Int_t iBinFast[nvar];
365  iBinFast[ipTFast] = iBin[ipT];
366  iBinFast[iyFast] = iBin[iy];
367  iBinFast[icTFast] = iBin[icT];
368  iBinFast[iphiFast] = iBin[iphi];
369  iBinFast[izvtxFast] = iBin[izvtx];
370  iBinFast[icentFast] = iBin[icent];
371  iBinFast[ifakeFast] = iBin[ifake];
372  iBinFast[imultFast] = iBin[imult];
373 
374  container = new AliCFContainer(nameContainer,"container for tracks", nstep, nvar, iBinFast);
375  printf("pt\n");
376  container -> SetBinLimits(ipTFast, binLimpT);
377  printf("y\n");
378  container -> SetBinLimits(iyFast, binLimy);
379  printf("ct\n");
380  container -> SetBinLimits(icTFast, binLimcT);
381  printf("phi\n");
382  container -> SetBinLimits(iphiFast, binLimphi);
383  printf("zvtx\n");
384  container -> SetBinLimits(izvtxFast, binLimzvtx);
385  printf("centrality\n");
386  container -> SetBinLimits(icentFast, binLimcent);
387  printf("fake\n");
388  container -> SetBinLimits(ifakeFast, binLimfake);
389  printf("multiplicity\n");
390 
391  container -> SetVarTitle(ipTFast, "pt");
392  container -> SetVarTitle(iyFast, "y");
393  container -> SetVarTitle(icTFast, "ct");
394  container -> SetVarTitle(iphiFast, "phi");
395  container -> SetVarTitle(izvtxFast, "zvtx");
396  container -> SetVarTitle(icentFast, "centrality");
397  container -> SetVarTitle(ifakeFast, "fake");
398  container -> SetVarTitle(imultFast, "multiplicity");
399  }
400  else if (configuration == AliCFTaskVertexingHF::kFalcon){
401  //arrays for the number of bins in each dimension
402  const Int_t nvar = 4;
403 
404  const UInt_t ipTSuperFast = 0;
405  const UInt_t iySuperFast = 1;
406  const UInt_t icentSuperFast = 2;
407  const UInt_t imultSuperFast = 3;
408 
409  Int_t iBinSuperFast[nvar];
410  iBinSuperFast[ipTSuperFast] = iBin[ipT];
411  iBinSuperFast[iySuperFast] = iBin[iy];
412  iBinSuperFast[icentSuperFast] = iBin[icent];
413  iBinSuperFast[imultSuperFast] = iBin[imult];
414 
415  container = new AliCFContainer(nameContainer,"container for tracks", nstep, nvar, iBinSuperFast);
416  printf("pt\n");
417  container -> SetBinLimits(ipTSuperFast, binLimpT);
418  printf("y\n");
419  container -> SetBinLimits(iySuperFast, binLimy);
420  printf("centrality\n");
421  container -> SetBinLimits(icentSuperFast, binLimcent);
422  printf("multiplicity\n");
423 
424  container -> SetVarTitle(ipTSuperFast, "pt");
425  container -> SetVarTitle(iySuperFast, "y");
426  container -> SetVarTitle(icentSuperFast, "centrality");
427  container -> SetVarTitle(imultSuperFast, "multiplicity");
428  }
429 
430  container -> SetStepTitle(0, "MCLimAcc");
431  container -> SetStepTitle(1, "MC");
432  container -> SetStepTitle(2, "MCAcc");
433  container -> SetStepTitle(3, "RecoVertex");
434  container -> SetStepTitle(4, "RecoRefit");
435  container -> SetStepTitle(5, "Reco");
436  container -> SetStepTitle(6, "RecoAcc");
437  container -> SetStepTitle(7, "RecoITSCluster");
438  container -> SetStepTitle(8, "RecoCuts");
439  container -> SetStepTitle(9, "RecoPID");
440 
441  //return container;
442 
443  //CREATE THE CUTS -----------------------------------------------
444 
445  // Gen-Level kinematic cuts
446  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
447 
448  //Particle-Level cuts:
449  AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
450  Bool_t useAbsolute = kTRUE;
451  if (isSign != 2){
452  useAbsolute = kFALSE;
453  }
454  mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include D0_bar
455  mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
456 
457  // Acceptance cuts:
458  AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
459  AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
460  kineAccCuts->SetPtRange(ptmin, ptmax);
461  kineAccCuts->SetEtaRange(etamin, etamax);
462 
463  // Rec-Level kinematic cuts
464  AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts", "rec-level kine cuts");
465 
466  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts", "rec-level quality cuts");
467 
468  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts", "rec-level isPrimary cuts");
469 
470  printf("CREATE MC KINE CUTS\n");
471  TObjArray* mcList = new TObjArray(0) ;
472  mcList->AddLast(mcKineCuts);
473  mcList->AddLast(mcGenCuts);
474 
475  printf("CREATE ACCEPTANCE CUTS\n");
476  TObjArray* accList = new TObjArray(0) ;
477  accList->AddLast(kineAccCuts);
478 
479  printf("CREATE RECONSTRUCTION CUTS\n");
480  TObjArray* recList = new TObjArray(0) ; // not used!!
481  recList->AddLast(recKineCuts);
482  recList->AddLast(recQualityCuts);
483  recList->AddLast(recIsPrimaryCuts);
484 
485  TObjArray* emptyList = new TObjArray(0);
486 
487  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
488  printf("CREATE INTERFACE AND CUTS\n");
489  AliCFManager* man = new AliCFManager() ;
490  man->SetParticleContainer(container);
491  man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
492  man->SetParticleCutsList(1 , mcList); // MC
493  man->SetParticleCutsList(2 , accList); // Acceptance
494  man->SetParticleCutsList(3 , emptyList); // Vertex
495  man->SetParticleCutsList(4 , emptyList); // Refit
496  man->SetParticleCutsList(5 , emptyList); // AOD
497  man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
498  man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
499  man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
500  man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
501 
502  // Get the pointer to the existing analysis manager via the static access method.
503  //==============================================================================
504  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
505  if (!mgr) {
506  ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
507  return NULL;
508  }
509  //CREATE THE TASK
510  printf("CREATE TASK\n");
511 
512  // create the task
513  AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF", cutsLcTMVA);
514  task->SetConfiguration(configuration);
515  task->SetFillFromGenerated(kFALSE);
516  task->SetCFManager(man); //here is set the CF manager
517  task->SetDecayChannel(22);
519  task->SetUseAdditionalCuts(kFALSE);
520  task->SetUseCutsForTMVA(kFALSE);
521  task->SetUseFlatPtWeight(useFlatPtWeight);
522  task->SetUseWeight(useWeight);
523  task->SetUseZWeight(useZWeight);
524  task->SetCutOnMomConservation(cutOnMomConservation);
525  Printf("CutOn mom = %f", cutOnMomConservation);
526  task->SetSign(isSign);
527  task->SetCentralitySelection(kFALSE);
528  task->SetFakeSelection(0);
529  task->SetRejectCandidateIfNotFromQuark(rejectIfNotFromQuark); // put to false if you want to keep HIJING D0!!
530  task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
531  //task->SetPtWeightsFromDataPbPb276overLHC12a17a();
532 
533  if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
534  if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
535 
536  TF1* funcWeight = 0x0;
537  if (task->GetUseWeight()) {
538  funcWeight = (TF1*)fileCuts->Get("funcWeight");
539  if (funcWeight == 0x0){
540  Printf("FONLL Weights will be used");
541  }
542  else {
543  task->SetWeightFunction(funcWeight);
544  Printf("User-defined Weights will be used. The function being:");
545  task->GetWeightFunction()->Print();
546  }
547  }
548 
549  if (useWeight){
550  TH1F *fHistoPtWeight_010_1 = (TH1F*)fileCuts->Get("fHistoPtWeight_010_1");
551  TH1F *fHistoPtWeight_010_2 = (TH1F*)fileCuts->Get("fHistoPtWeight_010_2");
552  TH1F *fHistoPtWeight_3050_1 = (TH1F*)fileCuts->Get("fHistoPtWeight_3050_1");
553  TH1F *fHistoPtWeight_3050_2 = (TH1F*)fileCuts->Get("fHistoPtWeight_3050_2");
554  if(!fHistoPtWeight_010_1) {
555  Printf("FATAL: Histogram for pt weights not found");
556  return 0x0;
557  }
558  if(!fHistoPtWeight_010_2) {
559  Printf("FATAL: Histogram for pt weights not found");
560  return 0x0;
561  }
562  if(!fHistoPtWeight_3050_1) {
563  Printf("FATAL: Histogram for pt weights not found");
564  return 0x0;
565  }
566  if(!fHistoPtWeight_3050_2) {
567  Printf("FATAL: Histogram for pt weights not found");
568  return 0x0;
569  }
570  TH1F* weightHisto = (TH1F*)fileCuts->Get(weightHistoName);
571  task->SetWeightHistogram(weightHisto);
572  }
573 
574 
575 
576  Printf("***************** TASK SETTINGS *****************");
577  Printf("UseCascadeTask = %d", (Int_t)task->GetUseCascadeTaskForLctoV0bachelor());
578  Printf("decay channel = %d", (Int_t)task->GetDecayChannel());
579  Printf("configuration = %d", task->GetConfiguration());
580  Printf("cut on momentum conservation = %f", task->GetCutOnMomConservation());
581  Printf("Running for central (for binning in multiplicity) = %d", (Int_t)isCent);
582  Printf("FillFromGenerated = %d", (Int_t)task->GetFillFromGenerated());
583  Printf("RejectCandidateIfNotFromQuark selection = %d", (Int_t)task->GetRejectCandidateIfNotFromQuark());
584  Printf("Dselection = %d", (Int_t)task->GetDselection());
585  Printf("UseWeight = %d", (Int_t)task->GetUseWeight());
586  if (task->GetUseWeight()) {
587  if(funcWeight) Printf("User-defined Weight function");
588  else Printf("FONLL will be used for the weights");
589  }
590  Printf("Use Nch weight = %d", (Int_t)task->GetUseNchWeight());
591  Printf("Sign = %d", (Int_t)task->GetSign());
592  Printf("Centrality selection = %d", (Int_t)task->GetCentralitySelection());
593  Printf("Fake selection = %d", (Int_t)task->GetFakeSelection());
594  Printf("UseMCVertex selection = %d", (Int_t)task->GetUseMCVertex());
595  Printf("***************END CONTAINER SETTINGS *****************\n");
596 
597 
598  //-----------------------------------------------------------//
599  // create correlation matrix for unfolding - only eta-pt //
600  //-----------------------------------------------------------//
601 
602  Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
603 
604  Int_t thnDim[4];
605 
606  //first half : reconstructed
607  //second half : MC
608 
609  thnDim[0] = iBin[0];
610  thnDim[2] = iBin[0];
611  thnDim[1] = iBin[1];
612  thnDim[3] = iBin[1];
613 
614  TString nameCorr="";
615  if(!isKeepDfromB) {
616  nameCorr="CFHFcorr0";
617  }
618  else if(isKeepDfromBOnly){
619  nameCorr= "CFHFcorr0KeepDfromBOnly";
620  }
621  else {
622  nameCorr="CFHFcorr0allD";
623 
624  }
625  nameCorr += suffix;
626 
627  THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
628  Double_t** binEdges = new Double_t*[2];
629 
630  // set bin limits
631 
632  binEdges[0]= binLimpT;
633  binEdges[1]= binLimy;
634 
635  correlation->SetBinEdges(0,binEdges[0]);
636  correlation->SetBinEdges(2,binEdges[0]);
637 
638  correlation->SetBinEdges(1,binEdges[1]);
639  correlation->SetBinEdges(3,binEdges[1]);
640 
641  correlation->Sumw2();
642 
643  // correlation matrix ready
644  //------------------------------------------------//
645 
646  task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
647 
648  // Create and connect containers for input/output
649 
650  // ------ input data ------
651  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
652 
653  // ----- output data -----
654 
655  TString outputfile = AliAnalysisManager::GetCommonFileName();
656  TString output1name="", output2name="", output3name="",output4name="", output5name="";
657  output2name=nameContainer;
658  output3name=nameCorr;
659  output4name= "Cuts";
660  output5name= "coutProfDst";
661  if(!isKeepDfromB) {
662  outputfile += ":PWG3_D2H_CFtaskLctoK0SpCascade";
663  output1name="CFHFchist0";
664  output3name+="_cOnly";
665  output4name+="_cOnly";
666  output5name+="_cOnly";
667  }
668  else if(isKeepDfromBOnly){
669  outputfile += ":PWG3_D2H_CFtaskLctoK0SpCascadeKeepDfromBOnly";
670  output1name="CFHFchist0DfromB";
671  output3name+="_bOnly";
672  output4name+="_bOnly";
673  output5name+="_bOnly";
674  }
675  else{
676  outputfile += ":PWG3_D2H_CFtaskLctoK0SpCascadeKeepDfromB";
677  output1name="CFHFchist0allD";
678  output3name+="_all";
679  output4name+="_all";
680  output5name+="_all";
681  }
682 
683  outputfile += suffix;
684  output1name += suffix;
685  output4name += suffix;
686  output5name += suffix;
687 
688  //now comes user's output objects :
689  // output TH1I for event counting
690  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
691  // output Correction Framework Container (for acceptance & efficiency calculations)
692  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
693  // Unfolding - correlation matrix
694  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
695  // cuts
696  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
697  // estimators list
698  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
699 
700  mgr->AddTask(task);
701 
702  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
703  mgr->ConnectOutput(task,1,coutput1);
704  mgr->ConnectOutput(task,2,coutput2);
705  mgr->ConnectOutput(task,3,coutput3);
706  mgr->ConnectOutput(task,4,coutput4);
707  mgr->ConnectOutput(task,5,coutput5);
708  return task;
709 
710 }
Int_t charge
const Double_t d0xd0min
const Double_t dcamin
void SetCutOnMomConservation(Float_t cut)
void SetWeightFunction(TF1 *func)
void SetRejectCandidateIfNotFromQuark(Bool_t opt)
const Double_t ymax
Definition: AddTaskCFDStar.C:7
double Double_t
Definition: External.C:58
void SetCFManager(AliCFManager *io)
CORRECTION FRAMEWORK RELATED FUNCTIONS.
const Float_t fakemax
const Double_t cTmax
void SetDecayChannel(Int_t decayChannel)
TSystem * gSystem
char Char_t
Definition: External.C:18
const Int_t mintrackrefsITS
void SetFillFromGenerated(Bool_t flag)
get corr manager
const Double_t cosmaxTS
AliCFTaskVertexingHF * AddTaskCFVertexingHFLctoV0bachelorTMVA_PbPb(Bool_t isCent=kFALSE, const char *cutFile="CutsLc2pK0STMVA_20140311.root", TString cutObjectName="LctoV0AnalysisCuts", TString suffix="TMVA", Int_t configuration=AliCFTaskVertexingHF::kCheetah, Bool_t rejectIfNotFromQuark=kTRUE, Bool_t isKeepDfromB=kTRUE, Bool_t isKeepDfromBOnly=kFALSE, Float_t cutOnMomConservation=1000., Int_t pdgCode=4122, Char_t isSign=2, Bool_t useWeight=kFALSE, Bool_t useFlatPtWeight=kFALSE, Bool_t useZWeight=kFALSE, const char *weightHistoName="")
void SetUseMCVertex(Bool_t opt)
void SetUseAdditionalCuts(Bool_t flag)
const Float_t centmin_10_60
const Double_t d0xd0max
const Int_t minITSClusters
const Double_t cosmax
const Float_t centmin_0_10
const Int_t mintrackrefsTPC
const Double_t etamin
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
const Float_t normDecLXYmax
const Int_t minclustersTPC
float Float_t
Definition: External.C:68
const Double_t ptmax
const Double_t dcamax
const Float_t cosmaxXY
const Float_t normDecLXYmin
const Double_t zmin
const Float_t fakemin
void SetCentralitySelection(Bool_t centSelec=kTRUE)
const Float_t centmax
const Double_t ptmin
Int_t GetConfiguration() const
const Double_t cosmin
const Float_t centmax_60_100
void SetWeightHistogram(TH1F *histo)
void SetUseCutsForTMVA(Bool_t useCutsForTMVA)
const Float_t cosminXY
void SetUseWeight(Bool_t useWeight)
Bool_t useWeight
Definition: anaTree.C:26
fast configuration, only a subset of variables
void SetConfiguration(Int_t configuration)
void SetDselection(UShort_t originDselection)
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:265
const Double_t etamax
const Double_t cosminTS
const Float_t centmax_0_10
TF1 * GetWeightFunction() const
void SetUseFlatPtWeight(Bool_t useWeight)
const Double_t ymin
Definition: AddTaskCFDStar.C:6
void SetCorrelationMatrix(THnSparse *h)
UNFOLDING.
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:266
void SetSign(Char_t isSign)
const Float_t centmin_60_100
Bool_t GetUseNchWeight() const
const Double_t zmax
const Double_t cTmin
Bool_t GetUseWeight() const
bool Bool_t
Definition: External.C:53
Float_t GetCutOnMomConservation() const
Bool_t GetUseCascadeTaskForLctoV0bachelor() const
Bool_t GetFillFromGenerated() const
slow configuration, all variables
void SetFakeSelection(Int_t fakeSel=0)
void SetUseCascadeTaskForLctoV0bachelor(Bool_t useCascadeTaskForLctoV0bachelor)
void SetUseZWeight(Bool_t useWeight)
const Float_t centmax_10_60
const Double_t phimin