Add option for centrality scan (Zaida)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliHFSystErr.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////////
19 //
20 // Class to handle systematic errors for charm hadrons
21 //
22 // Usage:
23 // AliHFSystEff syst;           // DECAY = 1 for D0, 2, for D+, 3 for D* 
24 // syst.SetRunNumber(YEAR);     // YEAR = two last numbers of the year (is 10 for 2010)
25 // syst.SetCollisionType(TYPE);  // TYPE =  0 is pp, 1 is PbPb
26 // syst.SetCentrality(CENT);     // CENT is centrality, 0100 for MB, 020 (4080) for 0-20 (40-80) CC...
27 // syst.Init(DECAY);             // DECAY = 1 for D0, 2, for D+, 3 for D* 
28 // syst.DrawErrors(); // to see a plot of the error contributions
29 // syst.GetTotalSystErr(pt); // to get the total err at pt 
30 //
31 // Author: A.Dainese, andrea.dainese@pd.infn.it
32 /////////////////////////////////////////////////////////////
33
34 #include <TStyle.h>
35 #include <TGraphAsymmErrors.h>
36 #include <TMath.h>
37 #include <TCanvas.h>
38 #include <TH2F.h>
39 #include <TLegend.h>
40 #include <TColor.h>
41
42 #include "AliLog.h"
43 #include "AliHFSystErr.h"
44
45
46 ClassImp(AliHFSystErr)
47
48 //--------------------------------------------------------------------------
49 AliHFSystErr::AliHFSystErr(const Char_t* name, const Char_t* title) : 
50 TNamed(name,title),
51 fNorm(0),
52 fRawYield(0),
53 fTrackingEff(0),
54 fBR(0),
55 fCutsEff(0),
56 fPIDEff(0),
57 fMCPtShape(0),
58 fPartAntipart(0),
59 fRunNumber(10),
60 fCollisionType(0),
61 fCentralityClass("0100"),
62 fIsLowEnergy(false),
63 fIsCentScan(false)
64 {
65   //
66   // Default Constructor
67   //
68 }
69
70 //--------------------------------------------------------------------------
71 AliHFSystErr::~AliHFSystErr() {
72   //  
73   // Default Destructor
74   //
75   /*
76
77   if(fNorm)         { delete fNorm; fNorm=0; }
78   if(fRawYield)     { delete fRawYield; fRawYield=0; }
79   if(fTrackingEff)  { delete fTrackingEff; fTrackingEff=0; }
80   if(fBR)           { delete fBR; fBR=0; }
81   if(fCutsEff)      { delete fCutsEff; fCutsEff=0; }
82   if(fPIDEff)       { delete fPIDEff; fPIDEff=0; }
83   if(fMCPtShape)    { delete fMCPtShape; fMCPtShape=0; }
84   if(fPartAntipart) { delete fPartAntipart; fPartAntipart=0; }
85   */
86 }
87
88 //--------------------------------------------------------------------------
89 void AliHFSystErr::Init(Int_t decay){
90   //
91   // Variables/histos initialization
92   //
93
94   if (fRunNumber!=10 && fIsLowEnergy==false) { 
95     AliError("Only settings for 2010 and the low energy runs are implemented so far");
96   }
97   if (fCentralityClass!="020" && fCentralityClass!="4080" && fCentralityClass!="0100"){
98     AliError("Only settings for MB2010 are implemented so far");
99   }
100
101   switch(decay) {
102   case 1: // D0->Kpi
103     if (fCollisionType==0) {
104       if (fIsLowEnergy) InitD0toKpi2010ppLowEn();
105       else InitD0toKpi2010pp();
106     } else if (fCollisionType==1) {
107       if (fCentralityClass=="010") InitD0toKpi2010PbPb010CentScan();
108       else if (fCentralityClass=="1020") InitD0toKpi2010PbPb1020CentScan();
109       else if (fCentralityClass=="020") InitD0toKpi2010PbPb020();
110       else if (fCentralityClass=="2040") InitD0toKpi2010PbPb2040CentScan();
111       else if (fCentralityClass=="4060") InitD0toKpi2010PbPb4060CentScan();
112       else if (fCentralityClass=="6080") InitD0toKpi2010PbPb6080CentScan();
113       else if (fCentralityClass=="4080") InitD0toKpi2010PbPb4080();
114       else AliError("Not yet implemented");
115     }
116     //    else if (fCollisionType==2) InitD0toKpi2010ppLowEn();
117     break;
118   case 2: // D+->Kpipi
119     if (fCollisionType==0) {
120       if (fIsLowEnergy) InitDplustoKpipi2010ppLowEn();
121       else InitDplustoKpipi2010pp();
122     } else if (fCollisionType==1) {
123       if (fCentralityClass=="010") InitDplustoKpipi2010PbPb010CentScan();
124       else if (fCentralityClass=="1020") InitDplustoKpipi2010PbPb1020CentScan();
125       else if (fCentralityClass=="020") InitDplustoKpipi2010PbPb020();
126       else if (fCentralityClass=="2040") InitDplustoKpipi2010PbPb2040CentScan();
127       else if (fCentralityClass=="4060") InitDplustoKpipi2010PbPb4060CentScan();
128       else if (fCentralityClass=="6080") InitDplustoKpipi2010PbPb6080CentScan();
129       else if (fCentralityClass=="4080") InitDplustoKpipi2010PbPb4080();
130       else AliError("Not yet implemented");
131     }
132     break;
133   case 3: // D*->D0pi
134     if (fCollisionType==0) {
135       if(fIsLowEnergy)  InitDstartoD0pi2010ppLowEn();
136       else InitDstartoD0pi2010pp();
137     }else if (fCollisionType==1) {
138       if (fCentralityClass=="010") InitDstartoD0pi2010PbPb010CentScan();
139       else if (fCentralityClass=="1020") InitDstartoD0pi2010PbPb1020CentScan();
140       else if (fCentralityClass=="020") InitDstartoD0pi2010PbPb020();
141       else if (fCentralityClass=="2040" && fIsCentScan) InitDstartoD0pi2010PbPb2040CentScan();
142       else if (fCentralityClass=="2040") InitDstartoD0pi2010PbPb2040();
143       else if (fCentralityClass=="4060") InitDstartoD0pi2010PbPb4060CentScan();
144       else if (fCentralityClass=="6080") InitDstartoD0pi2010PbPb6080CentScan();
145       else if (fCentralityClass=="4080") InitDstartoD0pi2010PbPb4080();
146       else AliError("Not yet implemented");
147     }
148     break;
149   case 4: // D+s->KKpi
150     if (fCollisionType==0) InitDstoKKpi2010pp();
151     else AliError("Not yet implemented");
152     break;
153     
154   default:
155     printf("Invalid decay type: %d\n",decay);
156     break;
157   }
158
159 }
160   
161 //--------------------------------------------------------------------------
162 void AliHFSystErr::InitD0toKpi2010pp() {
163   // 
164   // D0->Kpi syst errors. Responsible: A. Rossi
165   //   2010 pp sample
166   //
167
168   // Normalization
169   fNorm = new TH1F("fNorm","fNorm",24,0,24);
170   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.04); // 4% error on sigmaV0and
171
172   // Branching ratio 
173   fBR = new TH1F("fBR","fBR",24,0,24);
174   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
175
176   // Tracking efficiency
177   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
178   for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.08); // 8% (4% per track)
179
180   // Raw yield extraction
181   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
182   fRawYield->SetBinContent(1,1);
183   fRawYield->SetBinContent(2,0.22);
184   fRawYield->SetBinContent(3,0.1);
185   for(Int_t i=4;i<=7;i++) fRawYield->SetBinContent(i,0.04);
186   for(Int_t i=8;i<=12;i++) fRawYield->SetBinContent(i,0.07);
187   for(Int_t i=13;i<=16;i++) fRawYield->SetBinContent(i,0.10);
188   for(Int_t i=17;i<=24;i++) fRawYield->SetBinContent(i,1);
189
190   // Cuts efficiency (from cuts variation)
191   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
192   for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
193
194   // PID efficiency (from PID/noPID)
195   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
196   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.03); // 3%
197   fPIDEff->SetBinContent(2,0.05); // 5%
198
199   // MC dN/dpt
200   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
201   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
202   fMCPtShape->SetBinContent(1,0.03);
203   fMCPtShape->SetBinContent(2,0.03);
204
205   // particle-antiparticle
206   //  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",24,0,24);
207   //  fPartAntipart->SetBinContent(1,1); 
208   //  for(Int_t i=2;i<=24;i++) fPartAntipart->SetBinContent(i,0.05);
209   
210   return;
211 }
212 //--------------------------------------------------------------------------
213 void AliHFSystErr::InitD0toKpi2010PbPb020() {
214   // 
215   // D0->Kpi syst errors. Responsible: A. Rossi
216   //   2010 PbPb sample, 0-20 CC
217   //
218
219   // Normalization
220   fNorm = new TH1F("fNorm","fNorm",20,0,20);
221   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.05); // TAA and pp norm
222
223   // Branching ratio 
224   fBR = new TH1F("fBR","fBR",20,0,20);
225   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
226
227   // Tracking efficiency
228   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
229   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.10);// Jacek, 5% per track
230
231   // Raw yield extraction
232   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
233   fRawYield->SetBinContent(1,0);
234   fRawYield->SetBinContent(2,0);
235   fRawYield->SetBinContent(3,0.08);
236   for(Int_t i=4;i<=12;i++) fRawYield->SetBinContent(i,0.06);
237   for(Int_t i=13;i<=16;i++) fRawYield->SetBinContent(i,0.10);
238
239   // Cuts efficiency (from cuts variation)
240   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
241   fCutsEff->SetBinContent(1,0.);
242   fCutsEff->SetBinContent(2,0.);
243   fCutsEff->SetBinContent(3,0.13);
244   fCutsEff->SetBinContent(4,0.11);  
245   for(Int_t i=5;i<=16;i++) fCutsEff->SetBinContent(i,0.10);
246   for(Int_t i=17;i<=20;i++) fCutsEff->SetBinContent(i,0.);
247
248   // PID efficiency (from PID/noPID)
249   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
250   for(Int_t i=3;i<=16;i++) fPIDEff->SetBinContent(i,0.05);
251
252   // MC dN/dpt
253   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
254   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.01);
255   fMCPtShape->SetBinContent(3,0.04);
256   fMCPtShape->SetBinContent(4,0.02);
257   for(Int_t i=13;i<=16;i++) fMCPtShape->SetBinContent(i,0.03); 
258
259 //   // particle-antiparticle
260 //   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
261 //   for(Int_t i=3;i<=12;i++) fPartAntipart->SetBinContent(i,0.05);
262 //   fPartAntipart->SetBinContent(3,0.10);
263 //   fPartAntipart->SetBinContent(4,0.10);
264 //   fPartAntipart->SetBinContent(7,0.10);
265 //   fPartAntipart->SetBinContent(8,0.10);
266   
267   return;
268 }
269 //--------------------------------------------------------------------------
270 void AliHFSystErr::InitD0toKpi2010PbPb4080() {
271   // 
272   // D0->Kpi syst errors. Responsible: A. Rossi
273   //   2010 PbPb sample, 40-80 CC
274   //
275
276   // Normalization
277   fNorm = new TH1F("fNorm","fNorm",20,0,20);
278   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.07); // TAA and pp norm
279
280   // Branching ratio 
281   fBR = new TH1F("fBR","fBR",20,0,20);
282   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
283
284   // Tracking efficiency
285   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
286   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.10); // Jacek, 5% per track
287
288
289   // Raw yield extraction
290   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
291   fRawYield->SetBinContent(1,0);
292   fRawYield->SetBinContent(2,0);
293   for(Int_t i=3;i<=16;i++) fRawYield->SetBinContent(i,0.05);
294   //for(Int_t i=13;i<=20;i++) fRawYield->SetBinContent(i,0);
295
296   // Cuts efficiency (from cuts variation)
297   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
298   fCutsEff->SetBinContent(1,0.);
299   fCutsEff->SetBinContent(2,0.);
300   fCutsEff->SetBinContent(3,0.13);
301   fCutsEff->SetBinContent(4,0.11);  
302   for(Int_t i=5;i<=16;i++) fCutsEff->SetBinContent(i,0.10);
303   for(Int_t i=17;i<=20;i++) fCutsEff->SetBinContent(i,0.);
304
305   // PID efficiency (from PID/noPID)
306   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
307 //   for(Int_t i=3;i<=6;i++) fPIDEff->SetBinContent(i,0.10);
308 //   for(Int_t i=7;i<=16;i++) fPIDEff->SetBinContent(i,0.05);
309   for(Int_t i=3;i<=16;i++) fPIDEff->SetBinContent(i,0.05);
310
311   // MC dN/dpt
312   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
313   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.01);
314   //  fMCPtShape->SetBinContent(3,0.04); Not set for peripherals (Raa Vs pt is flat)
315   //  fMCPtShape->SetBinContent(4,0.02);
316   for(Int_t i=13;i<=16;i++) fMCPtShape->SetBinContent(i,0.03); 
317   
318   //   // particle-antiparticle
319   //   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
320   //   for(Int_t i=3;i<=12;i++) fPartAntipart->SetBinContent(i,0.05);
321   
322   return;
323 }
324
325 //--------------------------------------------------------------------------
326 void AliHFSystErr::InitD0toKpi2010ppLowEn() {
327   // 
328   // D0->Kpi syst errors. Low energy run
329   //   2011 2.76 TeV pp sample
330   //
331   AliInfo(" Settings for D0 --> K pi, p-p collisions at 2.76 TeV"); 
332
333   // Normalization
334   fNorm = new TH1F("fNorm","fNorm",20,0,20);
335   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.031); // 4% error on sigmaV0and
336
337   // Branching ratio 
338   fBR = new TH1F("fBR","fBR",20,0,20);
339   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
340
341   // Tracking efficiency
342   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
343   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.12); //10% (5% per track)
344
345   // Raw yield extraction
346   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
347   fRawYield->SetBinContent(1,1);
348   for(Int_t i=1;i<=20;i++) fRawYield->SetBinContent(i,0.15);
349
350   // Cuts efficiency (from cuts variation)
351   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
352   for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.10); // 10% 
353   fCutsEff->SetBinContent(2,0.20);
354   for(Int_t i=7;i<=20;i++) fCutsEff->SetBinContent(i,0.15); // 10% 
355
356
357   // PID efficiency (from PID/noPID)
358   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
359   for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.15); // 10%
360   //  fPIDEff->SetBinContent(2,0.20);
361   for(Int_t i=7;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 10%
362
363   // MC dN/dpt
364   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
365   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
366 //   fMCPtShape->SetBinContent(1,0.03);
367 //   fMCPtShape->SetBinContent(2,0.03);
368
369 //   // particle-antiparticle
370 //   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
371 //   fPartAntipart->SetBinContent(1,1);
372 //   fPartAntipart->SetBinContent(2,1);
373 //   for(Int_t i=3;i<=6;i++) fPartAntipart->SetBinContent(i,0.08);
374 //   for(Int_t i=1;i<=20;i++) fPartAntipart->SetBinContent(i,0.);
375   
376   return;
377 }
378
379 //--------------------------------------------------------------------------
380 void AliHFSystErr::InitDplustoKpipi2010pp() {
381   // 
382   // D+->Kpipi syst errors. Responsible: R. Bala
383   //  2010 pp sample
384   //
385
386
387 // Normalization
388   fNorm = new TH1F("fNorm","fNorm",24,0,24);
389   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.04); // 4% error on sigmaV0and
390
391   // Branching ratio 
392   fBR = new TH1F("fBR","fBR",24,0,24);
393   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.021); // 2.1% PDG2010
394
395   // Tracking efficiency
396   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
397   for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.12); // 12% (4% per track)
398
399
400   // Raw yield extraction
401   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
402   fRawYield->SetBinContent(1,1);
403   fRawYield->SetBinContent(2,0.25);
404   fRawYield->SetBinContent(3,0.25);
405   fRawYield->SetBinContent(4,0.20);
406   fRawYield->SetBinContent(5,0.09);
407   fRawYield->SetBinContent(6,0.09);
408   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);  
409   for(Int_t i=12;i<=24;i++) fRawYield->SetBinContent(i,0.10);  
410   
411   // Cuts efficiency (from cuts variation)
412   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
413   for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
414
415   // PID efficiency (from PID/noPID)
416   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
417   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.05); // 5%
418   fPIDEff->SetBinContent(1,0.15); // 15%
419   fPIDEff->SetBinContent(2,0.15); // 15%
420   fPIDEff->SetBinContent(3,0.15); // 15%
421   fPIDEff->SetBinContent(4,0.15); // 15%
422   for(Int_t i=12;i<=16;i++) fPIDEff->SetBinContent(i,0.10); // 5%
423
424   // MC dN/dpt  
425   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
426   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
427   fMCPtShape->SetBinContent(1,0.03);
428   fMCPtShape->SetBinContent(2,0.03);
429
430
431   // particle-antiparticle
432   /*
433   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
434   fPartAntipart->SetBinContent(1,1);
435   fPartAntipart->SetBinContent(2,1);
436   fPartAntipart->SetBinContent(3,0.12);
437   for(Int_t i=4;i<=20;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
438   */
439   return;
440 }
441  
442 //--------------------------------------------------------------------------
443 void AliHFSystErr::InitDstoKKpi2010pp() {
444   // 
445   // D+s->KKpi syst errors. Responsible: G.M. Innocenti
446   //  2010 pp sample
447   //
448
449
450 // Normalization
451   fNorm = new TH1F("fNorm","fNorm",12,0,12);
452   for(Int_t i=1;i<=12;i++) fNorm->SetBinContent(i,0.07); // 7% error on sigmaV0and
453
454   // Branching ratio 
455   fBR = new TH1F("fBR","fBR",12,0,12);
456   for(Int_t i=1;i<=12;i++) fBR->SetBinContent(i,0.05); // 5% PDG2010
457
458   // Tracking efficiency
459   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",12,0,12);
460   for(Int_t i=1;i<=12;i++) fTrackingEff->SetBinContent(i,0.03); // 3% (1% per track)
461
462
463   // Raw yield extraction
464   fRawYield = new TH1F("fRawYield","fRawYield",12,0,12);
465   fRawYield->SetBinContent(1,1);
466   fRawYield->SetBinContent(2,1);
467   fRawYield->SetBinContent(3,0.20);
468   fRawYield->SetBinContent(4,0.20);
469   fRawYield->SetBinContent(5,0.15);
470   fRawYield->SetBinContent(6,0.15);
471   fRawYield->SetBinContent(7,0.15);
472   fRawYield->SetBinContent(8,0.15);
473   fRawYield->SetBinContent(9,0.20);
474   fRawYield->SetBinContent(10,0.20);
475   fRawYield->SetBinContent(11,0.20);
476   fRawYield->SetBinContent(12,0.20);
477   
478   // Cuts efficiency (from cuts variation)
479   fCutsEff = new TH1F("fCutsEff","fCutsEff",12,0,12);
480   for(Int_t i=1;i<=12;i++) fCutsEff->SetBinContent(i,0.15); // 15%
481
482   // PID efficiency (from PID/noPID)
483   fPIDEff = new TH1F("fPIDEff","fPIDEff",12,0,12);
484   for(Int_t i=1;i<=12;i++) fPIDEff->SetBinContent(i,0.07); // 7%
485
486   // MC dN/dpt  (copied from D0 : will update later)
487   //fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",12,0,12);
488   //for(Int_t i=1;i<=12;i++) fMCPtShape->SetBinContent(i,(Float_t)i*0.006);
489
490
491   // particle-antiparticle
492   /*
493   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",12,0,12);
494   fPartAntipart->SetBinContent(1,1);
495   fPartAntipart->SetBinContent(2,1);
496   fPartAntipart->SetBinContent(3,0.12);
497   for(Int_t i=4;i<=12;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
498   */
499   return;
500 }
501    
502  
503 //--------------------------------------------------------------------------
504 void AliHFSystErr::InitDplustoKpipi2010PbPb020() {
505   // 
506   // D+->Kpipi syst errors. Responsible: ??
507   //  2010 PbPb sample, 0-20 CC
508   //
509
510  // Normalization
511   fNorm = new TH1F("fNorm","fNorm",20,0,20);
512   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.05); // TAA and pp norm
513
514   // Branching ratio 
515   fBR = new TH1F("fBR","fBR",20,0,20);
516   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.021); // 2.1% PDG2010
517
518   // Tracking efficiency
519   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
520   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.15); // Jacek, 5% per track
521
522   // Raw yield extraction
523   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
524   for(Int_t i=1;i<=20;i++) fRawYield->SetBinContent(i,.10);  //5 to 10%
525   // fRawYield->SetBinContent(5,0.23);
526   //fRawYield->SetBinContent(6,0.23);
527   fRawYield->SetBinContent(7,0.20);
528   fRawYield->SetBinContent(8,0.20);
529   fRawYield->SetBinContent(9,0.15);
530   fRawYield->SetBinContent(10,0.15);
531   fRawYield->SetBinContent(11,0.15);
532   fRawYield->SetBinContent(12,0.15);
533
534   // Cuts efficiency (from cuts variation)
535   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
536   for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.15); // 10%
537
538   // PID efficiency (from PID/noPID)
539   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
540   for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 5%
541
542   // MC dN/dpt  (2/2/2012)
543   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
544   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
545   for(Int_t iBin=7; iBin<=8; iBin++) fMCPtShape->SetBinContent(iBin,0.01);
546   for(Int_t iBin=9; iBin<=12; iBin++) fMCPtShape->SetBinContent(iBin,0.05);
547   for(Int_t iBin=13; iBin<=16; iBin++) fMCPtShape->SetBinContent(iBin,0.05);
548
549
550   // particle-antiparticle
551   /*
552   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
553   fPartAntipart->SetBinContent(1,1);
554   fPartAntipart->SetBinContent(2,1);
555   fPartAntipart->SetBinContent(3,0.12);
556   for(Int_t i=4;i<=20;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
557   */
558
559   return;
560 }
561
562 //--------------------------------------------------------------------------
563 void AliHFSystErr::InitDplustoKpipi2010PbPb4080() {
564   // 
565   // D+->Kpipi syst errors. Responsible: ??
566   //  2010 PbPb sample, 40-80 CC
567   //
568   
569
570  // Normalization
571   fNorm = new TH1F("fNorm","fNorm",20,0,20);
572   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.07); // TAA and pp norm
573
574   // Branching ratio 
575   fBR = new TH1F("fBR","fBR",20,0,20);
576   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.021); // 2.1% 
577
578   // Tracking efficiency
579   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
580   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.15); // Jacek, 5% per track
581
582
583   // Raw yield extraction
584   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
585   fRawYield->SetBinContent(1,1);
586   fRawYield->SetBinContent(2,1);
587   fRawYield->SetBinContent(3,1);
588   fRawYield->SetBinContent(4,0.15);
589   fRawYield->SetBinContent(5,0.05);
590   fRawYield->SetBinContent(6,0.05);
591   fRawYield->SetBinContent(7,0.15);
592   fRawYield->SetBinContent(8,0.15);
593   for(Int_t i=9;i<=12;i++) fRawYield->SetBinContent(i,0.15);
594   for(Int_t i=13;i<=20;i++) fRawYield->SetBinContent(i,1);  //5 to 10%
595
596   // Cuts efficiency (from cuts variation)
597   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
598   for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.10); // 10%
599
600   // PID efficiency (from PID/noPID)
601   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
602   for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 5%
603   fPIDEff->SetBinContent(3,0.13); // 13%
604  
605
606   // MC dN/dpt  (2/2/2012)
607   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
608   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
609   for(Int_t iBin=4; iBin<=8; iBin++) fMCPtShape->SetBinContent(iBin,0.01);
610   for(Int_t iBin=9; iBin<=12; iBin++) fMCPtShape->SetBinContent(iBin,0.03);
611   for(Int_t iBin=13; iBin<=16; iBin++) fMCPtShape->SetBinContent(iBin,0.03);
612
613
614   // particle-antiparticle
615   /*
616   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
617   fPartAntipart->SetBinContent(1,1);
618   fPartAntipart->SetBinContent(2,1);
619   fPartAntipart->SetBinContent(3,0.12);
620   for(Int_t i=4;i<=20;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
621   */
622   return;
623 }
624
625 //--------------------------------------------------------------------------
626 void AliHFSystErr::InitDplustoKpipi2010ppLowEn() {
627
628   // 
629   // D+->Kpipi syst errors. Responsible: R. Bala
630   //  2011 2.76 TeV pp sample
631   //
632   AliInfo(" Settings for D+ --> K pi pi p-p collisions at 2.76 TeV"); 
633
634   // Normalization
635   fNorm = new TH1F("fNorm","fNorm",20,0,20);
636   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.031); // 10% error on sigmaV0and
637
638   // Branching ratio 
639   fBR = new TH1F("fBR","fBR",20,0,20);
640   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.021); // 2.1% PDG2010
641
642   // Tracking efficiency
643   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
644   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.18); // 3% (1% per track)
645
646   // Raw yield extraction
647   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
648   fRawYield->SetBinContent(1,1);
649   fRawYield->SetBinContent(2,1);
650   for(Int_t i=3;i<=6;i++) fRawYield->SetBinContent(i,0.10);  //5 to 10%
651   fRawYield->SetBinContent(7,0.15);
652   fRawYield->SetBinContent(8,0.15); 
653   for(Int_t i=9;i<=20;i++) fRawYield->SetBinContent(i,0.055);  //5 to 10%
654
655   // Cuts efficiency (from cuts variation)
656   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
657   for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.15); // 10%
658
659   // PID efficiency (from PID/noPID)
660   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
661   for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 5%
662   fPIDEff->SetBinContent(3,0.10); // 13%
663   fPIDEff->SetBinContent(4,0.10); // 13%
664  
665   // MC dN/dpt  (copied from D0 : will update later)
666   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
667   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
668   fMCPtShape->SetBinContent(1,0.03);
669   fMCPtShape->SetBinContent(2,0.03);
670
671   return;
672 }
673
674 //--------------------------------------------------------------------------
675 void AliHFSystErr::InitDstartoD0pi2010pp() {
676   // 
677   // D*+->D0pi syst errors. Responsible: A. Grelli, Y. Wang
678   //  2010 pp sample
679   //
680
681  // Normalization
682   fNorm = new TH1F("fNorm","fNorm",24,0,24);
683   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.04); // 4% error on sigmaV0and
684
685   // Branching ratio 
686   fBR = new TH1F("fBR","fBR",24,0,24);
687   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
688
689   // Tracking efficiency
690   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
691   fTrackingEff->SetBinContent(1,1.0);
692   fTrackingEff->SetBinContent(2,0.13); // 10% (ITSsa) \oplus 8% (4% per ITSTPC track)
693   fTrackingEff->SetBinContent(3,0.12);
694   fTrackingEff->SetBinContent(3,0.12);
695   for(Int_t i=4;i<=24;i++) fTrackingEff->SetBinContent(i,0.12); // 12% (4% per track)
696
697
698   // Raw yield extraction
699   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
700   fRawYield->SetBinContent(1,1.0);
701   fRawYield->SetBinContent(2,0.10);
702   fRawYield->SetBinContent(3,0.04);
703   fRawYield->SetBinContent(4,0.03);
704   fRawYield->SetBinContent(5,0.03);
705   fRawYield->SetBinContent(6,0.05);
706   fRawYield->SetBinContent(7,0.05);
707   fRawYield->SetBinContent(8,0.05);
708   for(Int_t i=9;i<=12;i++) fRawYield->SetBinContent(i,0.04);  //4%
709   for(Int_t i=13;i<=16;i++) fRawYield->SetBinContent(i,0.09);  //4%
710   for(Int_t i=17;i<=24;i++) fRawYield->SetBinContent(i,0.2);  //4%
711
712   // Cuts efficiency (from cuts variation)
713   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
714   fCutsEff->SetBinContent(2,0.22);
715   for(Int_t i=3;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
716
717   // PID efficiency (from PID/noPID)
718   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
719   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
720  
721
722   // MC dN/dpt  (copied from D0 : will update later)
723   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
724   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
725   fMCPtShape->SetBinContent(1,0.03);
726   fMCPtShape->SetBinContent(2,0.03);
727
728   return;
729
730
731 }
732 //--------------------------------------------------------------------------
733 void AliHFSystErr::InitDstartoD0pi2010ppLowEn() {
734
735   // 
736   // D+->Kpipi syst errors. Responsible: A. Grelli
737   //  2011 2.76 TeV pp sample
738   //
739   AliInfo(" Settings for D*+ --> D0 pi p-p collisions at 2.76 TeV"); 
740
741 // Normalization
742   fNorm = new TH1F("fNorm","fNorm",20,0,20);
743   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.031); // 10% error on sigmaV0and
744
745   // Branching ratio 
746   fBR = new TH1F("fBR","fBR",20,0,20);
747   for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
748
749   // Tracking efficiency
750   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
751   for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.18); //10% (to be checked!!)
752
753   // Raw yield extraction
754   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
755   fRawYield->SetBinContent(1,1);
756   fRawYield->SetBinContent(2,1);
757   fRawYield->SetBinContent(3,0.14);
758   fRawYield->SetBinContent(4,0.14);
759   fRawYield->SetBinContent(5,0.12);
760   fRawYield->SetBinContent(6,0.12);
761   fRawYield->SetBinContent(7,0.06);
762   fRawYield->SetBinContent(8,0.06);
763   fRawYield->SetBinContent(9,0.08);
764   fRawYield->SetBinContent(10,0.08);
765   fRawYield->SetBinContent(11,0.08);
766   fRawYield->SetBinContent(12,0.08);
767   for(Int_t i=9;i<=20;i++) fRawYield->SetBinContent(i,0.065);
768
769   // Cuts efficiency (from cuts variation)
770   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
771   for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.10);  
772   fCutsEff->SetBinContent(3,0.15);
773   fCutsEff->SetBinContent(4,0.15);
774   fCutsEff->SetBinContent(5,0.15);
775   fCutsEff->SetBinContent(6,0.15);
776   fCutsEff->SetBinContent(7,0.10);
777   fCutsEff->SetBinContent(8,0.10);
778   fCutsEff->SetBinContent(9,0.10);
779   fCutsEff->SetBinContent(10,0.10);
780   fCutsEff->SetBinContent(11,0.10);
781   fCutsEff->SetBinContent(12,0.10);
782
783   // PID efficiency (from PID/noPID)
784   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
785   for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 10%
786
787   // MC dN/dpt
788   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
789   for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
790   fMCPtShape->SetBinContent(1,0.03);
791   fMCPtShape->SetBinContent(2,0.03);
792
793   return;
794 }
795
796 //------------------------------------------------------------------------
797 void AliHFSystErr::InitDstartoD0pi2010PbPb020() {
798   // 
799   // D*+->D0pi syst errors. Responsible: A. Grelli
800   //  2010 PbPb sample, 0-20 CC
801   //
802
803   AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 0-20 centrality - DUMMY"); 
804
805  // Normalization
806   fNorm = new TH1F("fNorm","fNorm",24,0,24);
807   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.05); // TAA and pp norm
808
809   // Branching ratio 
810   fBR = new TH1F("fBR","fBR",24,0,24);
811   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
812
813   // Tracking efficiency
814   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
815   for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.15); // Jacek, 5% per track
816
817
818   // Raw yield extraction
819   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
820   for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.1);  //4%
821   fRawYield->SetBinContent(3,0.2);
822   fRawYield->SetBinContent(4,0.2);
823   fRawYield->SetBinContent(5,0.2);
824   fRawYield->SetBinContent(6,0.2);
825  
826   // Cuts efficiency (from cuts variation)
827   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
828   for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
829   fCutsEff->SetBinContent(4,0.15);
830   fCutsEff->SetBinContent(5,0.15);
831   fCutsEff->SetBinContent(6,0.15);
832
833   // PID efficiency (from PID/noPID)
834   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
835   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.05); // 3%
836  
837
838   // MC dN/dpt  (from study on D* pt shape)
839   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
840   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.045);
841   fMCPtShape->SetBinContent(4,0.025);
842   fMCPtShape->SetBinContent(5,0.025);
843   fMCPtShape->SetBinContent(6,0.025);
844   fMCPtShape->SetBinContent(7,0.04);
845   fMCPtShape->SetBinContent(8,0.04);
846   fMCPtShape->SetBinContent(9,0.03);
847   fMCPtShape->SetBinContent(10,0.03);
848   fMCPtShape->SetBinContent(11,0.03);
849   fMCPtShape->SetBinContent(12,0.03);
850   
851   
852
853   return;
854
855 }
856
857 //-------------------------------------------------------------------------
858 void AliHFSystErr::InitDstartoD0pi2010PbPb2040() {
859   // 
860   // D*+->D0pi syst errors. Responsible: A. Grelli
861   //  2010 PbPb sample, 20-40 CC
862   //
863
864   AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 20-40 centrality - DUMMY"); 
865
866  // Normalization
867   fNorm = new TH1F("fNorm","fNorm",24,0,24);
868   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
869
870   // Branching ratio 
871   fBR = new TH1F("fBR","fBR",24,0,24);
872   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
873
874   // Tracking efficiency
875   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
876   for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.15); // Jacek, 5% per track
877
878
879   // Raw yield extraction
880   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
881   for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.15);  //4%
882  
883   // Cuts efficiency (from cuts variation)
884   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
885   for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
886
887   // PID efficiency (from PID/noPID)
888   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
889   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
890  
891
892   // MC dN/dpt  (copied from D0 : will update later)
893   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
894   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.);
895   fMCPtShape->SetBinContent(1,0.03);
896   fMCPtShape->SetBinContent(2,0.03);
897
898   return;
899
900 }
901
902 //--------------------------------------------------------------------------
903 void AliHFSystErr::InitDstartoD0pi2010PbPb4080() {
904   // 
905   // D*+->D0pi syst errors. Responsible: A. Grelli
906   //  2010 PbPb sample, 40-80 CC
907   //
908
909   AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 40-80 centrality - DUMMY"); 
910
911  // Normalization
912   fNorm = new TH1F("fNorm","fNorm",24,0,24);
913   for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.07); // TAA and pp norm
914
915   // Branching ratio 
916   fBR = new TH1F("fBR","fBR",24,0,24);
917   for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
918
919   // Tracking efficiency
920   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
921   for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.15); // Jacek, 5% per track
922
923
924   // Raw yield extraction
925   fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
926   for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.2);  //4%
927   fRawYield->SetBinContent(1,1);
928   fRawYield->SetBinContent(2,0.15);
929   fRawYield->SetBinContent(3,0.15);
930   fRawYield->SetBinContent(4,0.15);
931   fRawYield->SetBinContent(5,0.15);
932   fRawYield->SetBinContent(6,0.10);
933   fRawYield->SetBinContent(7,0.10);
934   fRawYield->SetBinContent(8,0.10);
935   fRawYield->SetBinContent(9,0.11);
936   fRawYield->SetBinContent(10,0.11);
937   fRawYield->SetBinContent(11,0.11);
938   fRawYield->SetBinContent(12,0.11);
939   fRawYield->SetBinContent(13,0.08);
940   fRawYield->SetBinContent(14,0.08);
941   fRawYield->SetBinContent(15,0.08);
942   fRawYield->SetBinContent(16,0.08);
943
944
945   // Cuts efficiency (from cuts variation)
946   fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
947   for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
948
949   // PID efficiency (from PID/noPID)
950   fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
951   for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.05); // 3%
952  
953
954   // MC dN/dpt  (copied from D0 : will update later)
955   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
956   for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.01);
957   fMCPtShape->SetBinContent(2,0.05);
958   fMCPtShape->SetBinContent(3,0.05);
959   fMCPtShape->SetBinContent(4,0.05);
960   fMCPtShape->SetBinContent(5,0.04);
961   fMCPtShape->SetBinContent(6,0.02);
962   fMCPtShape->SetBinContent(7,0.04);
963   fMCPtShape->SetBinContent(8,0.04);
964  
965   return;
966
967 }
968
969 //--------------------------------------------------------------------------
970 void AliHFSystErr::InitD0toKpi2010PbPb010CentScan(){
971   // define errors for RAA vs. centrality
972   InitD0toKpi2010PbPb020();
973   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);
974   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08); 
975 }
976 //--------------------------------------------------------------------------
977 void AliHFSystErr::InitD0toKpi2010PbPb1020CentScan(){
978   // define errors for RAA vs. centrality
979   InitD0toKpi2010PbPb020();
980   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);
981   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08); 
982 }
983 //--------------------------------------------------------------------------
984 void AliHFSystErr::InitD0toKpi2010PbPb2040CentScan(){
985   // define errors for RAA vs. centrality
986   InitD0toKpi2010PbPb4080();
987   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);
988   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08); 
989 }
990 //--------------------------------------------------------------------------
991 void AliHFSystErr::InitD0toKpi2010PbPb4060CentScan(){
992    // define errors for RAA vs. centrality
993   InitD0toKpi2010PbPb4080();
994   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.06);
995   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08); 
996 }
997 //--------------------------------------------------------------------------
998 void AliHFSystErr::InitD0toKpi2010PbPb6080CentScan(){
999    // define errors for RAA vs. centrality
1000   InitD0toKpi2010PbPb4080();
1001   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.08);
1002   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08); 
1003 }
1004 //--------------------------------------------------------------------------
1005 void AliHFSystErr::InitDplustoKpipi2010PbPb010CentScan(){
1006   // define errors for RAA vs. centrality
1007   InitDplustoKpipi2010PbPb020();
1008   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.18);
1009   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.09);
1010
1011 }
1012 //--------------------------------------------------------------------------
1013 void AliHFSystErr::InitDplustoKpipi2010PbPb1020CentScan(){
1014   // define errors for RAA vs. centrality
1015   InitDplustoKpipi2010PbPb020();
1016   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.23);
1017   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08);
1018 }
1019 //--------------------------------------------------------------------------
1020 void AliHFSystErr::InitDplustoKpipi2010PbPb2040CentScan(){
1021   // define errors for RAA vs. centrality
1022   InitDplustoKpipi2010PbPb020();
1023   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.08);
1024   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.095);
1025 }
1026 //--------------------------------------------------------------------------
1027 void AliHFSystErr::InitDplustoKpipi2010PbPb4060CentScan(){
1028   // define errors for RAA vs. centrality
1029   InitDplustoKpipi2010PbPb4080();
1030   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.08);
1031   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08);
1032 }
1033 //--------------------------------------------------------------------------
1034 void AliHFSystErr::InitDplustoKpipi2010PbPb6080CentScan(){
1035   // define errors for RAA vs. centrality
1036   InitDplustoKpipi2010PbPb4080();
1037   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.15);
1038   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.07);
1039 }
1040
1041 //--------------------------------------------------------------------------
1042 void AliHFSystErr::InitDstartoD0pi2010PbPb010CentScan(){
1043   // define errors for RAA vs. centrality
1044   InitDstartoD0pi2010PbPb020();
1045   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.16); 
1046   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.15);
1047 }
1048 //--------------------------------------------------------------------------
1049 void AliHFSystErr::InitDstartoD0pi2010PbPb1020CentScan(){
1050   // define errors for RAA vs. centrality
1051   InitDstartoD0pi2010PbPb020();
1052   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05); 
1053   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.15);
1054 }
1055 //--------------------------------------------------------------------------
1056 void AliHFSystErr::InitDstartoD0pi2010PbPb2040CentScan(){
1057   // define errors for RAA vs. centrality
1058   InitDstartoD0pi2010PbPb2040();
1059   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.10); 
1060   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.08);
1061 }
1062 //--------------------------------------------------------------------------
1063 void AliHFSystErr::InitDstartoD0pi2010PbPb4060CentScan(){
1064   // define errors for RAA vs. centrality
1065   InitDstartoD0pi2010PbPb4080();
1066   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.10); 
1067   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.045);
1068 }
1069 //--------------------------------------------------------------------------
1070 void AliHFSystErr::InitDstartoD0pi2010PbPb6080CentScan(){
1071   // define errors for RAA vs. centrality
1072   InitDstartoD0pi2010PbPb4080();
1073   for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.10); 
1074   for(Int_t i=7;i<=12;i++) fMCPtShape->SetBinContent(i,0.045);
1075 }
1076
1077
1078 //--------------------------------------------------------------------------
1079 Double_t AliHFSystErr::GetCutsEffErr(Double_t pt) const {
1080   // 
1081   // Get error
1082   //
1083
1084   Int_t bin=fCutsEff->FindBin(pt);
1085
1086   return fCutsEff->GetBinContent(bin);
1087 }
1088 //--------------------------------------------------------------------------
1089 Double_t AliHFSystErr::GetMCPtShapeErr(Double_t pt) const {
1090   // 
1091   // Get error
1092   //
1093
1094   Int_t bin=fMCPtShape->FindBin(pt);
1095
1096   return fMCPtShape->GetBinContent(bin);
1097 }
1098 //--------------------------------------------------------------------------
1099 Double_t AliHFSystErr::GetSeleEffErr(Double_t pt) const {
1100   // 
1101   // Get error
1102   //
1103
1104   Double_t err=GetCutsEffErr(pt)*GetCutsEffErr(pt)+GetMCPtShapeErr(pt)*GetMCPtShapeErr(pt);
1105
1106   return TMath::Sqrt(err);
1107 }
1108 //--------------------------------------------------------------------------
1109 Double_t AliHFSystErr::GetPIDEffErr(Double_t pt) const {
1110   // 
1111   // Get error
1112   //
1113
1114   Int_t bin=fPIDEff->FindBin(pt);
1115
1116   return fPIDEff->GetBinContent(bin);
1117 }
1118 //--------------------------------------------------------------------------
1119 Double_t AliHFSystErr::GetTrackingEffErr(Double_t pt) const {
1120   // 
1121   // Get error
1122   //
1123
1124   Int_t bin=fTrackingEff->FindBin(pt);
1125
1126   return fTrackingEff->GetBinContent(bin);
1127 }
1128 //--------------------------------------------------------------------------
1129 Double_t AliHFSystErr::GetRawYieldErr(Double_t pt) const {
1130   // 
1131   // Get error
1132   //
1133
1134   Int_t bin=fRawYield->FindBin(pt);
1135
1136   return fRawYield->GetBinContent(bin);
1137 }
1138 //--------------------------------------------------------------------------
1139 Double_t AliHFSystErr::GetPartAntipartErr(Double_t pt) const {
1140   // 
1141   // Get error
1142   //
1143
1144   Int_t bin=fPartAntipart->FindBin(pt);
1145
1146   return fPartAntipart->GetBinContent(bin);
1147 }
1148 //--------------------------------------------------------------------------
1149 Double_t AliHFSystErr::GetTotalSystErr(Double_t pt,Double_t feeddownErr) const {
1150   // 
1151   // Get total syst error (except norm. error)
1152   //
1153
1154   Double_t err=0.;
1155
1156   if(fRawYield) err += GetRawYieldErr(pt)*GetRawYieldErr(pt);
1157   if(fTrackingEff) err += GetTrackingEffErr(pt)*GetTrackingEffErr(pt);
1158   //  if(fBR) err += GetBRErr()*GetBRErr();
1159   if(fCutsEff) err += GetCutsEffErr(pt)*GetCutsEffErr(pt);
1160   if(fPIDEff) err += GetPIDEffErr(pt)*GetPIDEffErr(pt);
1161   if(fMCPtShape) err += GetMCPtShapeErr(pt)*GetMCPtShapeErr(pt);
1162   if(fPartAntipart) err += GetPartAntipartErr(pt)*GetPartAntipartErr(pt);
1163
1164   err += feeddownErr*feeddownErr;
1165
1166   return TMath::Sqrt(err);
1167 }
1168 //---------------------------------------------------------------------------
1169 void AliHFSystErr::DrawErrors(TGraphAsymmErrors *grErrFeeddown) const {
1170   //
1171   // Draw errors
1172   //
1173   gStyle->SetOptStat(0);
1174
1175   TCanvas *cSystErr = new TCanvas("cSystErr","Systematic Errors",300,80,640,500);
1176   cSystErr->Range(0.20,-0.5,18.4,0.34);
1177   cSystErr->SetRightMargin(0.318);
1178   cSystErr->SetFillColor(0);
1179
1180   TH2F *hFrame = new TH2F("hFrame","Systematic errors; p_{t} [GeV/c]; Relative Error",20,0,20,100,-1,+1);
1181   hFrame->SetAxisRange(1.,15.9,"X");
1182   hFrame->SetAxisRange(-0.5,0.5,"Y");
1183   hFrame->Draw();
1184
1185   TLegend *leg = new TLegend(0.69,0.44,0.98,0.86,NULL,"brNDC");
1186   leg->SetTextSize(0.03601695);
1187   leg->SetFillStyle(0);
1188   leg->SetBorderSize(0);
1189   
1190   TH1F *hTotErr=new TH1F("hTotErr","",24,0,24);
1191   Int_t nbins = fNorm->GetNbinsX();
1192   TGraphAsymmErrors *gTotErr = new TGraphAsymmErrors(nbins);
1193   for(Int_t i=1;i<=24;i++) {
1194     Double_t pt = hTotErr->GetBinCenter(i);
1195     Double_t ptwidth = hTotErr->GetBinWidth(i);
1196
1197     if(grErrFeeddown) {
1198       Double_t x=0., y=0., errxl=0., errxh=0., erryl=0., erryh=0.;
1199       Double_t toterryl=0., toterryh=0.;
1200       for(Int_t j=0; j<grErrFeeddown->GetN(); j++) {
1201         grErrFeeddown->GetPoint(j,x,y);
1202         errxh = grErrFeeddown->GetErrorXhigh(j);
1203         errxl = grErrFeeddown->GetErrorXlow(j);
1204         if ( ( (x-errxl) <= pt) && ( (x+errxl) >= pt) ) {
1205           erryh = grErrFeeddown->GetErrorYhigh(j);
1206           erryl = grErrFeeddown->GetErrorYlow(j);
1207         }
1208       }
1209       if (erryl>=1e-3) toterryl = GetTotalSystErr(pt,erryl);
1210       else toterryl = GetTotalSystErr(pt);
1211       if (erryh>=1e-3) toterryh = GetTotalSystErr(pt,erryh);
1212       else toterryh = GetTotalSystErr(pt);
1213
1214       hTotErr->SetBinContent(i,toterryh);
1215       gTotErr->SetPoint(i,pt,0.);
1216       gTotErr->SetPointError(i,ptwidth/2.,ptwidth/2.,toterryl,toterryh); // i, exl, exh, eyl, eyh
1217     }
1218     else {
1219       hTotErr->SetBinContent(i,GetTotalSystErr(pt));
1220       gTotErr->SetPoint(i,pt,0.);
1221       gTotErr->SetPointError(i,ptwidth/2.,ptwidth/2.,GetTotalSystErr(pt),GetTotalSystErr(pt)); // i, exl, exh, eyl, eyh
1222     }
1223
1224   }
1225   gTotErr->SetLineColor(kBlack);
1226   gTotErr->SetFillColor(kRed);
1227   gTotErr->SetFillStyle(3002);
1228   gTotErr->Draw("2");
1229   leg->AddEntry(gTotErr,"Total (excl. norm.)","f");
1230 //   hTotErr->SetLineColor(1);
1231 //   hTotErr->SetLineWidth(3);
1232 //   hTotErr->Draw("same");
1233 //   leg->AddEntry(hTotErr,"Total (excl. norm.)","l");
1234   
1235
1236   fNorm->SetFillColor(1);
1237   fNorm->SetFillStyle(3002);
1238   //fNorm->Draw("same");
1239   //TH1F *hNormRefl = ReflectHisto(fNorm);
1240   //hNormRefl->Draw("same");
1241   leg->AddEntry(fNorm,"Normalization (10%)","");
1242
1243   if(grErrFeeddown) {
1244     grErrFeeddown->SetFillColor(kTeal-8);
1245     grErrFeeddown->SetFillStyle(3001);
1246     grErrFeeddown->Draw("2");
1247     leg->AddEntry(grErrFeeddown,"Feed-down from B","f");
1248   }
1249   if(fTrackingEff) {
1250     fTrackingEff->SetFillColor(4);
1251     fTrackingEff->SetFillStyle(3006);
1252     fTrackingEff->Draw("same");
1253     TH1F *hTrackingEffRefl = ReflectHisto(fTrackingEff);
1254     hTrackingEffRefl->Draw("same");
1255     leg->AddEntry(fTrackingEff,"Tracking efficiency","f");
1256   }
1257   if(fBR) {
1258     fBR->SetFillColor(6);
1259     fBR->SetFillStyle(3005);
1260     //fBR->SetFillStyle(3020);
1261     fBR->Draw("same");
1262     TH1F *hBRRefl = ReflectHisto(fBR);
1263     hBRRefl->Draw("same");
1264     leg->AddEntry(fBR,"Branching ratio","f");
1265   }
1266   if(fRawYield) {
1267     Int_t ci;   // for color index setting
1268     ci = TColor::GetColor("#00cc00");
1269     fRawYield->SetLineColor(ci);
1270     //    fRawYield->SetLineColor(3);
1271     fRawYield->SetLineWidth(3);
1272     fRawYield->Draw("same");
1273     TH1F *hRawYieldRefl = ReflectHisto(fRawYield);
1274     hRawYieldRefl->Draw("same");
1275     leg->AddEntry(fRawYield,"Yield extraction","l");
1276   }
1277   if(fCutsEff) {
1278     fCutsEff->SetLineColor(4);
1279     fCutsEff->SetLineWidth(3);
1280     fCutsEff->Draw("same");
1281     TH1F *hCutsEffRefl = ReflectHisto(fCutsEff);
1282     hCutsEffRefl->Draw("same");
1283     leg->AddEntry(fCutsEff,"Cuts efficiency","l");
1284   }
1285   if(fPIDEff) {
1286     fPIDEff->SetLineColor(7);
1287     fPIDEff->SetLineWidth(3);
1288     fPIDEff->Draw("same");
1289     TH1F *hPIDEffRefl = ReflectHisto(fPIDEff);
1290     hPIDEffRefl->Draw("same");
1291     leg->AddEntry(fPIDEff,"PID efficiency","l");
1292   }
1293   if(fMCPtShape) {
1294     Int_t ci = TColor::GetColor("#9933ff");
1295     fMCPtShape->SetLineColor(ci);
1296     //    fMCPtShape->SetLineColor(8);
1297     fMCPtShape->SetLineWidth(3);
1298     fMCPtShape->Draw("same");
1299     TH1F *hMCPtShapeRefl = ReflectHisto(fMCPtShape);
1300     hMCPtShapeRefl->Draw("same");
1301     leg->AddEntry(fMCPtShape,"MC p_{t} shape","l");
1302   }
1303   if(fPartAntipart) {
1304     Int_t ci = TColor::GetColor("#ff6600");
1305     fPartAntipart->SetLineColor(ci);
1306     //    fPartAntipart->SetLineColor(9);
1307     fPartAntipart->SetLineWidth(3);
1308     fPartAntipart->Draw("same");
1309     TH1F *hPartAntipartRefl = ReflectHisto(fPartAntipart);
1310     hPartAntipartRefl->Draw("same");
1311     leg->AddEntry(fPartAntipart,"D = #bar{D}","l");
1312   }
1313
1314
1315   leg->Draw();
1316
1317   cSystErr->SaveAs("RelativeSystematics.eps");
1318
1319   return;
1320 }
1321 //-------------------------------------------------------------------------
1322 TH1F* AliHFSystErr::ReflectHisto(TH1F *hin) const {
1323   //
1324   // Clones and reflects histogram 
1325   // 
1326   TH1F *hout=(TH1F*)hin->Clone("hout");
1327   hout->Scale(-1.);
1328
1329   return hout;
1330 }