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