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