]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/macros/AddTaskCFVertexingHFLctoV0bachelor.C
Add possibility of fine Ntracklets bin (bins of 1 unit till 100 for pp, 200 for pPb)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / AddTaskCFVertexingHFLctoV0bachelor.C
CommitLineData
5cd139bc 1//DEFINITION OF A FEW CONSTANTS
85036182 2const Double_t ptmin = 0.0;
3const Double_t ptmax = 9999.0;
4const Double_t etamin = -0.9;
5const Double_t etamax = 0.9;
5cd139bc 6const Double_t ymin = -1.2 ;
7const Double_t ymax = 1.2 ;
53c91ed7 8
9const Double_t zmin = -15.;
10const Double_t zmax = 15.;
bd5b1c03 11const Float_t centmin = 0.;
5cd139bc 12const Float_t centmax = 100.;
85036182 13const Float_t fakemin = -0.5;
14const Float_t fakemax = 2.5;
15const Float_t multmin = 0.;
85036182 16const Float_t multmax = 102.;
5cd139bc 17
53c91ed7 18const Double_t cosPAV0min = 0.985;
19const Double_t cosPAV0max = 1.005;
20const Float_t onFlymin = -0.5;
21const Float_t onFlymax = 1.5;
22const Double_t pBachmin = 0.0;
23const Double_t pBachmax = 30.0;
24const Double_t ptV0min = 0.0;
25const Double_t ptV0max = 30.0;
26const Double_t yV0min =-1.2;
27const Double_t yV0max = 1.2;
28const Double_t dcaV0min = 0.0; // nSigma
29const Double_t dcaV0max = 1.5; // nSigma
5cd139bc 30const Double_t cTV0min = 0.0; // micron
31const Double_t cTV0max = 300; // micron
32const Double_t cTmin = 0.0; // micron
33const Double_t cTmax = 300; // micron
85036182 34const Float_t cosPAmin =-1.05;
35const Float_t cosPAmax = 1.05;
5cd139bc 36
53c91ed7 37
5cd139bc 38//----------------------------------------------------
39
40AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "./LctoV0bachelorCuts.root",
85036182 41 Bool_t rejectIfNotFromQuark=kTRUE,
42 //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kFALSE, // all in
43 Bool_t isKeepDfromB = kFALSE, Bool_t isKeepDfromBOnly = kFALSE, // prompt
44 //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kTRUE, // no-prompt
45 Int_t configuration = AliCFTaskVertexingHF::kCheetah,
46 Int_t pdgCode = 4122, Char_t isSign = 2, Char_t lcToV0bachelorDecayMode = 0,
ff12b981 47 TString usercomment = "username")
5cd139bc 48{
49
50
51 printf("Adding CF task using cuts from file %s\n",cutFile);
52 if (configuration == AliCFTaskVertexingHF::kSnail){
53 printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
54 }
55 else if (configuration == AliCFTaskVertexingHF::kCheetah){
56 printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
57 }
58 else{
59 printf("The configuration is not defined! returning\n");
60 return;
61 }
62
63 gSystem->Sleep(2000);
64
ff12b981 65 // isSign = 0 --> Lc+ only
66 // isSign = 1 --> Lc- only
67 // isSign = 2 --> Lc+ and Lc-
5cd139bc 68
69 TString expected;
70 if (isSign == 0 && pdgCode < 0){
ff12b981 71 AliError(Form("Error setting PDG code (%d) and sign (0 --> Lc+ only): they are not compatible, returning",pdgCode));
5cd139bc 72 return 0x0;
73 }
ff12b981 74 else if (isSign == 1 && pdgCode > 0){
75 AliError(Form("Error setting PDG code (%d) and sign (1 --> Lc- only): they are not compatible, returning",pdgCode));
5cd139bc 76 return 0x0;
77 }
ff12b981 78 else if (isSign > 2 || isSign < 0){
79 AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning",isSign));
5cd139bc 80 return 0x0;
81 }
82
83 TFile* fileCuts = TFile::Open(cutFile);
84 AliRDHFCuts *cutsLctoV0 = (AliRDHFCutsLctoV0*)fileCuts->Get("LctoV0AnalysisCuts");
85
86 // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
87 // for now the binning is the same than for all D's
88 if (isKeepDfromBOnly) isKeepDfromB = true;
89
90 Double_t massV0min = 0.47;
91 Double_t massV0max = 1.14;
ff12b981 92 if (lcToV0bachelorDecayMode==0) {
5cd139bc 93 massV0min = 0.47 ;
94 massV0max = 0.53 ;
ff12b981 95 } else if (lcToV0bachelorDecayMode==1) {
5cd139bc 96 massV0min = 1.09;
97 massV0max = 1.14;
98 }
99
53c91ed7 100 const Double_t phimin = 0.;
5cd139bc 101 const Double_t phimax = 2.*TMath::Pi();
53c91ed7 102 const Double_t phiV0min = 0.;
103 const Double_t phiV0max = 2.*TMath::Pi();
104
105 const Int_t nbinZvtx = 30; //bins in centrality (total number)
106 const Int_t nbincent =18+1; //bins in centrality (total number)
107 const Int_t nbinfake = 3; //bins in fake
108 const Int_t nbinmult = 48; //bins in multiplicity (total number)
109
110 const Int_t nbinpt = 11; //bins in pt from 0,1,2,3,4,5,6,8,12,17,25,35 GeV
111 const Int_t nbiny = 24; //bins in y Lc
112 const Int_t nbinphi = 18; //bins in phi Lc
113 const Int_t nbinonFly = 2; //bins in onFlyStatus x V0
114
115 const Int_t nbinpBach = 300; //bins in pt from 0 to 30 GeV
116 const Int_t nbinptV0 = 300; //bins in pt from 0 to 30 GeV
117 const Int_t nbinyV0 = 24; //bins in y V0
118 const Int_t nbinphiV0 = 18; //bins in phi V0
119 const Int_t nbindcaV0 = 150; //bins in dcaV0
120 const Int_t nbininvMassV0 = 60; //bins in invMassV0
121 const Int_t nbinpointingV0 = 42; //bins in cosPointingAngleV0
122 const Int_t nbinpointing = 42; //bins in cosPointingAngle
123
124 //const Int_t nbincTV0 = 15; //bins in cTV0
125 //const Int_t nbincT = 15; //bins in cT
5cd139bc 126
127 //the sensitive variables, their indices
128
129 // variables' indices
130 const UInt_t ipT = 0;
131 const UInt_t iy = 1;
132 const UInt_t iphi = 2;
53c91ed7 133 const UInt_t ionFly = 3;
134 const UInt_t iZvtx = 4;
e413c25a 135 const UInt_t icent = 5;
5cd139bc 136 const UInt_t ifake = 6;
e413c25a 137 const UInt_t imult = 7;
5cd139bc 138
53c91ed7 139 const UInt_t ipbach = 8;
140 const UInt_t ipTV0 = 9;
141 const UInt_t iyV0 = 10;
142 const UInt_t iphiV0 = 11;
143 const UInt_t iinvMassV0= 12;
144 const UInt_t idcaV0 = 13;
145 const UInt_t icosPAxV0 = 14;
5cd139bc 146 const UInt_t icosPA = 15;
53c91ed7 147 //const UInt_t icTv0 = 16;
148 //const UInt_t icT = 17;
5cd139bc 149
150 //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
151
152 //arrays for the number of bins in each dimension
153
154 //if ( configuration ==AliCFTaskVertexingHF::kSnail)
53c91ed7 155 const Int_t nvarTot = 16 ; //number of variables on the grid
5cd139bc 156 //if ( configuration ==AliCFTaskVertexingHF::kCheetah)
53c91ed7 157 //const Int_t nvarTot = 8 ; //number of variables on the grid
5cd139bc 158
159 Int_t iBin[nvarTot];
160
161 //OPTION 1: defining the pt, ptPi, ptK bins by hand...
162 iBin[ipT]=nbinpt;
163 iBin[iy]=nbiny;
164 iBin[iphi]=nbinphi;
5cd139bc 165 iBin[ionFly]=nbinonFly;
53c91ed7 166 iBin[iZvtx]=nbinZvtx;
5cd139bc 167 iBin[icent]=nbincent;
e413c25a 168 iBin[ifake]=nbinfake;
169 iBin[imult]=nbinmult;
5cd139bc 170
53c91ed7 171 iBin[ipbach]=nbinpBach;
172 iBin[ipTV0]=nbinptV0;
173 iBin[iyV0]=nbinyV0;
174 iBin[iphiV0]=nbinphiV0;
5cd139bc 175 iBin[iinvMassV0]=nbininvMassV0;
176 iBin[idcaV0]=nbindcaV0;
53c91ed7 177 iBin[icosPAxV0]=nbinpointingV0;
5cd139bc 178 iBin[icosPA]=nbinpointing;
53c91ed7 179 //iBin[icTv0]=nbincTV0;
180 //iBin[icT]=nbincT;
5cd139bc 181
182 // values for bin lower bounds
183
184 // pt
53c91ed7 185 Double_t *binLimpT=new Double_t[iBin[ipT]+1];
186 binLimpT[ 0]= 0.;
187 binLimpT[ 1]= 1.;
188 binLimpT[ 2]= 2.;
189 binLimpT[ 3]= 3.;
190 binLimpT[ 4]= 4.;
191 binLimpT[ 5]= 5.;
192 binLimpT[ 6]= 6.;
193 binLimpT[ 7]= 8.;
194 binLimpT[ 8]=12.;
195 binLimpT[ 9]=17.;
196 binLimpT[10]=25.;
197 binLimpT[11]=35.;
5cd139bc 198
199 // y
53c91ed7 200 Double_t *binLimy=new Double_t[iBin[iy]+1];
201 for(Int_t i=0; i<=iBin[iy]; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin)/iBin[iy]*(Double_t)i ;
5cd139bc 202
203 // phi
53c91ed7 204 Double_t *binLimphi=new Double_t[iBin[iphi]+1];
205 for(Int_t i=0; i<=iBin[iphi]; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin)/iBin[iphi]*(Double_t)i ;
5cd139bc 206
207 // onTheFlyV0
53c91ed7 208 Double_t *binLimonFlyV0=new Double_t[iBin[ionFly]+1];
209 for(Int_t i=0; i<=iBin[ionFly]; i++) binLimonFlyV0[i]=(Double_t)onFlymin + (onFlymax-onFlymin)/iBin[ionFly]*(Double_t)i ;
210
211 // z Primary Vertex
212 Double_t *binLimzvtx=new Double_t[iBin[iZvtx]+1];
213 for(Int_t i=0; i<=nbinZvtx; i++) binLimzvtx[i]=(Double_t)zmin + (zmax-zmin)/iBin[iZvtx]*(Double_t)i ;
5cd139bc 214
215 // centrality
53c91ed7 216 Double_t *binLimcent=new Double_t[iBin[icent]+1];
217 binLimcent[0]=centmin;
bd5b1c03 218 for(Int_t i=1; i<=iBin[icent]; i++) binLimcent[i]=centmin + (centmax-centmin)/iBin[icent]*(Double_t)i;
53c91ed7 219
5cd139bc 220 // fake
53c91ed7 221 Double_t *binLimfake=new Double_t[iBin[ifake]+1];
222 for(Int_t i=0; i<=iBin[ifake]; i++) binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/iBin[ifake] * (Double_t)i;
5cd139bc 223
224 // multiplicity
53c91ed7 225 Double_t *binLimmult=new Double_t[iBin[imult]+1];
226 for(Int_t i=0; i<=iBin[imult]; i++) binLimmult[i]=(Double_t)multmin + (multmax-multmin)/iBin[imult]*(Double_t)i ;
227
228
229 // pBach
230 Double_t *binLimpbach=new Double_t[iBin[ipbach]+1];
231 for(Int_t i=0; i<=iBin[ipbach]; i++) binLimpbach[i]=(Double_t)pBachmin + (pBachmax-pBachmin)/iBin[ipbach]*(Double_t)i ;
5cd139bc 232
53c91ed7 233 // ptV0
234 Double_t *binLimpTV0=new Double_t[iBin[ipTV0]+1];
235 for(Int_t i=0; i<=iBin[ipTV0]; i++) binLimpTV0[i]=(Double_t)ptV0min + (ptV0max-ptV0min)/iBin[ipTV0]*(Double_t)i ;
5cd139bc 236
53c91ed7 237 // yV0
238 Double_t *binLimyV0=new Double_t[iBin[iyV0]+1];
239 for(Int_t i=0; i<=iBin[iyV0]; i++) binLimyV0[i]=(Double_t)yV0min + (yV0max-yV0min)/iBin[iyV0]*(Double_t)i ;
5cd139bc 240
53c91ed7 241 // phiV0
242 Double_t *binLimphiV0=new Double_t[iBin[iphiV0]+1];
243 for(Int_t i=0; i<=iBin[iphiV0]; i++) binLimphiV0[i]=(Double_t)phiV0min + (phiV0max-phiV0min)/iBin[iphiV0]*(Double_t)i ;
5cd139bc 244
245 // invMassV0
53c91ed7 246 Double_t *binLimInvMassV0=new Double_t[iBin[iinvMassV0]+1];
247 for(Int_t i=0; i<=iBin[iinvMassV0]; i++) binLimInvMassV0[i]=(Double_t)massV0min + (massV0max-massV0min)/iBin[iinvMassV0]*(Double_t)i ;
5cd139bc 248
249 // dcaV0
53c91ed7 250 Double_t *binLimdcaV0=new Double_t[iBin[idcaV0]+1];
251 for(Int_t i=0; i<=iBin[idcaV0]; i++) binLimdcaV0[i]=(Double_t)dcaV0min + (dcaV0max-dcaV0min)/iBin[idcaV0]*(Double_t)i ;
5cd139bc 252
53c91ed7 253 // cosPointingAngleV0
254 Double_t *binLimcosPAV0=new Double_t[iBin[icosPAxV0]+1];
255 for(Int_t i=0; i<=iBin[icosPAxV0]; i++) binLimcosPAV0[i]=(Double_t)cosPAV0min + (cosPAV0max-cosPAV0min)/iBin[icosPAxV0]*(Double_t)i ;
256
257 // cosPointingAngle
258 Double_t *binLimcosPA=new Double_t[iBin[icosPA]+1];
259 for(Int_t i=0; i<=iBin[icosPA]; i++) binLimcosPA[i]=(Double_t)cosPAmin + (cosPAmax-cosPAmin)/iBin[icosPA]*(Double_t)i ;
260
261 /*
5cd139bc 262 // cTV0
53c91ed7 263 Double_t *binLimcTV0=new Double_t[iBin[icTv0]+1];
264 for(Int_t i=0; i<=iBin[icTv0]; i++) binLimcTV0[i]=(Double_t)cTV0min + (cTV0max-cTV0min)/iBin[icTv0]*(Double_t)i ;
5cd139bc 265
266 // cT
53c91ed7 267 Double_t *binLimcT=new Double_t[iBin[icT]+1];
268 for(Int_t i=0; i<=iBin[icT]; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin)/iBin[icT]*(Double_t)i ;
269 */
5cd139bc 270
5cd139bc 271
5cd139bc 272 //one "container" for MC
273 TString nameContainer="";
274 if (!isKeepDfromB) {
275 nameContainer="CFHFccontainer0_CommonFramework_"+usercomment;
276 }
277 else if (isKeepDfromBOnly) {
278 nameContainer="CFHFccontainer0LcfromB_CommonFramework_"+usercomment;
279 }
280 else {
281 nameContainer="CFHFccontainer0allLc_CommonFramework_"+usercomment;
282 }
283
284 //Setting up the container grid...
285
286 //CONTAINER DEFINITION
287 Info("AliCFTaskVertexingHF","SETUP CONTAINER");
288 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
289
290 AliCFContainer* container;
291 if (configuration == AliCFTaskVertexingHF::kSnail) {
292 container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
293 }
294 else if (configuration == AliCFTaskVertexingHF::kCheetah) {
295 container = new AliCFContainer(nameContainer,"container for tracks",nstep,8,iBin);
296 }
297
298 //setting the bin limits
53c91ed7 299 container -> SetBinLimits(ipT,binLimpT);
300 container -> SetBinLimits(iy,binLimy);
301 container -> SetBinLimits(iphi,binLimphi);
302 container -> SetBinLimits(ionFly,binLimonFlyV0);
303 container -> SetBinLimits(iZvtx,binLimzvtx);
304 container -> SetBinLimits(icent,binLimcent);
305 container -> SetBinLimits(ifake,binLimfake);
306 container -> SetBinLimits(imult,binLimmult);
307
308 container -> SetVarTitle(ipT,"p_{T}(#Lambda_{c}) [GeV/c]");
309 container -> SetVarTitle(iy,"y(#Lambda_{c})");
310 container -> SetVarTitle(iphi,"#phi(#Lambda_{c}) [rad]");
311 container -> SetVarTitle(ionFly,"onTheFlyStatusV0");
312 container -> SetVarTitle(iZvtx,"z_{vtx} [cm]");
313 container -> SetVarTitle(icent,"centrality");
314 container -> SetVarTitle(ifake,"fake");
315 container -> SetVarTitle(imult,"multiplicity");
5cd139bc 316
317 if (configuration == AliCFTaskVertexingHF::kSnail) {
53c91ed7 318 container -> SetBinLimits(ipbach,binLimpbach);
319 container -> SetBinLimits(ipTV0,binLimpTV0);
320 container -> SetBinLimits(iyV0,binLimyV0);
321 container -> SetBinLimits(iphiV0,binLimphiV0);
322 container -> SetBinLimits(iinvMassV0,binLimInvMassV0);
323 container -> SetBinLimits(idcaV0,binLimdcaV0);
324 container -> SetBinLimits(icosPAxV0,binLimcosPAV0);
325 container -> SetBinLimits(icosPA,binLimcosPA);
326 //container -> SetBinLimits(,binLimcTV0);
327 //container -> SetBinLimits(,binLimcT);
328
329 container -> SetVarTitle(ipbach,"p(bachelor) [GeV/c]");
330 container -> SetVarTitle(ipTV0,"p_{T}(V0) [GeV/c]");
331 container -> SetVarTitle(iyV0,"y(V0)");
332 container -> SetVarTitle(iphiV0,"#varphi(V0) [rad]");
333 container -> SetVarTitle(iinvMassV0,"m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]");
334 container -> SetVarTitle(idcaV0,"DCA(V0) [n#sigma]");
335 container -> SetVarTitle(icosPAxV0,"cosine pointing angle(V0)");
336 container -> SetVarTitle(icosPA,"cosine pointing angle (#Lambda_{c})");
337 //container -> SetVarTitle(,"c#tau -V0-");
338 //container -> SetVarTitle(,"c#tau");
5cd139bc 339 }
340
341 container -> SetStepTitle(0, "MCLimAcc");
342 container -> SetStepTitle(1, "MC");
343 container -> SetStepTitle(2, "MCAcc");
344 container -> SetStepTitle(3, "RecoVertex");
345 container -> SetStepTitle(4, "RecoRefit");
346 container -> SetStepTitle(5, "Reco");
347 container -> SetStepTitle(6, "RecoAcc");
348 container -> SetStepTitle(7, "RecoITSCluster");
349 container -> SetStepTitle(8, "RecoCuts");
350 container -> SetStepTitle(9, "RecoPID");
351
352 //return container;
353
354 //CREATE THE CUTS -----------------------------------------------
355
356 // Gen-Level kinematic cuts
357 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
358
359 //Particle-Level cuts:
360 AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
361 Bool_t useAbsolute = kTRUE;
ff12b981 362 if (isSign != 2) {
5cd139bc 363 useAbsolute = kFALSE;
364 }
365 mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include Lc-
366 mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
367
368 // Acceptance cuts:
369 AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
370 AliCFTrackKineCuts * kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
371 kineAccCuts->SetPtRange(ptmin,ptmax);
372 kineAccCuts->SetEtaRange(etamin,etamax);
373
374 // Rec-Level kinematic cuts
375 AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
376
377 AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
378
379 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
380
381 printf("CREATE MC KINE CUTS\n");
382 TObjArray* mcList = new TObjArray(0) ;
383 mcList->AddLast(mcKineCuts);
384 mcList->AddLast(mcGenCuts);
385
386 printf("CREATE ACCEPTANCE CUTS\n");
387 TObjArray* accList = new TObjArray(0) ;
388 accList->AddLast(kineAccCuts);
389
390 printf("CREATE RECONSTRUCTION CUTS\n");
391 TObjArray* recList = new TObjArray(0) ; // not used!!
392 recList->AddLast(recKineCuts);
393 recList->AddLast(recQualityCuts);
394 recList->AddLast(recIsPrimaryCuts);
395
396 TObjArray* emptyList = new TObjArray(0);
397
398 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
399 printf("CREATE INTERFACE AND CUTS\n");
400 AliCFManager* man = new AliCFManager() ;
401 man->SetParticleContainer(container);
402 man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
403 man->SetParticleCutsList(1 , mcList); // MC
404 man->SetParticleCutsList(2 , accList); // Acceptance
405 man->SetParticleCutsList(3 , emptyList); // Vertex
406 man->SetParticleCutsList(4 , emptyList); // Refit
407 man->SetParticleCutsList(5 , emptyList); // AOD
408 man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
409 man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
410 man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
411 man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
412
413 // Get the pointer to the existing analysis manager via the static access method.
414 //==============================================================================
415 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
416 if (!mgr) {
417 ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
418 return NULL;
419 }
420 //CREATE THE TASK
421 printf("CREATE TASK\n");
422
423 // create the task
424 AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsLctoV0);
425 task->SetConfiguration(configuration);
426 task->SetFillFromGenerated(kFALSE);
427 task->SetCFManager(man); //here is set the CF manager
428 task->SetDecayChannel(22);//kLctoV0bachelor
ff12b981 429 switch (lcToV0bachelorDecayMode) {
430 case 0:
431 task->SetCountLctoK0Sp();
432 break;
433 case 1:
434 task->SetCountLctoLambdapi();
435 break;
436 }
5cd139bc 437 task->SetUseWeight(kFALSE);
438 task->SetSign(isSign);
439 task->SetCentralitySelection(kFALSE);
440 task->SetFakeSelection(0);
85036182 441 task->SetRejectCandidateIfNotFromQuark(rejectIfNotFromQuark); // put to false if you want to keep HIJING D0!!
5cd139bc 442 task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
443
444 if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
445 if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
446
447 TF1* funcWeight = 0x0;
448 if (task->GetUseWeight()) {
449 funcWeight = (TF1*)fileCuts->Get("funcWeight");
450 if (funcWeight == 0x0){
451 Printf("FONLL Weights will be used");
452 }
453 else {
454 task->SetWeightFunction(funcWeight);
455 Printf("User-defined Weights will be used. The function being:");
456 task->GetWeightFunction(funcWeight)->Print();
457 }
458 }
459
460 Printf("***************** CONTAINER SETTINGS *****************");
461 Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
462 Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
463 Printf("Dselection = %d",(Int_t)task->GetDselection());
464 Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
465 if (task->GetUseWeight()) {
466 Printf("User-defined Weight function:");
467 task->GetWeightFunction(funcWeight)->Print();
468 }
469 else {
470 Printf("FONLL will be used for the weights");
471 }
472 Printf("Sign = %d",(Int_t)task->GetSign());
473 Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
474 Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
475 Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
476 Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
477 Printf("***************END CONTAINER SETTINGS *****************\n");
478
479 //-----------------------------------------------------------//
480 // create correlation matrix for unfolding - only eta-pt //
481 //-----------------------------------------------------------//
482
483 Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
484
485 Int_t thnDim[4];
486
487 //first half : reconstructed
488 //second half : MC
489
53c91ed7 490 thnDim[0] = iBin[ipT];
491 thnDim[2] = iBin[ipT];
492 thnDim[1] = iBin[iy];
493 thnDim[3] = iBin[iy];
5cd139bc 494
495 TString nameCorr="";
496 if (!isKeepDfromB) {
497 nameCorr="CFHFcorr0_CommonFramework_"+usercomment;
498 }
499 else if (isKeepDfromBOnly) {
500 nameCorr= "CFHFcorr0KeepDfromBOnly_CommonFramework_"+usercomment;
501 }
502 else {
503 nameCorr="CFHFcorr0allLc_CommonFramework_"+usercomment;
504 }
505
506 THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
507 Double_t** binEdges = new Double_t[2];
508
509 // set bin limits
510
511 binEdges[0]= binLimpT;
512 binEdges[1]= binLimy;
513
514 correlation->SetBinEdges(0,binEdges[0]);
515 correlation->SetBinEdges(2,binEdges[0]);
516
517 correlation->SetBinEdges(1,binEdges[1]);
518 correlation->SetBinEdges(3,binEdges[1]);
519
520 correlation->Sumw2();
521
522 // correlation matrix ready
523 //------------------------------------------------//
524
525 task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
526
527 // Create and connect containers for input/output
528
529 // ------ input data ------
530 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
531
532 // ----- output data -----
533
534 TString outputfile = AliAnalysisManager::GetCommonFileName();
53c91ed7 535 TString output1name="", output2name="", output3name="",output4name="";
5cd139bc 536 output2name=nameContainer;
537 output3name=nameCorr;
538 if (!isKeepDfromB) {
539 outputfile += ":PWG3_D2H_CFtaskLctoK0Sp_CommonFramework_"+usercomment;
540 output1name="CFHFchist0_CommonFramework_"+usercomment;
541 output4name= "Cuts_CommonFramework_"+usercomment;
542 }
543 else if (isKeepDfromBOnly) {
544 outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromBOnly_CommonFramework_"+usercomment;
545 output1name="CFHFchist0DfromB_CommonFramework_"+usercomment;
546 output4name= "Cuts_CommonFramework_DfromB_"+usercomment;
547 }
548 else {
549 outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromB_CommonFramework_"+usercomment;
550 output1name="CFHFchist0allLc_CommonFramework_"+usercomment;
551 output4name= "Cuts_CommonFramework_allLc_"+usercomment;
552 }
553
554 //now comes user's output objects :
555 // output TH1I for event counting
556 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
557 // output Correction Framework Container (for acceptance & efficiency calculations)
558 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
559 // Unfolding - correlation matrix
560 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
561 // cuts
562 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
563
564 mgr->AddTask(task);
565
566 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
567 mgr->ConnectOutput(task,1,coutput1);
568 mgr->ConnectOutput(task,2,coutput2);
569 mgr->ConnectOutput(task,3,coutput3);
570 mgr->ConnectOutput(task,4,coutput4);
571 return task;
572
573}