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