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