AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskCFVertexingHF3ProngDs.C
Go to the documentation of this file.
1 //DEFINITION OF A FEW CONSTANTS
2 const Double_t ymin = -1.2 ;
3 const Double_t ymax = 1.2 ;
4 const Double_t cosmin = -0.7;
5 const Double_t cosmax = 1.05;
6 const Double_t cTmin = 0; // micron
7 const Double_t cTmax = 500; // micron
8 const Double_t phimin = 0.0;
9 const Int_t mintrackrefsTPC = 2 ;
11 const Int_t charge = 1 ;
12 const Int_t minclustersTPC = 50 ;
13 // cuts
14 const Double_t ptmin = 0.1;
15 const Double_t ptmax = 9999.;
16 const Double_t etamin = -0.9;
17 const Double_t etamax = 0.9;
18 const Double_t zvtxmin = -15;
19 const Double_t zvtxmax = 15;
21 
22 const Float_t centmin_0_10 = 0.;
23 const Float_t centmax_0_10 = 10.;
24 const Float_t centmin_10_60 = 10.;
25 const Float_t centmax_10_60 = 60.;
26 const Float_t centmin_60_100 = 60.;
27 const Float_t centmax_60_100 = 100.;
28 const Float_t centmax = 100.;
29 const Float_t fakemin = -0.5;
30 const Float_t fakemax = 2.5.;
31 const Float_t cosminXY = 0.90;
32 const Float_t cosmaxXY = 1.0;
36 const Float_t multmax_0_20 = 20;
40 const Float_t multmax_50_102 = 102;
41 
42 
43 //----------------------------------------------------
44 
45 AliCFTaskVertexingHF *AddTaskCFVertexingHF3ProngDs(TString suffixName="", Int_t decayOption=AliCFVertexingHF3Prong::kCountResonant, const char* cutFile = "./DstoKKpiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 431, Char_t isSign = 2, Bool_t useNtrkWeight=kFALSE, Bool_t isFineNtrkBin=kFALSE)
46 //AliCFContainer *AddTaskCFVertexingHF3ProngDs(const char* cutFile = "./DstoKKpiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 431, Char_t isSign = 2)
47 {
48  printf("Addig CF task using cuts from file %s\n",cutFile);
49  if (configuration == AliCFTaskVertexingHF::kSnail){
50  printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
51  }
52  else if (configuration == AliCFTaskVertexingHF::kCheetah){
53  printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
54  }
55  else{
56  printf("The configuration is not defined! returning\n");
57  return;
58  }
59 
60  gSystem->Sleep(2000);
61 
62  // isSign = 0 --> D+s only
63  // isSign = 1 --> D-s only
64  // isSign = 2 --> D+s + D-s
65 
66  TString expected;
67  if (isSign == 0 && pdgCode < 0){
68  AliError(Form("Error setting PDG code (%d) and sign (0 --> particle (%d) only): they are not compatible, returning",pdgCode));
69  return 0x0;
70  }
71  else if (isSign == 1 && pdgCode > 0){
72  AliError(Form("Error setting PDG code (%d) and sign (1 --> antiparticle (%d) only): they are not compatible, returning",pdgCode));
73  return 0x0;
74  }
75  else if (isSign > 2 || isSign < 0){
76  AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning"));
77  return 0x0;
78  }
79 
80  TFile* fileCuts = TFile::Open(cutFile);
81  if(!fileCuts || (fileCuts && !fileCuts->IsOpen())){
82  AliError("Wrong cut file");
83  return 0x0;
84  }
85  AliRDHFCutsDstoKKpi *cutsDstoKKpi = (AliRDHFCutsDstoKKpi*)fileCuts->Get("AnalysisCuts");
86 
87  // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
88  // for now the binning is the same than for all D's
89  if(isKeepDfromBOnly) isKeepDfromB = true;
90 
91  /*
92  Double_t ptmin_0_4;
93  Double_t ptmax_0_4;
94  Double_t ptmin_4_8;
95  Double_t ptmax_4_8;
96  Double_t ptmin_8_10;
97  Double_t ptmax_8_10;
98 
99  if(!isKeepDfromB){
100  ptmin_0_4 = 0.0 ;
101  ptmax_0_4 = 4.0 ;
102  ptmin_4_8 = 4.0 ;
103  ptmax_4_8 = 8.0 ;
104  ptmin_8_10 = 8.0 ;
105  ptmax_8_10 = 10.0 ;
106  } else{
107  ptmin_0_4 = 0.0 ;
108  ptmax_0_4 = 3.0 ;
109  ptmin_4_8 = 3.0 ;
110  ptmax_4_8 = 5.0 ;
111  ptmin_8_10 = 5.0 ;
112  ptmax_8_10 = 10.0 ;
113  }
114  */
115 
116  //CONTAINER DEFINITION
117  Info("AliCFTaskVertexingHF","SETUP CONTAINER");
118 
119  const Double_t phimax = 2*TMath::Pi();
120 
121  //Setting up the container grid...
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 // const Int_t nbinpt_0_4 = 8 ; //bins in pt from 0 to 4 GeV
124 // const Int_t nbinpt_4_8 = 4 ; //bins in pt from 4 to 8 GeV
125 // const Int_t nbinpt_8_10 = 1 ; //bins in pt from 8 to 10 GeV
126 
127 /*
128  Int_t nbinpt_0_4;
129  Int_t nbinpt_4_8;
130  Int_t nbinpt_8_10;
131  if (!isKeepDfromB){
132  nbinpt_0_4 = 8 ; //bins in pt from 0 to 4 GeV
133  nbinpt_4_8 = 4 ; //bins in pt from 4 to 8 GeV
134  nbinpt_8_10 = 1 ; //bins in pt from 8 to 10 GeV
135  }else{
136  nbinpt_0_4 = 3 ; //bins in pt from 0 to 3 GeV
137  nbinpt_4_8 = 1 ; //bins in pt from 3 to 5 GeV
138  nbinpt_8_10 = 1 ; //bins in pt from 5 to 10 GeV
139  }
140 */
141  const Int_t nbinpt = cutsDstoKKpi->GetNPtBins(); // bins in pT
142  printf("pT: nbin (from cuts file) = %d\n",nbinpt);
143  const Int_t nbiny = 24 ; //bins in y
144  const Int_t nbinphi = 18 ; //bins in phi
145  const Int_t nbincT = 2 ; //bins in cT
146  const Int_t nbinpointing = 350 ; //bins in cosPointingAngle
147  const Int_t nbinpT1_0_4 = 8 ; //bins in pt1 from 0 to 4 GeV
148  const Int_t nbinpT1_4_8 = 4 ; //bins in pt1 from 4 to 8 GeV
149  const Int_t nbinpT1_8_10 = 1 ; //bins in pt1 from 8 to 10 GeV
150  const Int_t nbinpT2_0_4 = 8 ; //bins in pt2 from 0 to 4 GeV
151  const Int_t nbinpT2_4_8 = 4 ; //bins in pt2 from 4 to 8 GeV
152  const Int_t nbinpT2_8_10 = 1 ; //bins in pt2 from 8 to 10 GeV
153  const Int_t nbinpT3_0_4 = 8 ; //bins in pt3 from 0 to 4 GeV
154  const Int_t nbinpT3_4_8 = 4 ; //bins in pt3 from 4 to 8 GeV
155  const Int_t nbinpT3_8_10 = 1 ; //bins in pt3 from 8 to 10 GeV
156  const Int_t nbinzvtx = 30 ; //bins in z vertex
157  const Int_t nbincent = 18; //bins in centrality
158  const Int_t nbincent_0_10 = 4; //bins in centrality between 0 and 10
159  const Int_t nbincent_10_60 = 10; //bins in centrality between 10 and 60
160  const Int_t nbincent_60_100 = 4; //bins in centrality between 60 and 100
161  const Int_t nbinfake = 3; //bins in fake
162  const Int_t nbinpointingXY = 50; //bins in cosPointingAngleXY
163  const Int_t nbinnormDecayLXY = 20; //bins in NormDecayLengthXY
164  const Int_t nbinmult = 48; //bins in multiplicity (total number)
165  const Int_t nbinmult_0_20 = 20; //bins in multiplicity between 0 and 20
166  const Int_t nbinmult_20_50 = 15; //bins in multiplicity between 20 and 50
167  const Int_t nbinmult_50_102 = 13; //bins in multiplicity between 50 and 102
168 
169  Int_t nbinmultTmp=nbinmult;
170  if(isFineNtrkBin){
171  Int_t nbinLimmultFine=250;
172  const UInt_t nbinMultFine = nbinLimmultFine;
173  binLimmultFine = new Double_t[nbinMultFine+1];
174  for (Int_t ibin0 = 0 ; ibin0<=nbinMultFine; ibin0++){
175  binLimmultFine[ibin0] = ibin0;
176  }
177  nbinmultTmp=nbinLimmultFine;
178  }
179  const Int_t nbinmultTot=nbinmultTmp;
180 
181 
182  //the sensitive variables, their indices
183  const UInt_t ipT = 0;
184  const UInt_t iy = 1;
185  const UInt_t iphi = 2;
186  const UInt_t icT = 3;
187  const UInt_t ipointing = 4;
188  const UInt_t ipT1 = 5;
189  const UInt_t ipT2 = 6;
190  const UInt_t ipT3 = 7;
191  const UInt_t izvtx = 8;
192  const UInt_t icent = 9;
193  const UInt_t ifake = 10;
194  const UInt_t ipointingXY = 11;
195  const UInt_t inormDecayLXY = 12;
196  const UInt_t imult = 13;
197 
198  const Int_t nvarTot = 14 ;
199 
200  //arrays for the number of bins in each dimension
201  Int_t iBin[nvarTot];
202  //iBin[ipT]=nbinpt_0_4+nbinpt_4_8+nbinpt_8_10;
203  iBin[ipT]=nbinpt;
204  iBin[iy]=nbiny;
205  iBin[iphi]=nbinphi;
206  // iBin[icT]=nbincT_0_4+nbincT_4_8+nbincT_8_10;
207  //iBin[4]=nbinpointing_0_4+nbinpointing_4_8+nbinpointing_8_10;
208  iBin[icT]=nbincT;
209  iBin[ipointing]=nbinpointing;
210  iBin[ipT1]=nbinpt;
211  iBin[ipT2]=nbinpt;
212  iBin[ipT3]=nbinpt;
213  iBin[izvtx]=nbinzvtx;
214  iBin[icent]=nbincent;
215  iBin[ifake]=nbinfake;
216  iBin[ipointingXY]=nbinpointingXY;
217  iBin[inormDecayLXY]=nbinnormDecayLXY;
218  iBin[imult]=nbinmultTot;
219 
220  //arrays for lower bounds :
221  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
222  Double_t *binLimy=new Double_t[iBin[iy]+1];
223  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
224  Double_t *binLimcT=new Double_t[iBin[icT]+1];
225  Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
226  Double_t *binLimpT1=new Double_t[iBin[ipT1]+1];
227  Double_t *binLimpT2=new Double_t[iBin[ipT2]+1];
228  Double_t *binLimpT3=new Double_t[iBin[ipT3]+1];
229  Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
230  Double_t *binLimcent=new Double_t[iBin[icent]+1];
231  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
232  Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
233  Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
234  Double_t *binLimmult=new Double_t[iBin[imult]+1];
235 
236  // checking limits
237  /*
238  if (ptmax_0_4 != ptmin_4_8) {
239  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 1st range != min lim 2nd range, please check!");
240  }
241  if (ptmax_4_8 != ptmin_8_10) {
242  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 2nd range != min lim 3rd range, please check!");
243  }
244  */
245  // values for bin lower bounds
246  // pt
247  Float_t* floatbinLimpT = cutsDstoKKpi->GetPtBinLimits();
248  for (Int_t ibinpT = 0 ; ibinpT<iBin[ipT]+1; ibinpT++){
249  binLimpT[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
250  binLimpT1[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
251  binLimpT2[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
252  binLimpT3[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
253  }
254  for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
255 
256  /*
257  for(Int_t i=0; i<=nbinpt_0_4; i++) binLimpT[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbinpt_0_4*(Double_t)i ;
258  if (binLimpT[nbinpt_0_4] != ptmin_4_8) {
259  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
260  }
261  for(Int_t i=0; i<=nbinpt_4_8; i++) binLimpT[i+nbinpt_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbinpt_4_8*(Double_t)i ;
262  if (binLimpT[nbinpt_0_4+nbinpt_4_8] != ptmin_8_10) {
263  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
264  }
265  for(Int_t i=0; i<=nbinpt_8_10; i++) binLimpT[i+nbinpt_0_4+nbinpt_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbinpt_8_10*(Double_t)i ;
266  */
267 
268  // y
269  for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
270 
271  // Phi
272  for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
273 
274  // cT
275  for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
276 
277  // cosPointingAngle
278  for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
279 
280  /*
281  // ptPi
282  for(Int_t i=0; i<=nbincT_0_4; i++) binLimcT[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbincT_0_4*(Double_t)i ;
283  if (binLimcT[nbincT_0_4] != ptmin_4_8) {
284  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 1st range - differs from expected!");
285  }
286  for(Int_t i=0; i<=nbincT_4_8; i++) binLimcT[i+nbincT_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbincT_4_8*(Double_t)i ;
287  if (binLimcT[nbincT_0_4+nbincT_4_8] != ptmin_8_10) {
288  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 2nd range - differs from expected!\n");
289  }
290  for(Int_t i=0; i<=nbincT_8_10; i++) binLimcT[i+nbincT_0_4+nbincT_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbincT_8_10*(Double_t)i ;
291 
292  // ptKa
293  for(Int_t i=0; i<=nbinpointing_0_4; i++) binLimpointing[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbinpointing_0_4*(Double_t)i ;
294  if (binLimpointing[nbinpointing_0_4] != ptmin_4_8) {
295  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 1st range - differs from expected!");
296  }
297  for(Int_t i=0; i<=nbinpointing_4_8; i++) binLimpointing[i+nbinpointing_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbinpointing_4_8*(Double_t)i ;
298  if (binLimpointing[nbinpointing_0_4+nbinpointing_4_8] != ptmin_8_10) {
299  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 2nd range - differs from expected!\n");
300  }
301  for(Int_t i=0; i<=nbinpointing_8_10; i++) binLimpointing[i+nbinpointing_0_4+nbinpointing_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbinpointing_8_10*(Double_t)i ;
302  */
303 
304  // z Primary Vertex
305  for(Int_t i=0; i<=nbinzvtx; i++) {
306  binLimzvtx[i]=(Double_t)zvtxmin + (zvtxmax-zvtxmin) /nbinzvtx*(Double_t)i ;
307  }
308 
309  // centrality
310  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 ;
311  if (binLimcent[nbincent_0_10] != centmin_10_60) {
312  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
313  }
314  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 ;
315  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
316  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
317  }
318  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 ;
319 
320  // fake
321  for(Int_t i=0; i<=nbinfake; i++) {
322  binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
323  }
324 
325  // cosPointingAngleXY
326  for(Int_t i=0; i<=nbinpointingXY; i++) binLimpointingXY[i]=(Double_t)cosminXY + (cosmaxXY-cosminXY) /nbinpointingXY*(Double_t)i ;
327 
328  // normDecayLXY
329  for(Int_t i=0; i<=nbinnormDecayLXY; i++) binLimnormDecayLXY[i]=(Double_t)normDecLXYmin + (normDecLXYmax-normDecLXYmin) /nbinnormDecayLXY*(Double_t)i ;
330 
331  // multiplicity
332  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 ;
333  if (binLimmult[nbinmult_0_20] != multmin_20_50) {
334  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
335  }
336  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 ;
337  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102) {
338  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
339  }
340  for(Int_t i=0; i<=nbinmult_50_102; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50]=(Double_t)multmin_50_102 + (multmax_50_102-multmin_50_102)/nbinmult_50_102*(Double_t)i ;
341 
342  TString suffixDecayType="";
343  if(decayOption==AliCFVertexingHF3Prong::kCountAllDsKKpi) suffixDecayType="_All";
344  else if(decayOption==AliCFVertexingHF3Prong::kCountPhipi) suffixDecayType="_Phi";
345  else if(decayOption==AliCFVertexingHF3Prong::kCountK0stK) suffixDecayType="_K0star";
346  else if(decayOption==AliCFVertexingHF3Prong::kCountResonant) suffixDecayType="_Reson";
347  else if(decayOption==AliCFVertexingHF3Prong::kCountNonResonant) suffixDecayType="_NonReson";
348 
349  //one "container" for MC
350  TString nameContainer="";
351  if(!isKeepDfromB) {
352  nameContainer="CFHFccontainer0_3ProngDstoKKpi_CommonFramework";
353  }
354  else if(isKeepDfromBOnly){
355  nameContainer="CFHFccontainer0DfromB_3ProngDstoKKpi_CommonFramework";
356  }
357  else {
358  nameContainer="CFHFccontainer0allD_3ProngDstoKKpi_CommonFramework";
359  }
360  nameContainer+=suffixDecayType.Data();
361  nameContainer+=suffixName.Data();
362 
363  AliCFContainer* container;
364  if (configuration == AliCFTaskVertexingHF::kSnail){
365  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
366  //setting the bin limits
367  printf("pt\n");
368  container -> SetBinLimits(ipT,binLimpT);
369  printf("y\n");
370  container -> SetBinLimits(iy,binLimy);
371  printf("Phi\n");
372  container -> SetBinLimits(iphi,binLimphi);
373  printf("cT\n");
374  container -> SetBinLimits(icT,binLimcT);
375  printf("pointing angle\n");
376  container -> SetBinLimits(ipointing,binLimpointing);
377  printf("pt1\n");
378  container -> SetBinLimits(ipT1,binLimpT1);
379  printf("pt2\n");
380  container -> SetBinLimits(ipT2,binLimpT2);
381  printf("pt3\n");
382  container -> SetBinLimits(ipT3,binLimpT3);
383  printf("zvtx \n");
384  container -> SetBinLimits(izvtx,binLimzvtx);
385  printf("cent\n");
386  container -> SetBinLimits(icent,binLimcent);
387  printf("fake\n");
388  container -> SetBinLimits(ifake,binLimfake);
389  printf("pointingXY\n");
390  container -> SetBinLimits(ipointingXY,binLimpointingXY);
391  printf("normDecayLXY\n");
392  container -> SetBinLimits(inormDecayLXY,binLimnormDecayLXY);
393  printf("multiplicity\n");
394  if(isFineNtrkBin) container -> SetBinLimits(imult,binLimmultFine);
395  else container -> SetBinLimits(imult,binLimmult);
396 
397  container -> SetVarTitle(ipT,"pt");
398  container -> SetVarTitle(iy,"y");
399  container -> SetVarTitle(iphi, "phi");
400  container -> SetVarTitle(icT, "ct");
401  container -> SetVarTitle(ipointing, "pointing");
402  container -> SetVarTitle(ipT1, "pt1");
403  container -> SetVarTitle(ipT2, "pt2");
404  container -> SetVarTitle(ipT3, "pt3");
405  container -> SetVarTitle(izvtx, "zvtx");
406  container -> SetVarTitle(icent, "centrality");
407  container -> SetVarTitle(ifake, "fake");
408  container -> SetVarTitle(ipointingXY, "piointingXY");
409  container -> SetVarTitle(inormDecayLXY, "normDecayLXY");
410  container -> SetVarTitle(imult, "multiplicity");
411  }
412  else if (configuration == AliCFTaskVertexingHF::kCheetah){
413  //arrays for the number of bins in each dimension
414  const Int_t nvar = 8;
415 
416  const UInt_t ipTFast = 0;
417  const UInt_t iyFast = 1;
418  const UInt_t icTFast = 2;
419  const UInt_t iphiFast = 3;
420  const UInt_t izvtxFast = 4;
421  const UInt_t icentFast = 5;
422  const UInt_t ifakeFast = 6;
423  const UInt_t imultFast = 7;
424 
425  Int_t iBinFast[nvar];
426  iBinFast[ipTFast] = iBin[ipT];
427  iBinFast[iyFast] = iBin[iy];
428  iBinFast[icTFast] = iBin[icT];
429  iBinFast[iphiFast] = iBin[iphi];
430  iBinFast[izvtxFast] = iBin[izvtx];
431  iBinFast[icentFast] = iBin[icent];
432  iBinFast[ifakeFast] = iBin[ifake];
433  iBinFast[imultFast] = iBin[imult];
434 
435  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinFast);
436  printf("pt\n");
437  container -> SetBinLimits(ipTFast,binLimpT);
438  printf("y\n");
439  container -> SetBinLimits(iyFast,binLimy);
440  printf("ct\n");
441  container -> SetBinLimits(icTFast,binLimcT);
442  printf("phi\n");
443  container -> SetBinLimits(iphiFast,binLimphi);
444  printf("zvtx\n");
445  container -> SetBinLimits(izvtxFast,binLimzvtx);
446  printf("centrality\n");
447  container -> SetBinLimits(icentFast,binLimcent);
448  printf("fake\n");
449  container -> SetBinLimits(ifakeFast,binLimfake);
450  printf("multiplicity\n");
451  if(isFineNtrkBin) container -> SetBinLimits(imultFast,binLimmultFine);
452  else container -> SetBinLimits(imultFast,binLimmult);
453 
454  container -> SetVarTitle(ipTFast,"pt");
455  container -> SetVarTitle(iyFast,"y");
456  container -> SetVarTitle(icTFast, "ct");
457  container -> SetVarTitle(iphiFast, "phi");
458  container -> SetVarTitle(izvtxFast, "zvtx");
459  container -> SetVarTitle(icentFast, "centrality");
460  container -> SetVarTitle(ifakeFast, "fake");
461  container -> SetVarTitle(imultFast, "multiplicity");
462  }
463 
464  //return container;
465 
466  container -> SetStepTitle(0, "MCLimAcc");
467  container -> SetStepTitle(1, "MC");
468  container -> SetStepTitle(2, "MCAcc");
469  container -> SetStepTitle(3, "RecoVertex");
470  container -> SetStepTitle(4, "RecoRefit");
471  container -> SetStepTitle(5, "Reco");
472  container -> SetStepTitle(6, "RecoAcc");
473  container -> SetStepTitle(7, "RecoITSCluster");
474  container -> SetStepTitle(8, "RecoCuts");
475  container -> SetStepTitle(9, "RecoPID");
476 
477 
478  //CREATE THE CUTS -----------------------------------------------
479 
480  // Gen-Level kinematic cuts
481  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
482 
483  //Particle-Level cuts:
484  AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
485  Bool_t useAbsolute = kTRUE;
486  if (isSign != 2){
487  useAbsolute = kFALSE;
488  }
489  mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include antiparticle
490  mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
491 
492  // Acceptance cuts:
493  AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
494  AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
495  kineAccCuts->SetPtRange(ptmin,ptmax);
496  kineAccCuts->SetEtaRange(etamin,etamax);
497 
498  // Rec-Level kinematic cuts
499  AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
500 
501  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
502 
503  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
504 
505  printf("CREATE MC KINE CUTS\n");
506  TObjArray* mcList = new TObjArray(0) ;
507  mcList->AddLast(mcKineCuts);
508  mcList->AddLast(mcGenCuts);
509 
510  printf("CREATE ACCEPTANCE CUTS\n");
511  TObjArray* accList = new TObjArray(0) ;
512  accList->AddLast(kineAccCuts);
513 
514  printf("CREATE RECONSTRUCTION CUTS\n");
515  TObjArray* recList = new TObjArray(0) ; // not used!!
516  recList->AddLast(recKineCuts);
517  recList->AddLast(recQualityCuts);
518  recList->AddLast(recIsPrimaryCuts);
519 
520  TObjArray* emptyList = new TObjArray(0);
521 
522  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
523  printf("CREATE INTERFACE AND CUTS\n");
524  AliCFManager* man = new AliCFManager() ;
525  man->SetParticleContainer(container);
526  man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
527  man->SetParticleCutsList(1 , mcList); // MC
528  man->SetParticleCutsList(2 , accList); // Acceptance
529  man->SetParticleCutsList(3 , emptyList); // Vertex
530  man->SetParticleCutsList(4 , emptyList); // Refit
531  man->SetParticleCutsList(5 , emptyList); // AOD
532  man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
533  man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
534  man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
535  man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
536 
537  // Get the pointer to the existing analysis manager via the static access method.
538  //==============================================================================
539  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
540  if (!mgr) {
541  ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
542  return NULL;
543  }
544  //CREATE THE TASK
545  printf("CREATE TASK\n");
546 
547  // create the task
548  AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsDstoKKpi);
549  task->SetConfiguration(configuration);
550  task->SetFillFromGenerated(kFALSE);
551  task->SetDecayChannel(33);
553  else if(decayOption==AliCFVertexingHF3Prong::kCountPhipi) task->SetCountDsViaPhi();
554  else if(decayOption==AliCFVertexingHF3Prong::kCountK0stK) task->SetCountDsViaK0star();
555  else if(decayOption==AliCFVertexingHF3Prong::kCountResonant) task->SetCountResonantDs();
557  task->SetUseWeight(kFALSE);
558  task->SetCFManager(man); //here is set the CF manager
559  task->SetSign(isSign);
560  task->SetCentralitySelection(kFALSE);
561  task->SetFakeSelection(0);
562  task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
563  task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
564  if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
565  if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
566 
567  TF1* funcWeight = 0x0;
568  if (task->GetUseWeight()) {
569  funcWeight = (TF1*)fileCuts->Get("funcWeight");
570  if (funcWeight == 0x0){
571  Printf("FONLL Weights will be used");
572  }
573  else {
574  task->SetWeightFunction(funcWeight);
575  Printf("User-defined Weights will be used. The function being:");
576  task->GetWeightFunction()->Print();
577  }
578  }
579 
580  if(useNtrkWeight){
581  TH1F *hNtrkMC;
582  TH1F *hNtrkMeasured;
583  hNtrkMC = (TH1F*)fileCuts->Get("hNtrkMC");
584  hNtrkMeasured = (TH1F*)fileCuts->Get("hNtrkMeasured");
585  if(hNtrkMC) task->SetMCNchHisto(hNtrkMC);
586  else {
587  AliFatal("Histogram for multiplicity weights not found");
588  return 0x0;
589  }
590  if(hNtrkMeasured) task->SetMeasuredNchHisto(hNtrkMeasured);
591  else {
592  AliFatal("Histogram for multiplicity weights not found");
593  return 0x0;
594  }
595  task->SetUseNchTrackletsWeight(kTRUE);
596  }
597 
598  Printf("***************** CONTAINER SETTINGS *****************");
599  Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
600  Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
601  Printf("Dselection = %d",(Int_t)task->GetDselection());
602  Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
603  if (task->GetUseWeight()) {
604  funcWeight = (TF1*)fileCuts->Get("funcWeight");
605  if (funcWeight == 0x0){
606  Printf("FONLL Weights will be used");
607  }
608  else {
609  task->SetWeightFunction(funcWeight);
610  Printf("User-defined Weights will be used. The function being:");
611  task->GetWeightFunction()->Print();
612  }
613  }
614  Printf("Sign = %d",(Int_t)task->GetSign());
615  Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
616  Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
617  Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
618  Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
619  Printf("***************END CONTAINER SETTINGS *****************\n");
620 
621  //-----------------------------------------------------------//
622  // create correlation matrix for unfolding - only eta-pt //
623  //-----------------------------------------------------------//
624 
625  Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
626 
627  Int_t thnDim[4];
628 
629  //first half : reconstructed
630  //second half : MC
631 
632  thnDim[0] = iBin[ipT];
633  thnDim[2] = iBin[ipT];
634  thnDim[1] = iBin[iy];
635  thnDim[3] = iBin[iy];
636 
637  TString nameCorr="";
638  if(!isKeepDfromB) {
639  nameCorr="CFHFcorr0_3ProngDstoKKpi_CommonFramework";
640  }
641  else if(isKeepDfromBOnly){
642  nameCorr= "CFHFcorr0KeepDfromBOnly_3ProngDstoKKpi_CommonFramework";
643  }
644  else {
645  nameCorr="CFHFcorr0allD_3ProngDstoKKpi_CommonFramework";
646  }
647  nameCorr+=suffixDecayType.Data();
648  nameCorr+=suffixName.Data();
649 
650  THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
651  Double_t** binEdges = new Double_t[2];
652 
653  // set bin limits
654 
655  binEdges[0]= binLimpT;
656  binEdges[1]= binLimy;
657 
658  correlation->SetBinEdges(0,binEdges[0]);
659  correlation->SetBinEdges(2,binEdges[0]);
660 
661  correlation->SetBinEdges(1,binEdges[1]);
662  correlation->SetBinEdges(3,binEdges[1]);
663 
664  correlation->Sumw2();
665 
666  // correlation matrix ready
667  //------------------------------------------------//
668 
669  task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
670 
671  // Create and connect containers for input/output
672 
673  // ------ input data ------
674  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
675 
676  // ----- output data -----
677 
678  TString outputfile = AliAnalysisManager::GetCommonFileName();
679  TString output1name="", output2name="", output3name="", output4name="", output5name="";
680  output2name=nameContainer;
681  output3name=nameCorr;
682  output5name= "coutProfDs";
683  if(!isKeepDfromB) {
684  outputfile += ":PWG3_D2H_CFtaskDstoKKpi_CommonFramework";
685  output1name="CFHFchist0_3ProngDstoKKpi_CommonFramework";
686  output3name+="_cOnly";
687  output4name= "CutsDdirect_3ProngDs_CommonFramework";
688  output5name+="_cOnly";
689  }
690  else if(isKeepDfromBOnly){
691  outputfile += ":PWG3_D2H_CFtaskDstoKKpiKeepDfromBOnly_CommonFramework";
692  output1name="CFHFchist0DfromB_3ProngDstoKKpi_CommonFramework";
693  output3name+="_bOnly";
694  output4name= "CutsDfromB_3ProngDs_CommonFramework";
695  output5name+="_bOnly";
696  }
697  else{
698  outputfile += ":PWG3_D2H_CFtaskDstoKKpiKeepDfromB_CommonFramework";
699  output1name="CFHFchist0allD_3ProngDstoKKpi_CommonFramework";
700  output3name+="_all";
701  output4name= "CutsallD_3ProngDs_CommonFramework";
702  output5name+="_all";
703  }
704 
705  outputfile += suffixDecayType.Data();
706  output1name+= suffixDecayType.Data();
707  output4name+= suffixDecayType.Data();
708  output5name+= suffixDecayType.Data();
709 
710  outputfile += suffixName.Data();
711  output1name+= suffixName.Data();
712  output4name+= suffixName.Data();
713  output5name+= suffixName.Data();
714 
715  //now comes user's output objects :
716  // output TH1I for event counting
717  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
718  // output Correction Framework Container (for acceptance & efficiency calculations)
719  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
720  // Unfolding - correlation matrix
721  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
722  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
723  // estimators list
724  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
725 
726  mgr->AddTask(task);
727 
728  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
729  mgr->ConnectOutput(task,1,coutput1);
730  mgr->ConnectOutput(task,2,coutput2);
731  mgr->ConnectOutput(task,3,coutput3);
732  mgr->ConnectOutput(task,4,coutput4);
733  mgr->ConnectOutput(task,5,coutput5);
734 
735  return task;
736 }
AliCFTaskVertexingHF * AddTaskCFVertexingHF3ProngDs(TString suffixName="", Int_t decayOption=AliCFVertexingHF3Prong::kCountResonant, const char *cutFile="./DstoKKpiCuts.root", Int_t configuration=AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode=431, Char_t isSign=2, Bool_t useNtrkWeight=kFALSE, Bool_t isFineNtrkBin=kFALSE)
const Int_t mintrackrefsITS
const Float_t multmax_50_102
void SetWeightFunction(TF1 *func)
const Float_t multmin_0_20
const Float_t fakemin
void SetRejectCandidateIfNotFromQuark(Bool_t opt)
double Double_t
Definition: External.C:58
const Int_t charge
const Double_t ptmin
const Float_t centmax_60_100
void SetCFManager(AliCFManager *io)
CORRECTION FRAMEWORK RELATED FUNCTIONS.
const Double_t ptmax
const Float_t multmin_50_102
const Float_t multmax_20_50
void SetDecayChannel(Int_t decayChannel)
TSystem * gSystem
char Char_t
Definition: External.C:18
void SetFillFromGenerated(Bool_t flag)
get corr manager
void SetUseNchTrackletsWeight(Bool_t useWeight=kTRUE)
void SetUseMCVertex(Bool_t opt)
const Float_t centmin_10_60
const Float_t centmax_10_60
const Float_t fakemax
const Double_t zvtxmax
const Float_t multmax_0_20
const Double_t zvtxmin
const Float_t multmin_20_50
const Double_t cTmin
const Int_t minITSClusters
const Int_t mintrackrefsTPC
int Int_t
Definition: External.C:63
void SetMeasuredNchHisto(TH1F *h)
unsigned int UInt_t
Definition: External.C:33
const Float_t normDecLXYmin
float Float_t
Definition: External.C:68
const Double_t cosmin
const Double_t cTmax
const Float_t centmin_0_10
void SetCentralitySelection(Bool_t centSelec=kTRUE)
slow configuration, all variables
const Float_t normDecLXYmax
const Double_t cosmax
const Int_t minclustersTPC
void SetUseWeight(Bool_t useWeight)
const Double_t ymin
void SetConfiguration(Int_t configuration)
void SetDselection(UShort_t originDselection)
const Float_t cosmaxXY
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:238
TF1 * GetWeightFunction() const
void SetCorrelationMatrix(THnSparse *h)
UNFOLDING.
const Double_t ymax
const Float_t centmin_60_100
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:239
void SetSign(Char_t isSign)
Bool_t GetUseWeight() const
bool Bool_t
Definition: External.C:53
const Float_t cosminXY
Bool_t GetFillFromGenerated() const
const Double_t etamax
const Double_t phimin
const Double_t etamin
const Float_t centmax
void SetFakeSelection(Int_t fakeSel=0)
const Float_t centmax_0_10