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