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