]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/macros/AddTaskCFVertexingHF3Prong.C
Reorder parameters
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / AddTaskCFVertexingHF3Prong.C
CommitLineData
85e55da4 1//DEFINITION OF A FEW CONSTANTS
ec5288c3 2const Double_t ymin = -1.2 ;
3const Double_t ymax = 1.2 ;
4const Double_t cosmin = -0.7;
85e55da4 5const Double_t cosmax = 1.05;
6const Double_t cTmin = 0; // micron
7const Double_t cTmax = 500; // micron
85e55da4 8const Double_t phimin = 0.0;
85e55da4 9const Int_t mintrackrefsTPC = 2 ;
10const Int_t mintrackrefsITS = 3 ;
11const Int_t charge = 1 ;
85e55da4 12const Int_t minclustersTPC = 50 ;
13// cuts
14const Double_t ptmin = 0.1;
15const Double_t ptmax = 9999.;
16const Double_t etamin = -0.9;
17const Double_t etamax = 0.9;
ec5288c3 18const Double_t zvtxmin = -15;
19const Double_t zvtxmax = 15;
85e55da4 20const Int_t minITSClusters = 5;
21
ec5288c3 22const Float_t centmin_0_10 = 0.;
23const Float_t centmax_0_10 = 10.;
ad02b758 24const Float_t centmin_10_60 = 10.;
25const Float_t centmax_10_60 = 60.;
26const Float_t centmin_60_100 = 60.;
27const Float_t centmax_60_100 = 100.;
b7af2639 28const Float_t centmax = 100.;
1f780958 29const Float_t fakemin = -0.5;
30const Float_t fakemax = 2.5.;
ec5288c3 31const Float_t cosminXY = 0.95;
32const Float_t cosmaxXY = 1.0;
33const Float_t normDecLXYmin = 0;
34const Float_t normDecLXYmax = 20;
35const Float_t multmin_0_20 = 0;
36const Float_t multmax_0_20 = 20;
37const Float_t multmin_20_50 = 20;
38const Float_t multmax_20_50 = 50;
fd25e7aa 39const Float_t multmin_50_80 = 50;
40const Float_t multmax_50_80 = 80;
41const Float_t multmin_80_100 = 80;
42const Float_t multmax_80_100 = 100;
43const Float_t multmin_100_400 = 100;
44const Float_t multmax_100_400 = 400;
45
1f780958 46
b7af2639 47
85e55da4 48//----------------------------------------------------
49
c9d2246a 50AliCFTaskVertexingHF *AddTaskCFVertexingHF3Prong(TString suffixName="", const char* cutFile = "./DplustoKpipiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 411, Char_t isSign = 2, Bool_t useWeight=kFALSE, TString multFile="", Bool_t useNchWeight=kFALSE, Bool_t useNtrkWeight=kFALSE, TString estimatorFilename="", Int_t multiplicityEstimator = AliCFTaskVertexingHF::kNtrk10, Bool_t isPPbData = kFALSE, Double_t refMult=9.26, Bool_t isFineNtrkBin=kFALSE)
ec5288c3 51//AliCFContainer *AddTaskCFVertexingHF3Prong(const char* cutFile = "./DplustoKpipiCuts.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 411, Char_t isSign = 2)
85e55da4 52{
53 printf("Addig CF task using cuts from file %s\n",cutFile);
ec5288c3 54 if (configuration == AliCFTaskVertexingHF::kSnail){
55 printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
56 }
57 else if (configuration == AliCFTaskVertexingHF::kCheetah){
58 printf("The configuration is set to be FAST --> using only pt, y, ct, phi, zvtx, centrality, fake, multiplicity to fill the CF\n");
59 }
60 else{
61 printf("The configuration is not defined! returning\n");
62 return;
63 }
64
65 gSystem->Sleep(2000);
85e55da4 66
a147e835 67 // isSign = 0 --> D+ only
68 // isSign = 1 --> D- only
69 // isSign = 2 --> both
3ee5eb83 70
71 TString expected;
4e6f4183 72 if (isSign == 0 && pdgCode < 0){
3ee5eb83 73 AliError(Form("Error setting PDG code (%d) and sign (0 --> particle (%d) only): they are not compatible, returning",pdgCode));
74 return 0x0;
75 }
4e6f4183 76 else if (isSign == 1 && pdgCode > 0){
3ee5eb83 77 AliError(Form("Error setting PDG code (%d) and sign (1 --> antiparticle (%d) only): they are not compatible, returning",pdgCode));
78 return 0x0;
79 }
80 else if (isSign > 2 || isSign < 0){
81 AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning"));
82 return 0x0;
83 }
84
01e9725a 85 TFile* fileCuts = TFile::Open(cutFile);
e693cb03 86 if(!fileCuts || (fileCuts && !fileCuts->IsOpen())){
f4fb19b2 87 AliFatal(" Cut file not found");
e693cb03 88 return 0x0;
89 }
654ef521 90 AliRDHFCutsDplustoKpipi *cutsDplustoKpipi = (AliRDHFCutsDplustoKpipi*)fileCuts->Get("AnalysisCuts");
19560d8c 91 TH1F *hMult=0x0;
92 if(multFile.EqualTo("") ) {
93 printf("Will not be corrected with weights \n");
94 }else{
95 TFile *fileMult = TFile::Open(multFile.Data());
0c34e470 96 if(isPPbData) hMult = (TH1F*)fileMult->Get("hNtrUnCorrEvWithCandWeight");
97 else {
98 TDirectoryFile *dir1 = (TDirectoryFile*)fileMult->Get("PWG3_D2H_DMult_DplusLoose");
99 TList* list1=(TList*)dir1->Get("coutputDplusLoose");
100 hMult=(TH1F*)list1->FindObject("hGenPrimaryParticlesInelGt0");
101 }
19560d8c 102 }
85e55da4 103
104 // check that the fKeepD0fromB flag is set to true when the fKeepD0fromBOnly flag is true
105 // for now the binning is the same than for all D's
106 if(isKeepDfromBOnly) isKeepDfromB = true;
107
85e55da4 108 /*
109 Double_t ptmin_0_4;
110 Double_t ptmax_0_4;
111 Double_t ptmin_4_8;
112 Double_t ptmax_4_8;
113 Double_t ptmin_8_10;
114 Double_t ptmax_8_10;
115
116 if(!isKeepDfromB){
117 ptmin_0_4 = 0.0 ;
118 ptmax_0_4 = 4.0 ;
119 ptmin_4_8 = 4.0 ;
120 ptmax_4_8 = 8.0 ;
121 ptmin_8_10 = 8.0 ;
122 ptmax_8_10 = 10.0 ;
123 } else{
124 ptmin_0_4 = 0.0 ;
125 ptmax_0_4 = 3.0 ;
126 ptmin_4_8 = 3.0 ;
127 ptmax_4_8 = 5.0 ;
128 ptmin_8_10 = 5.0 ;
129 ptmax_8_10 = 10.0 ;
130 }
131 */
132
133 //CONTAINER DEFINITION
134 Info("AliCFTaskVertexingHF","SETUP CONTAINER");
85e55da4 135
136 const Double_t phimax = 2*TMath::Pi();
137
138 //Setting up the container grid...
139 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
ec5288c3 140// const Int_t nbinpt_0_4 = 8 ; //bins in pt from 0 to 4 GeV
141// const Int_t nbinpt_4_8 = 4 ; //bins in pt from 4 to 8 GeV
142// const Int_t nbinpt_8_10 = 1 ; //bins in pt from 8 to 10 GeV
85e55da4 143
144/*
ec5288c3 145 Int_t nbinpt_0_4;
146 Int_t nbinpt_4_8;
147 Int_t nbinpt_8_10;
85e55da4 148 if (!isKeepDfromB){
ec5288c3 149 nbinpt_0_4 = 8 ; //bins in pt from 0 to 4 GeV
150 nbinpt_4_8 = 4 ; //bins in pt from 4 to 8 GeV
151 nbinpt_8_10 = 1 ; //bins in pt from 8 to 10 GeV
85e55da4 152 }else{
ec5288c3 153 nbinpt_0_4 = 3 ; //bins in pt from 0 to 3 GeV
154 nbinpt_4_8 = 1 ; //bins in pt from 3 to 5 GeV
155 nbinpt_8_10 = 1 ; //bins in pt from 5 to 10 GeV
85e55da4 156 }
157*/
ec5288c3 158 const Int_t nbinpt = cutsDplustoKpipi->GetNPtBins(); // bins in pT
159 printf("pT: nbin (from cuts file) = %d\n",nbinpt);
160 const Int_t nbiny = 24 ; //bins in y
161 const Int_t nbinphi = 18 ; //bins in phi
162 const Int_t nbincT = 25 ; //bins in cT
163 const Int_t nbinpointing = 350 ; //bins in cosPointingAngle
164 const Int_t nbinpTpi_0_4 = 8 ; //bins in ptPi from 0 to 4 GeV
165 const Int_t nbinpTpi_4_8 = 4 ; //bins in ptPi from 4 to 8 GeV
166 const Int_t nbinpTpi_8_10 = 1 ; //bins in ptPi from 8 to 10 GeV
167 const Int_t nbinpTk_0_4 = 8 ; //bins in ptKa from 0 to 4 GeV
168 const Int_t nbinpTk_4_8 = 4 ; //bins in ptKa from 4 to 8 GeV
169 const Int_t nbinpTk_8_10 = 1 ; //bins in ptKa from 8 to 10 GeV
170 const Int_t nbinpTpi2_0_4 = 8 ; //bins in ptpi2 from 0 to 4 GeV
171 const Int_t nbinpTpi2_4_8 = 4 ; //bins in ptpi2 from 4 to 8 GeV
172 const Int_t nbinpTpi2_8_10 = 1 ; //bins in ptpi2 from 8 to 10 GeV
173 const Int_t nbinzvtx = 30 ; //bins in z vertex
ad02b758 174 const Int_t nbincent = 18; //bins in centrality
175 const Int_t nbincent_0_10 = 4; //bins in centrality between 0 and 10
176 const Int_t nbincent_10_60 = 10; //bins in centrality between 10 and 60
177 const Int_t nbincent_60_100 = 4; //bins in centrality between 60 and 100
ec5288c3 178 const Int_t nbinfake = 3; //bins in fake
179 const Int_t nbinpointingXY = 50; //bins in cosPointingAngleXY
180 const Int_t nbinnormDecayLXY = 20; //bins in NormDecayLengthXY
fd25e7aa 181 const Int_t nbinmult = 49; //bins in multiplicity (total number)
ec5288c3 182 const Int_t nbinmult_0_20 = 20; //bins in multiplicity between 0 and 20
183 const Int_t nbinmult_20_50 = 15; //bins in multiplicity between 20 and 50
fd25e7aa 184 const Int_t nbinmult_50_80 = 10; //bins in multiplicity between 50 and 80
185 const Int_t nbinmult_80_100 = 4; //bins in multiplicity between 80 and 100
186 const Int_t nbinmult_100_400 = 3; //bins in multiplicity between 100 and 400
187 if(isPPbData) nbinmult += nbinmult_100_400;
0c34e470 188
189 // Fine Ntrk bining setting
190 Double_t *binLimmultFine;
191 Int_t nbinmultTmp=nbinmult;
192 if(isFineNtrkBin){
193 Int_t nbinLimmultFine=100;
194 if(isPPbData) nbinLimmultFine = 200;
195 const UInt_t nbinMultFine = nbinLimmultFine;
196 binLimmultFine = new Double_t[nbinMultFine+1];
197 for (Int_t ibin0 = 0 ; ibin0<nbinMultFine+1; ibin0++){
198 binLimmultFine[ibin0] = ibin0;
199 }
200 nbinmultTmp=nbinLimmultFine;
201 }
202 const Int_t nbinmultTot=nbinmultTmp;
203
204
ec5288c3 205 //the sensitive variables, their indices
206 const UInt_t ipT = 0;
207 const UInt_t iy = 1;
208 const UInt_t iphi = 2;
209 const UInt_t icT = 3;
210 const UInt_t ipointing = 4;
211 const UInt_t ipTpi = 5;
212 const UInt_t ipTk = 6;
213 const UInt_t ipTpi2 = 7;
214 const UInt_t izvtx = 8;
215 const UInt_t icent = 9;
216 const UInt_t ifake = 10;
217 const UInt_t ipointingXY = 11;
218 const UInt_t inormDecayLXY = 12;
219 const UInt_t imult = 13;
220
221 const Int_t nvarTot = 14 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, zvtx, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
222
85e55da4 223 //arrays for the number of bins in each dimension
ec5288c3 224 Int_t iBin[nvarTot];
225 //iBin[ipT]=nbinpt_0_4+nbinpt_4_8+nbinpt_8_10;
226 iBin[ipT]=nbinpt;
227 iBin[iy]=nbiny;
228 iBin[iphi]=nbinphi;
229 // iBin[icT]=nbincT_0_4+nbincT_4_8+nbincT_8_10;
230 //iBin[4]=nbinpointing_0_4+nbinpointing_4_8+nbinpointing_8_10;
231 iBin[icT]=nbincT;
232 iBin[ipointing]=nbinpointing;
233 iBin[ipTpi]=nbinpt;
234 iBin[ipTk]=nbinpt;
235 iBin[ipTpi2]=nbinpt;
236 iBin[izvtx]=nbinzvtx;
237 iBin[icent]=nbincent;
238 iBin[ifake]=nbinfake;
239 iBin[ipointingXY]=nbinpointingXY;
240 iBin[inormDecayLXY]=nbinnormDecayLXY;
0c34e470 241 iBin[imult]=nbinmultTot;
85e55da4 242
243 //arrays for lower bounds :
ec5288c3 244 Double_t *binLimpT=new Double_t[iBin[ipT]+1];
245 Double_t *binLimy=new Double_t[iBin[iy]+1];
246 Double_t *binLimphi=new Double_t[iBin[iphi]+1];
247 Double_t *binLimcT=new Double_t[iBin[icT]+1];
248 Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
249 Double_t *binLimpTpi=new Double_t[iBin[ipTpi]+1];
250 Double_t *binLimpTk=new Double_t[iBin[ipTk]+1];
251 Double_t *binLimpTpi2=new Double_t[iBin[ipTpi2]+1];
252 Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
253 Double_t *binLimcent=new Double_t[iBin[icent]+1];
254 Double_t *binLimfake=new Double_t[iBin[ifake]+1];
255 Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
256 Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
257 Double_t *binLimmult=new Double_t[iBin[imult]+1];
258
85e55da4 259 // checking limits
260 /*
ec5288c3 261 if (ptmax_0_4 != ptmin_4_8) {
262 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 1st range != min lim 2nd range, please check!");
263 }
264 if (ptmax_4_8 != ptmin_8_10) {
265 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","max lim 2nd range != min lim 3rd range, please check!");
266 }
85e55da4 267 */
268 // values for bin lower bounds
269 // pt
ec5288c3 270 Float_t* floatbinLimpT = cutsDplustoKpipi->GetPtBinLimits();
271 for (Int_t ibinpT = 0 ; ibinpT<iBin[ipT]+1; ibinpT++){
272 binLimpT[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
273 binLimpTpi[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
274 binLimpTk[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
275 binLimpTpi2[ibinpT] = (Double_t)floatbinLimpT[ibinpT];
85e55da4 276 }
ec5288c3 277 for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);
278
85e55da4 279 /*
ec5288c3 280 for(Int_t i=0; i<=nbinpt_0_4; i++) binLimpT[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbinpt_0_4*(Double_t)i ;
281 if (binLimpT[nbinpt_0_4] != ptmin_4_8) {
282 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 1st range - differs from expected!\n");
283 }
284 for(Int_t i=0; i<=nbinpt_4_8; i++) binLimpT[i+nbinpt_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbinpt_4_8*(Double_t)i ;
285 if (binLimpT[nbinpt_0_4+nbinpt_4_8] != ptmin_8_10) {
286 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for pt - 2nd range - differs from expected!\n");
287 }
288 for(Int_t i=0; i<=nbinpt_8_10; i++) binLimpT[i+nbinpt_0_4+nbinpt_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbinpt_8_10*(Double_t)i ;
85e55da4 289 */
ec5288c3 290
85e55da4 291 // y
ec5288c3 292 for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin) /nbiny*(Double_t)i ;
293
85e55da4 294 // Phi
ec5288c3 295 for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin) /nbinphi*(Double_t)i ;
296
85e55da4 297 // cT
ec5288c3 298 for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin) /nbincT*(Double_t)i ;
299
85e55da4 300 // cosPointingAngle
ec5288c3 301 for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin + (cosmax-cosmin) /nbinpointing*(Double_t)i ;
85e55da4 302
303 /*
304 // ptPi
ec5288c3 305 for(Int_t i=0; i<=nbincT_0_4; i++) binLimcT[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbincT_0_4*(Double_t)i ;
306 if (binLimcT[nbincT_0_4] != ptmin_4_8) {
307 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 1st range - differs from expected!");
85e55da4 308 }
ec5288c3 309 for(Int_t i=0; i<=nbincT_4_8; i++) binLimcT[i+nbincT_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbincT_4_8*(Double_t)i ;
310 if (binLimcT[nbincT_0_4+nbincT_4_8] != ptmin_8_10) {
311 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptPi - 2nd range - differs from expected!\n");
85e55da4 312 }
ec5288c3 313 for(Int_t i=0; i<=nbincT_8_10; i++) binLimcT[i+nbincT_0_4+nbincT_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbincT_8_10*(Double_t)i ;
314
85e55da4 315 // ptKa
ec5288c3 316 for(Int_t i=0; i<=nbinpointing_0_4; i++) binLimpointing[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbinpointing_0_4*(Double_t)i ;
317 if (binLimpointing[nbinpointing_0_4] != ptmin_4_8) {
318 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 1st range - differs from expected!");
85e55da4 319 }
ec5288c3 320 for(Int_t i=0; i<=nbinpointing_4_8; i++) binLimpointing[i+nbinpointing_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbinpointing_4_8*(Double_t)i ;
321 if (binLimpointing[nbinpointing_0_4+nbinpointing_4_8] != ptmin_8_10) {
322 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for ptKa - 2nd range - differs from expected!\n");
85e55da4 323 }
ec5288c3 324 for(Int_t i=0; i<=nbinpointing_8_10; i++) binLimpointing[i+nbinpointing_0_4+nbinpointing_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbinpointing_8_10*(Double_t)i ;
85e55da4 325 */
ec5288c3 326
85e55da4 327 // z Primary Vertex
ec5288c3 328 for(Int_t i=0; i<=nbinzvtx; i++) {
329 binLimzvtx[i]=(Double_t)zvtxmin + (zvtxmax-zvtxmin) /nbinzvtx*(Double_t)i ;
85e55da4 330 }
ec5288c3 331
1f780958 332 // centrality
ad02b758 333
ec5288c3 334 for(Int_t i=0; i<=nbincent_0_10; i++) binLimcent[i]=(Double_t)centmin_0_10 + (centmax_0_10-centmin_0_10)/nbincent_0_10*(Double_t)i ;
ad02b758 335 if (binLimcent[nbincent_0_10] != centmin_10_60) {
336 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
b7af2639 337 }
ad02b758 338 for(Int_t i=0; i<=nbincent_10_60; i++) binLimcent[i+nbincent_0_10]=(Double_t)centmin_10_60 + (centmax_10_60-centmin_10_60)/nbincent_10_60*(Double_t)i ;
339 if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100) {
340 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
341 }
4c4ad34c 342 for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_0_10+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
ec5288c3 343
1f780958 344 // fake
ec5288c3 345 for(Int_t i=0; i<=nbinfake; i++) {
346 binLimfake[i]=(Double_t)fakemin + (fakemax-fakemin)/nbinfake * (Double_t)i;
1f780958 347 }
348
ec5288c3 349 // cosPointingAngleXY
350 for(Int_t i=0; i<=nbinpointingXY; i++) binLimpointingXY[i]=(Double_t)cosminXY + (cosmaxXY-cosminXY) /nbinpointingXY*(Double_t)i ;
b7af2639 351
ec5288c3 352 // normDecayLXY
353 for(Int_t i=0; i<=nbinnormDecayLXY; i++) binLimnormDecayLXY[i]=(Double_t)normDecLXYmin + (normDecLXYmax-normDecLXYmin) /nbinnormDecayLXY*(Double_t)i ;
85e55da4 354
ec5288c3 355 // multiplicity
fd25e7aa 356 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 ;
357 if (binLimmult[nbinmult_0_20] != multmin_20_50) {
358 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
359 }
360 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 ;
361 if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_80) {
362 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
363 }
364 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 ;
365 if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80] != multmin_80_100) {
366 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 3rd range - differs from expected!\n");
367 }
368 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 ;
369 if (binLimmult[nbinmult_0_20+nbinmult_20_50+nbinmult_50_80+nbinmult_80_100] != multmin_100_400) {
370 Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 4th range - differs from expected!\n");
371 }
372 if(isPPbData){
373 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 ;
374 }
375
85e55da4 376 //one "container" for MC
377 TString nameContainer="";
378 if(!isKeepDfromB) {
a147e835 379 nameContainer="CFHFcontainer_DplustoKpipi_Prompt";
f4fb19b2 380
85e55da4 381 }
382 else if(isKeepDfromBOnly){
a147e835 383 nameContainer="CFHFcontainer_DplustoKpipi_FromB";
f4fb19b2 384
85e55da4 385 }
386 else {
a147e835 387 nameContainer="CFHFcontainer_DplustoKpipi_All";
85e55da4 388 }
050ff6a8 389 nameContainer += suffixName.Data();
f4fb19b2 390
85e55da4 391
ec5288c3 392 AliCFContainer* container;
393 if (configuration == AliCFTaskVertexingHF::kSnail){
394 container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvarTot,iBin);
395 //setting the bin limits
396 printf("pt\n");
397 container -> SetBinLimits(ipT,binLimpT);
398 printf("y\n");
399 container -> SetBinLimits(iy,binLimy);
400 printf("Phi\n");
401 container -> SetBinLimits(iphi,binLimphi);
402 printf("cT\n");
403 container -> SetBinLimits(icT,binLimcT);
404 printf("pointing angle\n");
405 container -> SetBinLimits(ipointing,binLimpointing);
406 printf("ptpi\n");
407 container -> SetBinLimits(ipTpi,binLimpTpi);
408 printf("ptK\n");
409 container -> SetBinLimits(ipTk,binLimpTk);
410 printf("ptpi2\n");
411 container -> SetBinLimits(ipTpi2,binLimpTpi2);
412 printf("zvtx \n");
413 container -> SetBinLimits(izvtx,binLimzvtx);
414 printf("cent\n");
415 container -> SetBinLimits(icent,binLimcent);
416 printf("fake\n");
417 container -> SetBinLimits(ifake,binLimfake);
418 printf("pointingXY\n");
419 container -> SetBinLimits(ipointingXY,binLimpointingXY);
420 printf("normDecayLXY\n");
421 container -> SetBinLimits(inormDecayLXY,binLimnormDecayLXY);
422 printf("multiplicity\n");
0c34e470 423 if(isFineNtrkBin) container -> SetBinLimits(imult,binLimmultFine);
424 else container -> SetBinLimits(imult,binLimmult);
ec5288c3 425
426 container -> SetVarTitle(ipT,"pt");
427 container -> SetVarTitle(iy,"y");
428 container -> SetVarTitle(iphi, "phi");
429 container -> SetVarTitle(icT, "ct");
430 container -> SetVarTitle(ipointing, "pointing");
431 container -> SetVarTitle(ipTpi, "ptpi");
432 container -> SetVarTitle(ipTk, "ptK");
433 container -> SetVarTitle(ipTpi2, "ptpi2");
434 container -> SetVarTitle(izvtx, "zvtx");
435 container -> SetVarTitle(icent, "centrality");
436 container -> SetVarTitle(ifake, "fake");
437 container -> SetVarTitle(ipointingXY, "piointingXY");
438 container -> SetVarTitle(inormDecayLXY, "normDecayLXY");
439 container -> SetVarTitle(imult, "multiplicity");
440 }
441 else if (configuration == AliCFTaskVertexingHF::kCheetah){
442 //arrays for the number of bins in each dimension
443 const Int_t nvar = 8;
444
445 const UInt_t ipTFast = 0;
446 const UInt_t iyFast = 1;
447 const UInt_t icTFast = 2;
448 const UInt_t iphiFast = 3;
449 const UInt_t izvtxFast = 4;
450 const UInt_t icentFast = 5;
451 const UInt_t ifakeFast = 6;
452 const UInt_t imultFast = 7;
453
454 Int_t iBinFast[nvar];
455 iBinFast[ipTFast] = iBin[ipT];
456 iBinFast[iyFast] = iBin[iy];
457 iBinFast[icTFast] = iBin[icT];
458 iBinFast[iphiFast] = iBin[iphi];
459 iBinFast[izvtxFast] = iBin[izvtx];
460 iBinFast[icentFast] = iBin[icent];
461 iBinFast[ifakeFast] = iBin[ifake];
462 iBinFast[imultFast] = iBin[imult];
463
464 container = new AliCFContainer(nameContainer,"container for tracks",nstep,nvar,iBinFast);
465 printf("pt\n");
466 container -> SetBinLimits(ipTFast,binLimpT);
467 printf("y\n");
468 container -> SetBinLimits(iyFast,binLimy);
469 printf("ct\n");
470 container -> SetBinLimits(icTFast,binLimcT);
471 printf("phi\n");
472 container -> SetBinLimits(iphiFast,binLimphi);
473 printf("zvtx\n");
474 container -> SetBinLimits(izvtxFast,binLimzvtx);
475 printf("centrality\n");
476 container -> SetBinLimits(icentFast,binLimcent);
477 printf("fake\n");
478 container -> SetBinLimits(ifakeFast,binLimfake);
479 printf("multiplicity\n");
0c34e470 480 if(isFineNtrkBin) container -> SetBinLimits(imultFast,binLimmultFine);
481 else container -> SetBinLimits(imultFast,binLimmult);
ec5288c3 482
483 container -> SetVarTitle(ipTFast,"pt");
484 container -> SetVarTitle(iyFast,"y");
485 container -> SetVarTitle(icTFast, "ct");
486 container -> SetVarTitle(iphiFast, "phi");
487 container -> SetVarTitle(izvtxFast, "zvtx");
488 container -> SetVarTitle(icentFast, "centrality");
489 container -> SetVarTitle(ifakeFast, "fake");
490 container -> SetVarTitle(imultFast, "multiplicity");
491 }
492
493 //return container;
494
85e55da4 495 container -> SetStepTitle(0, "MCLimAcc");
496 container -> SetStepTitle(1, "MC");
497 container -> SetStepTitle(2, "MCAcc");
498 container -> SetStepTitle(3, "RecoVertex");
499 container -> SetStepTitle(4, "RecoRefit");
500 container -> SetStepTitle(5, "Reco");
501 container -> SetStepTitle(6, "RecoAcc");
502 container -> SetStepTitle(7, "RecoITSCluster");
503 container -> SetStepTitle(8, "RecoCuts");
654ef521 504 container -> SetStepTitle(9, "RecoPID");
85e55da4 505
85e55da4 506
507 //CREATE THE CUTS -----------------------------------------------
508
509 // Gen-Level kinematic cuts
510 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
511
512 //Particle-Level cuts:
513 AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
3ee5eb83 514 Bool_t useAbsolute = kTRUE;
515 if (isSign != 2){
516 useAbsolute = kFALSE;
517 }
518 mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute); // kTRUE set in order to include antiparticle
85e55da4 519 mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important)
520
521 // Acceptance cuts:
522 AliCFAcceptanceCuts* accCuts = new AliCFAcceptanceCuts("accCuts", "Acceptance cuts");
523 AliCFTrackKineCuts *kineAccCuts = new AliCFTrackKineCuts("kineAccCuts","Kine-Acceptance cuts");
524 kineAccCuts->SetPtRange(ptmin,ptmax);
525 kineAccCuts->SetEtaRange(etamin,etamax);
526
527 // Rec-Level kinematic cuts
528 AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
529
530 AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
531
532 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
533
534 printf("CREATE MC KINE CUTS\n");
535 TObjArray* mcList = new TObjArray(0) ;
536 mcList->AddLast(mcKineCuts);
537 mcList->AddLast(mcGenCuts);
538
539 printf("CREATE ACCEPTANCE CUTS\n");
540 TObjArray* accList = new TObjArray(0) ;
541 accList->AddLast(kineAccCuts);
542
543 printf("CREATE RECONSTRUCTION CUTS\n");
544 TObjArray* recList = new TObjArray(0) ; // not used!!
545 recList->AddLast(recKineCuts);
546 recList->AddLast(recQualityCuts);
547 recList->AddLast(recIsPrimaryCuts);
548
549 TObjArray* emptyList = new TObjArray(0);
550
551 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
552 printf("CREATE INTERFACE AND CUTS\n");
553 AliCFManager* man = new AliCFManager() ;
554 man->SetParticleContainer(container);
555 man->SetParticleCutsList(0 , mcList); // MC, Limited Acceptance
556 man->SetParticleCutsList(1 , mcList); // MC
557 man->SetParticleCutsList(2 , accList); // Acceptance
558 man->SetParticleCutsList(3 , emptyList); // Vertex
559 man->SetParticleCutsList(4 , emptyList); // Refit
560 man->SetParticleCutsList(5 , emptyList); // AOD
561 man->SetParticleCutsList(6 , emptyList); // AOD in Acceptance
562 man->SetParticleCutsList(7 , emptyList); // AOD with required n. of ITS clusters
563 man->SetParticleCutsList(8 , emptyList); // AOD Reco (PPR cuts implemented in Task)
564 man->SetParticleCutsList(9 , emptyList); // AOD Reco PID
565
566 // Get the pointer to the existing analysis manager via the static access method.
567 //==============================================================================
568 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
569 if (!mgr) {
570 ::Error("AddTaskCompareHF", "No analysis manager to connect to.");
571 return NULL;
572 }
573 //CREATE THE TASK
574 printf("CREATE TASK\n");
575
576 // create the task
577 AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsDplustoKpipi);
3ee5eb83 578 task->SetFillFromGenerated(kFALSE);
85e55da4 579 task->SetDecayChannel(31);
b09dbb93 580 task->SetUseWeight(useWeight);
85e55da4 581 task->SetCFManager(man); //here is set the CF manager
3ee5eb83 582 task->SetSign(isSign);
654ef521 583 task->SetCentralitySelection(kFALSE);
584 task->SetFakeSelection(0);
0ada222f 585 task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
586 task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
19560d8c 587 task->SetUseNchWeight(useNchWeight); //correction with mult weight
0c34e470 588 if(useNchWeight || useNtrkWeight){
19560d8c 589 if(hMult) task->SetMCNchHisto(hMult);
590 else{
591 AliFatal("Histogram for multiplicity weights not found");
592 return 0x0;
593 }
0c34e470 594 task->SetUseNchWeight(kTRUE);
595 if(useNtrkWeight) task->SetUseNchTrackletsWeight();
596 }
597 if(isPPbData) {
598 task->SetIsPPbData(kTRUE);
58744a23 599 }
3ee5eb83 600 if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
601 if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);
85e55da4 602
5b37c6e5 603 TF1* funcWeight = 0x0;
604 if (task->GetUseWeight()) {
605 funcWeight = (TF1*)cutFile->Get("funcWeight");
606 if (funcWeight == 0x0){
607 Printf("FONLL Weights will be used");
608 }
609 else {
610 task->SetWeightFunction(funcWeight);
611 Printf("User-defined Weights will be used. The function being:");
612 task->GetWeightFunction()->Print();
613 }
614 }
615
fd25e7aa 616 task->SetMultiplicityEstimator(multiplicityEstimator);
617 if(estimatorFilename.EqualTo("") ) {
618 printf("Estimator file not provided, multiplicity corrected histograms will not be filled\n");
619 task->SetUseZvtxCorrectedNtrkEstimator(kFALSE);
620 } else{
621 TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
622 if(!fileEstimator) {
623 AliFatal("File with multiplicity estimator not found");
624 return;
625 }
626 task->SetUseZvtxCorrectedNtrkEstimator(kTRUE);
627 task->SetReferenceMultiplcity(refMult);
628
629 if (isPPbData) { //load multiplicity estimators for pPb
630 const Char_t* periodNames[2] = {"LHC13b", "LHC13c"};
631 TProfile *multEstimatorAvg[2];
632 for (Int_t ip=0; ip < 2; ip++) {
633 multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
634 if (!multEstimatorAvg[ip]) {
635 AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
636 return;
637 }
638 }
639 task->SetMultiplVsZProfileLHC13b(multEstimatorAvg[0]);
640 task->SetMultiplVsZProfileLHC13c(multEstimatorAvg[1]);
641
642 } else { //load multiplicity estimators for pp
643 const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
644 TProfile* multEstimatorAvg[4];
645
646 for(Int_t ip=0; ip<4; ip++) {
647 multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("SPDmult10_%s",periodNames[ip]))->Clone(Form("SPDmult10_%s_clone",periodNames[ip])));
648 if (!multEstimatorAvg[ip]) {
649 AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
650 return;
651 }
652 }
653 task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
654 task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
655 task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
656 task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
657 }
658 }
f26726ed 659
3ee5eb83 660 Printf("***************** CONTAINER SETTINGS *****************");
661 Printf("decay channel = %d",(Int_t)task->GetDecayChannel());
662 Printf("FillFromGenerated = %d",(Int_t)task->GetFillFromGenerated());
663 Printf("Dselection = %d",(Int_t)task->GetDselection());
3ee5eb83 664 Printf("Sign = %d",(Int_t)task->GetSign());
b7af2639 665 Printf("Centrality selection = %d",(Int_t)task->GetCentralitySelection());
1f780958 666 Printf("Fake selection = %d",(Int_t)task->GetFakeSelection());
0ada222f 667 Printf("RejectCandidateIfNotFromQuark selection = %d",(Int_t)task->GetRejectCandidateIfNotFromQuark());
668 Printf("UseMCVertex selection = %d",(Int_t)task->GetUseMCVertex());
1f780958 669 Printf("***************END CONTAINER SETTINGS *****************\n");
670
85e55da4 671 //-----------------------------------------------------------//
672 // create correlation matrix for unfolding - only eta-pt //
673 //-----------------------------------------------------------//
674
675 Bool_t AcceptanceUnf = kTRUE; // unfold at acceptance level, otherwise PPR
676
677 Int_t thnDim[4];
678
679 //first half : reconstructed
680 //second half : MC
681
ec5288c3 682 thnDim[0] = iBin[ipT];
683 thnDim[2] = iBin[ipT];
684 thnDim[1] = iBin[iy];
685 thnDim[3] = iBin[iy];
85e55da4 686
687 TString nameCorr="";
688 if(!isKeepDfromB) {
a147e835 689 nameCorr="CFHFcorr_DplustoKpipi_Prompt";
85e55da4 690 }
3ee5eb83 691 else if(isKeepDfromBOnly){
a147e835 692 nameCorr="CFHFcorr_DplustoKpipi_FromB";
85e55da4 693 }
694 else {
a147e835 695 nameCorr="CFHFcorr_DplustoKpipi_All";
85e55da4 696 }
050ff6a8 697 nameCorr += suffixName.Data();
f4fb19b2 698
85e55da4 699
700 THnSparseD* correlation = new THnSparseD(nameCorr,"THnSparse with correlations",4,thnDim);
701 Double_t** binEdges = new Double_t[2];
702
703 // set bin limits
704
ec5288c3 705 binEdges[0]= binLimpT;
706 binEdges[1]= binLimy;
85e55da4 707
708 correlation->SetBinEdges(0,binEdges[0]);
709 correlation->SetBinEdges(2,binEdges[0]);
710
711 correlation->SetBinEdges(1,binEdges[1]);
712 correlation->SetBinEdges(3,binEdges[1]);
713
714 correlation->Sumw2();
715
716 // correlation matrix ready
717 //------------------------------------------------//
718
719 task->SetCorrelationMatrix(correlation); // correlation matrix for unfolding
720
721 // Create and connect containers for input/output
722
723 // ------ input data ------
724 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
725
726 // ----- output data -----
727
728 TString outputfile = AliAnalysisManager::GetCommonFileName();
f26726ed 729 TString output1name="", output2name="", output3name="", output4name="", output5name="";
85e55da4 730 output2name=nameContainer;
731 output3name=nameCorr;
f26726ed 732 output5name= "coutProfDp";
85e55da4 733 if(!isKeepDfromB) {
a147e835 734 outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_Prompt";
735 output1name="CFHFhist_DplustoKpipi_Prompt";
b5e549ed 736 output3name+="_Prompt";
a147e835 737 output4name= "Cuts_DplustoKpipi_Prompt";
f26726ed 738 output5name+="_Prompt";
85e55da4 739 }
740 else if(isKeepDfromBOnly){
a147e835 741 outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_FromB";
742 output1name="CFHFhist_DplustoKpipi_FromB";
b5e549ed 743 output3name+="_FromB";
a147e835 744 output4name= "Cuts_DplustoKpipi_FromB";
f26726ed 745 output5name+="_FromB";
85e55da4 746 }
747 else{
a147e835 748 outputfile += ":PWG3_D2H_CFtaskDplustoKpipi_All";
749 output1name="CFHFhist_DplustoKpipi_All";
b5e549ed 750 output3name+="_All";
a147e835 751 output4name= "Cuts_DplustoKpipi_All";
f26726ed 752 output5name+="_All";
85e55da4 753 }
f4fb19b2 754 outputfile += suffixName.Data();
755 output1name += suffixName.Data();
f4fb19b2 756 output4name += suffixName.Data();
f26726ed 757 output5name += suffixName.Data();
85e55da4 758
759 //now comes user's output objects :
760 // output TH1I for event counting
761 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output1name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
762 // output Correction Framework Container (for acceptance & efficiency calculations)
763 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output2name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
764 // Unfolding - correlation matrix
765 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output3name, THnSparseD::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
766 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output4name, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
f26726ed 767 // estimators list
768 AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output5name, TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
85e55da4 769
770 mgr->AddTask(task);
771
772 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
773 mgr->ConnectOutput(task,1,coutput1);
774 mgr->ConnectOutput(task,2,coutput2);
775 mgr->ConnectOutput(task,3,coutput3);
776 mgr->ConnectOutput(task,4,coutput4);
f26726ed 777 mgr->ConnectOutput(task,5,coutput5);
85e55da4 778
779 return task;
b5e549ed 780}