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