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