AliPhysics  e59a9ba (e59a9ba)
 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 ;
10 const Int_t mintrackrefsITS = 3 ;
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;
20 const Int_t minITSClusters = 5;
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;
33 const Float_t normDecLXYmin = 0;
34 const Float_t normDecLXYmax = 20;
35 const Float_t multmin_0_20 = 0;
36 const Float_t multmax_0_20 = 20;
37 const Float_t multmin_20_50 = 20;
38 const Float_t multmax_20_50 = 50;
39 const Float_t multmin_50_102 = 50;
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)
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  //the sensitive variables, their indices
170  const UInt_t ipT = 0;
171  const UInt_t iy = 1;
172  const UInt_t iphi = 2;
173  const UInt_t icT = 3;
174  const UInt_t ipointing = 4;
175  const UInt_t ipT1 = 5;
176  const UInt_t ipT2 = 6;
177  const UInt_t ipT3 = 7;
178  const UInt_t izvtx = 8;
179  const UInt_t icent = 9;
180  const UInt_t ifake = 10;
181  const UInt_t ipointingXY = 11;
182  const UInt_t inormDecayLXY = 12;
183  const UInt_t imult = 13;
184 
185  const Int_t nvarTot = 14 ;
186 
187  //arrays for the number of bins in each dimension
188  Int_t iBin[nvarTot];
189  //iBin[ipT]=nbinpt_0_4+nbinpt_4_8+nbinpt_8_10;
190  iBin[ipT]=nbinpt;
191  iBin[iy]=nbiny;
192  iBin[iphi]=nbinphi;
193  // iBin[icT]=nbincT_0_4+nbincT_4_8+nbincT_8_10;
194  //iBin[4]=nbinpointing_0_4+nbinpointing_4_8+nbinpointing_8_10;
195  iBin[icT]=nbincT;
196  iBin[ipointing]=nbinpointing;
197  iBin[ipT1]=nbinpt;
198  iBin[ipT2]=nbinpt;
199  iBin[ipT3]=nbinpt;
200  iBin[izvtx]=nbinzvtx;
201  iBin[icent]=nbincent;
202  iBin[ifake]=nbinfake;
203  iBin[ipointingXY]=nbinpointingXY;
204  iBin[inormDecayLXY]=nbinnormDecayLXY;
205  iBin[imult]=nbinmult;
206 
207  //arrays for lower bounds :
208  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
209  Double_t *binLimy=new Double_t[iBin[iy]+1];
210  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
211  Double_t *binLimcT=new Double_t[iBin[icT]+1];
212  Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
213  Double_t *binLimpT1=new Double_t[iBin[ipT1]+1];
214  Double_t *binLimpT2=new Double_t[iBin[ipT2]+1];
215  Double_t *binLimpT3=new Double_t[iBin[ipT3]+1];
216  Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
217  Double_t *binLimcent=new Double_t[iBin[icent]+1];
218  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
219  Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
220  Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
221  Double_t *binLimmult=new Double_t[iBin[imult]+1];
222 
223  // checking limits
224  /*
225  if (ptmax_0_4 != ptmin_4_8) {
226  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 1st range != min lim 2nd range, please check!");
227  }
228  if (ptmax_4_8 != ptmin_8_10) {
229  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 2nd range != min lim 3rd range, please check!");
230  }
231  */
232  // values for bin lower bounds
233  // pt
234  Float_t* floatbinLimpT = cutsDstoKKpi->GetPtBinLimits();
235  for (Int_t ibinpT = 0 ; ibinpT<iBin[ipT]+1; ibinpT++){
236  binLimpT[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
237  binLimpT1[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
238  binLimpT2[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
239  binLimpT3[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
240  }
241  for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
242 
243  /*
244  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 ;
245  if (binLimpT[nbinpt_0_4] != ptmin_4_8) {
246  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
247  }
248  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 ;
249  if (binLimpT[nbinpt_0_4+nbinpt_4_8] != ptmin_8_10) {
250  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
251  }
252  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 ;
253  */
254 
255  // y
256  for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
257 
258  // Phi
259  for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
260 
261  // cT
262  for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
263 
264  // cosPointingAngle
265  for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
266 
267  /*
268  // ptPi
269  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 ;
270  if (binLimcT[nbincT_0_4] != ptmin_4_8) {
271  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 1st range - differs from expected!");
272  }
273  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 ;
274  if (binLimcT[nbincT_0_4+nbincT_4_8] != ptmin_8_10) {
275  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 2nd range - differs from expected!\n");
276  }
277  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 ;
278 
279  // ptKa
280  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 ;
281  if (binLimpointing[nbinpointing_0_4] != ptmin_4_8) {
282  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 1st range - differs from expected!");
283  }
284  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 ;
285  if (binLimpointing[nbinpointing_0_4+nbinpointing_4_8] != ptmin_8_10) {
286  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 2nd range - differs from expected!\n");
287  }
288  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 ;
289  */
290 
291  // z Primary Vertex
292  for(Int_t i=0; i<=nbinzvtx; i++) {
293  binLimzvtx[i]=(Double_t)zvtxmin + (zvtxmax-zvtxmin) /nbinzvtx*(Double_t)i ;
294  }
295 
296  // centrality
297  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 ;
298  if (binLimcent[nbincent_0_10] != centmin_10_60) {
299  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
300  }
301  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 ;
302  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
303  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
304  }
305  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 ;
306 
307  // fake
308  for(Int_t i=0; i<=nbinfake; i++) {
309  binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
310  }
311 
312  // cosPointingAngleXY
313  for(Int_t i=0; i<=nbinpointingXY; i++) binLimpointingXY[i]=(Double_t)cosminXY + (cosmaxXY-cosminXY) /nbinpointingXY*(Double_t)i ;
314 
315  // normDecayLXY
316  for(Int_t i=0; i<=nbinnormDecayLXY; i++) binLimnormDecayLXY[i]=(Double_t)normDecLXYmin + (normDecLXYmax-normDecLXYmin) /nbinnormDecayLXY*(Double_t)i ;
317 
318  // multiplicity
319  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 ;
320  if (binLimmult[nbinmult_0_20] != multmin_20_50) {
321  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
322  }
323  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 ;
324  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102) {
325  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
326  }
327  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 ;
328 
329  TString suffixDecayType="";
330  if(decayOption==AliCFVertexingHF3Prong::kCountAllDsKKpi) suffixDecayType="_All";
331  else if(decayOption==AliCFVertexingHF3Prong::kCountPhipi) suffixDecayType="_Phi";
332  else if(decayOption==AliCFVertexingHF3Prong::kCountK0stK) suffixDecayType="_K0star";
333  else if(decayOption==AliCFVertexingHF3Prong::kCountResonant) suffixDecayType="_Reson";
334  else if(decayOption==AliCFVertexingHF3Prong::kCountNonResonant) suffixDecayType="_NonReson";
335 
336  //one "container" for MC
337  TString nameContainer="";
338  if(!isKeepDfromB) {
339  nameContainer="CFHFccontainer0_3ProngDstoKKpi_CommonFramework";
340  }
341  else if(isKeepDfromBOnly){
342  nameContainer="CFHFccontainer0DfromB_3ProngDstoKKpi_CommonFramework";
343  }
344  else {
345  nameContainer="CFHFccontainer0allD_3ProngDstoKKpi_CommonFramework";
346  }
347  nameContainer+=suffixDecayType.Data();
348  nameContainer+=suffixName.Data();
349 
350  AliCFContainer* container;
351  if (configuration == AliCFTaskVertexingHF::kSnail){
352  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
353  //setting the bin limits
354  printf("pt\n");
355  container -> SetBinLimits(ipT,binLimpT);
356  printf("y\n");
357  container -> SetBinLimits(iy,binLimy);
358  printf("Phi\n");
359  container -> SetBinLimits(iphi,binLimphi);
360  printf("cT\n");
361  container -> SetBinLimits(icT,binLimcT);
362  printf("pointing angle\n");
363  container -> SetBinLimits(ipointing,binLimpointing);
364  printf("pt1\n");
365  container -> SetBinLimits(ipT1,binLimpT1);
366  printf("pt2\n");
367  container -> SetBinLimits(ipT2,binLimpT2);
368  printf("pt3\n");
369  container -> SetBinLimits(ipT3,binLimpT3);
370  printf("zvtx \n");
371  container -> SetBinLimits(izvtx,binLimzvtx);
372  printf("cent\n");
373  container -> SetBinLimits(icent,binLimcent);
374  printf("fake\n");
375  container -> SetBinLimits(ifake,binLimfake);
376  printf("pointingXY\n");
377  container -> SetBinLimits(ipointingXY,binLimpointingXY);
378  printf("normDecayLXY\n");
379  container -> SetBinLimits(inormDecayLXY,binLimnormDecayLXY);
380  printf("multiplicity\n");
381  container -> SetBinLimits(imult,binLimmult);
382 
383  container -> SetVarTitle(ipT,"pt");
384  container -> SetVarTitle(iy,"y");
385  container -> SetVarTitle(iphi, "phi");
386  container -> SetVarTitle(icT, "ct");
387  container -> SetVarTitle(ipointing, "pointing");
388  container -> SetVarTitle(ipT1, "pt1");
389  container -> SetVarTitle(ipT2, "pt2");
390  container -> SetVarTitle(ipT3, "pt3");
391  container -> SetVarTitle(izvtx, "zvtx");
392  container -> SetVarTitle(icent, "centrality");
393  container -> SetVarTitle(ifake, "fake");
394  container -> SetVarTitle(ipointingXY, "piointingXY");
395  container -> SetVarTitle(inormDecayLXY, "normDecayLXY");
396  container -> SetVarTitle(imult, "multiplicity");
397  }
398  else if (configuration == AliCFTaskVertexingHF::kCheetah){
399  //arrays for the number of bins in each dimension
400  const Int_t nvar = 8;
401 
402  const UInt_t ipTFast = 0;
403  const UInt_t iyFast = 1;
404  const UInt_t icTFast = 2;
405  const UInt_t iphiFast = 3;
406  const UInt_t izvtxFast = 4;
407  const UInt_t icentFast = 5;
408  const UInt_t ifakeFast = 6;
409  const UInt_t imultFast = 7;
410 
411  Int_t iBinFast[nvar];
412  iBinFast[ipTFast] = iBin[ipT];
413  iBinFast[iyFast] = iBin[iy];
414  iBinFast[icTFast] = iBin[icT];
415  iBinFast[iphiFast] = iBin[iphi];
416  iBinFast[izvtxFast] = iBin[izvtx];
417  iBinFast[icentFast] = iBin[icent];
418  iBinFast[ifakeFast] = iBin[ifake];
419  iBinFast[imultFast] = iBin[imult];
420 
421  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinFast);
422  printf("pt\n");
423  container -> SetBinLimits(ipTFast,binLimpT);
424  printf("y\n");
425  container -> SetBinLimits(iyFast,binLimy);
426  printf("ct\n");
427  container -> SetBinLimits(icTFast,binLimcT);
428  printf("phi\n");
429  container -> SetBinLimits(iphiFast,binLimphi);
430  printf("zvtx\n");
431  container -> SetBinLimits(izvtxFast,binLimzvtx);
432  printf("centrality\n");
433  container -> SetBinLimits(icentFast,binLimcent);
434  printf("fake\n");
435  container -> SetBinLimits(ifakeFast,binLimfake);
436  printf("multiplicity\n");
437  container -> SetBinLimits(imultFast,binLimmult);
438 
439  container -> SetVarTitle(ipTFast,"pt");
440  container -> SetVarTitle(iyFast,"y");
441  container -> SetVarTitle(icTFast, "ct");
442  container -> SetVarTitle(iphiFast, "phi");
443  container -> SetVarTitle(izvtxFast, "zvtx");
444  container -> SetVarTitle(icentFast, "centrality");
445  container -> SetVarTitle(ifakeFast, "fake");
446  container -> SetVarTitle(imultFast, "multiplicity");
447  }
448 
449  //return container;
450 
451  container -> SetStepTitle(0, "MCLimAcc");
452  container -> SetStepTitle(1, "MC");
453  container -> SetStepTitle(2, "MCAcc");
454  container -> SetStepTitle(3, "RecoVertex");
455  container -> SetStepTitle(4, "RecoRefit");
456  container -> SetStepTitle(5, "Reco");
457  container -> SetStepTitle(6, "RecoAcc");
458  container -> SetStepTitle(7, "RecoITSCluster");
459  container -> SetStepTitle(8, "RecoCuts");
460  container -> SetStepTitle(9, "RecoPID");
461 
462 
463  //CREATE THE CUTS -----------------------------------------------
464 
465  // Gen-Level kinematic cuts
466  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
467 
468  //Particle-Level cuts:
469  AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
470  Bool_t useAbsolute = kTRUE;
471  if (isSign != 2){
472  useAbsolute = kFALSE;
473  }
474  mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include antiparticle
475  mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
476 
477  // Acceptance cuts:
478  AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
479  AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
480  kineAccCuts->SetPtRange(ptmin,ptmax);
481  kineAccCuts->SetEtaRange(etamin,etamax);
482 
483  // Rec-Level kinematic cuts
484  AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
485 
486  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
487 
488  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
489 
490  printf("CREATE MC KINE CUTS\n");
491  TObjArray* mcList = new TObjArray(0) ;
492  mcList->AddLast(mcKineCuts);
493  mcList->AddLast(mcGenCuts);
494 
495  printf("CREATE ACCEPTANCE CUTS\n");
496  TObjArray* accList = new TObjArray(0) ;
497  accList->AddLast(kineAccCuts);
498 
499  printf("CREATE RECONSTRUCTION CUTS\n");
500  TObjArray* recList = new TObjArray(0) ; // not used!!
501  recList->AddLast(recKineCuts);
502  recList->AddLast(recQualityCuts);
503  recList->AddLast(recIsPrimaryCuts);
504 
505  TObjArray* emptyList = new TObjArray(0);
506 
507  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
508  printf("CREATE INTERFACE AND CUTS\n");
509  AliCFManager* man = new AliCFManager() ;
510  man->SetParticleContainer(container);
511  man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
512  man->SetParticleCutsList(1 , mcList); // MC
513  man->SetParticleCutsList(2 , accList); // Acceptance
514  man->SetParticleCutsList(3 , emptyList); // Vertex
515  man->SetParticleCutsList(4 , emptyList); // Refit
516  man->SetParticleCutsList(5 , emptyList); // AOD
517  man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
518  man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
519  man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
520  man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
521 
522  // Get the pointer to the existing analysis manager via the static access method.
523  //==============================================================================
524  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
525  if (!mgr) {
526  ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
527  return NULL;
528  }
529  //CREATE THE TASK
530  printf("CREATE TASK\n");
531 
532  // create the task
533  AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsDstoKKpi);
534  task->SetConfiguration(configuration);
535  task->SetFillFromGenerated(kFALSE);
536  task->SetDecayChannel(33);
538  else if(decayOption==AliCFVertexingHF3Prong::kCountPhipi) task->SetCountDsViaPhi();
539  else if(decayOption==AliCFVertexingHF3Prong::kCountK0stK) task->SetCountDsViaK0star();
540  else if(decayOption==AliCFVertexingHF3Prong::kCountResonant) task->SetCountResonantDs();
542  task->SetUseWeight(kFALSE);
543  task->SetCFManager(man); //here is set the CF manager
544  task->SetSign(isSign);
545  task->SetCentralitySelection(kFALSE);
546  task->SetFakeSelection(0);
547  task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
548  task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
549  if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
550  if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
551 
552  TF1* funcWeight = 0x0;
553  if (task->GetUseWeight()) {
554  funcWeight = (TF1*)fileCuts->Get("funcWeight");
555  if (funcWeight == 0x0){
556  Printf("FONLL Weights will be used");
557  }
558  else {
559  task->SetWeightFunction(funcWeight);
560  Printf("User-defined Weights will be used. The function being:");
561  task->GetWeightFunction()->Print();
562  }
563  }
564 
565  Printf("***************** CONTAINER SETTINGS *****************");
566  Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
567  Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
568  Printf("Dselection = %d",(Int_t)task->GetDselection());
569  Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
570  if (task->GetUseWeight()) {
571  funcWeight = (TF1*)fileCuts->Get("funcWeight");
572  if (funcWeight == 0x0){
573  Printf("FONLL Weights will be used");
574  }
575  else {
576  task->SetWeightFunction(funcWeight);
577  Printf("User-defined Weights will be used. The function being:");
578  task->GetWeightFunction()->Print();
579  }
580  }
581  Printf("Sign = %d",(Int_t)task->GetSign());
582  Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
583  Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
584  Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
585  Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
586  Printf("***************END CONTAINER SETTINGS *****************\n");
587 
588  //-----------------------------------------------------------//
589  // create correlation matrix for unfolding - only eta-pt //
590  //-----------------------------------------------------------//
591 
592  Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
593 
594  Int_t thnDim[4];
595 
596  //first half : reconstructed
597  //second half : MC
598 
599  thnDim[0] = iBin[ipT];
600  thnDim[2] = iBin[ipT];
601  thnDim[1] = iBin[iy];
602  thnDim[3] = iBin[iy];
603 
604  TString nameCorr="";
605  if(!isKeepDfromB) {
606  nameCorr="CFHFcorr0_3ProngDstoKKpi_CommonFramework";
607  }
608  else if(isKeepDfromBOnly){
609  nameCorr= "CFHFcorr0KeepDfromBOnly_3ProngDstoKKpi_CommonFramework";
610  }
611  else {
612  nameCorr="CFHFcorr0allD_3ProngDstoKKpi_CommonFramework";
613  }
614  nameCorr+=suffixDecayType.Data();
615  nameCorr+=suffixName.Data();
616 
617  THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
618  Double_t** binEdges = new Double_t[2];
619 
620  // set bin limits
621 
622  binEdges[0]= binLimpT;
623  binEdges[1]= binLimy;
624 
625  correlation->SetBinEdges(0,binEdges[0]);
626  correlation->SetBinEdges(2,binEdges[0]);
627 
628  correlation->SetBinEdges(1,binEdges[1]);
629  correlation->SetBinEdges(3,binEdges[1]);
630 
631  correlation->Sumw2();
632 
633  // correlation matrix ready
634  //------------------------------------------------//
635 
636  task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
637 
638  // Create and connect containers for input/output
639 
640  // ------ input data ------
641  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
642 
643  // ----- output data -----
644 
645  TString outputfile = AliAnalysisManager::GetCommonFileName();
646  TString output1name="", output2name="", output3name="", output4name="", output5name="";
647  output2name=nameContainer;
648  output3name=nameCorr;
649  output5name= "coutProfDs";
650  if(!isKeepDfromB) {
651  outputfile += ":PWG3_D2H_CFtaskDstoKKpi_CommonFramework";
652  output1name="CFHFchist0_3ProngDstoKKpi_CommonFramework";
653  output3name+="_cOnly";
654  output4name= "CutsDdirect_3ProngDs_CommonFramework";
655  output5name+="_cOnly";
656  }
657  else if(isKeepDfromBOnly){
658  outputfile += ":PWG3_D2H_CFtaskDstoKKpiKeepDfromBOnly_CommonFramework";
659  output1name="CFHFchist0DfromB_3ProngDstoKKpi_CommonFramework";
660  output3name+="_bOnly";
661  output4name= "CutsDfromB_3ProngDs_CommonFramework";
662  output5name+="_bOnly";
663  }
664  else{
665  outputfile += ":PWG3_D2H_CFtaskDstoKKpiKeepDfromB_CommonFramework";
666  output1name="CFHFchist0allD_3ProngDstoKKpi_CommonFramework";
667  output3name+="_all";
668  output4name= "CutsallD_3ProngDs_CommonFramework";
669  output5name+="_all";
670  }
671 
672  outputfile += suffixDecayType.Data();
673  output1name+= suffixDecayType.Data();
674  output4name+= suffixDecayType.Data();
675  output5name+= suffixDecayType.Data();
676 
677  outputfile += suffixName.Data();
678  output1name+= suffixName.Data();
679  output4name+= suffixName.Data();
680  output5name+= suffixName.Data();
681 
682  //now comes user's output objects :
683  // output TH1I for event counting
684  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
685  // output Correction Framework Container (for acceptance & efficiency calculations)
686  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
687  // Unfolding - correlation matrix
688  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
689  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
690  // estimators list
691  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
692 
693  mgr->AddTask(task);
694 
695  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
696  mgr->ConnectOutput(task,1,coutput1);
697  mgr->ConnectOutput(task,2,coutput2);
698  mgr->ConnectOutput(task,3,coutput3);
699  mgr->ConnectOutput(task,4,coutput4);
700  mgr->ConnectOutput(task,5,coutput5);
701 
702  return task;
703 }
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)
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
void SetFillFromGenerated(Bool_t flag)
get corr manager
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
const Float_t normDecLXYmin
const Double_t cosmin
const Double_t cTmax
const Float_t centmin_0_10
void SetCentralitySelection(Bool_t centSelec=kTRUE)
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)
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)
slow configuration, all variables
const Float_t cosmaxXY
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:232
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:233
void SetSign(Char_t isSign)
Bool_t GetUseWeight() const
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