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