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