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