Changes for PbPb (Zaida)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliHFSystErr.cxx
index 1124075..ac1de65 100644 (file)
 // 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 
 //
@@ -35,6 +39,7 @@
 #include <TLegend.h>
 #include <TColor.h>
 
+#include "AliLog.h"
 #include "AliHFSystErr.h"
 
 
@@ -50,67 +55,185 @@ fBR(0),
 fCutsEff(0),
 fPIDEff(0),
 fMCPtShape(0),
-fPartAntipart(0)
+fPartAntipart(0),
+fRunNumber(10),
+fCollisionType(0),
+fCentralityClass(0100)
 {
   //
   // 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
+  //
+
+  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){
   //
-  // Standard Constructor
+  // Variables/histos initialization
   //
 
+  if (fRunNumber!=10) { 
+    AliError("Only settings for 2010 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) InitD0toKpi2010pp();
+    else if (fCollisionType==1) {
+      if (fCentralityClass==020) InitD0toKpi2010PbPb020();
+      else if (fCentralityClass==4080) InitD0toKpi2010PbPb4080();
+      else AliError("Not yet implemented");
+    }
     break;
   case 2: // D+->Kpipi
-    InitDplustoKpipi();
+    if (fCollisionType==0) 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) InitDstartoD0pi2010pp();
+    else if (fCollisionType==1) {
+      if (fCentralityClass==020) InitDstartoD0pi2010PbPb020();
+      else if (fCentralityClass==4080) InitDstartoD0pi2010PbPb4080();
+      else AliError("Not yet implemented");
+    }
     break;
   default:
     printf("Invalid decay type: %d\n",decay);
     break;
   }
 
-
 }
+  
 //--------------------------------------------------------------------------
-AliHFSystErr::~AliHFSystErr() {
-  //  
-  // Default Destructor
+void AliHFSystErr::InitD0toKpi2010pp() {
+  // 
+  // D0->Kpi syst errors. Responsible: A. Rossi
+  //   2010 pp sample
   //
 
-  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=1;i<=20;i++) fTrackingEff->SetBinContent(i,0.02); // 2% (1% 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);
+
+  // 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%
+
+  // 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%
+
+  // 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);
 
+  // particle-antiparticle
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  fPartAntipart->SetBinContent(1,1);
+  fPartAntipart->SetBinContent(2,1);
+  for(Int_t i=3;i<=6;i++) fPartAntipart->SetBinContent(i,0.08);
+  
+  return;
 }
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitD0toKpi() {
+void AliHFSystErr::InitD0toKpi2010PbPb020() {
   // 
-  // D0->Kpi syst errors. Responsible: A. Rossi
+  // D0->Kpi 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.012); // 1.2% PDG2010
+
+  // 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)
+
+  // Raw yield extraction
+  fRawYield = new TH1F("fRawYield","fRawYield",20,0,20);
+  fRawYield->SetBinContent(1,0);
+  fRawYield->SetBinContent(2,0);
+  fRawYield->SetBinContent(3,0);
+  fRawYield->SetBinContent(4,0.27);
+  fRawYield->SetBinContent(5,0.27);
+  fRawYield->SetBinContent(6,0);
+  fRawYield->SetBinContent(7,0.07);
+  fRawYield->SetBinContent(8,0.07);
+  for(Int_t i=9;i<=12;i++) fRawYield->SetBinContent(i,0.09);
+  for(Int_t i=12;i<=20;i++) fRawYield->SetBinContent(i,0);
+
+  // 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%
+
+  // 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%
+
+  // 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);
+
+  // particle-antiparticle
+  fPartAntipart = new TH1F("fPartAntipart","fPartAntipart",20,0,20);
+  fPartAntipart->SetBinContent(1,1);
+  fPartAntipart->SetBinContent(2,1);
+  for(Int_t i=3;i<=6;i++) fPartAntipart->SetBinContent(i,0.08);
   
+  return;
+}
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitD0toKpi2010PbPb4080() {
+  // 
+  // D0->Kpi syst errors. Responsible: ??
+  //   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
@@ -125,10 +248,15 @@ void AliHFSystErr::InitD0toKpi() {
 
   // 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(1,0);
+  fRawYield->SetBinContent(2,0);
+  fRawYield->SetBinContent(3,0);
+  fRawYield->SetBinContent(4,0);
+  fRawYield->SetBinContent(5,0.3);
+  fRawYield->SetBinContent(6,0);
+  fRawYield->SetBinContent(7,0.33);
+  fRawYield->SetBinContent(8,0.33);
+  for(Int_t i=9;i<=20;i++) fRawYield->SetBinContent(i,0);
 
   // Cuts efficiency (from cuts variation)
   fCutsEff = new TH1F("fCutsEff","fCutsEff",20,0,20);
@@ -152,9 +280,10 @@ void AliHFSystErr::InitD0toKpi() {
   return;
 }
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitDplustoKpipi() {
+void AliHFSystErr::InitDplustoKpipi2010pp() {
   // 
   // D+->Kpipi syst errors. Responsible: R. Bala
+  //  2010 pp sample
   //
 
  // Normalization
@@ -203,9 +332,32 @@ void AliHFSystErr::InitDplustoKpipi() {
   return;
 }
 //--------------------------------------------------------------------------
-void AliHFSystErr::InitDstartoD0pi() {
+void AliHFSystErr::InitDplustoKpipi2010PbPb020() {
+  // 
+  // D+->Kpipi syst errors. Responsible: ??
+  //  2010 PbPb sample, 0-20 CC
+  //
+  
+  AliInfo("Not yet implemented");
+  return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDplustoKpipi2010PbPb4080() {
+  // 
+  // D+->Kpipi syst errors. Responsible: ??
+  //  2010 PbPb sample, 40-80 CC
+  //
+  
+  AliInfo("Not yet implemented");
+  return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010pp() {
   // 
   // D*+->D0pi syst errors. Responsible: A. Grelli, Y. Wang
+  //  2010 pp sample
   //
 
  // Normalization
@@ -254,6 +406,26 @@ void AliHFSystErr::InitDstartoD0pi() {
   return;
 }
 //--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010PbPb020() {
+  // 
+  // D*+->D0pi syst errors. Responsible: ??
+  //  2010 PbPb sample, 0-20 CC
+  //
+
+  AliInfo("Not yet implemented");
+  return;
+}
+//--------------------------------------------------------------------------
+void AliHFSystErr::InitDstartoD0pi2010PbPb4080() {
+  // 
+  // D*+->D0pi syst errors. Responsible: ??
+  //  2010 PbPb sample, 40-80 CC
+  //
+
+  AliInfo("Not yet implemented");
+  return;
+}
+//--------------------------------------------------------------------------
 Double_t AliHFSystErr::GetCutsEffErr(Double_t pt) const {
   // 
   // Get error