No TF1/TF2 objects with the same name allowed in Root v3-10-01a
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Dec 2003 20:18:36 +0000 (20:18 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Dec 2003 20:18:36 +0000 (20:18 +0000)
EVGEN/AliGenHIJINGparaBa.cxx
EVGEN/AliGenParam.cxx
TPC/AliTPC.cxx
TPC/AliTPCPRF2D.cxx
TPC/AliTPCRF1D.cxx
TPC/AliTPCtrackerParam.cxx

index 170711a..683ad4c 100644 (file)
@@ -210,35 +210,35 @@ void AliGenHIJINGparaBa::Init()
     fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
     fETAba  = new TF1("etabaryon",&etabaryon,etaMin,etaMax,0);
 
-    TF1 *etaPic0 = new TF1("etapic",&etapic,    -7, 7, 0);
-    TF1 *etaKac0 = new TF1("etakac",&etakac,    -7, 7, 0);
-    TF1 *etaBar0 = new TF1("etabar",&etabaryon, -7, 7, 0);
+    TF1 etaPic0("etapic(-7,7)",&etapic,    -7, 7, 0);
+    TF1 etaKac0("etakac(-7,7)",&etakac,    -7, 7, 0);
+    TF1 etaBar0("etabar(-7,7)",&etabaryon, -7, 7, 0);
     
-    TF1 *ptPic0  = new TF1("ptpi",  &ptpi,     0., 15., 0);
-    TF1 *ptKac0  = new TF1("ptka",  &ptka,     0., 15., 0);
-    TF1 *ptBar0  = new TF1("ptbar", &ptbaryon, 0., 15., 0);
+    TF1 ptPic0("ptpi(0,15)",  &ptpi,     0., 15., 0);
+    TF1 ptKac0("ptka(0,15)",  &ptka,     0., 15., 0);
+    TF1 ptBar0("ptbar(0,15)", &ptbaryon, 0., 15., 0);
 
-    Float_t intETApi  = etaPic0->Integral(-0.5, 0.5);
-    Float_t intETAka  = etaKac0->Integral(-0.5, 0.5);
-    Float_t intETAba  = etaBar0->Integral(-0.5, 0.5);
+    Float_t intETApi  = etaPic0.Integral(-0.5, 0.5);
+    Float_t intETAka  = etaKac0.Integral(-0.5, 0.5);
+    Float_t intETAba  = etaBar0.Integral(-0.5, 0.5);
 
     Float_t scalePi   = 6979./(intETApi/1.5);
     Float_t scaleKa   =  657./(intETAka/2.0);
     Float_t scaleBa   =  364./(intETAba/2.0);
 
 //  Fraction of events corresponding to the selected pt-range    
-    Float_t intPt    = (0.837*ptPic0->Integral(0, 15)+
-                       0.105*ptKac0->Integral(0, 15)+
-                        0.058*ptBar0->Integral(0, 15));
-    Float_t intPtSel = (0.837*ptPic0->Integral(fPtMin, fPtMax)+
-                       0.105*ptKac0->Integral(fPtMin, fPtMax)+
-                       0.058*ptBar0->Integral(fPtMin, fPtMax));
+    Float_t intPt    = (0.837*ptPic0.Integral(0, 15)+
+                       0.105*ptKac0.Integral(0, 15)+
+                        0.058*ptBar0.Integral(0, 15));
+    Float_t intPtSel = (0.837*ptPic0.Integral(fPtMin, fPtMax)+
+                       0.105*ptKac0.Integral(fPtMin, fPtMax)+
+                       0.058*ptBar0.Integral(fPtMin, fPtMax));
     Float_t ptFrac   = intPtSel/intPt;
 
 //  Fraction of events corresponding to the selected eta-range    
-    Float_t intETASel  = (scalePi*etaPic0->Integral(etaMin, etaMax)+
-                         scaleKa*etaKac0->Integral(etaMin, etaMax)+
-                         scaleBa*etaBar0->Integral(etaMin, etaMax));
+    Float_t intETASel  = (scalePi*etaPic0.Integral(etaMin, etaMax)+
+                         scaleKa*etaKac0.Integral(etaMin, etaMax)+
+                         scaleBa*etaBar0.Integral(etaMin, etaMax));
 //  Fraction of events corresponding to the selected phi-range    
     Float_t phiFrac    = (fPhiMax-fPhiMin)/2/TMath::Pi();
 
index 9203eb9..84892b4 100644 (file)
@@ -173,9 +173,9 @@ void AliGenParam::Init()
     
     fPtPara->SetNpx(npx);
     
-    fYPara  = new TF1("Y -Parametrization",fYParaFunc,fYMin,fYMax,0);
-    TF1* ptPara = new TF1("Pt-Parametrization",fPtParaFunc,0,15,0);
-    TF1* yPara  = new TF1("Y -Parametrization",fYParaFunc,-6,6,0);
+    fYPara  = new TF1("Y-Parametrization",fYParaFunc,fYMin,fYMax,0);
+    TF1 ptPara("Pt-Parametrization(0,15)",fPtParaFunc,0,15,0);
+    TF1 yPara("Y-Parametrization(-6,6)",fYParaFunc,-6,6,0);
 
 //
 // dN/dy| y=0
@@ -185,9 +185,9 @@ void AliGenParam::Init()
     fdNdy0=fYParaFunc(&y1,&y2);
 //
 // Integral over generation region
-    Float_t intYS  = yPara ->Integral(fYMin, fYMax);
-    Float_t intPt0 = ptPara->Integral(0,15);
-    Float_t intPtS = ptPara->Integral(fPtMin,fPtMax);
+    Float_t intYS  = yPara.Integral(fYMin, fYMax);
+    Float_t intPt0 = ptPara.Integral(0,15);
+    Float_t intPtS = ptPara.Integral(fPtMin,fPtMax);
     Float_t phiWgt=(fPhiMax-fPhiMin)/2./TMath::Pi();
     if (fAnalog == kAnalog) {
        fYWgt  = intYS/fdNdy0;
index 97a4297..d52d0c3 100644 (file)
@@ -51,6 +51,8 @@
 #include <TTree.h>
 #include <TVector.h>
 #include <TVirtualMC.h>
+#include <TString.h>
+#include <TF2.h>
 
 #include "AliArrayBranch.h"
 #include "AliClusters.h"
@@ -1395,9 +1397,24 @@ void AliTPC::SetDefaults(){
     cerr<<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !\n" ;
      exit(3);
   }
+
+  TString s;
   prfinner->Read("prf_07504_Gati_056068_d02");
+  //PH Set different names
+  s=prfinner->GetGRF()->GetName();
+  s+="in";
+  prfinner->GetGRF()->SetName(s.Data());
+
   prfouter1->Read("prf_10006_Gati_047051_d03");
+  s=prfouter1->GetGRF()->GetName();
+  s+="out1";
+  prfouter1->GetGRF()->SetName(s.Data());
+
   prfouter2->Read("prf_15006_Gati_047051_d03");  
+  s=prfouter2->GetGRF()->GetName();
+  s+="out2";
+  prfouter2->GetGRF()->SetName(s.Data());
+
   f->Close();
   savedir->cd();
 
index 0331fbb..81cee46 100644 (file)
@@ -287,7 +287,7 @@ void AliTPCPRF2D::SetGauss(Float_t sigmaX, Float_t sigmaY,
   fOrigSigmaY=sigmaY;
   sprintf(fType,"Gauss");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",funGauss2D,-5.,5.,-5.,5.,4);
+  fGRF = new TF2("funGauss2D",funGauss2D,-5.,5.,-5.,5.,4);
   
   funParam[0]=sigmaX;
   funParam[1]=sigmaY;  
@@ -320,7 +320,7 @@ void AliTPCPRF2D::SetCosh(Float_t sigmaX, Float_t sigmaY,
   fOrigSigmaY=sigmaY; 
   sprintf(fType,"Cosh");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",        funCosh2D,-5.,5.,-5.,5.,4);   
+  fGRF = new TF2("funCosh2D",  funCosh2D,-5.,5.,-5.,5.,4);   
   funParam[0]=sigmaX;
   funParam[1]=sigmaY;
   funParam[2]=fK;  
@@ -351,7 +351,7 @@ void AliTPCPRF2D::SetGati(Float_t K3X, Float_t K3Y,
   fPadDistance=padDistance;  
   sprintf(fType,"Gati");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",        funGati2D,-5.,5.,-5.,5.,5);  
+  fGRF = new TF2("funGati2D",  funGati2D,-5.,5.,-5.,5.,5);  
  
   funParam[0]=padDistance;
   funParam[1]=K3X;
@@ -654,11 +654,11 @@ void AliTPCPRF2D::Streamer(TBuffer &R__b)
       if (strncmp(fType,"User",3)!=0){
        delete fGRF;  
         if (strncmp(fType,"Gauss",3)==0) 
-         fGRF = new TF2("fun",funGauss2D,-5.,5.,-5.,5.,4);
+         fGRF = new TF2("funGauss2D",funGauss2D,-5.,5.,-5.,5.,4);
         if (strncmp(fType,"Cosh",3)==0) 
-         fGRF = new TF2("fun",funCosh2D,-5.,5.,-5.,5.,4);
+         fGRF = new TF2("funCosh2D",funCosh2D,-5.,5.,-5.,5.,4);
         if (strncmp(fType,"Gati",3)==0) 
-         fGRF = new TF2("fun",funGati2D,-5.,5.,-5.,5.,5);      
+         fGRF = new TF2("funGati2D",funGati2D,-5.,5.,-5.,5.,5);      
         if (fGRF!=0) fGRF->SetParameters(funParam);
       }
       //calculate conversion coefitient to convert position to virtual wire
index ff3e1e0..dd1c4c2 100644 (file)
@@ -36,6 +36,7 @@
 #include "TPad.h"
 #include "TStyle.h"
 #include "TH1.h"
+#include <TString.h>
 
 extern TStyle * gStyle; 
 
@@ -98,8 +99,11 @@ AliTPCRF1D::AliTPCRF1D(const AliTPCRF1D &prf):TObject(prf)
   memcpy(this, &prf, sizeof(prf)); 
   fcharge = new Float_t[fNRF];
   memcpy(fcharge,prf.fcharge, fNRF);
-  fGRF = new TF1(*(prf.fGRF)); 
-
+  fGRF = new TF1(*(prf.fGRF));
+  //PH Change the name (add 0 to the end)
+  TString s(fGRF->GetName());
+  s+="0";
+  fGRF->SetName(s.Data());
 }
 
 AliTPCRF1D & AliTPCRF1D::operator = (const AliTPCRF1D &prf)
@@ -111,6 +115,10 @@ AliTPCRF1D & AliTPCRF1D::operator = (const AliTPCRF1D &prf)
   fcharge = new Float_t[fNRF];
   memcpy(fcharge,prf.fcharge, fNRF);
   fGRF = new TF1(*(prf.fGRF));
+   //PH Change the name (add 0 to the end)
+  TString s(fGRF->GetName());
+  s+="0";
+  fGRF->SetName(s.Data());
   return (*this);
 }
 
@@ -173,7 +181,7 @@ void AliTPCRF1D::SetGauss(Float_t sigma, Float_t padWidth,
   fpadWidth = padWidth;
   fkNorm = kNorm;
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF1("fun",funGauss,-5,5,1);
+  fGRF = new TF1("funGauss",funGauss,-5,5,1);
   funParam[0]=sigma;
   forigsigma=sigma;
   fGRF->SetParameters(funParam);
@@ -191,7 +199,7 @@ void AliTPCRF1D::SetCosh(Float_t sigma, Float_t padWidth,
   fpadWidth = padWidth;
   fkNorm = kNorm;
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF1("fun",        funCosh, -5.,5.,2);   
+  fGRF = new TF1("funCosh",    funCosh, -5.,5.,2);   
   funParam[0]=sigma;
   fGRF->SetParameters(funParam);
   forigsigma=sigma;
@@ -209,7 +217,7 @@ void AliTPCRF1D::SetGati(Float_t K3, Float_t padDistance, Float_t padWidth,
   fpadWidth = padWidth;
   fkNorm = kNorm;
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF1("fun",        funGati, -5.,5.,2);   
+  fGRF = new TF1("funGati",    funGati, -5.,5.,2);   
   funParam[0]=padDistance;
   funParam[1]=K3;  
   fGRF->SetParameters(funParam);
@@ -311,9 +319,9 @@ void AliTPCRF1D::Streamer(TBuffer &R__b)
       AliTPCRF1D::Class()->ReadBuffer(R__b, this);
       //read functions
  
-      if (strncmp(fType,"Gauss",3)==0) {delete fGRF; fGRF = new TF1("fun",funGauss,-5.,5.,4);}
-      if (strncmp(fType,"Cosh",3)==0)  {delete fGRF; fGRF = new TF1("fun",funCosh,-5.,5.,4);}
-      if (strncmp(fType,"Gati",3)==0)  {delete fGRF; fGRF = new TF1("fun",funGati,-5.,5.,4);}  
+      if (strncmp(fType,"Gauss",3)==0) {delete fGRF; fGRF = new TF1("funGauss",funGauss,-5.,5.,4);}
+      if (strncmp(fType,"Cosh",3)==0)  {delete fGRF; fGRF = new TF1("funCosh",funCosh,-5.,5.,4);}
+      if (strncmp(fType,"Gati",3)==0)  {delete fGRF; fGRF = new TF1("funGati",funGati,-5.,5.,4);}  
       if (fGRF) fGRF->SetParameters(funParam);     
 
    } else {
index 8428175..e42d3e0 100644 (file)
@@ -640,7 +640,7 @@ void AliTPCtrackerParam::AnalyzePulls(const Char_t *outName) {
 
   AliTPCkineGrid  pulls[5];
   TH1F *hDum = new TH1F("name","title",100,-7.,7.);
-  TF1 *g = new TF1("g","gaus");
+  TF1 g("g","gaus");
 
   InitializeKineGrid("pulls");
   InitializeKineGrid("DB");
@@ -736,29 +736,29 @@ void AliTPCtrackerParam::AnalyzePulls(const Char_t *outName) {
     // compute the sigma of the distributions
     for(Int_t i=0; i<nTotBins; i++) {
       if(hPulls0_[i].GetEntries()>10) {
-       g->SetRange(-3.*hPulls0_[i].GetRMS(),3.*hPulls0_[i].GetRMS());
+       g.SetRange(-3.*hPulls0_[i].GetRMS(),3.*hPulls0_[i].GetRMS());
        hPulls0_[i].Fit("g","R,Q,N");
-       pulls[0].SetParam(i,g->GetParameter(2));
+       pulls[0].SetParam(i,g.GetParameter(2));
       } else pulls[0].SetParam(i,-1.);
       if(hPulls1_[i].GetEntries()>10) {
-       g->SetRange(-3.*hPulls1_[i].GetRMS(),3.*hPulls1_[i].GetRMS());
+       g.SetRange(-3.*hPulls1_[i].GetRMS(),3.*hPulls1_[i].GetRMS());
        hPulls1_[i].Fit("g","R,Q,N");
-       pulls[1].SetParam(i,g->GetParameter(2));
+       pulls[1].SetParam(i,g.GetParameter(2));
       } else pulls[1].SetParam(i,-1.);
       if(hPulls2_[i].GetEntries()>10) {
-       g->SetRange(-3.*hPulls2_[i].GetRMS(),3.*hPulls2_[i].GetRMS());
+       g.SetRange(-3.*hPulls2_[i].GetRMS(),3.*hPulls2_[i].GetRMS());
        hPulls2_[i].Fit("g","R,Q,N");
-       pulls[2].SetParam(i,g->GetParameter(2));
+       pulls[2].SetParam(i,g.GetParameter(2));
       } else pulls[2].SetParam(i,-1.);
       if(hPulls3_[i].GetEntries()>10) {
-       g->SetRange(-3.*hPulls3_[i].GetRMS(),3.*hPulls3_[i].GetRMS());
+       g.SetRange(-3.*hPulls3_[i].GetRMS(),3.*hPulls3_[i].GetRMS());
        hPulls3_[i].Fit("g","R,Q,N");
-       pulls[3].SetParam(i,g->GetParameter(2));
+       pulls[3].SetParam(i,g.GetParameter(2));
       } else pulls[3].SetParam(i,-1.);
       if(hPulls4_[i].GetEntries()>10) {
-       g->SetRange(-3.*hPulls4_[i].GetRMS(),3.*hPulls4_[i].GetRMS());
+       g.SetRange(-3.*hPulls4_[i].GetRMS(),3.*hPulls4_[i].GetRMS());
        hPulls4_[i].Fit("g","R,Q,N");
-       pulls[4].SetParam(i,g->GetParameter(2));
+       pulls[4].SetParam(i,g.GetParameter(2));
       } else pulls[4].SetParam(i,-1.);
     } // loop on bins
 
@@ -861,7 +861,7 @@ void AliTPCtrackerParam::AnalyzeResolutions(Int_t pdg) {
   TH1F *hDumP4 = new TH1F("nameP4","dC",100,-0.0005,0.0005);
   TH1F *hDumPt = new TH1F("namePt","dp_{T}/p_{T}",100,-0.5,0.5);
 
-  TF1 *g = new TF1("g","gaus");
+  TF1 g("g","gaus");
 
   // create histograms for the all the bins
   TH1F *hP0_=NULL;
@@ -909,19 +909,19 @@ void AliTPCtrackerParam::AnalyzeResolutions(Int_t pdg) {
   // compute the sigma of the distributions
   for(Int_t i=0; i<nPtBins; i++) {
     if(hP0_[i].GetEntries()>10) {
-      g->SetRange(-3.*hP0_[i].GetRMS(),3.*hP0_[i].GetRMS());
+      g.SetRange(-3.*hP0_[i].GetRMS(),3.*hP0_[i].GetRMS());
       hP0_[i].Fit("g","R,Q,N");
-      dP0[i] = g->GetParameter(2);
+      dP0[i] = g.GetParameter(2);
     } else dP0[i] = 0.;
     if(hP4_[i].GetEntries()>10) {
-      g->SetRange(-3.*hP4_[i].GetRMS(),3.*hP4_[i].GetRMS());
+      g.SetRange(-3.*hP4_[i].GetRMS(),3.*hP4_[i].GetRMS());
       hP4_[i].Fit("g","R,Q,N");
-      dP4[i] = g->GetParameter(2);
+      dP4[i] = g.GetParameter(2);
     } else dP4[i] = 0.;
     if(hPt_[i].GetEntries()>10) {
-      g->SetRange(-3.*hPt_[i].GetRMS(),3.*hPt_[i].GetRMS());
+      g.SetRange(-3.*hPt_[i].GetRMS(),3.*hPt_[i].GetRMS());
       hPt_[i].Fit("g","R,Q,N");
-      dPtToPt[i] = 100.*g->GetParameter(2);
+      dPtToPt[i] = 100.*g.GetParameter(2);
     } else dPtToPt[i] = 0.;
   } // loop on bins