Code for computing MC efficiency for Lc->K0s+proton (Annalisa)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / AddTaskCFVertexingHFLctoV0bachelor.C
CommitLineData
5cd139bc 1//DEFINITION OF A FEW CONSTANTS
2const Double_t ptmin = 0.0;
3const Double_t ptmax = 6.0;
4const Double_t ymin = -1.2 ;
5const Double_t ymax = 1.2 ;
6const Double_t cosPAV0min = 0.95;
7const Double_t cosPAV0max = 1.02;
8const Int_t onFlymin = 0;
9const Int_t onFlymax = 2;
10const Float_t centmin = 0.;
11//const Float_t centmin_0_10 = 0.;
12//const Float_t centmax_0_10 = 10.;
13//const Float_t centmin_10_60 = 10.;
14//const Float_t centmax_10_60 = 60.;
15//const Float_t centmin_60_100 = 60.;
16//const Float_t centmax_60_100 = 100.;
17const Float_t centmax = 100.;
18const Int_t fakemin = 0;
19const Int_t fakemax = 3;
20const Float_t multmin = 0;
21//const Float_t multmin_0_20 = 0;
22//const Float_t multmax_0_20 = 20;
23//const Float_t multmin_20_50 = 20;
24//const Float_t multmax_20_50 = 50;
25//const Float_t multmin_50_102 = 50;
26//const Float_t multmax_50_102 = 102;
27const Float_t multmax = 102;
28
29const Double_t ptBachmin = 0.0;
30const Double_t ptBachmax = 5.0;
31const Double_t ptV0posmin = 0.0;
32const Double_t ptV0posmax = 5.0;
33const Double_t ptV0negmin = 0.0;
34const Double_t ptV0negmax = 5.0;
35const Double_t dcaV0min = 0.0; // nSigma
36const Double_t dcaV0max = 1.5; // nSigma
37const Double_t cTV0min = 0.0; // micron
38const Double_t cTV0max = 300; // micron
39const Double_t cTmin = 0.0; // micron
40const Double_t cTmax = 300; // micron
41const Float_t cosPAmin =-1.02;
42const Float_t cosPAmax = 1.02;
43
44const Double_t etamin = -0.9;
45const Double_t etamax = 0.9;
46//const Double_t zmin = -15.;
47//const Double_t zmax = 15.;
48
49
50//----------------------------------------------------
51
52AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "./LctoV0bachelorCuts.root",
53 Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB = kTRUE,
54 Bool_t isKeepDfromBOnly = kFALSE, Int_t pdgCode = 4122, Char_t isSign = 0, TString usercomment = "username")
55{
56
57
58 printf("Adding 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{
66 printf("The configuration is not defined! returning\n");
67 return;
68 }
69
70 gSystem->Sleep(2000);
71
72 // isSign = 0 --> K0S only
73 // isSign = 1 --> Lambda only
74 // isSign = 2 --> LambdaBar only
75 // isSign = 3 --> K0S and Lambda and LambdaBar
76
77 TString expected;
78 if (isSign == 0 && pdgCode < 0){
79 AliError(Form("Error setting PDG code (%d) and sign (0 --> K0S only): they are not compatible, returning"));
80 return 0x0;
81 }
82 else if (isSign == 1 && pdgCode < 0){
83 AliError(Form("Error setting PDG code (%d) and sign (1 --> Lambda only): they are not compatible, returning"));
84 return 0x0;
85 }
86 else if (isSign == 2 && pdgCode > 0){
87 AliError(Form("Error setting PDG code (%d) and sign (2 --> LambdaBar only): they are not compatible, returning"));
88 return 0x0;
89 }
90 else if (isSign > 3 || isSign < 0){
91 AliError(Form("Sign not valid (%d, possible values are 0, 1, 2, 3), returning"));
92 return 0x0;
93 }
94
95 TFile* fileCuts = TFile::Open(cutFile);
96 AliRDHFCuts *cutsLctoV0 = (AliRDHFCutsLctoV0*)fileCuts->Get("LctoV0AnalysisCuts");
97
98 // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
99 // for now the binning is the same than for all D's
100 if (isKeepDfromBOnly) isKeepDfromB = true;
101
102 Double_t massV0min = 0.47;
103 Double_t massV0max = 1.14;
104 if (isSign==0) {
105 massV0min = 0.47 ;
106 massV0max = 0.53 ;
107 } else if (isSign==1 || isSign==2) {
108 massV0min = 1.09;
109 massV0max = 1.14;
110 }
111
112 const Double_t phimin = 0.0;
113 const Double_t phimax = 2.*TMath::Pi();
114
115 const Int_t nbinpt = 6; //bins in pt from 0 to 6 GeV
116 const Int_t nbiny = 24; //bins in y
117 Int_t nbininvMassV0 = 60; //bins in invMassV0
118 if (isSign==3) nbininvMassV0=134; //bins in invMassV0
119 const Int_t nbinpointingV0 = 12; //bins in cosPointingAngleV0
120 const Int_t nbinonFly = 2; //bins in onFlyStatus x V0
121
122 const Int_t nbincent = 18; //bins in centrality (total number)
123 //const Int_t nbincent_0_10 = 4; //bins in centrality between 0 and 10
124 //const Int_t nbincent_10_60 = 10; //bins in centrality between 10 and 60
125 //const Int_t nbincent_60_100 = 4; //bins in centrality between 60 and 100
126
127 const Int_t nbinfake = 3; //bins in fake
128
129 const Int_t nbinmult = 48; //bins in multiplicity (total number)
130 //const Int_t nbinmult_0_20 = 20; //bins in multiplicity between 0 and 20
131 //const Int_t nbinmult_20_50 = 15; //bins in multiplicity between 20 and 50
132 //const Int_t nbinmult_50_102 = 13; //bins in multiplicity between 50 and 102
133
134
135 const Int_t nbinptBach = 50; //bins in pt from 0 to 5 GeV
136 const Int_t nbinptV0pos = 50; //bins in pt from 0 to 5 GeV
137 const Int_t nbinptV0neg = 50; //bins in pt from 0 to 5 GeV
138 const Int_t nbinphi = 18; //bins in Phi
139 const Int_t nbindcaV0 = 15; //bins in dcaV0
140 const Int_t nbincTV0 = 15; //bins in cTV0
141 const Int_t nbincT = 15; //bins in cT
142 const Int_t nbinpointing = 51; //bins in cosPointingAngle
143
144 //the sensitive variables, their indices
145
146 // variables' indices
147 const UInt_t ipT = 0;
148 const UInt_t iy = 1;
149 const UInt_t iphi = 2;
150 const UInt_t icosPAxV0 = 3;
151 const UInt_t ionFly = 4;
152 const UInt_t imult = 5;
153 const UInt_t ifake = 6;
154 const UInt_t icent = 7;
155
156 const UInt_t ipTbach = 8;
157 const UInt_t ipTposV0 = 9;
158 const UInt_t ipTnegV0 = 10;
159 const UInt_t iinvMassV0= 11;
160 const UInt_t idcaV0 = 12;
161 const UInt_t icTv0 = 13;
162 const UInt_t icT = 14;
163 const UInt_t icosPA = 15;
164
165 //Setting the bins: pt, ptPi, and ptK are considered seprately because for them you can either define the binning by hand, or using the cuts file
166
167 //arrays for the number of bins in each dimension
168
169 //if ( configuration ==AliCFTaskVertexingHF::kSnail)
170 const Int_t nvarTot = 16 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, z, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
171 //if ( configuration ==AliCFTaskVertexingHF::kCheetah)
172 //const Int_t nvarTot = 8 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, z, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
173
174 Int_t iBin[nvarTot];
175
176 //OPTION 1: defining the pt, ptPi, ptK bins by hand...
177 iBin[ipT]=nbinpt;
178 iBin[iy]=nbiny;
179 iBin[iphi]=nbinphi;
180 iBin[icosPAxV0]=nbinpointingV0;
181 iBin[ionFly]=nbinonFly;
182 iBin[imult]=nbinmult;
183 iBin[ifake]=nbinfake;
184 iBin[icent]=nbincent;
185
186 iBin[ipTbach]=nbinptBach;
187 iBin[ipTposV0]=nbinptV0pos;
188 iBin[ipTnegV0]=nbinptV0neg;
189 iBin[iinvMassV0]=nbininvMassV0;
190 iBin[idcaV0]=nbindcaV0;
191 iBin[icTv0]=nbincTV0;
192 iBin[icT]=nbincT;
193 iBin[icosPA]=nbinpointing;
194
195 // values for bin lower bounds
196
197 // pt
198 Double_t *binLimpT=new Double_t[iBin[0]+1];
199 for(Int_t i=0; i<=iBin[0]; i++) binLimpT[i]=(Double_t)ptmin + (ptmax-ptmin)/iBin[0]*(Double_t)i ;
200
201 // y
202 Double_t *binLimy=new Double_t[iBin[1]+1];
203 for(Int_t i=0; i<=iBin[1]; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin)/iBin[1]*(Double_t)i ;
204
205 // phi
206 Double_t *binLimphi=new Double_t[iBin[2]+1];
207 for(Int_t i=0; i<=iBin[2]; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin)/iBin[2]*(Double_t)i ;
208
209 // cosPointingAngleV0
210 Double_t *binLimcosPAV0=new Double_t[iBin[3]+1];
211 for(Int_t i=0; i<=iBin[3]; i++) binLimcosPAV0[i]=(Double_t)cosPAV0min + (cosPAV0max-cosPAV0min)/iBin[3]*(Double_t)i ;
212
213 // onTheFlyV0
214 Double_t *binLimonFlyV0=new Double_t[iBin[4]+1];
215 for(Int_t i=0; i<=iBin[4]; i++) binLimonFlyV0[i]=(Double_t)onFlymin + (onFlymax-onFlymin)/iBin[4]*(Double_t)i ;
216
217 // centrality
218 Double_t *binLimcent=new Double_t[iBin[5]+1];
219 for(Int_t i=0; i<=iBin[5]; i++) binLimcent[i]=(Double_t)centmin + (centmax-centmin)/iBin[5]*(Double_t)i ;
220 /*
221 Double_t *binLimcent_0_10=new Double_t[iBin[icent]+1];
222 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 ;
223 if (binLimcent[nbincent_0_10] != centmin_10_60) {
224 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
225 }
226
227 Double_t *binLimcent_10_60=new Double_t[iBin[icent]+1];
228 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 ;
229 if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
230 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
231 }
232
233 Double_t *binLimcent_60_100=new Double_t[iBin[icent]+1];
234 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 ;
235 */
236
237 // fake
238 Double_t *binLimfake=new Double_t[iBin[6]+1];
239 for(Int_t i=0; i<=iBin[6]; i++) binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/iBin[6] * (Double_t)i;
240
241 // multiplicity
242 Double_t *binLimmult=new Double_t[iBin[7]+1];
243 for(Int_t i=0; i<=iBin[7]; i++) binLimmult[i]=(Double_t)multmin + (multmax-multmin)/iBin[7]*(Double_t)i ;
244 /*
245 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 ;
246 if (binLimmult[nbinmult_0_20] != multmin_20_50) {
247 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
248 }
249 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 ;
250 if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102) {
251 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
252 }
253 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 ;
254 */
255
256
257 // ptBach
258 Double_t *binLimpTbach=new Double_t[iBin[8]+1];
259 for(Int_t i=0; i<=iBin[8]; i++) binLimpTbach[i]=(Double_t)ptBachmin + (ptBachmax-ptBachmin)/iBin[8]*(Double_t)i ;
260
261 // ptV0pos
262 Double_t *binLimpTV0pos=new Double_t[iBin[9]+1];
263 for(Int_t i=0; i<=iBin[9]; i++) binLimpTV0pos[i]=(Double_t)ptV0posmin + (ptV0posmax-ptV0posmin)/iBin[9]*(Double_t)i ;
264
265 // ptV0neg
266 Double_t *binLimpTV0neg=new Double_t[iBin[10]+1];
267 for(Int_t i=0; i<=iBin[10]; i++) binLimpTV0neg[i]=(Double_t)ptV0negmin + (ptV0negmax-ptV0negmin)/iBin[10]*(Double_t)i ;
268
269 // invMassV0
270 Double_t *binLimInvMassV0=new Double_t[iBin[11]+1];
271 for(Int_t i=0; i<=iBin[11]; i++) binLimInvMassV0[i]=(Double_t)massV0min + (massV0max-massV0min)/iBin[11]*(Double_t)i ;
272
273 // dcaV0
274 Double_t *binLimdcaV0=new Double_t[iBin[12]+1];
275 for(Int_t i=0; i<=iBin[12]; i++) binLimdcaV0[i]=(Double_t)dcaV0min + (dcaV0max-dcaV0min)/iBin[12]*(Double_t)i ;
276
277 // cTV0
278 Double_t *binLimcTV0=new Double_t[iBin[13]+1];
279 for(Int_t i=0; i<=iBin[13]; i++) binLimcTV0[i]=(Double_t)cTV0min + (cTV0max-cTV0min)/iBin[13]*(Double_t)i ;
280
281 // cT
282 Double_t *binLimcT=new Double_t[iBin[14]+1];
283 for(Int_t i=0; i<=iBin[14]; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin)/iBin[14]*(Double_t)i ;
284
285 // cosPointingAngle
286 Double_t *binLimcosPA=new Double_t[iBin[15]+1];
287 for(Int_t i=0; i<=iBin[15]; i++) binLimcosPA[i]=(Double_t)cosPAmin + (cosPAmax-cosPAmin)/iBin[15]*(Double_t)i ;
288
289
290
291 // z Primary Vertex
292 //for(Int_t i=0; i<=nbinzvtx; i++) binLimzvtx[i]=(Double_t)zmin + (zmax-zmin) /nbinzvtx*(Double_t)i ;
293
294
295 //OPTION 2: ...or from the cuts file
296 /*
297 const Int_t nbinpt = cutsLctoV0->GetNPtBins(); // bins in pT
298 iBin[ipT]=nbinpt;
299 iBin[ipTpi]=nbinpt;
300 iBin[ipTk]=nbinpt;
301 Double_t *binLimpT=new Double_t[iBin[ipT]+1];
302 Double_t *binLimpTpi=new Double_t[iBin[ipTpi]+1];
303 Double_t *binLimpTk=new Double_t[iBin[ipTk]+1];
304 // values for bin lower bounds
305 Float_t* floatbinLimpT = cutsLctoV0->GetPtBinLimits();
306 for (Int_t ibin0 = 0 ; ibin0<iBin[ipT]+1; ibin0++){
307 binLimpT[ibin0] = (Double_t)floatbinLimpT[ibin0];
308 binLimpTpi[ibin0] = (Double_t)floatbinLimpT[ibin0];
309 binLimpTk[ibin0] = (Double_t)floatbinLimpT[ibin0];
310 }
311 for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
312
313 printf("pT: nbin (from cuts file) = %d\n",nbinpt);
314
315 // defining now the binning for the other variables:
316
317 iBin[iy]=nbiny;
318 iBin[icosThetaStar]=nbincosThetaStar;
319 iBin[icT]=nbincT;
320 iBin[idca]=nbindca;
321 iBin[id0xd0]=nbind0xd0;
322 iBin[ipointing]=nbinpointing;
323 iBin[iphi]=nbinphi;
324 iBin[izvtx]=nbinzvtx;
325 iBin[icent]=nbincent;
326 iBin[ifake]=nbinfake;
327 iBin[ipointingXY]=nbinpointingXY;
328 iBin[inormDecayLXY]=nbinnormDecayLXY;
329 iBin[imult]=nbinmult;
330
331 //arrays for lower bounds :
332 Double_t *binLimy=new Double_t[iBin[iy]+1];
333 Double_t *binLimcosThetaStar=new Double_t[iBin[icosThetaStar]+1];
334 Double_t *binLimcT=new Double_t[iBin[icT]+1];
335 Double_t *binLimdca=new Double_t[iBin[idca]+1];
336 Double_t *binLimd0xd0=new Double_t[iBin[id0xd0]+1];
337 Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
338 Double_t *binLimphi=new Double_t[iBin[iphi]+1];
339 Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
340 Double_t *binLimcent=new Double_t[iBin[icent]+1];
341 Double_t *binLimfake=new Double_t[iBin[ifake]+1];
342 Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
343 Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
344 Double_t *binLimmult=new Double_t[iBin[imult]+1];
345
346 // y
347 for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
348
349 // cosThetaStar
350 for(Int_t i=0; i<=nbincosThetaStar; i++) binLimcosThetaStar[i]=(Double_t)cosminTS + (cosmaxTS-cosminTS) /nbincosThetaStar*(Double_t)i ;
351
352 // cT
353 for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
354
355 // dca
356 for(Int_t i=0; i<=nbindca; i++) binLimdca[i]=(Double_t)dcamin + (dcamax-dcamin) /nbindca*(Double_t)i ;
357
358 // d0xd0
359 for(Int_t i=0; i<=nbind0xd0; i++) binLimd0xd0[i]=(Double_t)d0xd0min + (d0xd0max-d0xd0min) /nbind0xd0*(Double_t)i ;
360
361 // cosPointingAngle
362 for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
363
364 // Phi
365 for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
366
367 // z Primary Vertex
368 for(Int_t i=0; i<=nbinzvtx; i++) {
369 binLimzvtx[i]=(Double_t)zmin + (zmax-zmin) /nbinzvtx*(Double_t)i ;
370 }
371
372 // centrality
373 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 ;
374 if (binLimcent[nbincent_0_10] != centmin_10_60) {
375 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
376 }
377 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 ;
378 if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
379 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
380 }
381 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 ;
382
383 // fake
384 for(Int_t i=0; i<=nbinfake; i++) {
385 binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
386 }
387
388 // multiplicity
389 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 ;
390 if (binLimmult[nbinmult_0_20] != multmin_20_50) {
391 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
392 }
393 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 ;
394 if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102) {
395 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
396 }
397 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 ;
398 */
399
400
401
402 //one "container" for MC
403 TString nameContainer="";
404 if (!isKeepDfromB) {
405 nameContainer="CFHFccontainer0_CommonFramework_"+usercomment;
406 }
407 else if (isKeepDfromBOnly) {
408 nameContainer="CFHFccontainer0LcfromB_CommonFramework_"+usercomment;
409 }
410 else {
411 nameContainer="CFHFccontainer0allLc_CommonFramework_"+usercomment;
412 }
413
414 //Setting up the container grid...
415
416 //CONTAINER DEFINITION
417 Info("AliCFTaskVertexingHF","SETUP CONTAINER");
418 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
419
420 AliCFContainer* container;
421 if (configuration == AliCFTaskVertexingHF::kSnail) {
422 container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
423 }
424 else if (configuration == AliCFTaskVertexingHF::kCheetah) {
425 container = new AliCFContainer(nameContainer,"container for tracks",nstep,8,iBin);
426 }
427
428 //setting the bin limits
429 container -> SetBinLimits(0,binLimpT);
430 container -> SetBinLimits(1,binLimy);
431 container -> SetBinLimits(2,binLimphi);
432 container -> SetBinLimits(3,binLimcosPAV0);
433 container -> SetBinLimits(4,binLimonFlyV0);
434 container -> SetBinLimits(5,binLimcent);
435 container -> SetBinLimits(6,binLimfake);
436 container -> SetBinLimits(7,binLimmult);
437
438 container -> SetVarTitle(0,"pt");
439 container -> SetVarTitle(1,"y");
440 container -> SetVarTitle(2,"phi");
441 container -> SetVarTitle(3,"cosPA -V0-");
442 container -> SetVarTitle(4,"onFlyV0");
443 container -> SetVarTitle(5,"centrality");
444 container -> SetVarTitle(6,"fake");
445 container -> SetVarTitle(7,"multiplicity");
446
447 if (configuration == AliCFTaskVertexingHF::kSnail) {
448 container -> SetBinLimits(8,binLimpTbach);
449 container -> SetBinLimits(9,binLimpTV0pos);
450 container -> SetBinLimits(10,binLimpTV0neg);
451 container -> SetBinLimits(11,binLimInvMassV0);
452 container -> SetBinLimits(12,binLimdcaV0);
453 container -> SetBinLimits(13,binLimcTV0);
454 container -> SetBinLimits(14,binLimcT);
455 container -> SetBinLimits(15,binLimcosPA);
456
457 container -> SetVarTitle(8,"ptBachelor");
458 container -> SetVarTitle(9,"ptV0pos");
459 container -> SetVarTitle(10,"ptV0neg");
460 container -> SetVarTitle(11,"mV0");
461 container -> SetVarTitle(12,"DCA -V0-");
462 container -> SetVarTitle(13,"c#tau -V0-");
463 container -> SetVarTitle(14,"c#tau");
464 container -> SetVarTitle(15,"cosPA");
465 }
466
467 container -> SetStepTitle(0, "MCLimAcc");
468 container -> SetStepTitle(1, "MC");
469 container -> SetStepTitle(2, "MCAcc");
470 container -> SetStepTitle(3, "RecoVertex");
471 container -> SetStepTitle(4, "RecoRefit");
472 container -> SetStepTitle(5, "Reco");
473 container -> SetStepTitle(6, "RecoAcc");
474 container -> SetStepTitle(7, "RecoITSCluster");
475 container -> SetStepTitle(8, "RecoCuts");
476 container -> SetStepTitle(9, "RecoPID");
477
478 //return container;
479
480 //CREATE THE CUTS -----------------------------------------------
481
482 // Gen-Level kinematic cuts
483 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
484
485 //Particle-Level cuts:
486 AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
487 Bool_t useAbsolute = kTRUE;
488 if (isSign != 3 && isSign!=0) {
489 useAbsolute = kFALSE;
490 }
491 mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include Lc-
492 mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
493
494 // Acceptance cuts:
495 AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
496 AliCFTrackKineCuts * kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
497 kineAccCuts->SetPtRange(ptmin,ptmax);
498 kineAccCuts->SetEtaRange(etamin,etamax);
499
500 // Rec-Level kinematic cuts
501 AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
502
503 AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
504
505 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
506
507 printf("CREATE MC KINE CUTS\n");
508 TObjArray* mcList = new TObjArray(0) ;
509 mcList->AddLast(mcKineCuts);
510 mcList->AddLast(mcGenCuts);
511
512 printf("CREATE ACCEPTANCE CUTS\n");
513 TObjArray* accList = new TObjArray(0) ;
514 accList->AddLast(kineAccCuts);
515
516 printf("CREATE RECONSTRUCTION CUTS\n");
517 TObjArray* recList = new TObjArray(0) ; // not used!!
518 recList->AddLast(recKineCuts);
519 recList->AddLast(recQualityCuts);
520 recList->AddLast(recIsPrimaryCuts);
521
522 TObjArray* emptyList = new TObjArray(0);
523
524 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
525 printf("CREATE INTERFACE AND CUTS\n");
526 AliCFManager* man = new AliCFManager() ;
527 man->SetParticleContainer(container);
528 man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
529 man->SetParticleCutsList(1 , mcList); // MC
530 man->SetParticleCutsList(2 , accList); // Acceptance
531 man->SetParticleCutsList(3 , emptyList); // Vertex
532 man->SetParticleCutsList(4 , emptyList); // Refit
533 man->SetParticleCutsList(5 , emptyList); // AOD
534 man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
535 man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
536 man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
537 man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
538
539 // Get the pointer to the existing analysis manager via the static access method.
540 //==============================================================================
541 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
542 if (!mgr) {
543 ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
544 return NULL;
545 }
546 //CREATE THE TASK
547 printf("CREATE TASK\n");
548
549 // create the task
550 AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsLctoV0);
551 task->SetConfiguration(configuration);
552 task->SetFillFromGenerated(kFALSE);
553 task->SetCFManager(man); //here is set the CF manager
554 task->SetDecayChannel(22);//kLctoV0bachelor
555 task->SetUseWeight(kFALSE);
556 task->SetSign(isSign);
557 task->SetCentralitySelection(kFALSE);
558 task->SetFakeSelection(0);
559 task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
560 task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
561
562 if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
563 if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
564
565 TF1* funcWeight = 0x0;
566 if (task->GetUseWeight()) {
567 funcWeight = (TF1*)fileCuts->Get("funcWeight");
568 if (funcWeight == 0x0){
569 Printf("FONLL Weights will be used");
570 }
571 else {
572 task->SetWeightFunction(funcWeight);
573 Printf("User-defined Weights will be used. The function being:");
574 task->GetWeightFunction(funcWeight)->Print();
575 }
576 }
577
578 Printf("***************** CONTAINER SETTINGS *****************");
579 Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
580 Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
581 Printf("Dselection = %d",(Int_t)task->GetDselection());
582 Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
583 if (task->GetUseWeight()) {
584 Printf("User-defined Weight function:");
585 task->GetWeightFunction(funcWeight)->Print();
586 }
587 else {
588 Printf("FONLL will be used for the weights");
589 }
590 Printf("Sign = %d",(Int_t)task->GetSign());
591 Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
592 Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
593 Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
594 Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
595 Printf("***************END CONTAINER SETTINGS *****************\n");
596
597 //-----------------------------------------------------------//
598 // create correlation matrix for unfolding - only eta-pt //
599 //-----------------------------------------------------------//
600
601 Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
602
603 Int_t thnDim[4];
604
605 //first half : reconstructed
606 //second half : MC
607
608 thnDim[0] = iBin[0];
609 thnDim[2] = iBin[0];
610 thnDim[1] = iBin[1];
611 thnDim[3] = iBin[1];
612
613 TString nameCorr="";
614 if (!isKeepDfromB) {
615 nameCorr="CFHFcorr0_CommonFramework_"+usercomment;
616 }
617 else if (isKeepDfromBOnly) {
618 nameCorr= "CFHFcorr0KeepDfromBOnly_CommonFramework_"+usercomment;
619 }
620 else {
621 nameCorr="CFHFcorr0allLc_CommonFramework_"+usercomment;
622 }
623
624 THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
625 Double_t** binEdges = new Double_t[2];
626
627 // set bin limits
628
629 binEdges[0]= binLimpT;
630 binEdges[1]= binLimy;
631
632 correlation->SetBinEdges(0,binEdges[0]);
633 correlation->SetBinEdges(2,binEdges[0]);
634
635 correlation->SetBinEdges(1,binEdges[1]);
636 correlation->SetBinEdges(3,binEdges[1]);
637
638 correlation->Sumw2();
639
640 // correlation matrix ready
641 //------------------------------------------------//
642
643 task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
644
645 // Create and connect containers for input/output
646
647 // ------ input data ------
648 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
649
650 // ----- output data -----
651
652 TString outputfile = AliAnalysisManager::GetCommonFileName();
653 TString output1name="", output2name="", output3name="",output4name="";
654 output2name=nameContainer;
655 output3name=nameCorr;
656 if (!isKeepDfromB) {
657 outputfile += ":PWG3_D2H_CFtaskLctoK0Sp_CommonFramework_"+usercomment;
658 output1name="CFHFchist0_CommonFramework_"+usercomment;
659 output4name= "Cuts_CommonFramework_"+usercomment;
660 }
661 else if (isKeepDfromBOnly) {
662 outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromBOnly_CommonFramework_"+usercomment;
663 output1name="CFHFchist0DfromB_CommonFramework_"+usercomment;
664 output4name= "Cuts_CommonFramework_DfromB_"+usercomment;
665 }
666 else {
667 outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromB_CommonFramework_"+usercomment;
668 output1name="CFHFchist0allLc_CommonFramework_"+usercomment;
669 output4name= "Cuts_CommonFramework_allLc_"+usercomment;
670 }
671
672 //now comes user's output objects :
673 // output TH1I for event counting
674 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
675 // output Correction Framework Container (for acceptance & efficiency calculations)
676 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
677 // Unfolding - correlation matrix
678 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
679 // cuts
680 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
681
682 mgr->AddTask(task);
683
684 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
685 mgr->ConnectOutput(task,1,coutput1);
686 mgr->ConnectOutput(task,2,coutput2);
687 mgr->ConnectOutput(task,3,coutput3);
688 mgr->ConnectOutput(task,4,coutput4);
689 return task;
690
691}