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