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