Migrating PWG2/SPECTRA/Fit to new PWG structure
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jan 2012 16:56:52 +0000 (16:56 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jan 2012 16:56:52 +0000 (16:56 +0000)
14 files changed:
PWG/CMakelibPWGTools.pkg
PWG/PWGToolsLinkDef.h
PWG/Tools/AliLatexTable.cxx [moved from PWG2/SPECTRA/Fit/AliLatexTable.cxx with 97% similarity]
PWG/Tools/AliLatexTable.h [moved from PWG2/SPECTRA/Fit/AliLatexTable.h with 100% similarity]
PWG/Tools/AliPWGFunc.cxx [moved from PWG2/SPECTRA/Fit/AliBWFunc.cxx with 77% similarity]
PWG/Tools/AliPWGFunc.h [moved from PWG2/SPECTRA/Fit/AliBWFunc.h with 92% similarity]
PWG/Tools/AliPWGHistoTools.cxx [moved from PWG2/SPECTRA/Fit/AliBWTools.cxx with 85% similarity]
PWG/Tools/AliPWGHistoTools.h [moved from PWG2/SPECTRA/Fit/AliBWTools.h with 91% similarity]
PWG2/SPECTRA/Fit/ALICEWorkInProgress.C [deleted file]
PWG2/SPECTRA/Fit/GetE735Ratios.C [deleted file]
PWG2/SPECTRA/Fit/PlotCombine7TeV.C [deleted file]
PWG2/SPECTRA/Fit/StarPPSpectra.C [deleted file]
PWGLF/SPECTRA/PiKaPr/COMBINED/CombineSpectra.C [moved from PWG2/SPECTRA/Fit/CombineSpectra.C with 90% similarity]
PWGLF/SPECTRA/PiKaPr/COMBINED/FitParticle.C [moved from PWG2/SPECTRA/Fit/FitParticle.C with 90% similarity]

index 68ff302..cd46e9f 100644 (file)
@@ -29,6 +29,9 @@
 set ( SRCS  
     Tools/AliAnalysisHelperJetTasks.cxx 
     Tools/AliTHn.cxx 
+    Tools/AliPWGHistoTools.cxx
+    Tools/AliPWGFunc.cxx
+    Tools/AliLatexTable.cxx
     )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
index a84e0b1..a04703d 100644 (file)
@@ -6,5 +6,8 @@
 
 #pragma link C++ class AliAnalysisHelperJetTasks+;
 #pragma link C++ class AliTHn+;
+#pragma link C++ class AliPWGHistoTools+;
+#pragma link C++ class AliPWGFunc+;
+
 
 #endif
similarity index 97%
rename from PWG2/SPECTRA/Fit/AliLatexTable.cxx
rename to PWG/Tools/AliLatexTable.cxx
index 68d0436..9c6b691 100644 (file)
@@ -6,16 +6,17 @@
 // than print the table as Latex source code (to be pasted on a paper)
 // or ASCII.
 //
-// The basic idea is that you add columns one after the other with the
-// SetNextCol method and than you insert this row. The SetNextCol
-// method comes in different flavours to alow the insertion of
-// different type of values (numbers with or without errors,
-// strings...).
+// The basic idea is that you have a stack of rows. You add columns
+// one after the other with the SetNextCol method and than you insert
+// this row. The SetNextCol method comes in different flavours to alow
+// the insertion of different type of values (numbers with or without
+// errors, strings...). Errors are rounded and written in scientific
+// notation with the desired accuracy.
 //
 // TODO:
 // 1. Make the class drawable
 // 2. Implement vertical lines in ascii print
-// 3. Print output in HTML format
+// 3. Improve output in HTML format
 //
 // Author: Michele Floris, CERN
 // ------------------------------------------------------------------
similarity index 77%
rename from PWG2/SPECTRA/Fit/AliBWFunc.cxx
rename to PWG/Tools/AliPWGFunc.cxx
index 00c4340..3b53472 100644 (file)
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------
-//                              AliBWFunc
+//                              AliPWGFunc
 //
 // This class implements several function useful to fit pt spectra,
 // including but not limited to blast wave models.
@@ -8,15 +8,17 @@
 // variables: dNdpt vs pt, 1/pt dNdpt vs pt, 1/mt dNdmt vs mt. 
 //
 // Before getting the function you need, you have to chose the
-// variable you want to use calling AliBWFunc::SetVarType with one of
+// variable you want to use calling AliPWGFunc::SetVarType with one of
 // the elements of the VarType_t enum.
 //
+// TODO: code cleaup, make the naming convention of function more transparent
+//
 // Warning: not all variables are implemented for all the functions.
 //
 // Author: M. Floris, CERN
 //----------------------------------------------------------------------
 
-#include "AliBWFunc.h"
+#include "AliPWGFunc.h"
 #include "TMath.h"
 #include "TF1.h"
 #include "TF3.h"
 #include "TSpline.h"
 #include "AliLog.h"
 
-ClassImp(AliBWFunc)
+ClassImp(AliPWGFunc)
 
-AliBWFunc::AliBWFunc () : fLastFunc(0),  fLineWidth(1), fVarType(kdNdpt) {
+AliPWGFunc::AliPWGFunc () : fLastFunc(0),  fLineWidth(1), fVarType(kdNdpt) {
 
   // ctor
   fLineWidth = 1;
 }
-AliBWFunc::~AliBWFunc(){
+AliPWGFunc::~AliPWGFunc(){
   
   // dtor
   if (fLastFunc) delete fLastFunc;
@@ -39,7 +41,7 @@ AliBWFunc::~AliBWFunc(){
 }
 
 
-TF1 * AliBWFunc::GetHistoFunc(TH1 * h, const char * name) {
+TF1 * AliPWGFunc::GetHistoFunc(TH1 * h, const char * name) {
 
   // Regardless of the variable type, this returns a function made
   // from the histo * a multiplicative normalization.
@@ -55,7 +57,7 @@ TF1 * AliBWFunc::GetHistoFunc(TH1 * h, const char * name) {
 
 
 }
-TF1 * AliBWFunc::GetGraphFunc(TGraph * g, const char * name) {
+TF1 * AliPWGFunc::GetGraphFunc(TGraph * g, const char * name) {
 
   // Regardless of the variable type, this returns a function made
   // from the graph * a multiplicative normalization.
@@ -72,7 +74,7 @@ TF1 * AliBWFunc::GetGraphFunc(TGraph * g, const char * name) {
 }
 
 
-TF1 * AliBWFunc::GetBGBW(Double_t mass, Double_t beta, Double_t T,
+TF1 * AliPWGFunc::GetBGBW(Double_t mass, Double_t beta, Double_t T,
                         Double_t n, Double_t norm, const char * name){
 
   // Boltzmann-Gibbs blast wave
@@ -96,7 +98,7 @@ TF1 * AliBWFunc::GetBGBW(Double_t mass, Double_t beta, Double_t T,
 }
   
 
-TF1 * AliBWFunc::GetBoltzmann(Double_t mass, Double_t T, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetBoltzmann(Double_t mass, Double_t T, Double_t norm, const char * name){
   // Boltzmann
   switch (fVarType) {
   case kdNdpt:
@@ -116,7 +118,7 @@ TF1 * AliBWFunc::GetBoltzmann(Double_t mass, Double_t T, Double_t norm, const ch
 }
 
 
-TF1 * AliBWFunc::GetTsallisBW(Double_t mass, Double_t beta, Double_t T, Double_t q,
+TF1 * AliPWGFunc::GetTsallisBW(Double_t mass, Double_t beta, Double_t T, Double_t q,
                              Double_t norm, Double_t ymax, const char * name){
 
   // Tsallis blast wave
@@ -139,7 +141,7 @@ TF1 * AliBWFunc::GetTsallisBW(Double_t mass, Double_t beta, Double_t T, Double_t
 }
 
 
-TF1 * AliBWFunc::GetMTExp(Double_t mass, Double_t T, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetMTExp(Double_t mass, Double_t T, Double_t norm, const char * name){
 
   // Simple exponential in 1/mt*MT
   switch (fVarType) {
@@ -162,7 +164,7 @@ TF1 * AliBWFunc::GetMTExp(Double_t mass, Double_t T, Double_t norm, const char *
 }
 
 
-TF1 * AliBWFunc::GetBoseEinstein(Double_t mass, Double_t T, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetBoseEinstein(Double_t mass, Double_t T, Double_t norm, const char * name){
 
   // Bose einstein
   switch (fVarType) {
@@ -184,7 +186,7 @@ TF1 * AliBWFunc::GetBoseEinstein(Double_t mass, Double_t T, Double_t norm, const
 
 }
 
-TF1 * AliBWFunc::GetFermiDirac(Double_t mass, Double_t T, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetFermiDirac(Double_t mass, Double_t T, Double_t norm, const char * name){
 
   // Simple exponential in 1/mt*MT
   switch (fVarType) {
@@ -207,7 +209,7 @@ TF1 * AliBWFunc::GetFermiDirac(Double_t mass, Double_t T, Double_t norm, const c
 }
 
 
-TF1 * AliBWFunc::GetPTExp(Double_t T, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetPTExp(Double_t T, Double_t norm, const char * name){
 
   // Simple exponential in 1/mt*MT
   switch (fVarType) {
@@ -230,7 +232,7 @@ TF1 * AliBWFunc::GetPTExp(Double_t T, Double_t norm, const char * name){
 }
 
 
-TF1 * AliBWFunc::GetLevi(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetLevi(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name){
   // Levi function (aka Tsallis)
   switch (fVarType) {
   case kdNdpt:
@@ -257,7 +259,7 @@ TF1 * AliBWFunc::GetLevi(Double_t mass, Double_t T, Double_t n, Double_t norm, c
 
 }
 
-TF1 * AliBWFunc::GetPowerLaw(Double_t pt0, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetPowerLaw(Double_t pt0, Double_t n, Double_t norm, const char * name){
   // power law Nuclear Physics B, Vol. 335, No. 2. (7 May 1990), pp. 261-287.
   // This is sometimes also called Hagedorn or modified Hagedorn
 
@@ -281,7 +283,7 @@ TF1 * AliBWFunc::GetPowerLaw(Double_t pt0, Double_t n, Double_t norm, const char
 
 }
 
-TF1 * AliBWFunc::GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n, Double_t T, Double_t norm, const char * name) {
+TF1 * AliPWGFunc::GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n, Double_t T, Double_t norm, const char * name) {
   // UA1 parametrization Nuclear Physics B, Vol. 335, No. 2. (7 May 1990), pp. 261-287.
 
   switch (fVarType) {
@@ -305,7 +307,22 @@ TF1 * AliBWFunc::GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n
 
     break;
   case kOneOverPtdNdpt:
-    AliFatal("Not Implemented");
+    fLastFunc = new TF1 (name, StaticUA1FuncOneOverPt, 0.0, 10, 6);
+    fLastFunc->FixParameter(0,mass);
+    fLastFunc->SetParameter(1,p0star);
+    fLastFunc->SetParameter(2,pt0);
+    fLastFunc->SetParameter(3,n);
+    fLastFunc->SetParameter(4,T);
+    fLastFunc->SetParameter(5,norm);
+    fLastFunc->SetParLimits(1,0.01,1);
+    fLastFunc->SetParLimits(2,0.01,100);
+    fLastFunc->SetParLimits(3,0.01,100);
+    fLastFunc->SetParLimits(4,0.01,100);
+    fLastFunc->SetParNames("mass","p0star","pt0","n","T","norm");
+    fLastFunc->SetNpx(5000);
+    fLastFunc->SetLineWidth(fLineWidth);
+    return fLastFunc;
+
     break;
   case kOneOverMtdNdmt:
     AliFatal("Not Implemented");
@@ -325,7 +342,7 @@ TF1 * AliBWFunc::GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n
 
 // Backend (private functions and support functions for numerical integration)
 
-Double_t AliBWFunc::StaticHistoFunc(const double * x, const double* p){
+Double_t AliPWGFunc::StaticHistoFunc(const double * x, const double* p){
 
   // provides a function interpolating a histo with a spline; 
   // using double to store a pointer... This is a bad hack. To be replaced
@@ -349,7 +366,7 @@ Double_t AliBWFunc::StaticHistoFunc(const double * x, const double* p){
   }
   else if(h->InheritsFrom("TGraph")) spl= new TSpline3("fGraph",(TGraph*)h);
   else {
-    Printf("AliBWFunc::StaticHistoFunc: Unsupported type");
+    Printf("AliPWGFunc::StaticHistoFunc: Unsupported type");
     return 0;
   }
     //  }
@@ -360,7 +377,7 @@ Double_t AliBWFunc::StaticHistoFunc(const double * x, const double* p){
   
 }
 
-Double_t AliBWFunc::StaticUA1Func(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticUA1Func(const double * x, const double* p) {
   
 
   // "mass","p0star","pt0","n","T","norm"
@@ -373,7 +390,7 @@ Double_t AliBWFunc::StaticUA1Func(const double * x, const double* p) {
   
   Double_t xx = x[0];
 
-  static AliBWFunc * self = new AliBWFunc;
+  static AliPWGFunc * self = new AliPWGFunc;
   static TF1 * fPLaw   = self->GetPowerLawdNdptTimesPt(pt0, n, norm, "fLocalPLawUA1");
   static TF1 * fPMTExp = self->GetMTExpdNdptTimesPt   (mass, temp, norm, "fLocalMTexpUA1");
 
@@ -386,7 +403,43 @@ Double_t AliBWFunc::StaticUA1Func(const double * x, const double* p) {
   
   
   if (TMath::Abs(fPMTExp->Eval(p0star) - fPLaw->Eval(p0star)) > 0.0001 ) {
-    Printf("AliBWFunc::StaticUA1Func - Wrong norm") ; 
+    Printf("AliPWGFunc::StaticUA1Func - Wrong norm") ; 
+    Printf(" p0* %f  NMT: %f  N: %f  PL: %f  MT: %f", p0star, normMT, norm, fPLaw->Eval(p0star), fPMTExp->Eval(p0star));
+  }
+
+  if (xx > p0star)  return fPLaw->Eval(xx);
+  return fPMTExp->Eval(xx);    
+  
+  
+
+}
+Double_t AliPWGFunc::StaticUA1FuncOneOverPt(const double * x, const double* p) {
+  // UA1 func
+
+  // "mass","p0star","pt0","n","T","norm"
+  Double_t mass   = p[0];
+  Double_t p0star = p[1];
+  Double_t pt0    = p[2];
+  Double_t n      = p[3];
+  Double_t temp   = p[4];
+  Double_t norm   = p[5];
+  
+  Double_t xx = x[0];
+
+  static AliPWGFunc * self = new AliPWGFunc;
+  static TF1 * fPLaw   = self->GetPowerLawdNdpt(pt0, n, norm, "fLocalPLawUA1");
+  static TF1 * fPMTExp = self->GetMTExpdNdpt   (mass, temp, norm, "fLocalMTexpUA1");
+
+  fPLaw->SetParameters(norm,pt0,n);
+  fPMTExp->SetParameters(1,temp);
+  
+
+  Double_t normMT =fPMTExp->Eval(p0star) >0 ? fPLaw->Eval(p0star) / fPMTExp->Eval(p0star) *  fPMTExp->GetParameter(0) : 1;
+  fPMTExp->SetParameter(0,normMT);
+  
+  
+  if (TMath::Abs(fPMTExp->Eval(p0star) - fPLaw->Eval(p0star)) > 0.0001 ) {
+    Printf("AliPWGFunc::StaticUA1Func - Wrong norm") ; 
     Printf(" p0* %f  NMT: %f  N: %f  PL: %f  MT: %f", p0star, normMT, norm, fPLaw->Eval(p0star), fPMTExp->Eval(p0star));
   }
 
@@ -398,7 +451,7 @@ Double_t AliBWFunc::StaticUA1Func(const double * x, const double* p) {
 }
 
 
-Double_t AliBWFunc::IntegrandBG(const double * x, const double* p){
+Double_t AliPWGFunc::IntegrandBG(const double * x, const double* p){
   // integrand for boltzman-gibbs blast wave
      // x[0] -> r (radius)
      // p[0] -> mass
@@ -435,7 +488,7 @@ Double_t AliBWFunc::IntegrandBG(const double * x, const double* p){
 
 
 
-Double_t AliBWFunc::StaticBGdNdPt(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticBGdNdPt(const double * x, const double* p) {
 
   // implementation of BGBW (1/pt dNdpt)
 
@@ -459,13 +512,13 @@ Double_t AliBWFunc::StaticBGdNdPt(const double * x, const double* p) {
 
 }
 
-Double_t AliBWFunc::StaticBGdNdPtTimesPt(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticBGdNdPtTimesPt(const double * x, const double* p) {
   // BGBW dNdpt implementation
   return x[0]*StaticBGdNdPt(x,p);
 }
 
 
-TF1 * AliBWFunc::GetBGBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
+TF1 * AliPWGFunc::GetBGBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
                              Double_t n, Double_t norm, const char * name){
   
   // BGBW 1/pt dNdpt
@@ -483,7 +536,7 @@ TF1 * AliBWFunc::GetBGBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
 //_____________________________________________________________________
 // Tsallis
 
-Double_t AliBWFunc::IntegrandTsallis(const double * x, const double* p){
+Double_t AliPWGFunc::IntegrandTsallis(const double * x, const double* p){
 
   // integrand for numerical integration (tsallis)
 
@@ -517,7 +570,7 @@ Double_t AliBWFunc::IntegrandTsallis(const double * x, const double* p){
 
 
 
-Double_t AliBWFunc::StaticTsallisdNdPt(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticTsallisdNdPt(const double * x, const double* p) {
 
   // tsallis BW implementation 1/pt dNdpt
 
@@ -548,14 +601,14 @@ Double_t AliBWFunc::StaticTsallisdNdPt(const double * x, const double* p) {
 
 }
 
-Double_t AliBWFunc::StaticTsallisdNdPtTimesPt(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticTsallisdNdPtTimesPt(const double * x, const double* p) {
 
   // tsallis BW , implementatio of dNdpt
   return x[0]*StaticTsallisdNdPt(x,p);
 
 }
 
-TF1 * AliBWFunc::GetTsallisBWdNdpt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
+TF1 * AliPWGFunc::GetTsallisBWdNdpt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
                                   Double_t norm, Double_t ymax,const char * name){
   
 
@@ -574,7 +627,7 @@ TF1 * AliBWFunc::GetTsallisBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
 
 // Times Pt funcs
 // Boltzmann-Gibbs Blast Wave
-TF1 * AliBWFunc::GetBGBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t n,
+TF1 * AliPWGFunc::GetBGBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t n,
                                     Double_t norm, const char * name){
 
   // BGBW, dNdpt
@@ -591,7 +644,7 @@ TF1 * AliBWFunc::GetBGBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp
 
 
 
-TF1 * AliBWFunc::GetTsallisBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
+TF1 * AliPWGFunc::GetTsallisBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
                                          Double_t norm, Double_t ymax, const char * name){
 
 // Tsallis blast wave, dNdpt
@@ -607,7 +660,7 @@ TF1 * AliBWFunc::GetTsallisBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t
 
 
 
-TF1 * AliBWFunc::GetMTExpdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetMTExpdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
 
   // Simple exponential in 1/mt*MT, as a function of dNdpt
   char formula[500];
@@ -622,7 +675,7 @@ TF1 * AliBWFunc::GetMTExpdNdptTimesPt(Double_t mass, Double_t temp, Double_t nor
 
 }
 
-TF1 * AliBWFunc::GetBoseEinsteindNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetBoseEinsteindNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
 
   // Bose einstein distribution as a function of dNdpt
   char formula[500];
@@ -637,7 +690,7 @@ TF1 * AliBWFunc::GetBoseEinsteindNdptTimesPt(Double_t mass, Double_t temp, Doubl
 
 }
 
-TF1 * AliBWFunc::GetFermiDiracdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetFermiDiracdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
 
   // Bose einstein distribution as a function of dNdpt
   char formula[500];
@@ -654,7 +707,7 @@ TF1 * AliBWFunc::GetFermiDiracdNdptTimesPt(Double_t mass, Double_t temp, Double_
 
 
 
-TF1 * AliBWFunc::GetPTExpdNdptTimesPt(Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetPTExpdNdptTimesPt(Double_t temp, Double_t norm, const char * name){
 
   // Simple exponential in 1/pt*dNdpT, as a function of dNdpt
   char formula[500];
@@ -670,7 +723,7 @@ TF1 * AliBWFunc::GetPTExpdNdptTimesPt(Double_t temp, Double_t norm, const char *
 }
 
 
-TF1 * AliBWFunc::GetBoltzmanndNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetBoltzmanndNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
   // Boltzmann (exp in 1/mt*dNdmT times mt) as a function of dNdpt
  char formula[500];
  snprintf(formula,500,"[0]*x*sqrt(x**2+%f**2)*exp(-sqrt(x**2+%f**2)/[1])", mass,mass);
@@ -686,7 +739,7 @@ TF1 * AliBWFunc::GetBoltzmanndNdptTimesPt(Double_t mass, Double_t temp, Double_t
 
 
 // Tsallis (no BW, a la CMS)
-// TF1 * AliBWFunc::GetTsallisdNdptTimesPt(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name){
+// TF1 * AliPWGFunc::GetTsallisdNdptTimesPt(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name){
 
 //   char formula[500];
 //   //  sprintf(formula,"[0]*x*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2)-%f)),(-1/([2]-1)))", mass, mass); //CMS
@@ -703,7 +756,7 @@ TF1 * AliBWFunc::GetBoltzmanndNdptTimesPt(Double_t mass, Double_t temp, Double_t
 // }
 
 
-TF1 * AliBWFunc::GetLevidNdptTimesPt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetLevidNdptTimesPt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
 
   // Levi function, dNdpt
   char formula[500];
@@ -721,7 +774,7 @@ TF1 * AliBWFunc::GetLevidNdptTimesPt(Double_t mass, Double_t temp, Double_t n, D
 
 }
 
-TF1 * AliBWFunc::GetPowerLawdNdptTimesPt(Double_t pt0, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetPowerLawdNdptTimesPt(Double_t pt0, Double_t n, Double_t norm, const char * name){
 
   // PowerLaw function, dNdpt
   char formula[500];
@@ -738,7 +791,7 @@ TF1 * AliBWFunc::GetPowerLawdNdptTimesPt(Double_t pt0, Double_t n, Double_t norm
 
 }
 
-TF1 * AliBWFunc::GetPowerLawdNdpt(Double_t pt0, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetPowerLawdNdpt(Double_t pt0, Double_t n, Double_t norm, const char * name){
 
   // PowerLaw function, 1/pt dNdpt
   char formula[500];
@@ -755,7 +808,7 @@ TF1 * AliBWFunc::GetPowerLawdNdpt(Double_t pt0, Double_t n, Double_t norm, const
 }
 
 
-TF1 * AliBWFunc::GetLevidNdpt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetLevidNdpt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
 
   // Levi function, dNdpt
   char formula[500];
@@ -772,7 +825,7 @@ TF1 * AliBWFunc::GetLevidNdpt(Double_t mass, Double_t temp, Double_t n, Double_t
 
 }
 
-TF1 * AliBWFunc::GetLevidNdmt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name, VarType_t var){
+TF1 * AliPWGFunc::GetLevidNdmt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name, VarType_t var){
 
   // Levi function, 1/mt dNdmt
   char formula[500];
@@ -800,7 +853,7 @@ TF1 * AliBWFunc::GetLevidNdmt(Double_t mass, Double_t temp, Double_t n, Double_t
 
 
 // Test Function
-Double_t AliBWFunc::IntegrandTest(const double * x, const double* p){
+Double_t AliPWGFunc::IntegrandTest(const double * x, const double* p){
 
   // test function
 
@@ -816,7 +869,7 @@ Double_t AliBWFunc::IntegrandTest(const double * x, const double* p){
 
 }
 
-Double_t AliBWFunc::StaticTest(const double * x, const double* p) {
+Double_t AliPWGFunc::StaticTest(const double * x, const double* p) {
 
   // test function
 
@@ -841,7 +894,7 @@ Double_t AliBWFunc::StaticTest(const double * x, const double* p) {
 
 }
 
-TF1 * AliBWFunc::GetTestFunc(Double_t mass, Double_t temp, Double_t norm, Double_t ymax, const char * name){
+TF1 * AliPWGFunc::GetTestFunc(Double_t mass, Double_t temp, Double_t norm, Double_t ymax, const char * name){
   
   // test function
   
@@ -857,7 +910,7 @@ TF1 * AliBWFunc::GetTestFunc(Double_t mass, Double_t temp, Double_t norm, Double
 //___________________________________________________________
 
 
-TF1 * AliBWFunc::GetMTExpdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetMTExpdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
   // Simple exp in 1/mt dNdmt, as a function of dNdpt
   // mt scaling
   char formula[500];
@@ -870,7 +923,7 @@ TF1 * AliBWFunc::GetMTExpdNdpt(Double_t mass, Double_t temp, Double_t norm, cons
   return fLastFunc;
 }
 
-TF1 * AliBWFunc::GetBoseEinsteindNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetBoseEinsteindNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
   // bose einstein
   char formula[500];
   snprintf(formula,500,"[0]*1./(exp(sqrt(x**2+%f**2)/[1])-1)", mass);
@@ -882,7 +935,7 @@ TF1 * AliBWFunc::GetBoseEinsteindNdpt(Double_t mass, Double_t temp, Double_t nor
   return fLastFunc;
 }
 
-TF1 * AliBWFunc::GetFermiDiracdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
+TF1 * AliPWGFunc::GetFermiDiracdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
   // bose einstein
   char formula[500];
   snprintf(formula,500,"[0]*1./(exp(sqrt(x**2+%f**2)/[1])+1)", mass);
@@ -896,7 +949,7 @@ TF1 * AliBWFunc::GetFermiDiracdNdpt(Double_t mass, Double_t temp, Double_t norm,
 
 
 // // Simple tsallis (a la CMS)
-// TF1 * AliBWFunc::GetTsallisdNdpt(Double_t mass, Double_t temp, Double_t q, Double_t norm, const char * name){
+// TF1 * AliPWGFunc::GetTsallisdNdpt(Double_t mass, Double_t temp, Double_t q, Double_t norm, const char * name){
   
 //   char formula[500];
 //   sprintf(formula,"[0]*sqrt(x**2+%f**2)*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2))),(-1/([2]-1)))", mass,mass); 
similarity index 92%
rename from PWG2/SPECTRA/Fit/AliBWFunc.h
rename to PWG/Tools/AliPWGFunc.h
index d774687..0fc4d78 100644 (file)
@@ -1,15 +1,9 @@
 //----------------------------------------------------------------------
-//                              AliBWFunc
+//                              AliPWGFunc
 //
 // This class implements several function useful to fit pt spectra,
 // including but not limited to blast wave models.
 //
-// It can return the same functional for as a function of different
-// variables: dNdpt vs pt, 1/pt dNdpt vs pt, 1/mt dNdmt vs mt. 
-//
-// Before getting the function you need, you have to chose the
-// variable you want to use calling AliBWFunc::SetVarType with one of
-// the elements of the VarType_t enum.
 //
 // Author: M. Floris, CERN
 //----------------------------------------------------------------------
@@ -28,15 +22,15 @@ class TGraph;
 
 
 
-class AliBWFunc : public TObject {
+class AliPWGFunc : public TObject {
 
 
 public:
   // define the variables used for the function
   typedef enum {kdNdpt,kOneOverPtdNdpt,kOneOverMtdNdmt,kdNdmt,kOneOverMtdNdmtMinusM} VarType_t;
 
-  AliBWFunc();
-  ~AliBWFunc();
+  AliPWGFunc();
+  ~AliPWGFunc();
 
   // Boltzmann-Gibbs Blast Wave
   TF1 * GetBGBW(Double_t mass, Double_t beta, Double_t T, Double_t n,
@@ -187,7 +181,8 @@ protected:
 
   // UA1 parametrization
   static Double_t StaticUA1Func(const double * x, const double* p);
-  
+  static Double_t StaticUA1FuncOneOverPt(const double * x, const double* p) ;
+
 
 private:
 
@@ -196,11 +191,11 @@ private:
   Width_t fLineWidth;  // Line width
   VarType_t fVarType;  // Variable types (e.g. dNdpt vs pt, 1/mt dNdmt vs mt...) 
   
-  AliBWFunc(const AliBWFunc&);            // not implemented
-  AliBWFunc& operator=(const AliBWFunc&); // not implemented
+  AliPWGFunc(const AliPWGFunc&);            // not implemented
+  AliPWGFunc& operator=(const AliPWGFunc&); // not implemented
 
 
-  ClassDef(AliBWFunc, 1)
+  ClassDef(AliPWGFunc, 1)
 
 
 };
similarity index 85%
rename from PWG2/SPECTRA/Fit/AliBWTools.cxx
rename to PWG/Tools/AliPWGHistoTools.cxx
index 5633e44..e9c9689 100644 (file)
@@ -1,5 +1,5 @@
 // ----------------------------------------------------------------------
-//                     AliBWTools
+//                     AliPWGHistoTools
 // 
 // This class provides some tools which can be useful in the analsis
 // of spectra, to fit or transform histograms. See the comments of the
@@ -8,7 +8,7 @@
 // Author: M. Floris (CERN)
 // ----------------------------------------------------------------------
 
-#include "AliBWTools.h"
+#include "AliPWGHistoTools.h"
 #include "TH1D.h"
 #include "TF1.h"
 #include "TH1.h"
 using namespace std;
 
 
-ClassImp(AliBWTools)
+ClassImp(AliPWGHistoTools)
 
-TF1 * AliBWTools::fdNdptForETCalc = 0;
+TF1 * AliPWGHistoTools::fdNdptForETCalc = 0;
 
-AliBWTools::AliBWTools() {
+AliPWGHistoTools::AliPWGHistoTools() {
   // ctor
 }
 
-AliBWTools::~AliBWTools(){
+AliPWGHistoTools::~AliPWGHistoTools(){
   // dtor
 }
 
-TH1 * AliBWTools::GetdNdmtFromdNdpt(const TH1 * hpt, Double_t mass) {
+TH1 * AliPWGHistoTools::GetdNdmtFromdNdpt(const TH1 * hpt, Double_t mass) {
   // convert the x axis from pt to mt. Assumes you have 1/pt dNdpt in the histo you start with
 
   Int_t nbins = hpt->GetNbinsX();
@@ -67,7 +67,7 @@ TH1 * AliBWTools::GetdNdmtFromdNdpt(const TH1 * hpt, Double_t mass) {
 
 }
 
-TH1 * AliBWTools::GetdNdptFromdNdmt(const TH1 * hmt, Double_t mass) {
+TH1 * AliPWGHistoTools::GetdNdptFromdNdmt(const TH1 * hmt, Double_t mass) {
   // convert the x axis from mt to pt. Assumes you have 1/mt dNdmt in the histo you start with
 
   Int_t nbins = hmt->GetNbinsX();
@@ -102,7 +102,7 @@ TH1 * AliBWTools::GetdNdptFromdNdmt(const TH1 * hmt, Double_t mass) {
 }
 
 
-TH1 * AliBWTools::GetdNdPtFromOneOverPt(const TH1 * h1Pt) {
+TH1 * AliPWGHistoTools::GetdNdPtFromOneOverPt(const TH1 * h1Pt) {
 
   // convert an histo from 1/pt dNdpt to dNdpt, using the pt at the center of the bin
 
@@ -142,7 +142,7 @@ TH1 * AliBWTools::GetdNdPtFromOneOverPt(const TH1 * h1Pt) {
 
 
 
-TH1 * AliBWTools::GetOneOverPtdNdPt(const TH1 * hPt) {
+TH1 * AliPWGHistoTools::GetOneOverPtdNdPt(const TH1 * hPt) {
 
   // convert an histo from dNdpt to 1/pt dNdpt, using the pt at the center of the bin
 
@@ -179,7 +179,7 @@ TH1 * AliBWTools::GetOneOverPtdNdPt(const TH1 * hPt) {
 }
 
 
-TGraphErrors * AliBWTools::GetGraphFromHisto(const TH1F * h, Bool_t binWidth) {
+TGraphErrors * AliPWGHistoTools::GetGraphFromHisto(const TH1F * h, Bool_t binWidth) {
   // Convert a histo to a graph
   // if binWidth is true ex is set to the bin width of the histos, otherwise it is set to zero
   Int_t nbin = h->GetNbinsX();
@@ -208,7 +208,7 @@ TGraphErrors * AliBWTools::GetGraphFromHisto(const TH1F * h, Bool_t binWidth) {
 
 }
 
-TH1F * AliBWTools::GetHistoFromGraph(const TGraphErrors * g, const TH1F* hTemplate) {
+TH1F * AliPWGHistoTools::GetHistoFromGraph(const TGraphErrors * g, const TH1F* hTemplate) {
 
   // convert a graph to histo with the binning of hTemplate.
   // Warning: the template should be chosen
@@ -222,7 +222,9 @@ TH1F * AliBWTools::GetHistoFromGraph(const TGraphErrors * g, const TH1F* hTempla
   for(Int_t ipoint = 0; ipoint < npoint; ipoint++){
     Float_t x  = g->GetX() [ipoint];
     Float_t y  = g->GetY() [ipoint];
-    Float_t ey = g->GetEY()[ipoint];
+    Float_t ey = 0;
+    if(g->InheritsFrom("TGraphErrors"))
+       ey = g->GetEY()[ipoint];
     Int_t bin = h->FindBin(x);
     //    cout << "bin: "<< bin << " -> " << x << ", "<< y <<", " << ey << endl;
     
@@ -238,7 +240,7 @@ TH1F * AliBWTools::GetHistoFromGraph(const TGraphErrors * g, const TH1F* hTempla
   return h;
 }
 
-TGraphErrors * AliBWTools::ConcatenateGraphs(const TGraphErrors * g1,const TGraphErrors * g2){
+TGraphErrors * AliPWGHistoTools::ConcatenateGraphs(const TGraphErrors * g1,const TGraphErrors * g2){
 
   // concatenates two graphs
 
@@ -265,7 +267,7 @@ TGraphErrors * AliBWTools::ConcatenateGraphs(const TGraphErrors * g1,const TGrap
 }
 
 
-TH1F * AliBWTools::Combine3HistosWithErrors(const TH1 * h1,  const TH1 * h2,  const TH1* h3, 
+TH1F * AliPWGHistoTools::Combine3HistosWithErrors(const TH1 * h1,  const TH1 * h2,  const TH1* h3, 
                                            TH1 * he1,  TH1 * he2,  TH1 * he3, 
                                            const TH1* htemplate, Int_t statFrom, 
                                            Float_t renorm1, Float_t renorm2, Float_t renorm3,
@@ -298,10 +300,10 @@ TH1F * AliBWTools::Combine3HistosWithErrors(const TH1 * h1,  const TH1 * h2,  co
   else if (statFrom == 1) hStatError = h2; 
   else if (statFrom == 2) hStatError = h3; 
   else {
-    Printf("AliBWTools::Combine3HistosWithErrors: wrong value of the statFrom parameter");
+    Printf("AliPWGHistoTools::Combine3HistosWithErrors: wrong value of the statFrom parameter");
     return NULL;
   }
-  Printf("AliBWTools::Combine3HistosWithErrors: improve error on combined");
+  Printf("AliPWGHistoTools::Combine3HistosWithErrors: improve error on combined");
   // Loop over all bins and take weighted mean of all points
   Int_t nBinComb = hcomb->GetNbinsX();
   for(Int_t ibin = 1; ibin <= nBinComb; ibin++){
@@ -313,7 +315,7 @@ TH1F * AliBWTools::Combine3HistosWithErrors(const TH1 * h1,  const TH1 * h2,  co
     if (statFrom == 0)      ibinError = ibin1; 
     else if (statFrom == 1) ibinError = ibin2; 
     else if (statFrom == 2) ibinError = ibin3; 
-    else Printf("AliBWTools::Combine3HistosWithErrors: wrong value of the statFrom parameter");
+    else Printf("AliPWGHistoTools::Combine3HistosWithErrors: wrong value of the statFrom parameter");
 
 
     Double_t y[3];
@@ -381,13 +383,13 @@ TH1F * AliBWTools::Combine3HistosWithErrors(const TH1 * h1,  const TH1 * h2,  co
 }
 
 
-void AliBWTools::GetMeanDataAndExtrapolation(const TH1 * hData, TF1 * fExtrapolation, Double_t &mean, Double_t &error, Float_t min, Float_t max){
+void AliPWGHistoTools::GetMeanDataAndExtrapolation(const TH1 * hData, TF1 * fExtrapolation, Double_t &mean, Double_t &error, Float_t min, Float_t max){
   // Computes the mean of the combined data and extrapolation in a
   // given range, use data where they are available and the function
   // where data are not available
   // ERROR from DATA ONLY is returned in this version! 
   //
-  Printf("AliBWTools::GetMeanDataAndExtrapolation: WARNING from data only");
+  Printf("AliPWGHistoTools::GetMeanDataAndExtrapolation: WARNING from data only");
   Float_t minData    = GetLowestNotEmptyBinEdge (hData);
   Int_t minDataBin   = GetLowestNotEmptyBin     (hData);
   Float_t maxData    = GetHighestNotEmptyBinEdge(hData);
@@ -426,7 +428,7 @@ void AliBWTools::GetMeanDataAndExtrapolation(const TH1 * hData, TF1 * fExtrapola
 
 }
 
-TH1F * AliBWTools::CombineHistos(const TH1 * h1, TH1 * h2, const TH1* htemplate, Float_t renorm1){
+TH1F * AliPWGHistoTools::CombineHistos(const TH1 * h1, TH1 * h2, const TH1* htemplate, Float_t renorm1){
   // Combine two histos. This assumes the histos have the same binning
   // in the overlapping region. It computes the arithmetic mean in the
   // overlapping region and assigns as an error the relative error
@@ -476,7 +478,7 @@ TH1F * AliBWTools::CombineHistos(const TH1 * h1, TH1 * h2, const TH1* htemplate,
 }
 
 
-void AliBWTools::GetFromHistoGraphDifferentX(const TH1F * h, TF1 * f, TGraphErrors ** gBarycentre, TGraphErrors ** gXlw) {
+void AliPWGHistoTools::GetFromHistoGraphDifferentX(const TH1F * h, TF1 * f, TGraphErrors ** gBarycentre, TGraphErrors ** gXlw) {
 
   // Computes the baycentre in each bin and the xlw as defined in NIMA
   // 355 - 541 using f. Returs 2 graphs with the same y content of h
@@ -533,7 +535,7 @@ void AliBWTools::GetFromHistoGraphDifferentX(const TH1F * h, TF1 * f, TGraphErro
 }
 
 
-Float_t AliBWTools::GetMean(TH1F * h, Float_t min, Float_t max, Float_t * error) {
+Float_t AliPWGHistoTools::GetMean(TH1F * h, Float_t min, Float_t max, Float_t * error) {
 
   // Get the mean of histo in a range; root is not reliable in sub
   // ranges with variable binning.  
@@ -556,7 +558,7 @@ Float_t AliBWTools::GetMean(TH1F * h, Float_t min, Float_t max, Float_t * error)
 
 }
 
-void AliBWTools::GetMean(TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
+void AliPWGHistoTools::GetMean(TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
 
   // Get the mean of function in a range; If normPar is >= 0, it means
   // that the function is defined such that par[normPar] is its
@@ -568,7 +570,7 @@ void AliBWTools::GetMean(TF1 * func, Float_t &mean, Float_t &error, Float_t min,
 
 }
 
-void AliBWTools::GetMeanSquare(TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
+void AliPWGHistoTools::GetMeanSquare(TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
 
   // Get the mean2 of function in a range;  If normPar is >= 0, it means
   // that the function is defined such that par[normPar] is its
@@ -581,7 +583,7 @@ void AliBWTools::GetMeanSquare(TF1 * func, Float_t &mean, Float_t &error, Float_
 
 }
 
-void AliBWTools::GetMoment(TString name, TString var, TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
+void AliPWGHistoTools::GetMoment(TString name, TString var, TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar) {
 
   // returns the integral of a function derived from func by prefixing some operation.
   // the derived function MUST have the same parameter in the same order
@@ -598,8 +600,8 @@ void AliBWTools::GetMoment(TString name, TString var, TF1 * func, Float_t &mean,
   // - this version assumes that func is defined using a
   //   TFormula. Generalize to the case of a C++ function
 
-  if (normPar<0) Printf("AliBWTools::GetMoment: Warning: If normalization is required, the error may bot be correct");
-  if (!strcmp(func->GetExpFormula(),"")) Printf("AliBWTools::GetMoment: Warning: Empty formula in the base function");
+  if (normPar<0) Printf("AliPWGHistoTools::GetMoment: Warning: If normalization is required, the error may bot be correct");
+  if (!strcmp(func->GetExpFormula(),"")) Printf("AliPWGHistoTools::GetMoment: Warning: Empty formula in the base function");
   Int_t npar = func->GetNpar();
 
   // Definition changes according to the value of normPar
@@ -651,7 +653,7 @@ void AliBWTools::GetMoment(TString name, TString var, TF1 * func, Float_t &mean,
 
 
 
-Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) { 
+Bool_t AliPWGHistoTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) { 
   
   // Fits h1 with func, preforms several checks on the quality of the
   // fit and tries to improve it. If the fit is not good enough, it
@@ -690,7 +692,7 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
  
 
   if( gMinuit->fLimset ) {
-    Printf("ERROR: AliBWTools: Parameters at limits");
+    Printf("ERROR: AliPWGHistoTools: Parameters at limits");
     return kFALSE;
   } 
 
@@ -703,7 +705,7 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
       TString(gMinuit->fCstatu) != "SUCCESSFUL"  &&
       TString(gMinuit->fCstatu) != "CONVERGED "  ) {
     if(fitStat < 3 && gMinuit->fCstatu != "UNCHANGED ") {
-      Printf("WARNING: AliBWTools: Cannot properly compute errors");
+      Printf("WARNING: AliPWGHistoTools: Cannot properly compute errors");
       if (fitStat == 0) Printf(" not calculated at all");
       if (fitStat == 1) Printf(" approximation only, not accurate");
       if (fitStat == 2) Printf(" full matrix, but forced positive-definite");
@@ -711,13 +713,13 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
 
     if (edm > 1e6) {
 
-      Printf("WARNING: AliBWTools: Huge EDM  (%f): Fit probably failed!", edm);
+      Printf("WARNING: AliPWGHistoTools: Huge EDM  (%f): Fit probably failed!", edm);
     }
     if (fitResult != 0) {
-      Printf("WARNING: AliBWTools: Fit Result (%d)", fitResult);
+      Printf("WARNING: AliPWGHistoTools: Fit Result (%d)", fitResult);
     }
       
-    Printf ("AliBWTools: Trying Again with Strategy = 2");
+    Printf ("AliPWGHistoTools: Trying Again with Strategy = 2");
 
     gMinuit->Command("SET STRATEGY 2"); // more effort
     fitResult = 0;
@@ -730,7 +732,7 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
     fitStat = fitter->GetStats(amin, edm, errdef, nvpar, nparx);  
 
     if(fitStat < 3 && gMinuit->fCstatu != "UNCHANGED ") {
-      Printf("ERROR: AliBWTools: Cannot properly compute errors");
+      Printf("ERROR: AliPWGHistoTools: Cannot properly compute errors");
       if (fitStat == 0) Printf(" not calculated at all");
       if (fitStat == 1) Printf(" approximation only, not accurate");
       if (fitStat == 2) Printf(" full matrix, but forced positive-definite");
@@ -739,12 +741,12 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
     }
 
     if (edm > 1e6) {
-      Printf("ERROR: AliBWTools: Huge EDM  (%f): Fit probably failed!", edm);
+      Printf("ERROR: AliPWGHistoTools: Huge EDM  (%f): Fit probably failed!", edm);
 
       return kFALSE;
     }
     if (fitResult != 0) {
-      Printf("ERROR: AliBWTools: Fit Result (%d)", fitResult);
+      Printf("ERROR: AliPWGHistoTools: Fit Result (%d)", fitResult);
 
       return kFALSE;
     }
@@ -759,7 +761,7 @@ Bool_t AliBWTools::Fit (TH1 * h1, TF1* func, Float_t min, Float_t max) {
   
 }
 
-Int_t AliBWTools::GetLowestNotEmptyBin(const TH1*h) {
+Int_t AliPWGHistoTools::GetLowestNotEmptyBin(const TH1*h) {
 
   // Return the index of the lowest non empty bin in the histo h
 
@@ -772,7 +774,7 @@ Int_t AliBWTools::GetLowestNotEmptyBin(const TH1*h) {
 
 }
 
-Int_t AliBWTools::GetHighestNotEmptyBin(const TH1*h) {
+Int_t AliPWGHistoTools::GetHighestNotEmptyBin(const TH1*h) {
 
   // Return the index of the highest non empty bin in the histo h
 
@@ -785,7 +787,7 @@ Int_t AliBWTools::GetHighestNotEmptyBin(const TH1*h) {
 
 }
 
-void AliBWTools::GetResiduals(const TGraphErrors * gdata, const TF1 * func, TH1F ** hres, TGraphErrors ** gres) {
+void AliPWGHistoTools::GetResiduals(const TGraphErrors * gdata, const TF1 * func, TH1F ** hres, TGraphErrors ** gres) {
 
   // Returns a graph of residuals vs point and the res/err distribution
 
@@ -819,16 +821,16 @@ void AliBWTools::GetResiduals(const TGraphErrors * gdata, const TF1 * func, TH1F
 
 }
 
-void AliBWTools::GetResiduals(const TH1F* hdata, const TF1 * func, TH1F ** hres, TH1F ** hresVsBin) {
+void AliPWGHistoTools::GetResiduals(const TH1F* hdata, const TF1 * func, TH1F ** hres, TH1F ** hresVsBin) {
 
   // Returns an histo of residuals bin by bin and the res/err distribution
 
   if (!func) {
-    Printf("AliBWTools::GetResiduals: No function provided");
+    Printf("AliPWGHistoTools::GetResiduals: No function provided");
     return;
   }
   if (!hdata) {
-    Printf("AliBWTools::GetResiduals: No data provided");
+    Printf("AliPWGHistoTools::GetResiduals: No data provided");
     return;
   }
 
@@ -860,7 +862,7 @@ void AliBWTools::GetResiduals(const TH1F* hdata, const TF1 * func, TH1F ** hres,
 
 }
 
-void AliBWTools::GetYield(TH1* h,  TF1 * f, Double_t &yield, Double_t &yieldError, Float_t min, Float_t max,
+void AliPWGHistoTools::GetYield(TH1* h,  TF1 * f, Double_t &yield, Double_t &yieldError, Float_t min, Float_t max,
                          Double_t *partialYields, Double_t *partialYieldsErrors){
 
   // Returns the yield extracted from the data in the histo where
@@ -904,7 +906,7 @@ void AliBWTools::GetYield(TH1* h,  TF1 * f, Double_t &yield, Double_t &yieldErro
 
 }
 
-TGraphErrors * AliBWTools::DivideGraphByFunc(const TGraphErrors * g, const TF1 * f, Bool_t invert){ 
+TGraphErrors * AliPWGHistoTools::DivideGraphByFunc(const TGraphErrors * g, const TF1 * f, Bool_t invert){ 
 
   // Divides g/f. If invert == true => f/g
 
@@ -924,7 +926,7 @@ TGraphErrors * AliBWTools::DivideGraphByFunc(const TGraphErrors * g, const TF1 *
 
 }
 
-TGraphErrors * AliBWTools::Divide2Graphs(const TGraphErrors * g1, const TGraphErrors * g2){ 
+TGraphErrors * AliPWGHistoTools::Divide2Graphs(const TGraphErrors * g1, const TGraphErrors * g2){ 
 
   // Divides g1/g2, looks for point with very close centers
   Int_t ipoint=0;
@@ -937,10 +939,13 @@ TGraphErrors * AliBWTools::Divide2Graphs(const TGraphErrors * g1, const TGraphEr
       Double_t x2 = g2->GetX()[ipoint2];
       if((TMath::Abs(x1-x2)/(x1+x2)*2)<0.01) {
        Double_t ratio   = g2->GetY()[ipoint2]  ? g1->GetY()[ipoint1]/g2->GetY()[ipoint2] : 0;
-       Double_t eratio  = g2->GetY()[ipoint2]  ? 
-         TMath::Sqrt(g1->GetEY()[ipoint1]*g1->GetEY()[ipoint1]/g1->GetY()[ipoint1]/g1->GetY()[ipoint1] + 
-                     g2->GetEY()[ipoint2]/g2->GetY()[ipoint2]/g2->GetY()[ipoint2] ) * ratio
-         : 0;
+       Double_t eratio  = 0;
+       if(g1->InheritsFrom("TGraphErrors") && g2->InheritsFrom("TGraphErrors")) {
+         eratio = g2->GetY()[ipoint2]  ? 
+           TMath::Sqrt(g1->GetEY()[ipoint1]*g1->GetEY()[ipoint1]/g1->GetY()[ipoint1]/g1->GetY()[ipoint1] + 
+                       g2->GetEY()[ipoint2]/g2->GetY()[ipoint2]/g2->GetY()[ipoint2] ) * ratio
+           : 0;
+       }
        gRatio->SetPoint     (ipoint, x1, ratio);
        gRatio->SetPointError(ipoint, 0, eratio);
        ipoint++;
@@ -956,8 +961,43 @@ TGraphErrors * AliBWTools::Divide2Graphs(const TGraphErrors * g1, const TGraphEr
   return gRatio;
 
 }
+TGraphErrors * AliPWGHistoTools::Add2Graphs(const TGraphErrors * g1, const TGraphErrors * g2){ 
+
+  // Sums g1/g2, looks for point with very close centers
+  Int_t ipoint=0;
+  TGraphErrors * gSum = new TGraphErrors();
+  Int_t npoint1 = g1->GetN();
+  Int_t npoint2 = g2->GetN();
+  for(Int_t ipoint1 = 0; ipoint1 < npoint1; ipoint1++){
+    Double_t x1 = g1->GetX()[ipoint1];
+    for(Int_t ipoint2 = 0; ipoint2 < npoint2; ipoint2++){
+      Double_t x2 = g2->GetX()[ipoint2];
+      if((TMath::Abs(x1-x2)/(x1+x2)*2)<0.01) {
+       Double_t sum   = g1->GetY()[ipoint1]+g2->GetY()[ipoint2];
+       Double_t esum  = 0;
+       if(g1->InheritsFrom("TGraphErrors") && g2->InheritsFrom("TGraphErrors")) {
+         esum = 
+           TMath::Sqrt(g1->GetEY()[ipoint1]*g1->GetEY()[ipoint1] + 
+                       g2->GetEY()[ipoint2]*g2->GetEY()[ipoint2] ) ;
+           
+       }
+       gSum->SetPoint     (ipoint, x1, sum);
+       gSum->SetPointError(ipoint, 0, esum);
+       ipoint++;
+       cout << ipoint << " [" << x1 << "] " <<  g1->GetY()[ipoint1] << "+" << g2->GetY()[ipoint2] << " = " << sum <<"+-"<<esum<< endl;
+       
+    //    cout << x << " " << g->GetY()[ipoint] << " " << f->Eval(x) << endl;
+      }
+    
+    }
+  }
+  gSum->SetMarkerStyle(20);
+  //gSum->Print();
+  return gSum;
+
+}
 
-TGraphErrors * AliBWTools::DivideGraphByHisto(const TGraphErrors * g, TH1 * h, Bool_t invert){ 
+TGraphErrors * AliPWGHistoTools::DivideGraphByHisto(const TGraphErrors * g, TH1 * h, Bool_t invert){ 
 
   // Divides g/h. If invert == true => h/g
 
@@ -1001,7 +1041,7 @@ TGraphErrors * AliBWTools::DivideGraphByHisto(const TGraphErrors * g, TH1 * h, B
 
 }
 
-TH1F * AliBWTools::DivideHistoByFunc(TH1F * h, TF1 * f, Bool_t invert){ 
+TH1F * AliPWGHistoTools::DivideHistoByFunc(TH1F * h, TF1 * f, Bool_t invert){ 
 
   // Divides h/f. If invert == true => f/g
   // Performs the integral of f on the bin range to perform the ratio
@@ -1033,7 +1073,7 @@ TH1F * AliBWTools::DivideHistoByFunc(TH1F * h, TF1 * f, Bool_t invert){
 
 }
 
-void AliBWTools::WeightedMean(Int_t npoints, const Double_t *x, const Double_t *xerr, Double_t &mean, Double_t &meanerr){
+void AliPWGHistoTools::WeightedMean(Int_t npoints, const Double_t *x, const Double_t *xerr, Double_t &mean, Double_t &meanerr){
 
   // Performs the weighted mean of npoints numbers in x with errors in xerr
 
@@ -1068,7 +1108,7 @@ void AliBWTools::WeightedMean(Int_t npoints, const Double_t *x, const Double_t *
   
 }
 
-TH1 * AliBWTools::GetRelativeError(TH1 * h){
+TH1 * AliPWGHistoTools::GetRelativeError(TH1 * h){
   // Returns an histogram with the same binning as h, filled with the relative error bin by bin
   TH1 * hrel = (TH1*) h->Clone(TString(h->GetName())+"_rel");
   hrel->Reset();
@@ -1082,7 +1122,7 @@ TH1 * AliBWTools::GetRelativeError(TH1 * h){
 }
 
 
-void AliBWTools::GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * herror, Bool_t isPercentError) {
+void AliPWGHistoTools::GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * herror, Bool_t isPercentError) {
   
   // Put into source, bin-by-bin, the values from hvalue and the
   // errors from content from herror. 
@@ -1090,7 +1130,7 @@ void AliBWTools::GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * h
   // Set isPercentError to kTRUE if the error is given in % 
 
   if(hdest == NULL){ 
-    Printf("AliBWTools::GetValueAndError Errror: hdest is null");
+    Printf("AliPWGHistoTools::GetValueAndError Errror: hdest is null");
     return;
   }
 
@@ -1117,7 +1157,7 @@ void AliBWTools::GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * h
       }
     }
     // if (!foundValue){
-    //   Printf("AliBWTools::GetValueAndError: Error: cannot find matching value source bin for destination %d",iBinDest);
+    //   Printf("AliPWGHistoTools::GetValueAndError: Error: cannot find matching value source bin for destination %d",iBinDest);
     // }
 
     // Error
@@ -1135,14 +1175,14 @@ void AliBWTools::GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * h
       }      
     }
     // if (!foundError ){
-    //   Printf("AliBWTools::GetValueAndError: Error: cannot find matching error source bin for destination %d",iBinDest);
+    //   Printf("AliPWGHistoTools::GetValueAndError: Error: cannot find matching error source bin for destination %d",iBinDest);
     // }
   }
   
 
 }
 
-void AliBWTools::AddHisto(TH1 * hdest, const TH1* hsource, Bool_t getMirrorBins) {
+void AliPWGHistoTools::AddHisto(TH1 * hdest, const TH1* hsource, Bool_t getMirrorBins) {
 
   // Adds hsource to hdest bin by bin, even if they have a different
   // binning If getMirrorBins is true, it takes the negative bins
@@ -1194,7 +1234,7 @@ void AliBWTools::AddHisto(TH1 * hdest, const TH1* hsource, Bool_t getMirrorBins)
 
 }
 
-void AliBWTools::GetHistoCombinedErrors(TH1 * hdest, const TH1 * h1) {
+void AliPWGHistoTools::GetHistoCombinedErrors(TH1 * hdest, const TH1 * h1) {
 
   // Combine the errors of hdest with the errors of h1, summing in
   // quadrature. Results are put in hdest. Histograms are assumed to
@@ -1210,7 +1250,7 @@ void AliBWTools::GetHistoCombinedErrors(TH1 * hdest, const TH1 * h1) {
   
 }
 
-TH1F * AliBWTools::DivideHistosDifferentBins(const TH1F* h1, const TH1F* h2) {
+TH1F * AliPWGHistoTools::DivideHistosDifferentBins(const TH1F* h1, const TH1F* h2) {
   // Divides 2 histos even if they have a different binning. Finds
   // overlapping bins and divides them
   
@@ -1248,7 +1288,7 @@ TH1F * AliBWTools::DivideHistosDifferentBins(const TH1F* h1, const TH1F* h2) {
   return hRatio;
 }
 
-Double_t AliBWTools::DoIntegral(TH1* h, Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Int_t binz1, Int_t binz2, Double_t & error ,
+Double_t AliPWGHistoTools::DoIntegral(TH1* h, Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Int_t binz1, Int_t binz2, Double_t & error ,
                                Option_t *option, Bool_t doError) 
 {
    // function to compute integral and optionally the error  between the limits
@@ -1307,7 +1347,7 @@ Double_t AliBWTools::DoIntegral(TH1* h, Int_t binx1, Int_t binx2, Int_t biny1, I
    return integral;
 }
 
-Double_t AliBWTools::dMtdptFunction(Double_t *x, Double_t *p) {
+Double_t AliPWGHistoTools::dMtdptFunction(Double_t *x, Double_t *p) {
 
   // Computes the dmt/dptdeta function using the dN/dpt function
   // This is a protected function used internally by GetdMtdy to integrate dN/dpt function using mt as a weight
@@ -1317,7 +1357,7 @@ Double_t AliBWTools::dMtdptFunction(Double_t *x, Double_t *p) {
   Double_t mt = TMath::Sqrt(pt*pt + mass*mass);
   Double_t jacobian = pt/mt;
   if(!fdNdptForETCalc){
-    Printf("AliBWTools::dMtdptFunction: ERROR: fdNdptForETCalc not defined");
+    Printf("AliPWGHistoTools::dMtdptFunction: ERROR: fdNdptForETCalc not defined");
     return 0;
   }
   Double_t dNdpt = fdNdptForETCalc->Eval(pt);
@@ -1325,7 +1365,7 @@ Double_t AliBWTools::dMtdptFunction(Double_t *x, Double_t *p) {
   
 }
 
-Double_t AliBWTools::GetdMtdEta(TH1 *hData, TF1 * fExtrapolation, Double_t mass) {
+Double_t AliPWGHistoTools::GetdMtdEta(TH1 *hData, TF1 * fExtrapolation, Double_t mass) {
   // Computes dMtdEta integrating dN/dptdy with the proper weights and jacobian.
   Printf("WARNING ALIBWTOOLS::GetdMtdEta: ONLY USING FUNCTION FOR THE TIME BEING, hData");
   if(!hData) {
similarity index 91%
rename from PWG2/SPECTRA/Fit/AliBWTools.h
rename to PWG/Tools/AliPWGHistoTools.h
index ee5be8a..1a5a9ad 100644 (file)
@@ -1,5 +1,5 @@
 // ----------------------------------------------------------------------
-//                     AliBWTools
+//                     AliPWGHistoTools
 // 
 // This class provides some tools which can be useful in the analsis
 // of spectra, to fit or transform histograms. See the comments of the
@@ -24,12 +24,12 @@ class TGraphErrors;
 
 
 
-class AliBWTools : public TObject {
+class AliPWGHistoTools : public TObject {
 
 public:
 
-  AliBWTools();
-  ~AliBWTools();
+  AliPWGHistoTools();
+  ~AliPWGHistoTools();
 
   static TH1 * GetOneOverPtdNdPt(const TH1 * hPt) ;
   static TH1 * GetdNdmtFromdNdpt(const TH1 * hpt, Double_t mass);
@@ -80,6 +80,7 @@ public:
   static Double_t DoIntegral(TH1* h, Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Int_t binz1, Int_t binz2, Double_t & error ,
                      Option_t *option, Bool_t doError) ;
   static TGraphErrors * Divide2Graphs(const TGraphErrors * g1, const TGraphErrors * g2);
+  static TGraphErrors * Add2Graphs(const TGraphErrors * g1, const TGraphErrors * g2);
 
   static Double_t dMtdptFunction(Double_t *x, Double_t *p) ;
   static Double_t GetdMtdEta(TH1 *hData, TF1 * fExtrapolation, Double_t mass) ;
@@ -88,13 +89,13 @@ public:
 
 private:
 
-  AliBWTools(const AliBWTools&);            // not implemented
-  AliBWTools& operator=(const AliBWTools&); // not implemented
+  AliPWGHistoTools(const AliPWGHistoTools&);            // not implemented
+  AliPWGHistoTools& operator=(const AliPWGHistoTools&); // not implemented
   static void GetMoment(TString name, TString var, TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max, Int_t normPar = -1) ;
 
   static TF1 * fdNdptForETCalc;
 
-  ClassDef(AliBWTools,1);
+  ClassDef(AliPWGHistoTools,1);
 
 };
 
diff --git a/PWG2/SPECTRA/Fit/ALICEWorkInProgress.C b/PWG2/SPECTRA/Fit/ALICEWorkInProgress.C
deleted file mode 100644 (file)
index fa8b880..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-void ALICEWorkInProgress(TCanvas *c,TString today="11/05/2010", TString label = "ALICE performance"){
-
-  TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",0.72,0.75,0.82,0.89);
-  myPadLogo->SetFillColor(0); 
-  myPadLogo->SetBorderMode(0);
-  myPadLogo->SetBorderSize(2);
-  myPadLogo->SetFrameBorderMode(0);
-  myPadLogo->SetLeftMargin(0.0);
-  myPadLogo->SetTopMargin(0.0);
-  myPadLogo->SetBottomMargin(0.0);
-  myPadLogo->SetRightMargin(0.0);
-  myPadLogo->SetFillStyle(0);
-  myPadLogo->Draw();
-  myPadLogo->cd();
-  TASImage *myAliceLogo = new TASImage("~/WORK/ALICE/ANALYSIS/macros/alice_logo.png");
-  myAliceLogo->Draw();
-  c->cd();
-  TPaveText* t1=new TPaveText(0.65,0.7,0.89,0.75,"NDC");
-  t1->SetFillStyle(0);
-  t1->SetBorderSize(0);
-  t1->AddText(0.,0.,label);
-  t1->SetTextColor(kRed);
-  t1->SetTextFont(42);
-  t1->Draw();
-  TPaveText* t2=new TPaveText(0.65,0.65,0.89,0.7,"NDC");
-  t2->SetFillStyle(0);
-  t2->SetBorderSize(0);
-  t2->SetTextColor(kRed);
-  t2->SetTextFont(52);
-  t2->AddText(0.,0.,today.Data());
-  t2->Draw();
-}
diff --git a/PWG2/SPECTRA/Fit/GetE735Ratios.C b/PWG2/SPECTRA/Fit/GetE735Ratios.C
deleted file mode 100644 (file)
index e363f5f..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-TH1F* GetE735Ratios(Int_t ratio, Int_t energy) {
-
-  Int_t nbins = 10;
-
-  const Float_t binsKpi [] = {0.25,0.30, 0.35, 0.40,0.50,0.60,0.70,0.95,1.15,1.35,1.55};
-  const Float_t binsPpi [] = {0.30, 0.35, 0.40,0.50,0.60,0.70,0.95,1.15,1.35,1.55,1.75};
-  enum {kEn300,kEn540,kEn1000,kEn1800,kNenergy};
-
-  
-  TH1F * hKpi[kNenergy] ;
-  TH1F * hPpi[kNenergy] ;
-  
-  const Int_t markers[] = {24,25,27,28};
-
-  for(Int_t iener = 0; iener < kNenergy; iener++){
-    hKpi[iener] = new TH1F(TString("hKpi")+long(iener),TString("hKpi")+long(iener),nbins,binsKpi);
-    hPpi[iener] = new TH1F(TString("hPpi")+long(iener),TString("hPpi")+long(iener),nbins,binsPpi);
-    hKpi[iener]->SetMarkerStyle(markers[iener]);
-    hPpi[iener]->SetMarkerStyle(markers[iener]);    
-  }
-  
-
-
-  // 300
-  hKpi[kEn300]  ->SetBinContent(0 , 8.1  /100);
-  hKpi[kEn300]  ->SetBinContent(1 , 7.5  /100);
-  hKpi[kEn300]  ->SetBinContent(2 , 9.5  /100);
-  hKpi[kEn300]  ->SetBinContent(3 , 16.1 /100);
-  hKpi[kEn300]  ->SetBinContent(4 , 16.4 /100);
-  hKpi[kEn300]  ->SetBinContent(5 , 17.9 /100);
-  hKpi[kEn300]  ->SetBinContent(6 , 19.4 /100);
-  hKpi[kEn300]  ->SetBinContent(7 , 23.8 /100);
-  hKpi[kEn300]  ->SetBinContent(8 , 25.7 /100);
-  hKpi[kEn300]  ->SetBinContent(9 , 0    /100);
-  hKpi[kEn300]  ->SetBinError  (0 , 1.7/100);
-  hKpi[kEn300]  ->SetBinError  (1 , 1.4/100);
-  hKpi[kEn300]  ->SetBinError  (2 , 1.6/100);
-  hKpi[kEn300]  ->SetBinError  (3 , 1.5/100);
-  hKpi[kEn300]  ->SetBinError  (4 , 2.5/100);
-  hKpi[kEn300]  ->SetBinError  (5 , 3.5/100);
-  hKpi[kEn300]  ->SetBinError  (6 , 2.4/100);
-  hKpi[kEn300]  ->SetBinError  (7 , 4.9/100);
-  hKpi[kEn300]  ->SetBinError  (8 , 7.5/100);
-  hKpi[kEn300]  ->SetBinError  (9 , 0  /100);
-
-  hKpi[kEn540]  ->SetBinContent(0 , 3.3 /100);
-  hKpi[kEn540]  ->SetBinContent(1 , 12.7/100);
-  hKpi[kEn540]  ->SetBinContent(2 , 10.6/100);
-  hKpi[kEn540]  ->SetBinContent(3 , 13.1/100);
-  hKpi[kEn540]  ->SetBinContent(4 , 16.9/100);
-  hKpi[kEn540]  ->SetBinContent(5 , 17.3/100);
-  hKpi[kEn540]  ->SetBinContent(6 , 20.2/100);
-  hKpi[kEn540]  ->SetBinContent(7 , 21.2/100);
-  hKpi[kEn540]  ->SetBinContent(8 , 25.0/100);
-  hKpi[kEn540]  ->SetBinContent(9 , 31.2/100);
-  hKpi[kEn540]  ->SetBinError  (0 , 0.9/100);
-  hKpi[kEn540]  ->SetBinError  (1 , 1.1/100);
-  hKpi[kEn540]  ->SetBinError  (2 , 0.9/100);
-  hKpi[kEn540]  ->SetBinError  (3 , 0.7/100);
-  hKpi[kEn540]  ->SetBinError  (4 , 1.6/100);
-  hKpi[kEn540]  ->SetBinError  (5 , 1.7/100);
-  hKpi[kEn540]  ->SetBinError  (6 , 1.4/100);
-  hKpi[kEn540]  ->SetBinError  (7 , 2.1/100);
-  hKpi[kEn540]  ->SetBinError  (8 , 3.2/100);
-  hKpi[kEn540]  ->SetBinError  (9 , 4.9/100);
-
-  hKpi[kEn1000] ->SetBinContent(0 , 9.2 /100);
-  hKpi[kEn1000] ->SetBinContent(1 , 10.4/100);
-  hKpi[kEn1000] ->SetBinContent(2 , 9.3 /100);
-  hKpi[kEn1000] ->SetBinContent(3 , 11.8/100);
-  hKpi[kEn1000] ->SetBinContent(4 , 15.3/100);
-  hKpi[kEn1000] ->SetBinContent(5 , 19.8/100);
-  hKpi[kEn1000] ->SetBinContent(6 , 19.8/100);
-  hKpi[kEn1000] ->SetBinContent(7 , 25.9/100);
-  hKpi[kEn1000] ->SetBinContent(8 , 27.8/100);
-  hKpi[kEn1000] ->SetBinContent(9 , 32.8/100);
-  hKpi[kEn1000] ->SetBinError  (0 , 0.7/100);
-  hKpi[kEn1000] ->SetBinError  (1 , 0.7/100);
-  hKpi[kEn1000] ->SetBinError  (2 , 0.7/100);
-  hKpi[kEn1000] ->SetBinError  (3 , 0.7/100);
-  hKpi[kEn1000] ->SetBinError  (4 , 1.2/100);
-  hKpi[kEn1000] ->SetBinError  (5 , 1.5/100);
-  hKpi[kEn1000] ->SetBinError  (6 , 1.2/100);
-  hKpi[kEn1000] ->SetBinError  (7 , 1.9/100);
-  hKpi[kEn1000] ->SetBinError  (8 , 2.6/100);
-  hKpi[kEn1000] ->SetBinError  (9 , 3.9/100);
-
-  hKpi[kEn1800] ->SetBinContent(0 , 7.8 /100);
-  hKpi[kEn1800] ->SetBinContent(1 , 9.1 /100);
-  hKpi[kEn1800] ->SetBinContent(2 , 9.7 /100);
-  hKpi[kEn1800] ->SetBinContent(3 , 13.9/100);
-  hKpi[kEn1800] ->SetBinContent(4 , 16.2/100);
-  hKpi[kEn1800] ->SetBinContent(5 , 18.1/100);
-  hKpi[kEn1800] ->SetBinContent(6 , 21.6/100);
-  hKpi[kEn1800] ->SetBinContent(7 , 24.6/100);
-  hKpi[kEn1800] ->SetBinContent(8 , 25.8/100);
-  hKpi[kEn1800] ->SetBinContent(9 , 25.2/100);
-  hKpi[kEn1800] ->SetBinError  (0 , 0.3/100);
-  hKpi[kEn1800] ->SetBinError  (1 , 0.3/100);
-  hKpi[kEn1800] ->SetBinError  (2 , 0.3/100);
-  hKpi[kEn1800] ->SetBinError  (3 , 0.3/100);
-  hKpi[kEn1800] ->SetBinError  (4 , 0.6/100);
-  hKpi[kEn1800] ->SetBinError  (5 , 0.7/100);
-  hKpi[kEn1800] ->SetBinError  (6 , 0.7/100);
-  hKpi[kEn1800] ->SetBinError  (7 , 0.8/100);
-  hKpi[kEn1800] ->SetBinError  (8 , 0.9/100);
-  hKpi[kEn1800] ->SetBinError  (9 , 1.0/100);
-
-  if (ratio == 0) return hKpi[energy];
-  else            return hPpi[energy];
-
-}
diff --git a/PWG2/SPECTRA/Fit/PlotCombine7TeV.C b/PWG2/SPECTRA/Fit/PlotCombine7TeV.C
deleted file mode 100644 (file)
index 86ccd95..0000000
+++ /dev/null
@@ -1,659 +0,0 @@
-class AliOADBContainer;
-class AliOADBPWG2Spectra;
-Int_t colors[]={ kBlack,kRed,kBlue+2,kGreen+2, kSpring, kTeal, kAzure};
-Int_t markers[]={21,22,23,24,25,26,27,28};
-Float_t min[]={0.1,0.2,0.3,-1.0,-1.0,-1.0,0.5,0.5,0.8,-1.0,-1.0,-1.0};
-Float_t max[]={0.5,0.5,0.5,-1.0,-1.0,-1.0,2.0,2.0,2.5,1.5,1.5,1.7};
-Float_t min2[]={0.1,0.2,0.3,-1.0,-1.0,-1.0,0.5,0.5,0.8,-1.0,-1.0,-1.0};
-Float_t max2[]={0.5,0.5,0.5,-1.0,-1.0,-1.0,2.0,2.0,2.5,0.1,0.1,0.1};
-TString mcmodels[]={"Phojet","Pythia109","Pythia320"};
-const char * fgkDetectorNames[] = {"ITS", "ITSTPC", "TPC", "TOF", "TOFTPC", "Dummy", "Dummy"};
-const char * fgkPidTypeNames[]  = {"GaussFit", "NSigma", "Bayes", "Kinks"};
-const char * partext[]={"#pi^{+}","K^{+}","p","#pi^{-}","K^{-}","#bar{p}"};
-void ALICEWorkInProgress(TCanvas *c,TString today="11/05/2010", TString label = "ALICE performance");
-TH1D* DrawHisto(AliOADBContainer* fOADBContainer, TCanvas* c1,Int_t ana,Int_t method,Int_t par,Int_t charge,Int_t color, Int_t marker,TLegend* leg, TString estimator ,Int_t bin);
-Double_t myLevyPt(Double_t *pt, Double_t *par);
-TH1D* CombineSpectra(TList* l,Int_t startpoint, Float_t min* , Float_t* max);
-void DrawandFit(TH1D* hist,TCanvas* c1,Int_t par,TCanvas* c1ratio,Float_t* yileds,Float_t* yiledserr);
-void GetMCratios(TString filename, TList* ktopi,TList* ptopi);
-void plotRatios(TCanvas* c1, TH1D* data , TList* mc,TLegend* leg ,Int_t opt=0);
-TH1D* Plotratiodatafit(TH1D* hist1, TF1* fun);
-TCanvas* Ktopi(Float_t value,Float_t err);
-void DrawMulRatios(TH1D** bin1,TH1D** bin2,TCanvas* c,TLegend* leg);
-
-
-void PlotCombine7TeV()
-{
-       gSystem->Load("libCore.so");  
-       gSystem->Load("libGeom.so");
-       gSystem->Load("libPhysics.so");
-       gSystem->Load("libVMC");
-       gSystem->Load("libTree");
-       gSystem->Load("libProof");
-       gSystem->Load("libMatrix");
-       gSystem->Load("libSTEERBase");
-       gSystem->Load("libESD");
-       gSystem->Load("libAOD");
-       gSystem->Load("libANALYSIS");
-       gSystem->Load("libOADB");
-       gSystem->Load("libANALYSISalice");
-       gSystem->Load("libTENDER");
-       gSystem->Load("libCORRFW");
-       gSystem->Load("libPWG0base");
-       gSystem->Load("libMinuit");
-       gSystem->Load("libPWG2spectra");
-       
-       gROOT->SetStyle("Plain");
-       gStyle->SetPalette(1,0);
-       gStyle->SetOptFit(0);
-       gStyle->SetOptStat(0);
-       Int_t det[]={AliOADBPWG2Spectra::kITSsa,AliOADBPWG2Spectra::kITSTPC,AliOADBPWG2Spectra::kTOF,AliOADBPWG2Spectra::kTOFTPC} ;
-       Int_t method[]={AliOADBPWG2Spectra::kGaussFit,AliOADBPWG2Spectra::kGaussFit,AliOADBPWG2Spectra::kGaussFit,AliOADBPWG2Spectra::kNSigma };
-       
-       
-        TString fileName = AliOADBPWG2Spectra::GetOADBPWG2SpectraFileName();
-       TFile * f = new TFile (fileName);
-       AliOADBContainer* fOADBContainer = (AliOADBContainer*) f->Get("Corrected");
-       f->Close();
-       if(!fOADBContainer)
-               return;
-       AliOADBPWG2Spectra* fOADBSpectra = (AliOADBPWG2Spectra*) fOADBContainer->GetObject(116562); 
-       if(!fOADBSpectra)
-               return;
-       fOADBSpectra->Print();  
-       TCanvas* c1= new TCanvas("pos","pos",1200,800);
-       c1->cd()->SetLogy();
-       TLegend* Leg1 = new TLegend(0.1,0.1,0.45,0.45,"","NDC");
-       Leg1->SetNColumns(3);
-       Leg1->SetTextSize(0.027);
-       Leg1->SetFillStyle(kFALSE);
-       Leg1->SetLineColor(kWhite);
-       Leg1->SetBorderSize(0);
-       
-       
-       TCanvas* c2= new TCanvas("neg","neg",1200,800);
-       c2->cd()->SetLogy();
-       TLegend* Leg2 = new TLegend(0.1,0.1,0.45,0.45,"","NDC");
-       Leg2->SetNColumns(3);
-       Leg2->SetTextSize(0.027);
-       Leg2->SetFillStyle(kFALSE);
-       Leg2->SetLineColor(kWhite);
-       Leg2->SetBorderSize(0);
-       
-       
-       TDatime date;
-       TList* posparthist=new TList();
-       TList* negparthist=new TList();
-       
-       TList* posparthistbin1=new TList();
-       TList* negparthistbin1=new TList();
-       
-       TList* posparthistbin4=new TList();
-       TList* negparthistbin4=new TList();
-       
-       for(int i=0;i<4;i++)// ITS , ITSTPC, TOF TPCTOF 
-       {
-               for(int j=0;j<3;j++) //pion kaon proton
-               {       
-                       posparthist->Add(DrawHisto(fOADBSpectra,c1,det[i],method[i],j,0,colors[j],markers[i],Leg1));
-                       negparthist->Add(DrawHisto(fOADBSpectra,c2,det[i],method[i],j,1,colors[j],markers[i],Leg2));
-                       posparthistbin1->Add(DrawHisto(fOADBSpectra,0x0,det[i],method[i],j,0,colors[j],markers[i],0x0,"SPD2",1));
-                       negparthistbin1->Add(DrawHisto(fOADBSpectra,0x0,det[i],method[i],j,1,colors[j],markers[i],0x0,"SPD2",1));
-                       posparthistbin4->Add(DrawHisto(fOADBSpectra,0x0,det[i],method[i],j,0,colors[j],markers[i],0x0,"SPD2",4));
-                       negparthistbin4->Add(DrawHisto(fOADBSpectra,0x0,det[i],method[i],j,1,colors[j],markers[i],0x0,"SPD2",4));
-               }       
-       }       
-       //negparthistbin4->ls();
-       ALICEWorkInProgress(c1,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       Leg1->Draw();
-       ALICEWorkInProgress(c2,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       Leg2->Draw();
-       
-       c1->SaveAs("Pos.eps");
-       c2->SaveAs("Neg.eps");
-       
-       
-       TH1D* combinepos[3];
-       TH1D* combineneg[3];
-       TH1D* combineposbin1[3];
-       TH1D* combinenegbin1[3];
-       TH1D* combineposbin4[3];
-       TH1D* combinenegbin4[3];
-       TCanvas* c1fit= new TCanvas("posfit","posfit",1200,800);
-       c1fit->cd()->SetLogy();
-       TCanvas* c2fit= new TCanvas("negfit","negfit",1200,800);
-       c2fit->cd()->SetLogy();
-       TCanvas* c1fitratio= new TCanvas("posfitratio","posfitrato",1200,800);
-       TCanvas* c2fitratio= new TCanvas("negfitratio","negfitratio",1200,800);
-       Float_t yileds[3]={0.0,0.0,0.0};
-       Float_t yiledserr[3]={0.0,0.0,0.0};
-       for(int j=0;j<3;j++) //pion kaon proton
-       {
-                       combinepos[j]=CombineSpectra(posparthist,j, min,max);
-                       combineposbin1[j]=CombineSpectra(posparthistbin1,j,min2,max2);
-                       combineposbin4[j]=CombineSpectra(posparthistbin4,j,min2,max2);
-                       DrawandFit(combinepos[j],c1fit,j,c1fitratio,yileds,yiledserr);
-                       combinepos[j]->Sumw2();
-                       combineposbin1[j]->Sumw2();
-                       combineposbin4[j]->Sumw2();
-                       combineposbin1[j]->Divide(combinepos[j]);
-                       combineposbin4[j]->Divide(combinepos[j]);
-                       combineneg[j]=CombineSpectra(negparthist,j, min,max);
-                       combinenegbin1[j]=CombineSpectra(negparthistbin1,j,min2,max2);
-                       combinenegbin4[j]=CombineSpectra(negparthistbin4,j,min2,max2);
-                       DrawandFit(combineneg[j],c2fit,j,c2fitratio,yileds,yiledserr);
-                       combineneg[j]->Sumw2();
-                       combinenegbin1[j]->Sumw2();
-                       combinenegbin4[j]->Sumw2();
-                       combinenegbin1[j]->Divide(combinepos[j]);
-                       combinenegbin4[j]->Divide(combinepos[j]);
-                       combinepos[j]->Add(combineneg[j]);
-                               
-       }
-       ALICEWorkInProgress(c1fit,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       ALICEWorkInProgress(c2fit,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       c1fit->SaveAs("posfit.eps");
-       c2fit->SaveAs("negfit.eps");
-       c1fitratio->SaveAs("posfitratio.eps");
-       c2fitratio->SaveAs("negfitratio.eps");
-       combinepos[1]->Divide(combinepos[0]);
-       combinepos[2]->Divide(combinepos[0]);
-       
-       TString mcfiles[3]={"/home/marek/Analysis/Spectra/7TeVLHC10b/MCmodels/AnalyseFastPhojet7000AccCut.root","/home/marek/Analysis/Spectra/7TeVLHC10b/MCmodels/AnalyseFastPythia7000AccCutTune109.root","/home/marek/Analysis/Spectra/7TeVLHC10b/MCmodels/AnalyseFastPythia7000AccCutTune320.root"};
-       TList* ktopi=new TList();
-       TList* ptopi=new TList();
-       //ktopi->ls();
-       for(int i=0;i<3;i++)
-               GetMCratios(mcfiles[i],ktopi,ptopi);
-       //ktopi->ls();  
-       TCanvas* c1MC= new TCanvas("K/pi","K/pi",1200,800);
-       c1MC->cd();
-       
-       TLegend* Leg3 = new TLegend(0.1,0.35,0.45,0.75,"","NDC");
-       Leg3->SetTextSize(0.027);
-       Leg3->SetFillStyle(kFALSE);
-       Leg3->SetLineColor(kWhite);
-       Leg3->SetBorderSize(0);
-       plotRatios(c1MC,combinepos[1],ktopi,Leg3,1);
-       Leg3->Draw();
-       TCanvas* c2MC= new TCanvas("p/pi","p/pi",1200,800);
-       TLegend* Leg4 = new TLegend(0.1,0.25,0.45,0.65,"","NDC");
-       Leg4->SetTextSize(0.027);
-       Leg4->SetFillStyle(kFALSE);
-       Leg4->SetLineColor(kWhite);
-       Leg4->SetBorderSize(0);
-       plotRatios(c2MC,combinepos[2],ptopi,Leg4,0);
-       Leg4->Draw();
-       ALICEWorkInProgress(c1MC,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       ALICEWorkInProgress(c2MC,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-
-       c1MC->SaveAs("spectraKtopiMC.eps");
-       c2MC->SaveAs("spectraptopiMC.eps");
-       
-       TCanvas* cK2pi=0x0;
-       if(yileds[0]>0.0)
-       {
-               cK2pi=Ktopi(yileds[1]/yileds[0],yileds[1]/yileds[0]*TMath::Sqrt((yiledserr[0]/yileds[0])*(yiledserr[0]/yileds[0])+(yiledserr[1]/yileds[1])*(yiledserr[1]/yileds[1])));
-               ALICEWorkInProgress(cK2pi,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       }
-       cK2pi->SaveAs("K2pi.eps");
-       TCanvas* c1mul= new TCanvas("posmul","posmul",1200,800);
-       
-       c1mul->cd();
-       TLegend* Leg5 = new TLegend(0.2,0.2,0.45,0.45,"","NDC");
-       Leg5->SetNColumns(2);
-       Leg5->SetTextSize(0.027);
-       Leg5->SetFillStyle(kFALSE);
-       Leg5->SetLineColor(kWhite);
-       Leg5->SetBorderSize(0);
-       DrawMulRatios(combineposbin1,combineposbin4,c1mul,Leg5,0);
-       Leg5->Draw();
-       TCanvas* c2mul= new TCanvas("negmul","negmul",1200,800);
-       TLegend* Leg6 = new TLegend(0.2,0.2,0.45,0.45,"","NDC");
-       Leg6->SetNColumns(2);
-       Leg6->SetTextSize(0.027);
-       Leg6->SetFillStyle(kFALSE);
-       Leg6->SetLineColor(kWhite);
-       Leg6->SetBorderSize(0);
-       DrawMulRatios(combinenegbin1,combinenegbin4,c2mul,Leg6,1);
-       Leg6->Draw();
-       c2mul->cd();
-       ALICEWorkInProgress(c1mul,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       ALICEWorkInProgress(c2mul,Form("%d/%d/%d",date.GetDay(),date.GetMonth(),date.GetYear()),"ALICE preliminary");
-       c1mul->SaveAs("MulPos.eps");
-       c2mul->SaveAs("MulNeg.eps");
-}
-void ALICEWorkInProgress(TCanvas *c,TString today, TString label)
-{
-               c->cd();
-         TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",0.72,0.72,0.89,0.89);
-         //TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",0.72,0.62,0.85,0.75);
-         myPadLogo->SetFillColor(0); 
-         myPadLogo->SetBorderMode(0);
-         myPadLogo->SetBorderSize(2);
-         myPadLogo->SetFrameBorderMode(0);
-         myPadLogo->SetLeftMargin(0.0);
-         myPadLogo->SetTopMargin(0.0);
-         myPadLogo->SetBottomMargin(0.0);
-         myPadLogo->SetRightMargin(0.0);
-         myPadLogo->SetFillStyle(0);
-         myPadLogo->Draw();
-         myPadLogo->cd();
-         TASImage *myAliceLogo = new TASImage("alice_logo_trans.png");
-         myAliceLogo->Draw();
-         c->cd();  
-         TPaveText* t1=new TPaveText(0.418103, 0.837798, 0.656609, 0.888393,"NDC");
-         t1->SetFillStyle(0);
-         t1->SetBorderSize(0);
-         t1->AddText(0.,0.,label);
-         t1->SetTextColor(kRed);
-         t1->SetTextFont(42);
-         t1->SetTextSize(0.04);
-         t1->Draw();
-         TPaveText* t2=new TPaveText(0.418103, 0.80, 0.656609, 0.84,"NDC");
-         t2->SetFillStyle(0);
-         t2->SetBorderSize(0);
-         t2->AddText(0.,0.,"pp at #sqrt{s} = 7 TeV");
-         t2->SetTextColor(kRed);
-         t2->SetTextFont(42);
-         t2->SetTextSize(0.027);
-         t2->Draw();
-         TPaveText* t3=new TPaveText(0.418103, 0.76, 0.656609, 0.80,"NDC");
-         t3->SetFillStyle(0);
-         t3->SetBorderSize(0);
-        // t3->AddText(0.,0.,"Statistical and systematic errors");
-         t3->AddText(0.,0.,"Statistical  errors");
-         t3->SetTextColor(kRed);
-         t3->SetTextFont(42);
-         t3->SetTextSize(0.027);
-         t3->Draw(); 
-          TPaveText* t2=new TPaveText(0.65,0.65,0.89,0.7,"NDC");
-          t2->SetFillStyle(0);
-          t2->SetBorderSize(0);
-          t2->SetTextColor(kRed);
-          t2->SetTextFont(52);
-          t2->AddText(0.,0.,today.Data());
-          t2->Draw();
-}
-
-TH1D* DrawHisto(AliOADBPWG2Spectra* fOADBSpectra, TCanvas* c1, Int_t ana,Int_t method,Int_t par,Int_t charge,Int_t color, Int_t marker,TLegend* leg,TString estimator="MB" ,Int_t bin=-1)
-{
-   TH1D * h = 0;
-    TString binname=estimator;
-   if(estimator.CompareTo("MB")==0)
-   {
-               cout<<fOADBSpectra->GetHistoName(ana,method,par,charge,"MB")<<endl;
-               h = fOADBSpectra->GetHisto(ana,method,par,charge,"MB");
-   // Draw the selected histogram
-       }
-       else
-       {
-               cout<<fOADBSpectra->GetHistoName(ana,method,par,charge,estimator.Data(),bin)<<endl;
-               h = fOADBSpectra->GetHisto(ana,method,par,charge,estimator.Data(),bin);
-               binname+=bin;   
-       }
-   if(!h) 
-   {
-     cout << "Cannot get pointer to histo" << endl;
-     return 0x0;
-   }
-   h->GetYaxis()->SetRangeUser(0.001,10.0);
-    h->GetXaxis()->SetRangeUser(0.0,3.0);
-   
-    if(charge==0)
-               h->SetTitle(Form("Positive_%s",binname.Data()));
-    else
-               h->SetTitle(Form("Negative_%s",binname.Data()));
-    h->SetXTitle("p_{T} (GeV/c)");
-     h->SetYTitle("1/N_{events} dN/dp_{T} |y|<0.5");
-   h->SetMarkerColor(color);
-   h->SetMarkerStyle(marker);
-   
-   
-   
-   
- if(c1&&leg)
- {
-       TString opt = "E1";
-       c1->cd();
-    c1->GetListOfPrimitives()->Print();
-    if (c1->GetListOfPrimitives()->GetEntries()>0) 
-               opt += "same";
-       c1->Update();
-       c1->Modified();
-       c1->Update();
-   
-       leg->AddEntry(h,Form("%s_{%s_%s}",partext[charge*3+par],fgkDetectorNames[ana],fgkPidTypeNames[method]),"p");
-    h->Draw(opt.Data());
-   // TCanvas::Update() draws the frame, after which it can be changed
-}
-   return h;
-}
-Double_t myLevyPt(Double_t *pt, Double_t *par)
-{
-  
-  Double_t pdNdy  = par[0];
-  Double_t pTemp = par[1];
-  Double_t pPower = par[2];
-  Double_t pMass  = par[3];
-  Double_t pBigCoef = ((pPower-1)*(pPower-2)) / (pPower*pTemp*(pPower*pTemp+pMass*(pPower-2)));
-  Double_t pInPower = 1.0 + (TMath::Sqrt(pt[0]*pt[0]+pMass*pMass)-pMass) / (pPower*pTemp);
-  return pdNdy * pt[0] * pBigCoef * TMath::Power(pInPower,(-1.0)*pPower);
-}
-TH1D* CombineSpectra(TList* l,Int_t startpoint, Float_t* min, Float_t* max)
-{
-       //l->ls();
-//     ((TH1D*)l->At(0))->Print("all");
-       TH1D* hcombine=new TH1D(*((TH1D*)l->At(0)));
-       hcombine->SetName(Form("%s_combine",((TH1D*)l->At(startpoint))->GetName()));
-       //cout<<hcombine->GetName()<<endl;
-       for (int i=1; i<=hcombine->GetNbinsX();i++)
-       {
-               Float_t pt=hcombine->GetXaxis()->GetBinCenter(i);
-               Int_t use[4]={1,1,1,1};
-               Float_t values[4]={0.0,0.0,0.0,0.0};
-               Float_t errors[4]={-1.0,-1.0,-1.0,-1.0};
-       //      cout<<pt<<endl;
-               for(int j=0;j<4;j++)
-               {
-                       if(min[3*j+startpoint]>0.0&&min[3*j+startpoint]>pt)
-                               use[j]=0;
-                       if(max[3*j+startpoint]>0.0&&max[3*j+startpoint]<pt)
-                               use[j]=0;
-                       if(use[j])
-                       {
-                               values[j]=((TH1D*)l->At(3*j+startpoint))->GetBinContent(i);
-                               if(values[j]>0.0)
-                                       errors[j]=((TH1D*)l->At(3*j+startpoint))->GetBinError(i);
-                               else
-                               {
-                                       values[j]=0.0;
-                                       use[j]=0;       
-                               }               
-                       }       
-               }       
-               if(use[0]+use[1]+use[2]+use[3]==0)
-               {
-                               hcombine->SetBinContent(i,0.0);
-                               hcombine->SetBinError(i,0.0);
-               }       
-               else
-               {
-                       hcombine->SetBinContent(i,(values[0]+values[1]+values[2]+values[3])/(use[0]+use[1]+use[2]+use[3]));
-                       hcombine->SetBinError(i,TMath::MaxElement(4,errors));   
-               }
-               //cout<<use[0]+use[1]+use[2]+use[3]<<endl;
-       }       
-       return hcombine;
-} 
-void DrawandFit(TH1D* hist,TCanvas* c1, Int_t par , TCanvas* cratio,Float_t* yileds,Float_t* yiledserr)
-{
-       c1->cd();
-       TF1 *f1 = new TF1(Form("%s_fit",hist->GetName()),myLevyPt,0.1,3.0,4);
-       f1->SetParNames("dN/dy","T","n","mass");
-       f1->FixParameter(3,AliPID::ParticleMass(par+2));
-       f1->SetParameter(0,hist->GetMaximum()/2.0);
-                                               
-       f1->SetParameter(1,0.1);
-       f1->SetParLimits(1,0.01,10.0);
-       f1->SetParameter(2,3.0);
-       f1->SetParLimits(2,2.1,1000.0); 
-       
-       hist->SetMarkerColor(colors[par]);
-    hist->SetMarkerStyle(markers[par]);
-    
-    
-    hist->Fit(Form("%s_fit",hist->GetName()),"I0");
-    
-    TString opt = "E1";
-  
-     c1->GetListOfPrimitives()->Print();
-     if (c1->GetListOfPrimitives()->GetEntries()>0) 
-               opt += "same";  
-               cout<<opt<<endl;
-       hist->DrawCopy(opt.Data());
-       f1->DrawCopy("Lsame");  
-       cratio->cd();
-       Plotratiodatafit(hist,f1)->Draw(opt.Data());
-       yileds[par]+=f1->GetParameter(0);
-       yiledserr[par]=TMath::Sqrt(yiledserr[par]*yiledserr[par]+f1->GetParError(0)*f1->GetParError(0));
-}      
-void GetMCratios(TString filename, TList* ktopi,TList* ptopi)
-{
-               TFile* f=TFile::Open(filename.Data());
-               if(!f)
-                                       return;
-               TH1F* fpiplus=(TH1F*)f->Get("h1PrimariesPiPlusPtVar");          
-               TH1F* fpiminus=(TH1F*)f->Get("h1PrimariesPiMinusPtVar");        
-               TH1F* fKplus=(TH1F*)f->Get("h1PrimariesKPlusPtVar");            
-               TH1F* fKminus=(TH1F*)f->Get("h1PrimariesKMinusPtVar");  
-               TH1F* fpplus=(TH1F*)f->Get("h1PrimariesProtonPtVar");           
-               TH1F* fpminus=(TH1F*)f->Get("h1PrimariesAntiProtonPtVar");
-               
-               fpiplus->Sumw2();
-               fpiminus->Sumw2();
-               fKplus->Sumw2();
-               fKminus->Sumw2();
-               fpplus->Sumw2();
-               fpminus->Sumw2();
-               
-               fpiplus->Add(fpiminus);
-               fKplus->Add(fKminus);
-               fpplus->Add(fpminus);   
-
-               fKplus->Divide(fpiplus);
-               fpplus->Divide(fpiplus);
-               
-               ktopi->Add(fKplus);
-               ptopi->Add(fpplus);
-}
-void plotRatios(TCanvas* c1, TH1D* data , TList* mc,TLegend* leg, Int_t opt)
-{
-       c1->cd();
-       data->SetMarkerStyle(markers[0]);
-       data->SetMarkerColor(colors[0]);
-       data->Draw("E1");
-       leg->AddEntry(data,"data","p");
-       if(opt==1)
-               data->SetTitle("K/#pi");
-       else
-               data->SetTitle("p/#pi");                
-       data->GetYaxis()->SetTitle("");
-       data->GetYaxis()->SetRangeUser(0.0,0.5);
-       data->GetXaxis()->SetRangeUser(0.0,2.5);
-       
-       for (int i=0;i<3;i++)
-       {
-                       TH1F* mchist=(TH1F*)mc->At(i);
-                       leg->AddEntry(mchist,mcmodels[i].Data(),"p");
-                       mchist->SetMarkerStyle(markers[i+1]);
-                       mchist->SetMarkerColor(colors[i+1]);
-                       mchist->Draw("E1same");
-       }
-}      
-TH1D* Plotratiodatafit(TH1D* hist1, TF1* fun)
-{
-       TString name(hist1->GetName());
-       TH1D* histratio=new TH1D(*hist1);
-       
-       histratio->SetName(Form("ratio%s",name.Data()));
-       //histratio->SetTitle("ratio");
-       histratio->GetYaxis()->SetTitle("ratio data/fit");
-       for (int i=1;i<histratio->GetNbinsX();i++)
-       {
-               if(histratio->GetBinContent(i)>0.0)
-               {
-                       histratio->SetBinContent(i,histratio->GetBinContent(i)/fun->Eval(histratio->GetXaxis()->GetBinCenter(i)));
-                       histratio->SetBinError(i,histratio->GetBinError(i)/fun->Eval(histratio->GetXaxis()->GetBinCenter(i)));  
-               }
-       }
-       histratio->GetYaxis()->SetRangeUser(0.8,1.2);
-       return histratio;
-}
-TCanvas* Ktopi(Float_t value,Float_t err)
-{
-//=========Macro generated from canvas: c1/c1
-//=========  (Thu Oct 14 14:18:11 2010) by ROOT version5.26/00b
-   TCanvas *c1 = new TCanvas("K2pi", "K2pi",0,44,1105,782);
-   c1->Range(0.4639814,-0.024875,3.950796,0.223875);
-   c1->SetFillColor(0);
-   c1->SetBorderMode(0);
-   c1->SetBorderSize(2);
-   c1->SetLogx();
-   c1->SetTickx(1);
-   c1->SetTicky(1);
-   c1->SetFrameBorderMode(0);
-   c1->SetFrameBorderMode(0);
-   
-   TH2F *__1 = new TH2F("__1","",4002,1.5,9000.5,199,0,0.199);
-   __1->SetDirectory(0);
-   __1->SetStats(0);
-   __1->GetXaxis()->SetTitle("#sqrt{s} (GeV)");
-   __1->GetXaxis()->SetRangeUser(6,9002);
-   __1->GetXaxis()->CenterTitle(true);
-   __1->GetXaxis()->SetTitleSize(0.05);
-   __1->GetXaxis()->SetTitleOffset(0.87);
-   __1->GetYaxis()->SetTitle("K/#pi");
-   __1->GetYaxis()->CenterTitle(true);
-   __1->GetYaxis()->SetTitleSize(0.06);
-   __1->GetYaxis()->SetTitleOffset(0.67);
-   __1->Draw("");
-   
-   TGraphErrors *gre = new TGraphErrors(1);
-   gre->SetName("Graph");
-   gre->SetTitle("Graph");
-   gre->SetFillColor(1);
-   gre->SetMarkerColor(3);
-   gre->SetMarkerStyle(29);
-   gre->SetMarkerSize(3.1);
-   gre->SetPoint(0,199.9004,0.1030843);
-   gre->SetPointError(0,0,0.008);
-   
-   TH1F *Graph1 = new TH1F("Graph1","Graph",100,199.9,201.1);
-   Graph1->SetMinimum(0.0934);
-   Graph1->SetMaximum(0.1126);
-   Graph1->SetDirectory(0);
-   Graph1->SetStats(0);
-   gre->SetHistogram(Graph1);
-   
-   gre->Draw("p");
-   
-   gre = new TGraphErrors(1);
-   gre->SetName("Graph");
-   gre->SetTitle("Graph");
-   gre->SetFillColor(1);
-   gre->SetMarkerColor(2);
-   gre->SetMarkerStyle(20);
-   gre->SetMarkerSize(2.5);
-   //gre->SetPoint(0,897.8542,0.1235148);
-   //gre->SetPointError(0,0,0.008624);
-   //gre->SetPoint(0,897.8542,0.122);  // new vale from MF: K/pi ratio = 0.122 +- 0.01  Oct. 14, 2010
-   //    gre->SetPointError(0,0,0.01);
-
-   gre->SetPoint(0,897.8542,0.12294);  // new vale from MF: K/pi ratio = 0.12294 +- 0.012  Feb.. 21, 2011
-   gre->SetPointError(0,0,0.012);
-   
-   gre->SetPoint(1,7000,value);  // new vale from MF: K/pi ratio = 0.12294 +- 0.012  Feb.. 21, 2011
-   gre->SetPointError(1,0,err);
-
-   
-   TH1F *Graph2 = new TH1F("Graph2","Graph",100,899.9,901.1);
-   Graph2->SetMinimum(0.1128512);
-   Graph2->SetMaximum(0.1335488);
-   Graph2->SetDirectory(0);
-   Graph2->SetStats(0);
-   gre->SetHistogram(Graph2);
-   
-   gre->Draw("p");
-   
-   gre = new TGraphErrors(1);
-   gre->SetName("Graph");
-   gre->SetTitle("Graph");
-   gre->SetFillColor(1);
-   gre->SetMarkerColor(4);
-   gre->SetMarkerStyle(22);
-   gre->SetMarkerSize(2.2);
-   gre->SetPoint(0,17.24717,0.08050324);
-   gre->SetPointError(0,0,0.0034);
-   
-   TH1F *Graph3 = new TH1F("Graph3","Graph",100,17.2,18.4);
-   Graph3->SetMinimum(0.07634);
-   Graph3->SetMaximum(0.0845);
-   Graph3->SetDirectory(0);
-   Graph3->SetStats(0);
-   gre->SetHistogram(Graph3);
-   
-   gre->Draw("p");
-   
-   gre = new TGraphErrors(4);
-   gre->SetName("Graph");
-   gre->SetTitle("Graph");
-   gre->SetFillColor(1);
-   gre->SetMarkerStyle(28);
-   gre->SetMarkerSize(2.5);
-   gre->SetPoint(0,300,0.105);
-   gre->SetPointError(0,0,0.02);
-   gre->SetPoint(1,534.998,0.112045);
-   gre->SetPointError(1,0,0.01);
-   gre->SetPoint(2,994.3588,0.1041596);
-   gre->SetPointError(2,0,0.008);
-   gre->SetPoint(3,1795.007,0.1131203);
-   gre->SetPointError(3,0,0.005);
-   
-   TH1F *Graph4 = new TH1F("Graph4","Graph",100,150,1950);
-   Graph4->SetMinimum(0.081);
-   Graph4->SetMaximum(0.129);
-   Graph4->SetDirectory(0);
-   Graph4->SetStats(0);
-   gre->SetHistogram(Graph4);
-   
-   gre->Draw("p");
-   
-   gre = new TGraphErrors(1);
-   gre->SetName("Graph");
-   gre->SetTitle("Graph");
-   gre->SetFillColor(1);
-   gre->SetMarkerStyle(24);
-   gre->SetMarkerSize(2.6);
-   gre->SetPoint(0,546.8309,0.09519885);
-   gre->SetPointError(0,0,0.0114);
-   
-   TH1F *Graph5 = new TH1F("Graph5","Graph",100,544.9,546.1);
-   Graph5->SetMinimum(0.08132);
-   Graph5->SetMaximum(0.10868);
-   Graph5->SetDirectory(0);
-   Graph5->SetStats(0);
-   gre->SetHistogram(Graph5);
-   
-   gre->Draw("p");
-   c1->Modified();
-   c1->cd();
-   c1->SetSelected(c1);
-  // c1->ToggleToolBar();
-  return c1;
-}
-void DrawMulRatios(TH1D** bin1,TH1D** bin2,TCanvas* c,TLegend* leg,Int_t charge=0)
-{
-       c->cd();
-       for(int i=0;i<3;i++)
-       {
-               bin1[i]->GetYaxis()->SetTitle("ratio over MB spectra");
-               bin1[i]->GetYaxis()->SetRangeUser(0.0,4.0);
-               bin1[i]->SetMarkerStyle(markers[i]);
-               bin1[i]->SetMarkerColor(colors[i]);
-               leg->AddEntry(bin1[i],Form("%s_{bin1}",partext[i+charge*3],"p"));
-               if(i==0)
-                       bin1[i]->Draw("E1");
-               else
-                       bin1[i]->Draw("E1same");
-               bin2[i]->GetYaxis()->SetTitle("ratio over MB spectra");
-               bin2[i]->GetYaxis()->SetRangeUser(0.0,4.0);
-               bin2[i]->SetMarkerStyle(markers[i+3]);
-               bin2[i]->SetMarkerColor(colors[i]);     
-               bin2[i]->Draw("E1same") ;       
-               leg->AddEntry(bin2[i],Form("%s_{bin4}",partext[i+charge*3],"p"));
-       }
-}      
diff --git a/PWG2/SPECTRA/Fit/StarPPSpectra.C b/PWG2/SPECTRA/Fit/StarPPSpectra.C
deleted file mode 100644 (file)
index 4b663e0..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-TGraphErrors ** StarPPSpectra() {
-
-  TGraphErrors ** gStar = new TGraphErrors*[7];
-  const Int_t kNMaxPoints = 19;
-  Double_t pt[kNMaxPoints];
-  Double_t errpt[kNMaxPoints] = {0};
-  Double_t pim [kNMaxPoints];
-  Double_t pime[kNMaxPoints];
-  Double_t pip [kNMaxPoints];
-  Double_t pipe[kNMaxPoints];
-  Double_t km [kNMaxPoints];
-  Double_t kme[kNMaxPoints];
-  Double_t kp [kNMaxPoints];
-  Double_t kpe[kNMaxPoints];
-  Double_t pm [kNMaxPoints];
-  Double_t pme[kNMaxPoints];
-  Double_t pp [kNMaxPoints];
-  Double_t ppe[kNMaxPoints];
-
-  Int_t ipoint = 0;
-  pt[ipoint++] = 0.225;
-  pt[ipoint++] = 0.275;
-  pt[ipoint++] = 0.325;
-  pt[ipoint++] = 0.375;
-  pt[ipoint++] = 0.425;
-  pt[ipoint++] = 0.475;
-  pt[ipoint++] = 0.525;
-  pt[ipoint++] = 0.575;
-  pt[ipoint++] = 0.625;
-  pt[ipoint++] = 0.675;
-  pt[ipoint++] = 0.725;
-  pt[ipoint++] = 0.775;
-  pt[ipoint++] = 0.825;
-  pt[ipoint++] = 0.875;
-  pt[ipoint++] = 0.925;
-  pt[ipoint++] = 0.975;
-  pt[ipoint++] = 1.025;
-  pt[ipoint++] = 1.075;
-  pt[ipoint++] = 1.125;
-
-
-  // pi-
-  ipoint = 0;
-  pim[ipoint++]  = 2.02;
-  pim[ipoint++]  = 1.52;
-  pim[ipoint++]  = 1.13;
-  pim[ipoint++]  = 8.44*1e-1;
-  pim[ipoint++]  = 6.35*1e-1;
-  pim[ipoint++]  = 4.69*1e-1;
-  pim[ipoint++]  = 3.54*1e-1;
-  pim[ipoint++]  = 2.67*1e-1;
-  pim[ipoint++]  = 2.02*1e-1;
-  pim[ipoint++]  = 1.53*1e-1;
-  pim[ipoint++]  = 1.16*1e-1;
-  pim[ipoint++]  = 8.65*1e-2;
-
-  ipoint = 0;
-  pime[ipoint++] = 0.06;
-  pime[ipoint++] = 0.03;
-  pime[ipoint++] = 0.02;
-  pime[ipoint++] = 0.09*1e-1;
-  pime[ipoint++] = 0.07*1e-1;
-  pime[ipoint++] = 0.05*1e-1;
-  pime[ipoint++] = 0.04*1e-1;
-  pime[ipoint++] = 0.03*1e-1;
-  pime[ipoint++] = 0.04*1e-1;
-  pime[ipoint++] = 0.03*1e-1;
-  pime[ipoint++] = 0.03*1e-1;
-  pime[ipoint++] = 0.30*1e-2;
-
-  gStar[0] = new TGraphErrors(ipoint,pt,pim,errpt,pime);
-
-  // pi+
-  ipoint = 0;
-  pip[ipoint++]  = 2.07;
-  pip[ipoint++]  = 1.54;
-  pip[ipoint++]  = 1.14;
-  pip[ipoint++]  = 8.57*1e-1;
-  pip[ipoint++]  = 6.38*1e-1;
-  pip[ipoint++]  = 4.76*1e-1;
-  pip[ipoint++]  = 3.59*1e-1;
-  pip[ipoint++]  = 2.73*1e-1;
-  pip[ipoint++]  = 2.07*1e-1;
-  pip[ipoint++]  = 1.55*1e-1;
-  pip[ipoint++]  = 1.16*1e-1;
-  pip[ipoint++]  = 8.95*1e-2;
-
-  ipoint = 0;
-  pipe[ipoint++] = 0.06;
-  pipe[ipoint++] = 0.03;
-  pipe[ipoint++] = 0.02;
-  pipe[ipoint++] = 0.09*1e-1;
-  pipe[ipoint++] = 0.07*1e-1;
-  pipe[ipoint++] = 0.05*1e-1;
-  pipe[ipoint++] = 0.04*1e-1;
-  pipe[ipoint++] = 0.03*1e-1;
-  pipe[ipoint++] = 0.04*1e-1;
-  pipe[ipoint++] = 0.03*1e-1;
-  pipe[ipoint++] = 0.03*1e-1;
-  pipe[ipoint++] = 0.31*1e-2;
-
-  gStar[1] = new TGraphErrors(ipoint,pt,pip,errpt,pipe);
-
-  // k-
-  ipoint = 0;
-  km[ipoint++]  = 1.43*1e-1;
-  km[ipoint++]  = 1.26*1e-1;
-  km[ipoint++]  = 1.08*1e-1;
-  km[ipoint++]  = 8.77*1e-2;
-  km[ipoint++]  = 7.34*1e-2;
-  km[ipoint++]  = 6.17*1e-2;
-  km[ipoint++]  = 4.87*1e-2;
-  km[ipoint++]  = 4.11*1e-2;
-  km[ipoint++]  = 3.70*1e-2;
-  km[ipoint++]  = 2.86*1e-2;
-  km[ipoint++]  = 2.42*1e-2;
-
-  ipoint = 0;
-  kme[ipoint++] = 0.11*1e-1;
-  kme[ipoint++] = 0.05*1e-1;
-  kme[ipoint++] = 0.02*1e-1;
-  kme[ipoint++] = 0.24*1e-2;
-  kme[ipoint++] = 0.26*1e-2;
-  kme[ipoint++] = 0.63*1e-2;
-  kme[ipoint++] = 0.50*1e-2;
-  kme[ipoint++] = 0.42*1e-2;
-  kme[ipoint++] = 0.28*1e-2;
-  kme[ipoint++] = 0.22*1e-2;
-  kme[ipoint++] = 0.27*1e-2;
-
-  gStar[2] = new TGraphErrors(ipoint,pt,km,errpt,kme);
-
-
-  // k+
-  ipoint = 0;
-  kp[ipoint++]  = 1.52*1e-1;
-  kp[ipoint++]  = 1.30*1e-1;
-  kp[ipoint++]  = 1.08*1e-1;
-  kp[ipoint++]  = 9.16*1e-2;
-  kp[ipoint++]  = 7.47*1e-2;
-  kp[ipoint++]  = 6.26*1e-2;
-  kp[ipoint++]  = 5.26*1e-2;
-  kp[ipoint++]  = 4.41*1e-2;
-  kp[ipoint++]  = 3.81*1e-2;
-  kp[ipoint++]  = 3.06*1e-2;
-  kp[ipoint++]  = 2.49*1e-2;
-
-  ipoint = 0;
-  kpe[ipoint++] = 0.11*1e-1;
-  kpe[ipoint++] = 0.05*1e-1;
-  kpe[ipoint++] = 0.02*1e-1;
-  kpe[ipoint++] = 0.25*1e-2;
-  kpe[ipoint++] = 0.27*1e-2;
-  kpe[ipoint++] = 0.64*1e-2;
-  kpe[ipoint++] = 0.54*1e-2;
-  kpe[ipoint++] = 0.45*1e-2;
-  kpe[ipoint++] = 0.28*1e-2;
-  kpe[ipoint++] = 0.24*1e-2;
-  kpe[ipoint++] = 0.28*1e-2;
-
-  gStar[3] = new TGraphErrors(ipoint,pt,kp,errpt,kpe);
-
-
-  // pbar
-  ipoint = 0;
-  pm[ipoint++]  = 0;
-  pm[ipoint++]  = 0;
-  pm[ipoint++]  = 0;
-  pm[ipoint++]  = 5.54*1e-2;
-  pm[ipoint++]  = 4.81*1e-2;
-  pm[ipoint++]  = 4.25*1e-2;
-  pm[ipoint++]  = 3.77*1e-2;
-  pm[ipoint++]  = 3.38*1e-2;
-  pm[ipoint++]  = 2.78*1e-2;
-  pm[ipoint++]  = 2.49*1e-2;
-  pm[ipoint++]  = 2.03*1e-2;
-  pm[ipoint++]  = 1.75*1e-2;
-  pm[ipoint++]  = 1.52*1e-2;
-  pm[ipoint++]  = 1.27*1e-2;
-  pm[ipoint++]  = 1.05*1e-2;
-  pm[ipoint++]  = 8.95*1e-3;
-  pm[ipoint++]  = 7.36*1e-3;
-  pm[ipoint++]  = 6.59*1e-3;
-  pm[ipoint++]  = 5.21*1e-3;
-
-  ipoint = 0;
-  pme[ipoint++] = 0;
-  pme[ipoint++] = 0;
-  pme[ipoint++] = 0;
-  pme[ipoint++] = 0.13*1e-2;
-  pme[ipoint++] = 0.11*1e-2;
-  pme[ipoint++] = 0.10*1e-2;
-  pme[ipoint++] = 0.09*1e-2;
-  pme[ipoint++] = 0.08*1e-2;
-  pme[ipoint++] = 0.07*1e-2;
-  pme[ipoint++] = 0.06*1e-2;
-  pme[ipoint++] = 0.06*1e-2;
-  pme[ipoint++] = 0.06*1e-2;
-  pme[ipoint++] = 0.05*1e-2;
-  pme[ipoint++] = 0.04*1e-2;
-  pme[ipoint++] = 0.04*1e-2;
-  pme[ipoint++] = 0.34*1e-3;
-  pme[ipoint++] = 0.34*1e-3;
-  pme[ipoint++] = 0.32*1e-3;
-  pme[ipoint++] = 0.29*1e-3;
-
-  gStar[4] =  new TGraphErrors(ipoint,pt,pm,errpt,pme);
-
-
-  // p
-  ipoint = 0;
-  pp[ipoint++]  = 0;
-  pp[ipoint++]  = 0;
-  pp[ipoint++]  = 0;
-  pp[ipoint++]  = 0;
-  pp[ipoint++]  = 0;
-  pp[ipoint++]  = 5.07*1e-2;
-  pp[ipoint++]  = 4.69*1e-2;
-  pp[ipoint++]  = 4.08*1e-2;
-  pp[ipoint++]  = 3.42*1e-2;
-  pp[ipoint++]  = 2.87*1e-2;
-  pp[ipoint++]  = 2.41*1e-2;
-  pp[ipoint++]  = 2.13*1e-2;
-  pp[ipoint++]  = 1.82*1e-2;
-  pp[ipoint++]  = 1.54*1e-2;
-  pp[ipoint++]  = 1.31*1e-2;
-  pp[ipoint++]  = 1.11*1e-2;
-  pp[ipoint++]  = 9.78*1e-3;
-  pp[ipoint++]  = 8.56*1e-3;
-  pp[ipoint++]  = 7.38*1e-3;
-
-  ipoint = 0;
-  ppe[ipoint++] = 0;
-  ppe[ipoint++] = 0;
-  ppe[ipoint++] = 0;
-  ppe[ipoint++] = 0;
-  ppe[ipoint++] = 0;
-  ppe[ipoint++] = 0.25*1e-2;
-  ppe[ipoint++] = 0.19*1e-2;
-  ppe[ipoint++] = 0.14*1e-2;
-  ppe[ipoint++] = 0.10*1e-2;
-  ppe[ipoint++] = 0.07*1e-2;
-  ppe[ipoint++] = 0.07*1e-2;
-  ppe[ipoint++] = 0.06*1e-2;
-  ppe[ipoint++] = 0.05*1e-2;
-  ppe[ipoint++] = 0.05*1e-2;
-  ppe[ipoint++] = 0.04*1e-2;
-  ppe[ipoint++] = 0.04*1e-2;
-  ppe[ipoint++] = 0.40*1e-3;
-  ppe[ipoint++] = 0.37*1e-3;
-  ppe[ipoint++] = 0.38*1e-3;
-
-
-
-  gStar[5] = new TGraphErrors(ipoint,pt,pp,errpt,ppe);
-
-//   gStar[0]->SetMarkerStyle(kOpenTriangleUp);
-//   gStar[1]->SetMarkerStyle(kFullTriangleUp);
-//   gStar[2]->SetMarkerStyle(kOpenCircle);
-//   gStar[3]->SetMarkerStyle(kFullCircle);
-//   gStar[4]->SetMarkerStyle(kOpenSquare);
-//   gStar[5]->SetMarkerStyle(kFullSquare);
-  gStar[0]->SetMarkerStyle(kOpenStar);
-  gStar[1]->SetMarkerStyle(kFullStar);
-  gStar[2]->SetMarkerStyle(kOpenStar);
-  gStar[3]->SetMarkerStyle(kFullStar);
-  gStar[4]->SetMarkerStyle(kOpenStar);
-  gStar[5]->SetMarkerStyle(kFullStar);
-
-  gStar[0]->SetMarkerColor(kBlack);
-  gStar[1]->SetMarkerColor(kBlack);
-  gStar[2]->SetMarkerColor(kRed);
-  gStar[3]->SetMarkerColor(kRed);
-  gStar[4]->SetMarkerColor(kBlue);
-  gStar[5]->SetMarkerColor(kBlue);
-
-  gStar[0]->SetLineColor (kBlack);
-  gStar[1]->SetLineColor (kBlack);
-  gStar[2]->SetLineColor (kRed);
-  gStar[3]->SetLineColor (kRed);
-  gStar[4]->SetLineColor (kBlue);
-  gStar[5]->SetLineColor (kBlue);
-
-  // Scale all for 2*pi and pt in order to go to dNdpt
-  for(Int_t istar = 0; istar < 6; istar++){
-    Int_t npoint = gStar[istar]->GetN();
-    for(Int_t ipoint = 0; ipoint < npoint; ipoint++){
-      Double_t ptbin = gStar[istar]->GetX()[ipoint];
-      gStar[istar]->SetPoint(ipoint,
-                            gStar[istar]->GetX()[ipoint],
-                            gStar[istar]->GetY()[ipoint]*2*TMath::Pi()*ptbin);
-      gStar[istar]->SetPointError(ipoint,
-                                 gStar[istar]->GetEX()[ipoint],
-                                 gStar[istar]->GetEY()[ipoint]*2*TMath::Pi()*ptbin);
-    }
-    
-  }
-  
-
-  // Compute K/pi
-  Int_t npoint = gStar[2]->GetN(); // Kaons have less points than pions
-  gStar[6] = new TGraphErrors();
-  for(Int_t ipoint = 0; ipoint < npoint; ipoint++){
-    Float_t pn  = gStar[0]->GetY()[ipoint];
-    Float_t pne = gStar[0]->GetEY()[ipoint];
-    Float_t pp  = gStar[1]->GetY()[ipoint];
-    Float_t ppe = gStar[1]->GetEY()[ipoint];
-    Float_t kn  = gStar[2]->GetY()[ipoint];
-    Float_t kne = gStar[2]->GetEY()[ipoint];
-    Float_t kp  = gStar[3]->GetY()[ipoint];
-    Float_t kpe = gStar[3]->GetEY()[ipoint];
-
-    if (TMath::Abs(
-                  gStar[0]->GetX()[ipoint]-
-                  gStar[2]->GetX()[ipoint]
-                  ) 
-       ) {
-         cout << "Wrong STAR pt!!!" << endl;
-         exit(1);
-       }
-    Double_t kpiRatio = (kp+kn)/(pp+pn);
-    Double_t error2K   = (kne*kne+kpe*kpe)/(kp+kn)/(kp+kn);
-    Double_t error2pi  = (pne*pne+ppe*ppe)/(pp+pn)/(pp+pn);
-    Double_t error = TMath::Sqrt(error2pi+error2K)*kpiRatio;
-    gStar[6]->SetPoint (ipoint, gStar[0]->GetX()[ipoint],kpiRatio);
-    gStar[6]->SetPointError (ipoint, 0, error);
-  }
-  
-
-
-
-//   gStar[0]->Draw("AP");
-//   gStar[1]->Draw("P");
-//   gStar[2]->Draw("P");
-//   gStar[3]->Draw("P");
-//   gStar[4]->Draw("P");
-//   gStar[5]->Draw("P");
-
-
-  return gStar;
-
-
-  
-  // table from PRC79  79 (2009) 34909
-//         pi-                   pi+               k-                 K+               pbar              p
-//  0.225  2.02+-0.06            2.07+-0.06        (1.43+-0.11)*10-1 (1.52+-0.11)*10-1
-//  0.275  1.52+-0.03            1.54+-0.03        (1.26+-0.05)*10-1 (1.30+-0.05)*10-1
-//  0.325  1.13+-0.02            1.14+-0.02        (1.08+-0.02)*10-1 (1.08+-0.02)*10-1
-//  0.375  (8.44+-0.09)*10-1     (8.57+-0.09)*10-1 (8.77+-0.24)*10-2 (9.16+-0.25)*10-2 (5.54+-0.13)*10-2
-//  0.425  (6.35+-0.07)*10-1     (6.38+-0.07)*10-1 (7.34+-0.26)*10-2 (7.47+-0.27)*10-2 (4.81+-0.11)*10-2
-//  0.475  (4.69+-0.05)*10-1     (4.76+-0.05)*10-1 (6.17+-0.63)*10-2 (6.26+-0.64)*10-2 (4.25+-0.10)*10-2 (5.07+-0.25)*10-2
-//  0.525  (3.54+-0.04)*10-1     (3.59+-0.04)*10-1 (4.87+-0.50)*10-2 (5.26+-0.54)*10-2 (3.77+-0.09)*10-2 (4.69+-0.19)*10-2
-//  0.575  (2.67+-0.03)*10-1     (2.73+-0.03)*10-1 (4.11+-0.42)*10-2 (4.41+-0.45)*10-2 (3.38+-0.08)*10-2 (4.08+-0.14)*10-2
-//  0.625  (2.02+-0.04)*10-1     (2.07+-0.04)*10-1 (3.70+-0.28)*10-2 (3.81+-0.28)*10-2 (2.78+-0.07)*10-2 (3.42+-0.10)*10-2
-//  0.675  (1.53+-0.03)*10-1     (1.55+-0.03)*10-1 (2.86+-0.22)*10-2 (3.06+-0.24)*10-2 (2.49+-0.06)*10-2 (2.87+-0.07)*10-2
-//  0.725  (1.16+-0.03)*10-1     (1.16+-0.03)*10-1 (2.42+-0.27)*10-2 (2.49+-0.28)*10-2 (2.03+-0.06)*10-2 (2.41+-0.07)*10-2
-//  0.775  (8.65+-0.30)*10-2     (8.95+-0.31)*10-2                                     (1.75+-0.06)*10-2 (2.13+-0.06)*10-2
-//  0.825                                                                              (1.52+-0.05)*10-2 (1.82+-0.05)*10-2
-//  0.875                                                                              (1.27+-0.04)*10-2 (1.54+-0.05)*10-2
-//  0.925                                                                              (1.05+-0.04)*10-2 (1.31+-0.04)*10-2
-//  0.975                                                                              (8.95+-0.34)*10-3 (1.11+-0.04)*10-2
-//  1.025                                                                              (7.36+-0.34)*10-3 (9.78+-0.40)*10-3
-//  1.075                                                                              (6.59+-0.32)*10-3 (8.56+-0.37)*10-3
-//  1.125                                                                              (5.21+-0.29)*10-3 (7.38+-0.38)*10-3
-
-
-  }
similarity index 90%
rename from PWG2/SPECTRA/Fit/CombineSpectra.C
rename to PWGLF/SPECTRA/PiKaPr/COMBINED/CombineSpectra.C
index edb5f14..9a7a4e2 100644 (file)
@@ -2,8 +2,8 @@
 #include <iostream>
 #include "TH1F.h"
 #include "TGraphErrors.h"
-#include "AliBWFunc.h"
-#include "AliBWTools.h"
+#include "AliPWGFunc.h"
+#include "AliPWGHistoTools.h"
 #include "TF1.h"
 #include "TFile.h"
 #include "TDatabasePDG.h"
@@ -233,9 +233,9 @@ void FitCombined() {
   gStyle->SetOptStat(0);
 
   // Draw combined & Fit
-  AliBWFunc * fm = new AliBWFunc;
-  fm->SetVarType(AliBWFunc::kdNdpt);
-  if (convertToMT) fm->SetVarType(AliBWFunc::kOneOverMtdNdmt);
+  AliPWGFunc * fm = new AliPWGFunc;
+  fm->SetVarType(AliPWGFunc::kdNdpt);
+  if (convertToMT) fm->SetVarType(AliPWGFunc::kOneOverMtdNdmt);
 
   // table to print results
   AliLatexTable table(10,"c|ccccccccc");
@@ -346,9 +346,9 @@ void FitCombined() {
       TH1F * hsyst     = new TH1F(*htemplate);
       TH1F * hsyststat = 0;
       hsyst->SetFillColor(kGray);
-      AliBWTools::GetValueAndError(hsyst,hSpectra[iCombInStudy][ipart][icharge],hSystError[iCombInStudy][ipart][icharge],kTRUE);
+      AliPWGHistoTools::GetValueAndError(hsyst,hSpectra[iCombInStudy][ipart][icharge],hSystError[iCombInStudy][ipart][icharge],kTRUE);
       hsyststat= new TH1F(*hsyst);
-      AliBWTools::GetHistoCombinedErrors(hsyststat,hSpectra[iCombInStudy][ipart][icharge]); // combine syst and stat
+      AliPWGHistoTools::GetHistoCombinedErrors(hsyststat,hSpectra[iCombInStudy][ipart][icharge]); // combine syst and stat
       hsyststat->SetFillColor(kGray);
 
       TH1F * hToFit = 0;
@@ -364,16 +364,16 @@ void FitCombined() {
          TH1F * hsyst2     = new TH1F(*htemplate);
          TH1F * hsyststat2 = 0;
          hsyst2->SetFillColor(kGray);
-         AliBWTools::GetValueAndError(hsyst2,hSpectra[iCombInStudy][ipart][1],hSystError[iCombInStudy][ipart][1],kTRUE);
+         AliPWGHistoTools::GetValueAndError(hsyst2,hSpectra[iCombInStudy][ipart][1],hSystError[iCombInStudy][ipart][1],kTRUE);
          hsyststat2= new TH1F(*hsyst2);
-         AliBWTools::GetHistoCombinedErrors(hsyststat2,hSpectra[iCombInStudy][ipart][1]); // combine syst and stat
+         AliPWGHistoTools::GetHistoCombinedErrors(hsyststat2,hSpectra[iCombInStudy][ipart][1]); // combine syst and stat
          hToFit->Add(hsyststat2);
        }
       }
 
       
 
-      if(!AliBWTools::Fit(hToFit,func,fitmin,fitmax)) {
+      if(!AliPWGHistoTools::Fit(hToFit,func,fitmin,fitmax)) {
        cout << " FIT ERROR " << endl;
        return;      
       }
@@ -425,7 +425,7 @@ void FitCombined() {
 
       Double_t yieldTools, yieldETools;
       Double_t partialYields[3],partialYieldsErrors[3]; 
-      AliBWTools::GetYield(hToFit, func, yieldTools, yieldETools, 
+      AliPWGHistoTools::GetYield(hToFit, func, yieldTools, yieldETools, 
                           0, 100, partialYields,partialYieldsErrors);
       Double_t tslope   = func->GetParameter(2);
       Double_t tslopeE  = func->GetParError(2);        
@@ -437,8 +437,8 @@ void FitCombined() {
       table.SetNextCol(tslope,tslopeE,-4);
       table.SetNextCol(func->GetParameter(1),func->GetParError(1),-2); 
       table.SetNextCol(Form("%2.2f/%d",func->GetChisquare(),func->GetNDF())); 
-      Float_t lowestPoint = AliBWTools::GetLowestNotEmptyBinEdge(hToFit);
-      //Float_t lowestPoint = AliBWTools::GetLowestNotEmptyBinEdge(hSpectra[kITS][ipart][icharge]);
+      Float_t lowestPoint = AliPWGHistoTools::GetLowestNotEmptyBinEdge(hToFit);
+      //Float_t lowestPoint = AliPWGHistoTools::GetLowestNotEmptyBinEdge(hSpectra[kITS][ipart][icharge]);
       Float_t yieldAbove  = func->Integral(lowestPoint,100);
       table.SetNextCol(lowestPoint,-2);
       table.SetNextCol((1 - yieldAbove/yield)*100,-1);
@@ -446,11 +446,11 @@ void FitCombined() {
       Double_t meanDF, meanDFe; // Mean from data + fit 
       Float_t mean2, mean2e;
       if (fitFuncID < kFitPhojet) {
-       AliBWTools::GetMean      (func, mean,  meane , 0.,100., normPar);
-       AliBWTools::GetMeanSquare(func, mean2, mean2e, 0.,100., normPar);
+       AliPWGHistoTools::GetMean      (func, mean,  meane , 0.,100., normPar);
+       AliPWGHistoTools::GetMeanSquare(func, mean2, mean2e, 0.,100., normPar);
       }
-      //      AliBWTools::GetMeanDataAndExtrapolation(hToFit, func, meanDF, meanDFe, 0.,100.);
-      AliBWTools::GetMeanDataAndExtrapolation(hToFit, func, meanDF, meanDFe, 0.,100.);
+      //      AliPWGHistoTools::GetMeanDataAndExtrapolation(hToFit, func, meanDF, meanDFe, 0.,100.);
+      AliPWGHistoTools::GetMeanDataAndExtrapolation(hToFit, func, meanDF, meanDFe, 0.,100.);
       table.SetNextCol(mean,   meane  ,-4);
       table.SetNextCol(meanDF, meanDFe,-4);
       
@@ -605,20 +605,20 @@ void LoadSpectra() {
   // TOF: systematics
   // Load TOF systematic errors:
   f = new TFile ("./Files/systMatchingPos.root");
-  AliBWTools::AddHisto(hSystError[kTOF][kPion][kPos]  ,(TH1*)gDirectory->Get("hErrPionMatch")  );
-  AliBWTools::AddHisto(hSystError[kTOF][kProton][kPos],(TH1*)gDirectory->Get("hErrProtonMatch"));
-  AliBWTools::AddHisto(hSystError[kTOF][kKaon][kPos]  ,(TH1*)gDirectory->Get("hErrKaonMatch")  );
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kPion][kPos]  ,(TH1*)gDirectory->Get("hErrPionMatch")  );
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kProton][kPos],(TH1*)gDirectory->Get("hErrProtonMatch"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kKaon][kPos]  ,(TH1*)gDirectory->Get("hErrKaonMatch")  );
   f = new TFile ("./Files/systMatchingNeg.root");
-  AliBWTools::AddHisto(hSystError[kTOF][kPion]  [kNeg],(TH1*)gDirectory->Get("hErrPionMatch"));
-  AliBWTools::AddHisto(hSystError[kTOF][kProton][kNeg],(TH1*)gDirectory->Get("hErrProtonMatch"));
-  AliBWTools::AddHisto(hSystError[kTOF][kKaon]  [kNeg],(TH1*)gDirectory->Get("hErrKaonMatch"));  
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kPion]  [kNeg],(TH1*)gDirectory->Get("hErrPionMatch"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kProton][kNeg],(TH1*)gDirectory->Get("hErrProtonMatch"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kKaon]  [kNeg],(TH1*)gDirectory->Get("hErrKaonMatch"));  
   f = new TFile ("./Files/systPIDall.root");
-  AliBWTools::AddHisto(hSystError[kTOF][kPion]  [kPos],(TH1*)gDirectory->Get("hpiCorr"));
-  AliBWTools::AddHisto(hSystError[kTOF][kProton][kPos],(TH1*)gDirectory->Get("hpCorr"));
-  AliBWTools::AddHisto(hSystError[kTOF][kKaon]  [kPos],(TH1*)gDirectory->Get("hkCorr"));  
-  AliBWTools::AddHisto(hSystError[kTOF][kPion]  [kNeg],(TH1*)gDirectory->Get("hpiCorr"));
-  AliBWTools::AddHisto(hSystError[kTOF][kProton][kNeg],(TH1*)gDirectory->Get("hpCorr"));
-  AliBWTools::AddHisto(hSystError[kTOF][kKaon]  [kNeg],(TH1*)gDirectory->Get("hkCorr"));  
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kPion]  [kPos],(TH1*)gDirectory->Get("hpiCorr"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kProton][kPos],(TH1*)gDirectory->Get("hpCorr"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kKaon]  [kPos],(TH1*)gDirectory->Get("hkCorr"));  
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kPion]  [kNeg],(TH1*)gDirectory->Get("hpiCorr"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kProton][kNeg],(TH1*)gDirectory->Get("hpCorr"));
+  AliPWGHistoTools::AddHisto(hSystError[kTOF][kKaon]  [kNeg],(TH1*)gDirectory->Get("hkCorr"));  
   
   
   // ITS SA 
@@ -698,7 +698,7 @@ void LoadSpectra() {
   f = TFile::Open("./Files/ITSsa-systematics-20101014.root");
   for(Int_t ipart = 0; ipart < kNPart; ipart++){
       for(Int_t icharge = 0; icharge < kNCharge; icharge++){
-       AliBWTools::AddHisto(hSystError[kITS][ipart][icharge], (TH1*) gDirectory->Get(Form("hSystTot%s%s",chargeFlag[icharge],partFlag[ipart]))); // Using total error
+       AliPWGHistoTools::AddHisto(hSystError[kITS][ipart][icharge], (TH1*) gDirectory->Get(Form("hSystTot%s%s",chargeFlag[icharge],partFlag[ipart]))); // Using total error
       }
     }
 
@@ -716,26 +716,26 @@ void LoadSpectra() {
   // Systematics
   f = TFile::Open("./Files/SpectraCorrectedITSBeforeProtonssys29102010.root");
   list = (TList*) gDirectory->Get("output");
-  hSystError[kITSTPC][kPion]  [kPos]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("Pions"));
-  hSystError[kITSTPC][kKaon]  [kPos]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("Kaons"));
-  hSystError[kITSTPC][kProton][kPos]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("Protons"));
-  hSystError[kITSTPC][kPion]  [kNeg]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("AntiPions"));
-  hSystError[kITSTPC][kKaon]  [kNeg]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("AntiKaons"));
-  hSystError[kITSTPC][kProton][kNeg]= (TH1F*) AliBWTools::GetRelativeError((TH1*) list->FindObject("AntiProtons"));
+  hSystError[kITSTPC][kPion]  [kPos]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("Pions"));
+  hSystError[kITSTPC][kKaon]  [kPos]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("Kaons"));
+  hSystError[kITSTPC][kProton][kPos]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("Protons"));
+  hSystError[kITSTPC][kPion]  [kNeg]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("AntiPions"));
+  hSystError[kITSTPC][kKaon]  [kNeg]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("AntiKaons"));
+  hSystError[kITSTPC][kProton][kNeg]= (TH1F*) AliPWGHistoTools::GetRelativeError((TH1*) list->FindObject("AntiProtons"));
 
 
 
   // TPC
   f = new TFile("./Files/protonSpectra_20100615.root");
-  hSpectra[kTPC][kProton][kPos]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("protonPosClassic"),htemplate);
-  hSpectra[kTPC][kProton][kNeg]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("protonNegClassic"),htemplate);
+  hSpectra[kTPC][kProton][kPos]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("protonPosClassic"),htemplate);
+  hSpectra[kTPC][kProton][kNeg]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("protonNegClassic"),htemplate);
   f = new TFile("./Files/pionSpectra_20100615.root");
-  hSpectra[kTPC][kPion][kPos]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("pionPosClassic"),htemplate);
-  hSpectra[kTPC][kPion][kNeg]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("pionNegClassic"),htemplate);
+  hSpectra[kTPC][kPion][kPos]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("pionPosClassic"),htemplate);
+  hSpectra[kTPC][kPion][kNeg]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("pionNegClassic"),htemplate);
   //  f = new TFile("./Files/kaonSpectra_20100615.root");
   f = new TFile("./Files/kaonsTPCcorr_2010_08_31.root");
-  hSpectra[kTPC][kKaon][kPos]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("kaonPosClassic"),htemplate);
-  hSpectra[kTPC][kKaon][kNeg]= AliBWTools::GetHistoFromGraph((TGraphErrors*)f->Get("kaonNegClassic"),htemplate);
+  hSpectra[kTPC][kKaon][kPos]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("kaonPosClassic"),htemplate);
+  hSpectra[kTPC][kKaon][kNeg]= AliPWGHistoTools::GetHistoFromGraph((TGraphErrors*)f->Get("kaonNegClassic"),htemplate);
 
   // Clean UP TPC spectra, removing unwanted points
   cout << "Cleaning Up TPC spectra" << endl;
@@ -763,18 +763,18 @@ void LoadSpectra() {
   // Load TPC systematics
   cout << "WARNING: TPC SYST FOR NEGATIVES TO BE CORRECTED" << endl;
   f = TFile ::Open("./Files/pionsSystSum.root");
-  AliBWTools::AddHisto(hSystError[kTPC][kPion][kPos],(TH1*) gDirectory->Get("pionsSyst"));
-  AliBWTools::AddHisto(hSystError[kTPC][kPion][kNeg],(TH1*) gDirectory->Get("pionsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kPion][kPos],(TH1*) gDirectory->Get("pionsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kPion][kNeg],(TH1*) gDirectory->Get("pionsSyst"));
   f = TFile ::Open("./Files/kaonsSystSum.root");
-  AliBWTools::AddHisto(hSystError[kTPC][kKaon][kPos],(TH1*) gDirectory->Get("kaonsSyst"));
-  AliBWTools::AddHisto(hSystError[kTPC][kKaon][kNeg],(TH1*) gDirectory->Get("kaonsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kKaon][kPos],(TH1*) gDirectory->Get("kaonsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kKaon][kNeg],(TH1*) gDirectory->Get("kaonsSyst"));
   f = TFile ::Open("./Files/ProtonsSystSum.root");
-  AliBWTools::AddHisto(hSystError[kTPC][kProton][kPos],(TH1*) gDirectory->Get("ProtonsSyst"));
-  AliBWTools::AddHisto(hSystError[kTPC][kProton][kNeg],(TH1*) gDirectory->Get("ProtonsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kProton][kPos],(TH1*) gDirectory->Get("ProtonsSyst"));
+  AliPWGHistoTools::AddHisto(hSystError[kTPC][kProton][kNeg],(TH1*) gDirectory->Get("ProtonsSyst"));
     
   // K0s
   f = new TFile ("./Files/PtSpectraCorrectedK0sOff_20100803.root");
-  //  hSpectra[kK0][kKaon][kPos] = (TH1F*) AliBWTools::GetdNdPtFromOneOverPt((TH1*) gDirectory->Get("hSpectraOff")); 
+  //  hSpectra[kK0][kKaon][kPos] = (TH1F*) AliPWGHistoTools::GetdNdPtFromOneOverPt((TH1*) gDirectory->Get("hSpectraOff")); 
   hSpectra[kK0][kKaon][kPos] = (TH1F*) gDirectory->Get("hSpectraOff"); 
   //  hSpectra[kK0][kKaon][kPos]->Scale(2*TMath::Pi());
   //  hSpectra[kK0][kKaon][kPos]->Scale(1./272463);
@@ -925,7 +925,7 @@ void LoadSpectra() {
            Float_t minPtCorrection = hCorrFluka[icharge]->GetYaxis()->GetBinLowEdge(1);
            //      hCorrFluka[icharge]->Draw();
            TH1D * htmpFluka=hCorrFluka[icharge]->ProjectionY();
-           Float_t maxPtCorrection = AliBWTools::GetHighestNotEmptyBinEdge(htmpFluka);//->GetYaxis()->GetBinLowEdge(hCorrFluka[icharge]->GetNbinsY()+1);
+           Float_t maxPtCorrection = AliPWGHistoTools::GetHighestNotEmptyBinEdge(htmpFluka);//->GetYaxis()->GetBinLowEdge(hCorrFluka[icharge]->GetNbinsY()+1);
            if (pt < minPtCorrection) pt = minPtCorrection+0.0001;
            if (pt > maxPtCorrection) pt = maxPtCorrection-0.0001;
            Float_t correction = hCorrFluka[icharge]->GetBinContent(1,hCorrFluka[icharge]->GetYaxis()->FindBin(pt));
@@ -967,8 +967,8 @@ void LoadSpectra() {
          hSpectra[idet][ipart][icharge]->SetXTitle("p_{t} (GeV/c)");
          hSpectra[idet][ipart][icharge]->SetYTitle("1/N_{ev} dN/dp_{t} (GeV/c)^{-1}");
          if (convertToMT) {
-           TH1F * htmp = (TH1F*) AliBWTools::GetOneOverPtdNdPt(hSpectra[idet][ipart][icharge]);
-           hSpectra[idet][ipart][icharge] = (TH1F*)AliBWTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
+           TH1F * htmp = (TH1F*) AliPWGHistoTools::GetOneOverPtdNdPt(hSpectra[idet][ipart][icharge]);
+           hSpectra[idet][ipart][icharge] = (TH1F*)AliPWGHistoTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
            hSpectra[idet][ipart][icharge]->SetXTitle("m_{t} (GeV)");
            hSpectra[idet][ipart][icharge]->SetYTitle("1/N_{ev} 1/m_{t} dN/dp_{t} (GeV)^{-1}");
          }
@@ -1019,16 +1019,16 @@ void LoadSpectra() {
       TH1F * htemplLocal = htemplate; // If we are converting to 1/mt dNdmt we need to convert the template as well...
       
       if (convertToMT) {
-       TH1F * htmp = (TH1F*) AliBWTools::GetOneOverPtdNdPt(htemplate);
-       htemplLocal = (TH1F*)AliBWTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
+       TH1F * htmp = (TH1F*) AliPWGHistoTools::GetOneOverPtdNdPt(htemplate);
+       htemplLocal = (TH1F*)AliPWGHistoTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
 
       }
-      hSpectra[kCombTOFTPC][ipart][icharge] = AliBWTools::CombineHistos(hSpectra[kTOF][ipart][icharge],
+      hSpectra[kCombTOFTPC][ipart][icharge] = AliPWGHistoTools::CombineHistos(hSpectra[kTOF][ipart][icharge],
                                                                        hSpectra[kTPC][ipart][icharge],
                                                                        htemplLocal,1.);;
 
       hSpectra[kCombAll][ipart][icharge]   = 
-       AliBWTools::Combine3HistosWithErrors(hSpectra[kITS][ipart][icharge],  // Histos to combine
+       AliPWGHistoTools::Combine3HistosWithErrors(hSpectra[kITS][ipart][icharge],  // Histos to combine
                                             hSpectra[kTPC][ipart][icharge],
                                             hSpectra[kTOF][ipart][icharge],
                                             hSystError[kITS][ipart][icharge], // Errors (weights) used for the average
@@ -1045,8 +1045,8 @@ void LoadSpectra() {
                                             1 // weights histos contain error in bin content
                                             );
 //       if (convertToMT) {
-//     TH1F * htmp = (TH1F*) AliBWTools::GetOneOverPtdNdPt(hSpectra[kCombTOFTPC][ipart][icharge]);
-//     hSpectra[kCombTOFTPC][ipart][icharge] = (TH1F*)AliBWTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
+//     TH1F * htmp = (TH1F*) AliPWGHistoTools::GetOneOverPtdNdPt(hSpectra[kCombTOFTPC][ipart][icharge]);
+//     hSpectra[kCombTOFTPC][ipart][icharge] = (TH1F*)AliPWGHistoTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
 //     hSpectra[kCombTOFTPC][ipart][icharge]->SetXTitle("m_{t} (GeV)");
 //     hSpectra[kCombTOFTPC][ipart][icharge]->SetYTitle("1/N_{ev} 1/m_{t} dN/dp_{t} (GeV)^{-1}");
 //       }
@@ -1111,8 +1111,8 @@ void LoadMC() {
          hSpectraMC[itune][ipart][icharge]->SetLineStyle   (mcLineStyle[itune] );
          hSpectraMC[itune][ipart][icharge]->SetMarkerStyle (1);
          if (convertToMT) {
-           TH1F * htmp = (TH1F*)AliBWTools::GetOneOverPtdNdPt(hSpectraMC[itune][ipart][icharge]);
-           hSpectraMC[itune][ipart][icharge] = (TH1F*)AliBWTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
+           TH1F * htmp = (TH1F*)AliPWGHistoTools::GetOneOverPtdNdPt(hSpectraMC[itune][ipart][icharge]);
+           hSpectraMC[itune][ipart][icharge] = (TH1F*)AliPWGHistoTools::GetdNdmtFromdNdpt(htmp,mass[ipart]);
            hSpectraMC[itune][ipart][icharge]->SetXTitle("m_{t} (GeV)");
            hSpectraMC[itune][ipart][icharge]->SetYTitle("1/N_{ev} 1/m_{t} dN/dp_{t} (GeV)^{-1}");
          }
@@ -1151,7 +1151,7 @@ void GetITSResiduals() {
 //       gSystem->Sleep(1000);
       TF1* f = (TF1*)   hSpectra[kCombTOFTPC][ipart][icharge]->GetListOfFunctions()->At(0);
       TH1F * hres1, *hres2;
-      AliBWTools::GetResiduals(hSpectra[kITS][ipart][icharge], f, &hres1, &hres2);
+      AliPWGHistoTools::GetResiduals(hSpectra[kITS][ipart][icharge], f, &hres1, &hres2);
 
       TCanvas * c1 = new TCanvas(TString(partFlag[ipart])+"_"+chargeFlag[icharge],TString(partFlag[ipart])+"_"+chargeFlag[icharge]);
       c1->SetLogy();
@@ -1173,7 +1173,7 @@ void GetITSResiduals() {
       hres2->SetMaximum(1);
       hres2->Draw();
       hres2->GetYaxis()->SetTitleOffset(1.2);
-      Float_t x = AliBWTools::GetLowestNotEmptyBinEdge(hSpectra[kCombTOFTPC][ipart][icharge]);
+      Float_t x = AliPWGHistoTools::GetLowestNotEmptyBinEdge(hSpectra[kCombTOFTPC][ipart][icharge]);
       TLine * line = new TLine(x,-1,x,1);
       line->SetLineStyle(kDashed);
       line->Draw("same");
@@ -1234,7 +1234,7 @@ void DrawWithModels() {
        if(sumCharge)   hSpectraMC[itune][ipart][icharge]->Add(hSpectraMC[itune][ipart][kNeg]); // Draw pos+neg;    
        l->AddEntry(hSpectraMC[itune][ipart][icharge],mcTuneName[itune]);
        hSpectraMC[itune][ipart][icharge]->SetLineWidth(2);    
-       AliBWTools::GetGraphFromHisto(hSpectraMC[itune][ipart][icharge])->Draw("CX");
+       AliPWGHistoTools::GetGraphFromHisto(hSpectraMC[itune][ipart][icharge])->Draw("CX");
       }
       l->Draw("same");
      
@@ -1262,18 +1262,18 @@ void DrawWithModels() {
       hemptyr->GetYaxis()->SetNdivisions(5);
       hemptyr->Draw("");
 
-      AliBWFunc fm;
+      AliPWGFunc fm;
       for(Int_t itune = 0; itune < kNTunes; itune++){      
        TF1* f = fm.GetHistoFunc(hSpectraMC[itune][ipart][icharge], TString("f")+mcTuneName[itune]);
 
        //      l->AddEntry(hSpectraMC[itune][ipart][icharge],mcTuneName[itune]);
-       TH1F* hRatio = AliBWTools::DivideHistoByFunc(hSpectra[iCombInStudy][ipart][icharge],f);
+       TH1F* hRatio = AliPWGHistoTools::DivideHistoByFunc(hSpectra[iCombInStudy][ipart][icharge],f);
        hRatio->SetLineStyle(hSpectraMC[itune][ipart][icharge]->GetLineStyle());
        hRatio->SetLineColor(hSpectraMC[itune][ipart][icharge]->GetLineColor());
        hRatio->SetLineWidth(hSpectraMC[itune][ipart][icharge]->GetLineWidth());
        hRatio->SetMarkerStyle(0);
        hRatio->Draw("same");
-       //      AliBWTools::GetGraphFromHisto(hRatio)->Draw("CX");
+       //      AliPWGHistoTools::GetGraphFromHisto(hRatio)->Draw("CX");
       }
 
 
@@ -1389,7 +1389,7 @@ void DrawAllAndKaons() {
        hSpectra[idet][ipart][icharge]->SetMarkerStyle(marker[idet]);
        TH1F * hsyst = new TH1F(*hSpectra[idet][ipart][icharge]);
        hsyst->Reset();
-       AliBWTools::GetValueAndError(hsyst, hSpectra[idet][ipart][icharge],hSystError[idet][ipart][icharge],kTRUE);
+       AliPWGHistoTools::GetValueAndError(hsyst, hSpectra[idet][ipart][icharge],hSystError[idet][ipart][icharge],kTRUE);
        //      hSpectra[idet][ipart][icharge]->Draw("same");
        hsyst->Draw("same");
        hSpectraSystError[idet][ipart][icharge] = hsyst;
@@ -1662,7 +1662,7 @@ void DrawWithJacek() {
   gJacek->GetHistogram()->SetYTitle("d^{2}N/dp_{t}d#eta (GeV^{-1})");
   hsum->Draw("same");
 
-  TGraphErrors * gRatio = AliBWTools::DivideGraphByHisto(gJacek,hsum);  
+  TGraphErrors * gRatio = AliPWGHistoTools::DivideGraphByHisto(gJacek,hsum);  
   new TCanvas();
   gRatio->Draw("AP");
 
@@ -1717,17 +1717,17 @@ void DrawRatioToStar() {
 
   c1->cd();
   TGraphErrors * g ;
-  g = AliBWTools::DivideGraphByHisto(gStar[0],hSpectra[iCombInStudy][kPion][kNeg],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[0],hSpectra[iCombInStudy][kPion][kNeg],1);
   g->SetMarkerStyle(kFullCircle);
   g->SetMarkerColor(kBlack);
   g->Draw("p");
   leg->AddEntry(g,"#pi^{-}","lp");
-  g = AliBWTools::DivideGraphByHisto(gStar[2],hSpectra[iCombInStudy][kKaon][kNeg],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[2],hSpectra[iCombInStudy][kKaon][kNeg],1);
   g->SetMarkerStyle(kOpenCircle);
   g->SetMarkerColor(kRed);
   g->Draw("p");
   leg->AddEntry(g,"K^{-}","lp");
-  g = AliBWTools::DivideGraphByHisto(gStar[4],hSpectra[iCombInStudy][kProton][kNeg],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[4],hSpectra[iCombInStudy][kProton][kNeg],1);
   g->SetMarkerStyle(kOpenSquare);
   g->SetMarkerColor(kBlue);
   g->Draw("p");
@@ -1760,17 +1760,17 @@ void DrawRatioToStar() {
 
   c2->cd();
  //  TGraphErrors * g ;
-  g = AliBWTools::DivideGraphByHisto(gStar[1],hSpectra[iCombInStudy][kPion][kPos],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[1],hSpectra[iCombInStudy][kPion][kPos],1);
   g->SetMarkerStyle(kFullCircle);
   g->SetMarkerColor(kBlack);
   g->Draw("p");
   leg->AddEntry(g,"#pi^{+}","lp");
-  g = AliBWTools::DivideGraphByHisto(gStar[3],hSpectra[iCombInStudy][kKaon][kPos],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[3],hSpectra[iCombInStudy][kKaon][kPos],1);
   g->SetMarkerStyle(kOpenCircle);
   g->SetMarkerColor(kRed);
   g->Draw("p");
   leg->AddEntry(g,"K^{+}","lp");
-  g = AliBWTools::DivideGraphByHisto(gStar[5],hSpectra[iCombInStudy][kProton][kPos],1);
+  g = AliPWGHistoTools::DivideGraphByHisto(gStar[5],hSpectra[iCombInStudy][kProton][kPos],1);
   g->SetMarkerStyle(kOpenSquare);
   g->SetMarkerColor(kBlue);
   g->Draw("p");
@@ -1834,16 +1834,16 @@ void DrawRatios() {
   // Get ratio of syst errors
   // FIXME: commented combined error
   TH1F * hKPiRatioSyst = new TH1F(*htemplate);;
-  AliBWTools::GetValueAndError(hKPiRatioSyst,hSpectra[iCombInStudy][kKaon][kPos],hSystError[iCombInStudy][kKaon][kPos],kTRUE);
-  //  AliBWTools::GetHistoCombinedErrors(hKPiRatioSyst,hSpectra[iCombInStudy][kKaon][kPos]);
-  AliBWTools::GetValueAndError(htmp,hSpectra[iCombInStudy][kKaon][kNeg],hSystError[iCombInStudy][kKaon][kNeg],kTRUE);
-  // //  AliBWTools::GetHistoCombinedErrors(htmp,hSpectra[iCombInStudy][kKaon][kNeg]);
+  AliPWGHistoTools::GetValueAndError(hKPiRatioSyst,hSpectra[iCombInStudy][kKaon][kPos],hSystError[iCombInStudy][kKaon][kPos],kTRUE);
+  //  AliPWGHistoTools::GetHistoCombinedErrors(hKPiRatioSyst,hSpectra[iCombInStudy][kKaon][kPos]);
+  AliPWGHistoTools::GetValueAndError(htmp,hSpectra[iCombInStudy][kKaon][kNeg],hSystError[iCombInStudy][kKaon][kNeg],kTRUE);
+  // //  AliPWGHistoTools::GetHistoCombinedErrors(htmp,hSpectra[iCombInStudy][kKaon][kNeg]);
   hKPiRatioSyst->Add(htmp);
-  AliBWTools::GetValueAndError(htmp,hSpectra[iCombInStudy][kPion][kNeg],hSystError[iCombInStudy][kPion][kNeg],kTRUE);
-  //  AliBWTools::GetHistoCombinedErrors(htmp,hSpectra[iCombInStudy][kPion][kNeg]);
+  AliPWGHistoTools::GetValueAndError(htmp,hSpectra[iCombInStudy][kPion][kNeg],hSystError[iCombInStudy][kPion][kNeg],kTRUE);
+  //  AliPWGHistoTools::GetHistoCombinedErrors(htmp,hSpectra[iCombInStudy][kPion][kNeg]);
   TH1F * htmp2 = new TH1F(*htemplate);
-  AliBWTools::GetValueAndError(htmp2,hSpectra[iCombInStudy][kPion][kPos],hSystError[iCombInStudy][kPion][kPos],kTRUE);
-  //  AliBWTools::GetHistoCombinedErrors(htmp2,hSpectra[iCombInStudy][kPion][kPos]);
+  AliPWGHistoTools::GetValueAndError(htmp2,hSpectra[iCombInStudy][kPion][kPos],hSystError[iCombInStudy][kPion][kPos],kTRUE);
+  //  AliPWGHistoTools::GetHistoCombinedErrors(htmp2,hSpectra[iCombInStudy][kPion][kPos]);
   htmp->Add(htmp2);
   hKPiRatioSyst->Divide(htmp);
   hKPiRatioSyst->SetYTitle("(K^{+}+K^{-})/(#pi^{+}+#pi^{-})");
@@ -1895,7 +1895,7 @@ void DrawRatios() {
   hPPiRatioPhenix->Add((TH1F*) fPhenix->Get("PbarPHNX"));
   htmp = (TH1F*) fPhenix->Get("PiPlusPHNX");
   htmp->Add((TH1F*) fPhenix->Get("PiMinusPHNX"));
-  hPPiRatioPhenix = AliBWTools::DivideHistosDifferentBins(hPPiRatioPhenix,htmp);
+  hPPiRatioPhenix = AliPWGHistoTools::DivideHistosDifferentBins(hPPiRatioPhenix,htmp);
   hPPiRatioPhenix->SetMarkerStyle(24);
   hPPiRatioPhenix->SetBinContent(14,0);
   hPPiRatioPhenix->SetBinError(14,0);
@@ -1905,8 +1905,8 @@ void DrawRatios() {
   //  hempty->SetYTitle("");
 
   // tmp: overlay levi fits
-  AliBWFunc * fm2 = new AliBWFunc;
-  fm2->SetVarType(AliBWFunc::kdNdpt);
+  AliPWGFunc * fm2 = new AliPWGFunc;
+  fm2->SetVarType(AliPWGFunc::kdNdpt);
   TF1 * fLevi[kNPart]  [kNCharge];
   fLevi[kPion]  [kPos] = fm2->GetLevi (mass[0], 0.1243, 7.614785, 1.524167, "fLeviPiPlus");
   fLevi[kKaon]  [kPos] = fm2->GetLevi (mass[1], 0.1625, 5.869318, 0.186361, "fLeviKPlus");
@@ -1948,8 +1948,8 @@ void DrawRatios() {
   TFile * f = TFile::Open("./Files/ITSsa-systematics-20101014.root");
   TH1F * hsystRatio = (TH1F*) f->Get("hSystRatioKpi");
   TH1F * hsyst = new TH1F(*htemplate);
-  AliBWTools::GetValueAndError(hsyst,hKPiRatio,hsystRatio,1);
-  //  AliBWTools::GetHistoCombinedErrors(hsyst,hKPiRatio);
+  AliPWGHistoTools::GetValueAndError(hsyst,hKPiRatio,hsystRatio,1);
+  //  AliPWGHistoTools::GetHistoCombinedErrors(hsyst,hKPiRatio);
   //  hsyst->Draw("samee1");
   // END TMP
   hKPiRatio->SetMaximum(0.62);  
@@ -2053,13 +2053,13 @@ void DrawWithSyst() {
        
        TString opt = ipart ? "" : "same";
        TH1F * hsyst = new TH1F(*htemplate);
-       AliBWTools::GetValueAndError(hsyst,hSpectra[idet][ipart][icharge],hSystError[idet][ipart][icharge],kTRUE);
+       AliPWGHistoTools::GetValueAndError(hsyst,hSpectra[idet][ipart][icharge],hSystError[idet][ipart][icharge],kTRUE);
        hsyst->SetFillColor(kGray);
        hsyst->Draw("e5,same");
        hSpectra[idet][ipart][icharge]->Draw("same");
        // Do not draw syst error outside of spectra range
-       Float_t lowEdge = AliBWTools::GetLowestNotEmptyBinEdge(hSpectra[idet][ipart][icharge]);
-       Float_t hiEdge  = AliBWTools::GetHighestNotEmptyBinEdge(hSpectra[idet][ipart][icharge]);
+       Float_t lowEdge = AliPWGHistoTools::GetLowestNotEmptyBinEdge(hSpectra[idet][ipart][icharge]);
+       Float_t hiEdge  = AliPWGHistoTools::GetHighestNotEmptyBinEdge(hSpectra[idet][ipart][icharge]);
        Int_t lowBin = hSystError[idet][ipart][icharge]->FindBin(lowEdge);
        Int_t hiBin = hSystError[idet][ipart][icharge]->FindBin(hiEdge);
        Int_t nbin =    hSystError[idet][ipart][icharge]->GetNbinsX();
@@ -2072,7 +2072,7 @@ void DrawWithSyst() {
          hSystError[idet][ipart][icharge]->SetBinError(ibin,0);          
        }
        // Draw relative syst error, convert to graph to avoid vertical bars at the edges (empty bins in histo)
-       AliBWTools::GetGraphFromHisto(hSystError[idet][ipart][icharge])->Draw("LX");
+       AliPWGHistoTools::GetGraphFromHisto(hSystError[idet][ipart][icharge])->Draw("LX");
 
                                     
 
similarity index 90%
rename from PWG2/SPECTRA/Fit/FitParticle.C
rename to PWGLF/SPECTRA/PiKaPr/COMBINED/FitParticle.C
index 236854e..6da0dc2 100644 (file)
@@ -1,8 +1,8 @@
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include <iostream>
 
-#include "AliBWTools.h"
-#include "AliBWFunc.h"
+#include "AliPWGHistoTools.h"
+#include "AliPWGFunc.h"
 #include "AliLatexTable.h"
 #include "TF1.h"
 #include "TFile.h"
@@ -21,7 +21,7 @@ using namespace std;
 
 enum {kFitExpPt, kFitLevi, fFitExpMt, kFitBoltzmann, kFitBlastWave, kFitBoseEinstein, kFitFermiDirac};
 
-void FitParticle(const char * file, const char * histo, const char * partName,  const char * listname=0, Float_t min = 0, Float_t max =3, Float_t scaleHisto = -1., Int_t fitFunc = kFitLevi, Int_t vartype = AliBWFunc::kdNdpt, const char * fileOut = 0, Bool_t wait = 0) {
+void FitParticle(const char * file, const char * histo, const char * partName,  const char * listname=0, Float_t min = 0, Float_t max =3, Float_t scaleHisto = -1., Int_t fitFunc = kFitLevi, Int_t vartype = AliPWGFunc::kdNdpt, const char * fileOut = 0, Bool_t wait = 0) {
 
   // Generic Macro to fit any particle using the PWG2/SPECTRA/Fit macros
   //
@@ -40,7 +40,9 @@ void FitParticle(const char * file, const char * histo, const char * partName,
   //   divided).
   // - fitFunc: id of the function, levi is the default
   //   valide options: kFitExpPt, kFitLevi, fFitExpMt, kFitBoltzmann, kFitBlastWave
-  // - varType: the variable used in the pt spectrum (see AliBWFunc.h)
+  // - varType: the variable used in the pt spectrum (see AliPWGFunc.h)
+
+  // Author: Michele Floris, CERN
 
   // load stuff
   gSystem->Load("libTree.so");
@@ -56,9 +58,9 @@ void FitParticle(const char * file, const char * histo, const char * partName,
 
 
   // get histo and draw
-  AliBWFunc * fm = new AliBWFunc;
-  fm->SetVarType(AliBWFunc::VarType_t(vartype));
-  //  fm->SetVarType(AliBWFunc::VarType_t(0));//FIXME
+  AliPWGFunc * fm = new AliPWGFunc;
+  fm->SetVarType(AliPWGFunc::VarType_t(vartype));
+  //  fm->SetVarType(AliPWGFunc::VarType_t(0));//FIXME
   //  cout << "Warning: hacked vartype" << endl;
   
   if (!TDatabasePDG::Instance()->GetParticle(partName)) {
@@ -152,14 +154,14 @@ void FitParticle(const char * file, const char * histo, const char * partName,
   }
   h->Sumw2();
   if (scaleHisto > 0) h->Scale(scaleHisto, "width");
-//   TH1 * h = AliBWTools::GetdNdPtFromOneOverPt((TH1*) gDirectory->Get(histo)); // FIXME
+//   TH1 * h = AliPWGHistoTools::GetdNdPtFromOneOverPt((TH1*) gDirectory->Get(histo)); // FIXME
 //   cout << "WARNING SCALING2PI" << endl;
 //   h->Scale(2*TMath::Pi());//Fixme
 
    h->Fit(func); // FIXME
    gMinuit->Command("SET STRATEGY 2"); // FIXME
 
-  if (!AliBWTools::Fit(h,func,min,max)) {
+  if (!AliPWGHistoTools::Fit(h,func,min,max)) {
     cout << "Fitting error!" << endl;
     //    return;    
   }
@@ -179,7 +181,7 @@ void FitParticle(const char * file, const char * histo, const char * partName,
 
   Double_t yield=0,yieldE=0;
   cout << "Y" << endl;
-  AliBWTools::GetYield(h,func,yield,yieldE);  
+  AliPWGHistoTools::GetYield(h,func,yield,yieldE);  
   cout << "YE" << endl;
   TLatex * l = new TLatex(2,(h->GetMaximum()+h->GetMinimum())/2,Form("%3.3f #pm %3.3f (%s)", yield,yieldE, func->GetName()));
   l->Draw();
@@ -210,7 +212,7 @@ void FitParticle(const char * file, const char * histo, const char * partName,
   }
   //  table->SetNextCol(func->GetParameter(1),func->GetParError(1),-4);
   table->SetNextCol(Form("%2.2f/%d",func->GetChisquare(),func->GetNDF()));
-  Float_t lowestPoint = TMath::Max(AliBWTools::GetLowestNotEmptyBinEdge(h),min);
+  Float_t lowestPoint = TMath::Max(AliPWGHistoTools::GetLowestNotEmptyBinEdge(h),min);
   //  Float_t yieldAbove  = func->Integral(lowestPoint,100);
   Float_t yieldBelow  = func->Integral(0,lowestPoint);
   table->SetNextCol(lowestPoint,-3);
@@ -220,8 +222,8 @@ void FitParticle(const char * file, const char * histo, const char * partName,
 
   // Float_t mean=0, meane=0;
   // Float_t mean2=0, mean2e=0;
-  // AliBWTools::GetMean      (func, mean,  meane , 0.,100., normPar);
-  // AliBWTools::GetMeanSquare(func, mean2, mean2e, 0.,100., normPar);
+  // AliPWGHistoTools::GetMean      (func, mean,  meane , 0.,100., normPar);
+  // AliPWGHistoTools::GetMeanSquare(func, mean2, mean2e, 0.,100., normPar);
   // table->SetNextCol(mean,  meane ,-4);
   // table->SetNextCol(mean2, mean2e,-4);
   //                    fMean2->IntegralError(0,100)/func->Integral(0,100),-7);