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