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