Update (Andrea)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliHFSystErr.cxx
index c0a77bb..3b0d6f4 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+/* $Id$ */
+
 /////////////////////////////////////////////////////////////
 //
 // Class to handle systematic errors for charm hadrons
 //
 // Usage:
-// AliHFSystEff syst(DECAY); // DECAY = 1 for D0, 2, for D+, 3 for D* 
+// AliHFSystEff syst;           // DECAY = 1 for D0, 2, for D+, 3 for D* 
+// syst.SetRunNumber(YEAR);     // YEAR = two last numbers of the year (is 10 for 2010)
+// syst.SetCollisionType(TYPE);  // TYPE =  0 is pp, 1 is PbPb
+// syst.SetCentrality(CENT);     // CENT is centrality, 0100 for MB, 020 (4080) for 0-20 (40-80) CC...
+// syst.Init(DECAY);             // DECAY = 1 for D0, 2, for D+, 3 for D* 
 // syst.DrawErrors(); // to see a plot of the error contributions
 // syst.GetTotalSystErr(pt); // to get the total err at pt 
 //
@@ -33,6 +39,7 @@
 #include <TLegend.h>
 #include <TColor.h>
 
+#include "AliLog.h"
 #include "AliHFSystErr.h"
 
 
@@ -48,67 +55,275 @@ fBR(0),
 fCutsEff(0),
 fPIDEff(0),
 fMCPtShape(0),
-fPartAntipart(0)
+fPartAntipart(0),
+fRunNumber(10),
+fCollisionType(0),
+fCentralityClass("0100"),
+fIsLowEnergy(false)
 {
   //
   // Default Constructor
   //
 }
+
 //--------------------------------------------------------------------------
-AliHFSystErr::AliHFSystErr(Int_t decay,const Char_t* name, const Char_t* title) : 
-TNamed(name,title),
-fNorm(0),
-fRawYield(0),
-fTrackingEff(0),
-fBR(0),
-fCutsEff(0),
-fPIDEff(0),
-fMCPtShape(0),
-fPartAntipart(0)
-{
+AliHFSystErr::~AliHFSystErr() {
+  //  
+  // Default Destructor
   //
-  // Standard Constructor
+  /*
+
+  if(fNorm)         { delete fNorm; fNorm=0; }
+  if(fRawYield)     { delete fRawYield; fRawYield=0; }
+  if(fTrackingEff)  { delete fTrackingEff; fTrackingEff=0; }
+  if(fBR)           { delete fBR; fBR=0; }
+  if(fCutsEff)      { delete fCutsEff; fCutsEff=0; }
+  if(fPIDEff)       { delete fPIDEff; fPIDEff=0; }
+  if(fMCPtShape)    { delete fMCPtShape; fMCPtShape=0; }
+  if(fPartAntipart) { delete fPartAntipart; fPartAntipart=0; }
+  */
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::Init(Int_t decay){
+  //
+  // Variables/histos initialization
   //
 
+  if (fRunNumber!=10 && fIsLowEnergy==false) { 
+    AliError("Only settings for 2010 and the low energy runs are implemented so far");
+  }
+  if (fCentralityClass!="020" && fCentralityClass!="4080" && fCentralityClass!="0100"){
+    AliError("Only settings for MB2010 are implemented so far");
+  }
+
   switch(decay) {
   case 1: // D0->Kpi
-    InitD0toKpi();
+    if (fCollisionType==0) {
+      if (fIsLowEnergy) InitD0toKpi2010ppLowEn();
+      else InitD0toKpi2010pp();
+    } else if (fCollisionType==1) {
+      if (fCentralityClass=="020") InitD0toKpi2010PbPb020();
+      else if (fCentralityClass=="4080") InitD0toKpi2010PbPb4080();
+      else AliError("Not yet implemented");
+    }
+    //    else if (fCollisionType==2) InitD0toKpi2010ppLowEn();
     break;
   case 2: // D+->Kpipi
-    InitDplustoKpipi();
+    if (fCollisionType==0) {
+      if (fIsLowEnergy) InitDplustoKpipi2010ppLowEn();
+      else InitDplustoKpipi2010pp();
+    } else if (fCollisionType==1) {
+      if (fCentralityClass=="020") InitDplustoKpipi2010PbPb020();
+      else if (fCentralityClass=="4080") InitDplustoKpipi2010PbPb4080();
+      else AliError("Not yet implemented");
+    }
     break;
   case 3: // D*->D0pi
-    InitDstartoD0pi();
+    if (fCollisionType==0) {
+      if(fIsLowEnergy)  InitDstartoD0pi2010ppLowEn();
+      else InitDstartoD0pi2010pp();
+    }else if (fCollisionType==1) {
+      if (fCentralityClass=="020")  InitDstartoD0pi2010PbPb020();
+      if (fCentralityClass=="2040") InitDstartoD0pi2010PbPb2040();
+      if (fCentralityClass=="4080") InitDstartoD0pi2010PbPb4080();
+      if (fCentralityClass!="4080" && fCentralityClass!="2040" && fCentralityClass!="020")  AliError("Not yet implemented");
+    }
     break;
   default:
     printf("Invalid decay type: %d\n",decay);
     break;
   }
 
+}
+  
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitD0toKpi2010pp() {
+  // 
+  // D0->Kpi syst errors. Responsible: A. Rossi
+  //   2010 pp sample
+  //
+
+  // Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
 
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.02); // 2% (1% per track)
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  fRawYield->SetBinContent(1,1);
+  fRawYield->SetBinContent(2,0.2); 
+  for(Int_t i=3;i<=16;i++) fRawYield->SetBinContent(i,0.05);
+  for(Int_t i=13;i<=16;i++) fRawYield->SetBinContent(i,0.10);
+  for(Int_t i=17;i<=24;i++) fRawYield->SetBinContent(i,1);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.03); // 3%
+  fPIDEff->SetBinContent(2,0.05); // 5%
+
+  // MC dN/dpt
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  // particle-antiparticle
+  //  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",24,0,24);
+  //  fPartAntipart->SetBinContent(1,1); 
+  //  for(Int_t i=2;i<=24;i++) fPartAntipart->SetBinContent(i,0.05);
+  
+  return;
 }
 //--------------------------------------------------------------------------
-AliHFSystErr::~AliHFSystErr() {
-  //  
-  // Default Destructor
+void AliHFSystErr::InitD0toKpi2010PbPb020() {
+  // 
+  // D0->Kpi syst errors. Responsible: A. Rossi
+  //   2010 PbPb sample, 0-20 CC
   //
 
-  if(fNorm)         { delete fNorm; fNorm=0; }
-  if(fRawYield)     { delete fRawYield; fRawYield=0; }
-  if(fTrackingEff)  { delete fTrackingEff; fTrackingEff=0; }
-  if(fBR)           { delete fBR; fBR=0; }
-  if(fCutsEff)      { delete fCutsEff; fCutsEff=0; }
-  if(fPIDEff)       { delete fPIDEff; fPIDEff=0; }
-  if(fMCPtShape)    { delete fMCPtShape; fMCPtShape=0; }
-  if(fPartAntipart) { delete fPartAntipart; fPartAntipart=0; }
+  // Normalization
+  fNorm = new TH1F("fNorm","fNorm",20,0,20);
+  for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",20,0,20);
+  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
+  for(Int_t i=2;i<=12;i++) fTrackingEff->SetBinContent(i,0.05+0.005*(Float_t)i);
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
+  fRawYield->SetBinContent(1,0);
+  fRawYield->SetBinContent(2,0);
+  fRawYield->SetBinContent(3,0.05);
+  fRawYield->SetBinContent(4,0.05);
+  fRawYield->SetBinContent(5,0.10);
+  fRawYield->SetBinContent(6,0.10);
+  for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);
+ // for(Int_t i=13;i<=20;i++) fRawYield->SetBinContent(i,0);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
+  fCutsEff->SetBinContent(1,0.);
+  fCutsEff->SetBinContent(2,0.);
+  fCutsEff->SetBinContent(3,0.18);
+  fCutsEff->SetBinContent(4,0.18);
+  fCutsEff->SetBinContent(5,0.18);
+  fCutsEff->SetBinContent(6,0.15);
+  fCutsEff->SetBinContent(7,0.15);
+  fCutsEff->SetBinContent(8,0.15);
+fCutsEff->SetBinContent(9,0.15);
+ fCutsEff->SetBinContent(10,0.15);
+  fCutsEff->SetBinContent(11,0.15);
+  fCutsEff->SetBinContent(12,0.15);
+ // for(Int_t i=13;i<=20;i++) fCutsEff->SetBinContent(i,0.);
 
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
+  for(Int_t i=3;i<=12;i++) fPIDEff->SetBinContent(i,0.05);
+  fPIDEff->SetBinContent(5,0.10);
+  fPIDEff->SetBinContent(6,0.10);
+
+  // MC dN/dpt
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+
+  // particle-antiparticle
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  for(Int_t i=3;i<=12;i++) fPartAntipart->SetBinContent(i,0.05);
+  fPartAntipart->SetBinContent(3,0.10);
+  fPartAntipart->SetBinContent(4,0.10);
+  fPartAntipart->SetBinContent(7,0.10);
+  fPartAntipart->SetBinContent(8,0.10);
+  
+  return;
 }
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitD0toKpi() {
+void AliHFSystErr::InitD0toKpi2010PbPb4080() {
   // 
   // D0->Kpi syst errors. Responsible: A. Rossi
+  //   2010 PbPb sample, 40-80 CC
   //
+
+  // Normalization
+  fNorm = new TH1F("fNorm","fNorm",20,0,20);
+  for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",20,0,20);
+  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.012); // 1.2% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
+  for(Int_t i=2;i<=12;i++) fTrackingEff->SetBinContent(i,0.5*(0.05+0.005*(Float_t)i));
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
+  fRawYield->SetBinContent(1,0);
+  fRawYield->SetBinContent(2,0);
+  for(Int_t i=3;i<=12;i++) fRawYield->SetBinContent(i,0.05);
+  //for(Int_t i=13;i<=20;i++) fRawYield->SetBinContent(i,0);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
+  fCutsEff->SetBinContent(1,0.);
+  fCutsEff->SetBinContent(2,0.);
+  fCutsEff->SetBinContent(3,0.15);
+  fCutsEff->SetBinContent(4,0.15);
+  fCutsEff->SetBinContent(5,0.15);
+  fCutsEff->SetBinContent(6,0.15);
+  fCutsEff->SetBinContent(7,0.15);
+  fCutsEff->SetBinContent(8,0.15);
+  fCutsEff->SetBinContent(9,0.15);
+  fCutsEff->SetBinContent(10,0.15);
+  fCutsEff->SetBinContent(11,0.15);
+  fCutsEff->SetBinContent(12,0.15);
+ // for(Int_t i=13;i<=20;i++) fCutsEff->SetBinContent(i,0.);
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
+  for(Int_t i=3;i<=12;i++) fPIDEff->SetBinContent(i,0.05);
+
+  // MC dN/dpt
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  // particle-antiparticle
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  for(Int_t i=3;i<=12;i++) fPartAntipart->SetBinContent(i,0.05);
   
+  return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitD0toKpi2010ppLowEn() {
+  // 
+  // D0->Kpi syst errors. Low energy run
+  //   2011 2.76 TeV pp sample
+  //
+  AliInfo(" Settings for D0 --> K pi, p-p collisions at 2.76 TeV"); 
+
   // Normalization
   fNorm = new TH1F("fNorm","fNorm",20,0,20);
   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
@@ -119,27 +334,37 @@ void AliHFSystErr::InitD0toKpi() {
 
   // Tracking efficiency
   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
-  for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.02); // 2% (1% per track)
+  for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.10); //10% (5% per track)
 
   // Raw yield extraction
   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
   fRawYield->SetBinContent(1,1);
   fRawYield->SetBinContent(2,1);
-  fRawYield->SetBinContent(3,0.15);
-  for(Int_t i=4;i<=20;i++) fRawYield->SetBinContent(i,0.065);
+  fRawYield->SetBinContent(3,0.2);
+  fRawYield->SetBinContent(4,0.2);
+  fRawYield->SetBinContent(5,0.1);
+  fRawYield->SetBinContent(6,0.1);
+  fRawYield->SetBinContent(7,0.2);
+  fRawYield->SetBinContent(8,0.2);
+  for(Int_t i=9;i<=20;i++) fRawYield->SetBinContent(i,0.065);
 
   // Cuts efficiency (from cuts variation)
   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
-  for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+  for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.18); // 10% 
 
   // PID efficiency (from PID/noPID)
   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
-  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.03); // 3%
-  fPIDEff->SetBinContent(4,0.10); // 10%
+  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.20); // 10%
+  fPIDEff->SetBinContent(3,0.25); // 10%
+  fPIDEff->SetBinContent(4,0.25); // 10%
+  fPIDEff->SetBinContent(7,0.25); // 10%
+  fPIDEff->SetBinContent(8,0.25); // 10%
 
   // MC dN/dpt
   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
-  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,(Float_t)i*0.006);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
 
   // particle-antiparticle
   fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
@@ -149,11 +374,139 @@ void AliHFSystErr::InitD0toKpi() {
   
   return;
 }
+
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitDplustoKpipi() {
+void AliHFSystErr::InitDplustoKpipi2010pp() {
   // 
   // D+->Kpipi syst errors. Responsible: R. Bala
+  //  2010 pp sample
+  //
+
+
+// Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.07); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.04); // 4% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.03); // 3% (1% per track)
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  fRawYield->SetBinContent(1,0.25);
+  fRawYield->SetBinContent(2,0.25);
+  fRawYield->SetBinContent(3,0.25);
+  fRawYield->SetBinContent(4,0.25);
+  fRawYield->SetBinContent(5,0.09);
+  fRawYield->SetBinContent(6,0.09);
+  for(Int_t i=7;i<=12;i++) fRawYield->SetBinContent(i,0.05);  //5 to 10%
+  for(Int_t i=12;i<=24;i++) fRawYield->SetBinContent(i,0.10);  // 15%
+  
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.05); // 5%
+  fPIDEff->SetBinContent(1,0.15); // 15%
+  fPIDEff->SetBinContent(2,0.15); // 15%
+  fPIDEff->SetBinContent(3,0.15); // 15%
+  fPIDEff->SetBinContent(4,0.15); // 15%
+  for(Int_t i=12;i<=16;i++) fPIDEff->SetBinContent(i,0.10); // 5%
+
+  // MC dN/dpt  
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+
+  // particle-antiparticle
+  /*
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  fPartAntipart->SetBinContent(1,1);
+  fPartAntipart->SetBinContent(2,1);
+  fPartAntipart->SetBinContent(3,0.12);
+  for(Int_t i=4;i<=20;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
+  */
+  return;
+}
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDplustoKpipi2010PbPb020() {
+  // 
+  // D+->Kpipi syst errors. Responsible: ??
+  //  2010 PbPb sample, 0-20 CC
+  //
+
+ // Normalization
+  fNorm = new TH1F("fNorm","fNorm",20,0,20);
+  for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",20,0,20);
+  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.04); // 4% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,i,0.075+0.005*(Float_t)i); 
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
+  for(Int_t i=1;i<=20;i++) fRawYield->SetBinContent(i,1);  //5 to 10%
+//   for(Int_t i=6;i<=7;i++) fRawYield->SetBinContent(i,0.32);
+//   for(Int_t i=7;i<=9;i++) fRawYield->SetBinContent(i,0.32);
+//   for(Int_t i=9;i<=12;i++) fRawYield->SetBinContent(i,0.05);//31./156.);
+  fRawYield->SetBinContent(6,0.12);
+  fRawYield->SetBinContent(7,0.17);
+  fRawYield->SetBinContent(8,0.17);
+  fRawYield->SetBinContent(9,0.08);
+  fRawYield->SetBinContent(10,0.08);
+  fRawYield->SetBinContent(11,0.08);
+  fRawYield->SetBinContent(12,0.08);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.15); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 5%
+  fPIDEff->SetBinContent(3,0.13); // 13%
+
+  // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+
+  // particle-antiparticle
+  /*
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  fPartAntipart->SetBinContent(1,1);
+  fPartAntipart->SetBinContent(2,1);
+  fPartAntipart->SetBinContent(3,0.12);
+  for(Int_t i=4;i<=20;i++) fPartAntipart->SetBinContent(i,0.05);   //5 to 12%
+  */
+  return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDplustoKpipi2010PbPb4080() {
+  // 
+  // D+->Kpipi syst errors. Responsible: ??
+  //  2010 PbPb sample, 40-80 CC
   //
+  
 
  // Normalization
   fNorm = new TH1F("fNorm","fNorm",20,0,20);
@@ -172,8 +525,14 @@ void AliHFSystErr::InitDplustoKpipi() {
   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
   fRawYield->SetBinContent(1,1);
   fRawYield->SetBinContent(2,1);
-  fRawYield->SetBinContent(3,0.20);
-  for(Int_t i=4;i<=20;i++) fRawYield->SetBinContent(i,0.055);  //5 to 10%
+  fRawYield->SetBinContent(3,1);
+  fRawYield->SetBinContent(4,1.);
+  fRawYield->SetBinContent(5,4./23.);
+  fRawYield->SetBinContent(6,4./23.);
+  fRawYield->SetBinContent(7,5./20.);
+  fRawYield->SetBinContent(8,5./20.);
+  for(Int_t i=9;i<=12;i++) fRawYield->SetBinContent(i,1./16.);
+  for(Int_t i=13;i<=20;i++) fRawYield->SetBinContent(i,1);  //5 to 10%
 
   // Cuts efficiency (from cuts variation)
   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
@@ -187,7 +546,9 @@ void AliHFSystErr::InitDplustoKpipi() {
 
   // MC dN/dpt  (copied from D0 : will update later)
   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
-  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,(Float_t)i*0.006);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
 
 
   // particle-antiparticle
@@ -200,36 +561,35 @@ void AliHFSystErr::InitDplustoKpipi() {
   */
   return;
 }
+
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitDstartoD0pi() {
+void AliHFSystErr::InitDplustoKpipi2010ppLowEn() {
+
   // 
-  // D*+->D0pi syst errors. Responsible: A. Grelli, Y. Wang
+  // D+->Kpipi syst errors. Responsible: R. Bala
+  //  2011 2.76 TeV pp sample
   //
+  AliInfo(" Settings for D+ --> K pi pi p-p collisions at 2.76 TeV"); 
 
- // Normalization
+  // Normalization
   fNorm = new TH1F("fNorm","fNorm",20,0,20);
   for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
 
   // Branching ratio 
   fBR = new TH1F("fBR","fBR",20,0,20);
-  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.07); // 7% PDG2010
+  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.04); // 4% PDG2010
 
   // Tracking efficiency
   fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
-  fTrackingEff->SetBinContent(1,0.12);
-  fTrackingEff->SetBinContent(2,0.08);
-  fTrackingEff->SetBinContent(3,0.032);
-  for(Int_t i=4;i<=20;i++) fTrackingEff->SetBinContent(i,0.03); // 3% (1% per track)
-
+  for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.15); // 3% (1% per track)
 
   // Raw yield extraction
   fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
-  fRawYield->SetBinContent(1,0.19);
-  fRawYield->SetBinContent(2,0.10);
-  fRawYield->SetBinContent(3,0.10);
-  fRawYield->SetBinContent(4,0.13);
-  fRawYield->SetBinContent(5,0.09);
-  for(Int_t i=5;i<=20;i++) fRawYield->SetBinContent(i,0.08);  //8%
+  fRawYield->SetBinContent(1,1);
+  fRawYield->SetBinContent(2,1);
+  fRawYield->SetBinContent(3,0.20);
+  fRawYield->SetBinContent(4,0.20);
+  for(Int_t i=5;i<=20;i++) fRawYield->SetBinContent(i,0.055);  //5 to 10%
 
   // Cuts efficiency (from cuts variation)
   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
@@ -237,16 +597,280 @@ void AliHFSystErr::InitDstartoD0pi() {
 
   // PID efficiency (from PID/noPID)
   fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
-  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.03); // 3%
-  fPIDEff->SetBinContent(4,0.10); // 10%
-  fPIDEff->SetBinContent(5,0.06); // 6%
+  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 5%
+  fPIDEff->SetBinContent(3,0.15); // 13%
+  fPIDEff->SetBinContent(4,0.15); // 13%
+  // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010pp() {
+  // 
+  // D*+->D0pi syst errors. Responsible: A. Grelli, Y. Wang
+  //  2010 pp sample
+  //
+
+ // Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);
+  fTrackingEff->SetBinContent(1,1.0);
+  fTrackingEff->SetBinContent(2,0.12);
+  fTrackingEff->SetBinContent(3,0.08);
+  fTrackingEff->SetBinContent(3,0.05);
+  for(Int_t i=4;i<=24;i++) fTrackingEff->SetBinContent(i,0.03); // 3% (1% per track)
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  fRawYield->SetBinContent(1,1.0);
+  fRawYield->SetBinContent(2,0.09);
+  fRawYield->SetBinContent(3,0.04);
+  fRawYield->SetBinContent(4,0.02);
+  fRawYield->SetBinContent(5,0.03);
+  fRawYield->SetBinContent(6,0.06);
+  fRawYield->SetBinContent(7,0.04);
+  fRawYield->SetBinContent(8,0.11);
+  for(Int_t i=5;i<=24;i++) fRawYield->SetBinContent(i,0.03);  //4%
+  fRawYield->SetBinContent(13,0.09);
+  fRawYield->SetBinContent(14,0.09);
+  fRawYield->SetBinContent(15,0.09);
+  fRawYield->SetBinContent(16,0.09);
+  fRawYield->SetBinContent(17,0.24);
+  fRawYield->SetBinContent(18,0.24);
+  fRawYield->SetBinContent(19,0.24);
+  fRawYield->SetBinContent(20,0.24);
+  fRawYield->SetBinContent(21,0.24);
+  fRawYield->SetBinContent(22,0.24);
+  fRawYield->SetBinContent(23,0.24);
+  fRawYield->SetBinContent(24,0.24);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  fCutsEff->SetBinContent(2,0.22);
+  for(Int_t i=3;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
  
 
   // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  return;
+
+
+}
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010ppLowEn() {
+
+  // 
+  // D+->Kpipi syst errors. Responsible: A. Grelli
+  //  2011 2.76 TeV pp sample
+  //
+  AliInfo(" Settings for D*+ --> D0 pi p-p collisions at 2.76 TeV"); 
+
+// Normalization
+  fNorm = new TH1F("fNorm","fNorm",20,0,20);
+  for(Int_t i=1;i<=20;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",20,0,20);
+  for(Int_t i=1;i<=20;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.15); //10% (to be checked!!)
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
+  fRawYield->SetBinContent(1,1);
+  fRawYield->SetBinContent(2,1);
+  fRawYield->SetBinContent(3,0.2);
+  fRawYield->SetBinContent(4,0.2);
+  fRawYield->SetBinContent(5,0.08);
+  fRawYield->SetBinContent(6,0.08);
+  fRawYield->SetBinContent(7,0.1);
+  fRawYield->SetBinContent(8,0.1);
+  fRawYield->SetBinContent(9,0.2);
+  fRawYield->SetBinContent(10,0.2);
+  for(Int_t i=9;i<=20;i++) fRawYield->SetBinContent(i,0.065);
+
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fCutsEff->SetBinContent(i,0.18);  
+  fCutsEff->SetBinContent(3,0.2);
+  fCutsEff->SetBinContent(4,0.2);
+  fCutsEff->SetBinContent(5,0.1);
+  fCutsEff->SetBinContent(6,0.1);
+  fCutsEff->SetBinContent(7,0.12);
+  fCutsEff->SetBinContent(8,0.12);
+  fCutsEff->SetBinContent(9,0.2);
+  fCutsEff->SetBinContent(10,0.2);
+  fCutsEff->SetBinContent(11,0.2);
+  fCutsEff->SetBinContent(12,0.2);
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",20,0,20);
+  for(Int_t i=1;i<=20;i++) fPIDEff->SetBinContent(i,0.05); // 10%
+
+  // MC dN/dpt
   fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",20,0,20);
-  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,(Float_t)i*0.006);
+  for(Int_t i=1;i<=20;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+
+  return;
+}
+//------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010PbPb020() {
+  // 
+  // D*+->D0pi syst errors. Responsible: A. Grelli
+  //  2010 PbPb sample, 0-20 CC
+  //
+
+  AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 0-20 centrality - DUMMY"); 
+
+ // Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
+  for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.12); // 3% (1% per track)
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.15);  //4%
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
+
+  // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  return;
+
+}
+//-------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010PbPb2040() {
+  // 
+  // D*+->D0pi syst errors. Responsible: A. Grelli
+  //  2010 PbPb sample, 20-40 CC
+  //
+
+  AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 20-40 centrality - DUMMY"); 
+
+ // Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
+  for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.12); // 3% (1% per track)
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.15);  //4%
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
+
+  // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
+
+  return;
+
+}
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010PbPb4080() {
+  // 
+  // D*+->D0pi syst errors. Responsible: A. Grelli
+  //  2010 PbPb sample, 40-80 CC
+  //
+
+  AliInfo(" Settings for D*+ --> D0pi Pb-Pb collisions at 2.76 TeV - 40-80 centrality - DUMMY"); 
+
+ // Normalization
+  fNorm = new TH1F("fNorm","fNorm",24,0,24);
+  for(Int_t i=1;i<=24;i++) fNorm->SetBinContent(i,0.10); // 10% error on sigmaV0and
+
+  // Branching ratio 
+  fBR = new TH1F("fBR","fBR",24,0,24);
+  for(Int_t i=1;i<=24;i++) fBR->SetBinContent(i,0.015); // 1.5% PDG2010
+
+  // Tracking efficiency
+  fTrackingEff = new TH1F("fTrackingEff","fTrackingEff",24,0,24);;
+  for(Int_t i=1;i<=24;i++) fTrackingEff->SetBinContent(i,0.12); // 3% (1% per track)
+
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",24,0,24);
+  for(Int_t i=1;i<=24;i++) fRawYield->SetBinContent(i,0.15);  //4%
+  // Cuts efficiency (from cuts variation)
+  fCutsEff = new TH1F("fCutsEff","fCutsEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fCutsEff->SetBinContent(i,0.10); // 10%
+
+  // PID efficiency (from PID/noPID)
+  fPIDEff = new TH1F("fPIDEff","fPIDEff",24,0,24);
+  for(Int_t i=1;i<=24;i++) fPIDEff->SetBinContent(i,0.04); // 3%
+
+  // MC dN/dpt  (copied from D0 : will update later)
+  fMCPtShape = new TH1F("fMCPtShape","fMCPtShape",24,0,24);
+  for(Int_t i=1;i<=24;i++) fMCPtShape->SetBinContent(i,0.);
+  fMCPtShape->SetBinContent(1,0.03);
+  fMCPtShape->SetBinContent(2,0.03);
 
   return;
+
 }
 //--------------------------------------------------------------------------
 Double_t AliHFSystErr::GetCutsEffErr(Double_t pt) const {
@@ -345,22 +969,25 @@ void AliHFSystErr::DrawErrors(TGraphAsymmErrors *grErrFeeddown) const {
   //
   gStyle->SetOptStat(0);
 
-  TCanvas *cSystErr = new TCanvas("cSystErr","Systematic Errors",0,0,500,500);
+  TCanvas *cSystErr = new TCanvas("cSystErr","Systematic Errors",300,80,640,500);
+  cSystErr->Range(0.20,-0.5,18.4,0.34);
+  cSystErr->SetRightMargin(0.318);
   cSystErr->SetFillColor(0);
 
   TH2F *hFrame = new TH2F("hFrame","Systematic errors; p_{t} [GeV/c]; Relative Error",20,0,20,100,-1,+1);
-  hFrame->SetAxisRange(2.,11.9,"X");
-  hFrame->SetAxisRange(-0.6,0.6,"Y");
+  hFrame->SetAxisRange(1.,15.9,"X");
+  hFrame->SetAxisRange(-0.5,0.5,"Y");
   hFrame->Draw();
 
-  TLegend *leg=new TLegend(0.5,0.5,0.9,0.9);
+  TLegend *leg = new TLegend(0.69,0.44,0.98,0.86,NULL,"brNDC");
+  leg->SetTextSize(0.03601695);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   
-  TH1F *hTotErr=new TH1F("hTotErr","",20,0,20);
+  TH1F *hTotErr=new TH1F("hTotErr","",24,0,24);
   Int_t nbins = fNorm->GetNbinsX();
   TGraphAsymmErrors *gTotErr = new TGraphAsymmErrors(nbins);
-  for(Int_t i=1;i<=20;i++) {
+  for(Int_t i=1;i<=24;i++) {
     Double_t pt = hTotErr->GetBinCenter(i);
     Double_t ptwidth = hTotErr->GetBinWidth(i);
 
@@ -371,7 +998,7 @@ void AliHFSystErr::DrawErrors(TGraphAsymmErrors *grErrFeeddown) const {
        grErrFeeddown->GetPoint(j,x,y);
        errxh = grErrFeeddown->GetErrorXhigh(j);
        errxl = grErrFeeddown->GetErrorXlow(j);
-       if ( ( (x-errxl) >= pt) && ( (x+errxl) <= pt) ) {
+       if ( ( (x-errxl) <= pt) && ( (x+errxl) >= pt) ) {
          erryh = grErrFeeddown->GetErrorYhigh(j);
          erryl = grErrFeeddown->GetErrorYlow(j);
        }
@@ -403,14 +1030,13 @@ void AliHFSystErr::DrawErrors(TGraphAsymmErrors *grErrFeeddown) const {
 //   leg->AddEntry(hTotErr,"Total (excl. norm.)","l");
   
 
-  if(fNorm) {
-    fNorm->SetFillColor(1);
-    fNorm->SetFillStyle(3002);
-    //fNorm->Draw("same");
-    //TH1F *hNormRefl = ReflectHisto(fNorm);
-    //hNormRefl->Draw("same");
-    leg->AddEntry(fNorm,"Normalization (10%)","");
-  }
+  fNorm->SetFillColor(1);
+  fNorm->SetFillStyle(3002);
+  //fNorm->Draw("same");
+  //TH1F *hNormRefl = ReflectHisto(fNorm);
+  //hNormRefl->Draw("same");
+  leg->AddEntry(fNorm,"Normalization (10%)","");
+
   if(grErrFeeddown) {
     grErrFeeddown->SetFillColor(kTeal-8);
     grErrFeeddown->SetFillStyle(3001);