AliPhysics  fde8a9f (fde8a9f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskCFVertexingHFLctoV0bachelor.C
Go to the documentation of this file.
1 //DEFINITION OF A FEW CONSTANTS
2 const Double_t ptmin = 0.0; // GeV/c
3 const Double_t ptmax = 9999.0; // GeV/c
4 const Double_t etamin = -0.9;
5 const Double_t etamax = 0.9;
6 const Double_t ymin = -1.2 ;
7 const Double_t ymax = 1.2 ;
8 
9 const Double_t zmin = -15.;
10 const Double_t zmax = 15.;
11 const Float_t centmin = 0.;
12 const Float_t centmax = 100.;
13 const Float_t fakemin = -0.5;
14 const Float_t fakemax = 2.5;
16 const Float_t multmax_0_20 = 20;
22 const Float_t multmax_80_100 = 100;
25 //const Float_t multmin = 0.;
26 //const Float_t multmax = 102.;
27 
28 const Double_t cosPAV0min = 0.985;
29 const Double_t cosPAV0max = 1.005;
30 const Float_t onFlymin = -0.5;
31 const Float_t onFlymax = 1.5;
32 const Double_t pBachmin = 0.0; // GeV/c
33 const Double_t pBachmax = 30.0; // GeV/c
34 const Double_t ptV0min = 0.0; // GeV/c
35 const Double_t ptV0max = 30.0; // GeV/c
36 const Double_t yV0min =-1.2;
37 const Double_t yV0max = 1.2;
38 const Double_t dcaV0min = 0.0; // cm
39 const Double_t dcaV0max = 1.5; // cm
40 const Double_t cTV0min = 0.0; // micron
41 const Double_t cTV0max = 300; // micron
42 const Double_t cTmin = 0.0; // micron
43 const Double_t cTmax = 300; // micron
44 const Float_t cosPAmin =-1.05;
45 const Float_t cosPAmax = 1.05;
46 
47 
48 //----------------------------------------------------
49 
50 AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "./LctoV0bachelorCuts.root",
51  Bool_t rejectIfNotFromQuark=kTRUE,
52  //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kFALSE, // all in
53  Bool_t isKeepDfromB = kFALSE, Bool_t isKeepDfromBOnly = kFALSE, // prompt
54  //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kTRUE, // no-prompt
55  Int_t configuration = AliCFTaskVertexingHF::kCheetah,
56  Int_t pdgCode = 4122, Char_t isSign = 2, Char_t lcToV0bachelorDecayMode = 0,
57  TString usercomment = "username",
58  Bool_t useWeight=kFALSE,
59  Bool_t useFlatPtWeight = kFALSE,
60  Bool_t useZWeight = kFALSE,
61  Bool_t useNchWeight = kFALSE,
62  Bool_t useNtrkWeight = kFALSE,
63  TString estimatorFilename="",
64  Int_t multiplicityEstimator = AliCFTaskVertexingHF::kNtrk10,
65  Bool_t isPPData = kTRUE,
66  Bool_t isPPbData = kFALSE,
67  Double_t refMult = 9.26,
68  Bool_t isFineNtrkBin = kFALSE)
69 {
70 
71  if ( (isPPData && isPPbData) ||
72  (!isPPData && !isPPbData) ) {
73  printf("You have to choose the data kind; bad choise isPPData=%d isPPbData=%d\n",isPPData,isPPbData);
74  return;
75  }
76 
77  printf("Adding CF task using cuts from file %s\n",cutFile);
78  if (configuration == AliCFTaskVertexingHF::kSnail){
79  printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
80  }
81  else if (configuration == AliCFTaskVertexingHF::kCheetah){
82  printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
83  }
84  else{
85  printf("The configuration is not defined! returning\n");
86  return;
87  }
88 
89  gSystem->Sleep(2000);
90 
91  // isSign = 0 --> Lc+ only
92  // isSign = 1 --> Lc- only
93  // isSign = 2 --> Lc+ and Lc-
94 
95  TString expected;
96  if (isSign == 0 && pdgCode < 0){
97  AliError(Form("Error setting PDG code (%d) and sign (0 --> Lc+ only): they are not compatible, returning",pdgCode));
98  return 0x0;
99  }
100  else if (isSign == 1 && pdgCode > 0){
101  AliError(Form("Error setting PDG code (%d) and sign (1 --> Lc- only): they are not compatible, returning",pdgCode));
102  return 0x0;
103  }
104  else if (isSign > 2 || isSign < 0){
105  AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning",isSign));
106  return 0x0;
107  }
108 
109  TFile* fileCuts = TFile::Open(cutFile);
110  AliRDHFCuts *cutsLctoV0 = (AliRDHFCutsLctoV0*)fileCuts->Get("LctoV0AnalysisCuts");
111 
112  // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
113  // for now the binning is the same than for all D's
114  if (isKeepDfromBOnly) isKeepDfromB = true;
115 
116  Double_t massV0min = 0.47;
117  Double_t massV0max = 1.14;
118  if (lcToV0bachelorDecayMode==0) {
119  massV0min = 0.47 ;
120  massV0max = 0.53 ;
121  } else if (lcToV0bachelorDecayMode==1) {
122  massV0min = 1.09;
123  massV0max = 1.14;
124  }
125 
126  const Double_t phimin = 0.;
127  const Double_t phimax = 2.*TMath::Pi();
128  const Double_t phiV0min = 0.;
129  const Double_t phiV0max = 2.*TMath::Pi();
130 
131  const Int_t nbinZvtx = 30; //bins in centrality (total number)
132  const Int_t nbincent =18+1; //bins in centrality (total number)
133  const Int_t nbinfake = 3; //bins in fake
134  //const Int_t nbinmult = 48; //bins in multiplicity (total number)
135  const Int_t nbinmult = 49; //bins in multiplicity (total number)
136  const Int_t nbinmult_0_20 = 20; //bins in multiplicity between 0 and 20
137  const Int_t nbinmult_20_50 = 15; //bins in multiplicity between 20 and 50
138  const Int_t nbinmult_50_80 = 10; //bins in multiplicity between 50 and 80
139  const Int_t nbinmult_80_100 = 4; //bins in multiplicity between 80 and 100
140  const Int_t nbinmult_100_400 = 3; //bins in multiplicity between 100 and 400
141  if(isPPbData) nbinmult += nbinmult_100_400;
142 
143  const Int_t nbinpt = cutsLctoV0->GetNPtBins(); // bins in pT
144  const Int_t nbiny = 24; //bins in y Lc
145  const Int_t nbinphi = 18; //bins in phi Lc
146  const Int_t nbinonFly = 2; //bins in onFlyStatus x V0
147 
148  const Int_t nbinpBach = 300; //bins in pt from 0 to 30 GeV
149  const Int_t nbinptV0 = 300; //bins in pt from 0 to 30 GeV
150  const Int_t nbinyV0 = 24; //bins in y V0
151  const Int_t nbinphiV0 = 18; //bins in phi V0
152  const Int_t nbindcaV0 = 150; //bins in dcaV0
153  const Int_t nbininvMassV0 = 60; //bins in invMassV0
154  const Int_t nbinpointingV0 = 42; //bins in cosPointingAngleV0
155  const Int_t nbinpointing = 42; //bins in cosPointingAngle
156 
157  //const Int_t nbincTV0 = 15; //bins in cTV0
158  //const Int_t nbincT = 15; //bins in cT
159 
160  //the sensitive variables, their indices
161 
162  // variables' indices
163  const UInt_t ipT = 0;
164  const UInt_t iy = 1;
165  const UInt_t iphi = 2;
166  const UInt_t ionFly = 3;
167  const UInt_t iZvtx = 4;
168  const UInt_t icent = 5;
169  const UInt_t ifake = 6;
170  const UInt_t imult = 7;
171 
172  const UInt_t ipbach = 8;
173  const UInt_t ipTV0 = 9;
174  const UInt_t iyV0 = 10;
175  const UInt_t iphiV0 = 11;
176  const UInt_t iinvMassV0= 12;
177  const UInt_t idcaV0 = 13;
178  const UInt_t icosPAxV0 = 14;
179  const UInt_t icosPA = 15;
180  //const UInt_t icTv0 = 16;
181  //const UInt_t icT = 17;
182 
183  //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
184 
185  //arrays for the number of bins in each dimension
186 
187  //if ( configuration ==AliCFTaskVertexingHF::kSnail)
188  const Int_t nvarTot = 16 ; //number of variables on the grid
189  //if ( configuration ==AliCFTaskVertexingHF::kCheetah)
190  //const Int_t nvarTot = 8 ; //number of variables on the grid
191 
192  Int_t iBin[nvarTot];
193 
194  //OPTION 1: defining the pt, ptPi, ptK bins by hand...
195  iBin[ipT]=nbinpt;
196  iBin[iy]=nbiny;
197  iBin[iphi]=nbinphi;
198  iBin[ionFly]=nbinonFly;
199  iBin[iZvtx]=nbinZvtx;
200  iBin[icent]=nbincent;
201  iBin[ifake]=nbinfake;
202 
203  // Fine Ntrk binning setting
204  Double_t *binLimmultFine;
205  Int_t nbinmultTmp = nbinmult;
206  if (isFineNtrkBin) {
207  Int_t nbinLimmultFine = 100;
208  if (isPPbData) nbinLimmultFine = 200;
209  const UInt_t nbinMultFine = nbinLimmultFine;
210  binLimmultFine = new Double_t[nbinMultFine+1];
211  for (Int_t ibin0 = 0; ibin0 < nbinMultFine+1; ibin0++) {
212  binLimmultFine[ibin0] = ibin0;
213  }
214  nbinmultTmp = nbinLimmultFine;
215  }
216  const Int_t nbinmultTot = nbinmultTmp;
217  iBin[imult] = nbinmultTot;
219 
220  iBin[ipbach]=nbinpBach;
221  iBin[ipTV0]=nbinptV0;
222  iBin[iyV0]=nbinyV0;
223  iBin[iphiV0]=nbinphiV0;
224  iBin[iinvMassV0]=nbininvMassV0;
225  iBin[idcaV0]=nbindcaV0;
226  iBin[icosPAxV0]=nbinpointingV0;
227  iBin[icosPA]=nbinpointing;
228  //iBin[icTv0]=nbincTV0;
229  //iBin[icT]=nbincT;
230 
231  // values for bin lower bounds
232 
233  // pt
234  Float_t* floatbinLimpT = cutsLctoV0->GetPtBinLimits();
235  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
236  for (Int_t ibinpT = 0 ; ibinpT<iBin[ipT]+1; ibinpT++){
237  binLimpT[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
238  printf("binLimpT[%d]=%f\n",ibinpT,binLimpT[ibinpT]);
239  }
240 
241  // y
242  Double_t *binLimy=new Double_t[iBin[iy]+1];
243  for(Int_t i=0; i<=iBin[iy]; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin)/iBin[iy]*(Double_t)i ;
244 
245  // phi
246  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
247  for(Int_t i=0; i<=iBin[iphi]; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin)/iBin[iphi]*(Double_t)i ;
248 
249  // onTheFlyV0
250  Double_t *binLimonFlyV0=new Double_t[iBin[ionFly]+1];
251  for(Int_t i=0; i<=iBin[ionFly]; i++) binLimonFlyV0[i]=(Double_t)onFlymin + (onFlymax-onFlymin)/iBin[ionFly]*(Double_t)i ;
252 
253  // z Primary Vertex
254  Double_t *binLimzvtx=new Double_t[iBin[iZvtx]+1];
255  for(Int_t i=0; i<=nbinZvtx; i++) binLimzvtx[i]=(Double_t)zmin + (zmax-zmin)/iBin[iZvtx]*(Double_t)i ;
256 
257  // centrality
258  Double_t *binLimcent=new Double_t[iBin[icent]+1];
259  binLimcent[0]=centmin;
260  for(Int_t i=1; i<=iBin[icent]; i++) binLimcent[i]=centmin + (centmax-centmin)/iBin[icent]*(Double_t)i;
261 
262  // fake
263  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
264  for(Int_t i=0; i<=iBin[ifake]; i++) binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/iBin[ifake] * (Double_t)i;
265 
266  // multiplicity
267  Double_t *binLimmult=new Double_t[iBin[imult]+1];
268  //for(Int_t i=0; i<=iBin[imult]; i++) binLimmult[i]=(Double_t)multmin + (multmax-multmin)/iBin[imult]*(Double_t)i ;
269  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 ;
270  if (binLimmult[nbinmult_0_20] != multmin_20_50) {
271  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
272  }
273  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 ;
274  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_80) {
275  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
276  }
277  for(Int_t i=0; i<=nbinmult_50_80; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50] = (Double_t)multmin_50_80 + (multmax_50_80-multmin_50_80)/nbinmult_50_80*(Double_t)i ;
278  if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80] != multmin_80_100) {
279  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 3rd range - differs from expected!\n");
280  }
281  for(Int_t i=0; i<=nbinmult_80_100; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50+nbinmult_50_80] = (Double_t)multmin_80_100 + (multmax_80_100-multmin_80_100)/nbinmult_80_100*(Double_t)i ;
282  if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100] != multmin_100_400) {
283  Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 4th range - differs from expected!\n");
284  }
285  if(isPPbData){
286  for (Int_t i = 0; i<=nbinmult_100_400; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100] = (Double_t)multmin_100_400 + (multmax_100_400-multmin_100_400)/nbinmult_100_400*(Double_t)i ;
287  }
288 
289 
290  // pBach
291  Double_t *binLimpbach=new Double_t[iBin[ipbach]+1];
292  for(Int_t i=0; i<=iBin[ipbach]; i++) binLimpbach[i]=(Double_t)pBachmin + (pBachmax-pBachmin)/iBin[ipbach]*(Double_t)i ;
293 
294  // ptV0
295  Double_t *binLimpTV0=new Double_t[iBin[ipTV0]+1];
296  for(Int_t i=0; i<=iBin[ipTV0]; i++) binLimpTV0[i]=(Double_t)ptV0min + (ptV0max-ptV0min)/iBin[ipTV0]*(Double_t)i ;
297 
298  // yV0
299  Double_t *binLimyV0=new Double_t[iBin[iyV0]+1];
300  for(Int_t i=0; i<=iBin[iyV0]; i++) binLimyV0[i]=(Double_t)yV0min + (yV0max-yV0min)/iBin[iyV0]*(Double_t)i ;
301 
302  // phiV0
303  Double_t *binLimphiV0=new Double_t[iBin[iphiV0]+1];
304  for(Int_t i=0; i<=iBin[iphiV0]; i++) binLimphiV0[i]=(Double_t)phiV0min + (phiV0max-phiV0min)/iBin[iphiV0]*(Double_t)i ;
305 
306  // invMassV0
307  Double_t *binLimInvMassV0=new Double_t[iBin[iinvMassV0]+1];
308  for(Int_t i=0; i<=iBin[iinvMassV0]; i++) binLimInvMassV0[i]=(Double_t)massV0min + (massV0max-massV0min)/iBin[iinvMassV0]*(Double_t)i ;
309 
310  // dcaV0
311  Double_t *binLimdcaV0=new Double_t[iBin[idcaV0]+1];
312  for(Int_t i=0; i<=iBin[idcaV0]; i++) binLimdcaV0[i]=(Double_t)dcaV0min + (dcaV0max-dcaV0min)/iBin[idcaV0]*(Double_t)i ;
313 
314  // cosPointingAngleV0
315  Double_t *binLimcosPAV0=new Double_t[iBin[icosPAxV0]+1];
316  for(Int_t i=0; i<=iBin[icosPAxV0]; i++) binLimcosPAV0[i]=(Double_t)cosPAV0min + (cosPAV0max-cosPAV0min)/iBin[icosPAxV0]*(Double_t)i ;
317 
318  // cosPointingAngle
319  Double_t *binLimcosPA=new Double_t[iBin[icosPA]+1];
320  for(Int_t i=0; i<=iBin[icosPA]; i++) binLimcosPA[i]=(Double_t)cosPAmin + (cosPAmax-cosPAmin)/iBin[icosPA]*(Double_t)i ;
321 
322  /*
323  // cTV0
324  Double_t *binLimcTV0=new Double_t[iBin[icTv0]+1];
325  for(Int_t i=0; i<=iBin[icTv0]; i++) binLimcTV0[i]=(Double_t)cTV0min + (cTV0max-cTV0min)/iBin[icTv0]*(Double_t)i ;
326 
327  // cT
328  Double_t *binLimcT=new Double_t[iBin[icT]+1];
329  for(Int_t i=0; i<=iBin[icT]; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin)/iBin[icT]*(Double_t)i ;
330  */
331 
332 
333  //one "container" for MC
334  TString nameContainer="";
335  if (!isKeepDfromB) {
336  nameContainer="CFHFccontainer0_CommonFramework_"+usercomment;
337  }
338  else if (isKeepDfromBOnly) {
339  nameContainer="CFHFccontainer0LcfromB_CommonFramework_"+usercomment;
340  }
341  else {
342  nameContainer="CFHFccontainer0allLc_CommonFramework_"+usercomment;
343  }
344 
345  //Setting up the container grid...
346 
347  //CONTAINER DEFINITION
348  Info("AliCFTaskVertexingHF","SETUP CONTAINER");
349  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
350 
351  AliCFContainer* container;
352  if (configuration == AliCFTaskVertexingHF::kSnail) {
353  container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
354  }
355  else if (configuration == AliCFTaskVertexingHF::kCheetah) {
356  container = new AliCFContainer(nameContainer,"container for tracks",nstep,8,iBin);
357  }
358 
359  //setting the bin limits
360  container -> SetBinLimits(ipT,binLimpT);
361  container -> SetBinLimits(iy,binLimy);
362  container -> SetBinLimits(iphi,binLimphi);
363  container -> SetBinLimits(ionFly,binLimonFlyV0);
364  container -> SetBinLimits(iZvtx,binLimzvtx);
365  container -> SetBinLimits(icent,binLimcent);
366  container -> SetBinLimits(ifake,binLimfake);
367  if (isFineNtrkBin) container->SetBinLimits(imult, binLimmultFine);
368  else container->SetBinLimits(imult, binLimmult);
369 
370  container -> SetVarTitle(ipT,"p_{T}(#Lambda_{c}) [GeV/c]");
371  container -> SetVarTitle(iy,"y(#Lambda_{c})");
372  container -> SetVarTitle(iphi,"#phi(#Lambda_{c}) [rad]");
373  container -> SetVarTitle(ionFly,"onTheFlyStatusV0");
374  container -> SetVarTitle(iZvtx,"z_{vtx} [cm]");
375  container -> SetVarTitle(icent,"centrality");
376  container -> SetVarTitle(ifake,"fake");
377  container -> SetVarTitle(imult,"multiplicity");
378 
379  if (configuration == AliCFTaskVertexingHF::kSnail) {
380  container -> SetBinLimits(ipbach,binLimpbach);
381  container -> SetBinLimits(ipTV0,binLimpTV0);
382  container -> SetBinLimits(iyV0,binLimyV0);
383  container -> SetBinLimits(iphiV0,binLimphiV0);
384  container -> SetBinLimits(iinvMassV0,binLimInvMassV0);
385  container -> SetBinLimits(idcaV0,binLimdcaV0);
386  container -> SetBinLimits(icosPAxV0,binLimcosPAV0);
387  container -> SetBinLimits(icosPA,binLimcosPA);
388  //container -> SetBinLimits(,binLimcTV0);
389  //container -> SetBinLimits(,binLimcT);
390 
391  container -> SetVarTitle(ipbach,"p(bachelor) [GeV/c]");
392  container -> SetVarTitle(ipTV0,"p_{T}(V0) [GeV/c]");
393  container -> SetVarTitle(iyV0,"y(V0)");
394  container -> SetVarTitle(iphiV0,"#varphi(V0) [rad]");
395  container -> SetVarTitle(iinvMassV0,"m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]");
396  container -> SetVarTitle(idcaV0,"DCA(V0) [n#sigma]");
397  container -> SetVarTitle(icosPAxV0,"cosine pointing angle(V0)");
398  container -> SetVarTitle(icosPA,"cosine pointing angle (#Lambda_{c})");
399  //container -> SetVarTitle(,"c#tau -V0-");
400  //container -> SetVarTitle(,"c#tau");
401  }
402 
403  container -> SetStepTitle(0, "MCLimAcc");
404  container -> SetStepTitle(1, "MC");
405  container -> SetStepTitle(2, "MCAcc");
406  container -> SetStepTitle(3, "RecoVertex");
407  container -> SetStepTitle(4, "RecoRefit");
408  container -> SetStepTitle(5, "Reco");
409  container -> SetStepTitle(6, "RecoAcc");
410  container -> SetStepTitle(7, "RecoITSCluster");
411  container -> SetStepTitle(8, "RecoCuts");
412  container -> SetStepTitle(9, "RecoPID");
413 
414  //return container;
415 
416  //CREATE THE CUTS -----------------------------------------------
417 
418  // Gen-Level kinematic cuts
419  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
420 
421  //Particle-Level cuts:
422  AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
423  Bool_t useAbsolute = kTRUE;
424  if (isSign != 2) {
425  useAbsolute = kFALSE;
426  }
427  mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include Lc-
428  mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
429 
430  // Acceptance cuts:
431  AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
432  AliCFTrackKineCuts * kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
433  kineAccCuts->SetPtRange(ptmin,ptmax);
434  kineAccCuts->SetEtaRange(etamin,etamax);
435 
436  // Rec-Level kinematic cuts
437  AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
438 
439  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
440 
441  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
442 
443  printf("CREATE MC KINE CUTS\n");
444  TObjArray* mcList = new TObjArray(0) ;
445  mcList->AddLast(mcKineCuts);
446  mcList->AddLast(mcGenCuts);
447 
448  printf("CREATE ACCEPTANCE CUTS\n");
449  TObjArray* accList = new TObjArray(0) ;
450  accList->AddLast(kineAccCuts);
451 
452  printf("CREATE RECONSTRUCTION CUTS\n");
453  TObjArray* recList = new TObjArray(0) ; // not used!!
454  recList->AddLast(recKineCuts);
455  recList->AddLast(recQualityCuts);
456  recList->AddLast(recIsPrimaryCuts);
457 
458  TObjArray* emptyList = new TObjArray(0);
459 
460  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
461  printf("CREATE INTERFACE AND CUTS\n");
462  AliCFManager* man = new AliCFManager() ;
463  man->SetParticleContainer(container);
464  man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
465  man->SetParticleCutsList(1 , mcList); // MC
466  man->SetParticleCutsList(2 , accList); // Acceptance
467  man->SetParticleCutsList(3 , emptyList); // Vertex
468  man->SetParticleCutsList(4 , emptyList); // Refit
469  man->SetParticleCutsList(5 , emptyList); // AOD
470  man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
471  man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
472  man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
473  man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
474 
475  // Get the pointer to the existing analysis manager via the static access method.
476  //==============================================================================
477  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
478  if (!mgr) {
479  ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
480  return NULL;
481  }
482  //CREATE THE TASK
483  printf("CREATE TASK\n");
484 
485  // create the task
486  AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsLctoV0);
487  task->SetConfiguration(configuration);
488  task->SetFillFromGenerated(kFALSE);
489  task->SetCFManager(man); //here is set the CF manager
490  task->SetDecayChannel(22);//kLctoV0bachelor
491  switch (lcToV0bachelorDecayMode) {
492  case 0:
493  task->SetCountLctoK0Sp();
494  break;
495  case 1:
496  task->SetCountLctoLambdapi();
497  break;
498  }
499  task->SetUseWeight(useWeight);
500  task->SetUseFlatPtWeight(useFlatPtWeight);
501  task->SetUseWeight(useWeight);
502  task->SetUseZWeight(useZWeight);
503  task->SetSign(isSign);
504  task->SetCentralitySelection(kFALSE);
505  task->SetFakeSelection(0);
506  task->SetRejectCandidateIfNotFromQuark(rejectIfNotFromQuark); // put to false if you want to keep HIJING D0!!
507  task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
508 
509  if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
510  if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
511 
512  TF1* funcWeight = 0x0;
513  if (task->GetUseWeight()) {
514  funcWeight = (TF1*)fileCuts->Get("funcWeight");
515  if (funcWeight == 0x0){
516  Printf("FONLL Weights will be used");
517  }
518  else {
519  task->SetWeightFunction(funcWeight);
520  Printf("User-defined Weights will be used. The function being:");
521  task->GetWeightFunction()->Print();
522  }
523  }
524 
525  if (useNchWeight || useNtrkWeight){
526  TH1F *hNchPrimaries;
527  TH1F *hNchMeasured;
528  if (isPPbData) hNchPrimaries = (TH1F*)fileCuts->Get("hNtrUnCorrEvWithCandWeight");
529  else hNchPrimaries = (TH1F*)fileCuts->Get("hGenPrimaryParticlesInelGt0");
530  hNchMeasured = (TH1F*)fileCuts->Get("hNchMeasured");
531  if(hNchPrimaries) {
532  task->SetUseNchWeight(kTRUE);
533  task->SetMCNchHisto(hNchPrimaries);
534  if(isPPbData) task->SetUseNchTrackletsWeight();
535  } else {
536  AliFatal("Histogram for multiplicity weights not found");
537  return 0x0;
538  }
539  if(hNchMeasured) task->SetMeasuredNchHisto(hNchMeasured);
540  if(useNtrkWeight) task->SetUseNchTrackletsWeight();
541  }
542 
543  task->SetMultiplicityEstimator(multiplicityEstimator);
544  if(estimatorFilename.EqualTo("") ) {
545  printf("Estimator file not provided, multiplicity corrected histograms will not be filled\n");
546  task->SetUseZvtxCorrectedNtrkEstimator(kFALSE);
547  } else {
548  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
549  if(!fileEstimator) {
550  AliFatal("File with multiplicity estimator not found");
551  return;
552  }
554  task->SetReferenceMultiplcity(refMult);
555 
556  if (isPPData) {
557  task->SetIsPPData(isPPData);
558  }
559  if (isPPbData) { //load multiplicity estimators for pPb
560  task->SetIsPPbData(isPPbData);
561  const Char_t* periodNames[2] = {"LHC13b", "LHC13c"};
562  TProfile *multEstimatorAvg[2];
563  for (Int_t ip=0; ip < 2; ip++) {
564  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
565  if (!multEstimatorAvg[ip]) {
566  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
567  return;
568  }
569  }
570  task->SetMultiplVsZProfileLHC13b(multEstimatorAvg[0]);
571  task->SetMultiplVsZProfileLHC13c(multEstimatorAvg[1]);
572 
573  } else { //load multiplicity estimators for pp
574  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
575  TProfile* multEstimatorAvg[4];
576 
577  for(Int_t ip=0; ip<4; ip++) {
578  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
579  if (!multEstimatorAvg[ip]) {
580  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
581  return;
582  }
583  }
584  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
585  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
586  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
587  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
588  }
589  }
590 
591 
592  Printf("***************** CONTAINER SETTINGS *****************");
593  Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
594  Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
595  Printf("Dselection = %d",(Int_t)task->GetDselection());
596  Printf("UseWeight = %d",(Int_t)task->GetUseWeight());
597  if (task->GetUseWeight()) {
598  if(funcWeight) Printf("User-defined Weight function");
599  else Printf("FONLL will be used for the weights");
600  }
601  Printf("Sign = %d",(Int_t)task->GetSign());
602  Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
603  Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
604  Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
605  Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
606  Printf("***************END CONTAINER SETTINGS *****************\n");
607 
608  //-----------------------------------------------------------//
609  // create correlation matrix for unfolding - only eta-pt //
610  //-----------------------------------------------------------//
611 
612  Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
613 
614  Int_t thnDim[4];
615 
616  //first half : reconstructed
617  //second half : MC
618 
619  thnDim[0] = iBin[ipT];
620  thnDim[2] = iBin[ipT];
621  thnDim[1] = iBin[iy];
622  thnDim[3] = iBin[iy];
623 
624  TString nameCorr="";
625  if (!isKeepDfromB) {
626  nameCorr="CFHFcorr0_CommonFramework_"+usercomment;
627  }
628  else if (isKeepDfromBOnly) {
629  nameCorr= "CFHFcorr0KeepDfromBOnly_CommonFramework_"+usercomment;
630  }
631  else {
632  nameCorr="CFHFcorr0allLc_CommonFramework_"+usercomment;
633  }
634 
635  THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
636  Double_t** binEdges = new Double_t[2];
637 
638  // set bin limits
639 
640  binEdges[0]= binLimpT;
641  binEdges[1]= binLimy;
642 
643  correlation->SetBinEdges(0,binEdges[0]);
644  correlation->SetBinEdges(2,binEdges[0]);
645 
646  correlation->SetBinEdges(1,binEdges[1]);
647  correlation->SetBinEdges(3,binEdges[1]);
648 
649  correlation->Sumw2();
650 
651  // correlation matrix ready
652  //------------------------------------------------//
653 
654  task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
655 
656  // Create and connect containers for input/output
657 
658  // ------ input data ------
659  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
660 
661  // ----- output data -----
662 
663  TString outputfile = AliAnalysisManager::GetCommonFileName();
664  TString output1name="", output2name="", output3name="",output4name="";
665  output2name=nameContainer;
666  output3name=nameCorr;
667  if (!isKeepDfromB) {
668  outputfile += ":PWG3_D2H_CFtaskLctoK0Sp_CommonFramework_"+usercomment;
669  output1name="CFHFchist0_CommonFramework_"+usercomment;
670  output4name= "Cuts_CommonFramework_"+usercomment;
671  }
672  else if (isKeepDfromBOnly) {
673  outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromBOnly_CommonFramework_"+usercomment;
674  output1name="CFHFchist0DfromB_CommonFramework_"+usercomment;
675  output4name= "Cuts_CommonFramework_DfromB_"+usercomment;
676  }
677  else {
678  outputfile += ":PWG3_D2H_CFtaskLctoK0SpKeepDfromB_CommonFramework_"+usercomment;
679  output1name="CFHFchist0allLc_CommonFramework_"+usercomment;
680  output4name= "Cuts_CommonFramework_allLc_"+usercomment;
681  }
682 
683  //now comes user's output objects :
684  // output TH1I for event counting
685  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
686  // output Correction Framework Container (for acceptance & efficiency calculations)
687  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
688  // Unfolding - correlation matrix
689  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
690  // cuts
691  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
692 
693  mgr->AddTask(task);
694 
695  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
696  mgr->ConnectOutput(task,1,coutput1);
697  mgr->ConnectOutput(task,2,coutput2);
698  mgr->ConnectOutput(task,3,coutput3);
699  mgr->ConnectOutput(task,4,coutput4);
700  return task;
701 
702 }
const Double_t cosPAV0min
const Double_t ptmin
const Float_t cosPAmax
void SetWeightFunction(TF1 *func)
const Double_t ymax
const Float_t multmax_20_50
void SetRejectCandidateIfNotFromQuark(Bool_t opt)
double Double_t
Definition: External.C:58
void SetMultiplVsZProfileLHC10e(TProfile *hprof)
const Double_t dcaV0max
void SetCFManager(AliCFManager *io)
CORRECTION FRAMEWORK RELATED FUNCTIONS.
const Double_t yV0max
void SetDecayChannel(Int_t decayChannel)
TSystem * gSystem
const Double_t ymin
char Char_t
Definition: External.C:18
void SetFillFromGenerated(Bool_t flag)
get corr manager
void SetUseNchTrackletsWeight(Bool_t useWeight=kTRUE)
void SetUseMCVertex(Bool_t opt)
const Float_t multmin_0_20
AliCFTaskVertexingHF * AddTaskCFVertexingHFLctoV0bachelor(const char *cutFile="./LctoV0bachelorCuts.root", Bool_t rejectIfNotFromQuark=kTRUE, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t configuration=AliCFTaskVertexingHF::kCheetah, Int_t pdgCode=4122, Char_t isSign=2, Char_t lcToV0bachelorDecayMode=0, TString usercomment="username", Bool_t useWeight=kFALSE, Bool_t useFlatPtWeight=kFALSE, Bool_t useZWeight=kFALSE, Bool_t useNchWeight=kFALSE, Bool_t useNtrkWeight=kFALSE, TString estimatorFilename="", Int_t multiplicityEstimator=AliCFTaskVertexingHF::kNtrk10, Bool_t isPPData=kTRUE, Bool_t isPPbData=kFALSE, Double_t refMult=9.26, Bool_t isFineNtrkBin=kFALSE)
const Float_t multmin_50_80
const Float_t fakemax
const Double_t zmax
const Double_t ptV0min
const Double_t pBachmax
const Double_t etamax
const Float_t centmax
const Double_t pBachmin
const Double_t cTmin
int Int_t
Definition: External.C:63
void SetMeasuredNchHisto(TH1F *h)
void SetIsPPData(Bool_t flag)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
const Float_t multmax_50_80
const Double_t cTmax
void SetIsPPbData(Bool_t flag)
const Double_t cTV0min
void SetCentralitySelection(Bool_t centSelec=kTRUE)
const Float_t multmin_80_100
const Float_t onFlymax
const Double_t ptmax
const Float_t centmin
const Float_t multmax_80_100
void SetReferenceMultiplcity(Double_t rmu)
void SetUseWeight(Bool_t useWeight)
void SetUseZvtxCorrectedNtrkEstimator(Bool_t flag)
const Float_t multmin_20_50
const Float_t fakemin
void SetConfiguration(Int_t configuration)
void SetDselection(UShort_t originDselection)
const Double_t zmin
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:234
const Float_t multmax_100_400
const Float_t multmax_0_20
TF1 * GetWeightFunction() const
void SetUseNchWeight(Bool_t useWeight)
void SetUseFlatPtWeight(Bool_t useWeight)
void SetCorrelationMatrix(THnSparse *h)
UNFOLDING.
void SetMultiplVsZProfileLHC10b(TProfile *hprof)
const Float_t cosPAmin
const Float_t onFlymin
const Double_t yV0min
void SetMultiplVsZProfileLHC10d(TProfile *hprof)
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:235
void SetSign(Char_t isSign)
const Double_t dcaV0min
Bool_t GetUseWeight() const
bool Bool_t
Definition: External.C:53
const Double_t cosPAV0max
slow configuration, all variables
void SetMultiplicityEstimator(Int_t value)
void SetMultiplVsZProfileLHC13b(TProfile *hprof)
Bool_t GetFillFromGenerated() const
const Double_t etamin
void SetMultiplVsZProfileLHC13c(TProfile *hprof)
void SetFakeSelection(Int_t fakeSel=0)
void SetUseZWeight(Bool_t useWeight)
const Double_t phimin
const Double_t ptV0max
void SetMultiplVsZProfileLHC10c(TProfile *hprof)
const Double_t cTV0max
const Float_t multmin_100_400