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