]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliCFEffGrid : corrected bin limits in constructor
authorrvernet <rvernet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Sep 2009 15:13:15 +0000 (15:13 +0000)
committerrvernet <rvernet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Sep 2009 15:13:15 +0000 (15:13 +0000)
AliCFGridSparse: added histogram name in projection

CORRFW/AliCFEffGrid.cxx
CORRFW/AliCFGridSparse.cxx

index a8f50a0908deef1a3e5a777ca58953860acf9c60..dfd7ae606f1683b6b93d40baa3bc5a95097b737b 100644 (file)
@@ -73,7 +73,11 @@ AliCFEffGrid::AliCFEffGrid(const Char_t* name, const Char_t* title, const AliCFC
   //assign the container;
   fContainer=&c;
   for (Int_t iVar=0; iVar<GetNVar(); iVar++) {
-    SetBinLimits(iVar,GetBinLimits(iVar));
+    Int_t nbins = c.GetNBins(iVar);
+    Double_t* array=new Double_t[nbins+1] ;
+    c.GetBinLimits(iVar,array);
+    SetBinLimits(iVar,array);
+    delete array ;
   }
   for (Int_t iVar=0; iVar<GetNVar(); iVar++) SetVarTitle(iVar,c.GetVarTitle(iVar));
 }
@@ -236,6 +240,7 @@ TH1D *AliCFEffGrid::Project(Int_t ivar) const
   delete hNum; delete hDen;
   TH1D* h = ratio->Projection(0);
   h->SetXTitle(GetVarTitle(ivar));
+  h->SetName(Form("%s_proj-%s",GetName(),GetVarTitle(ivar)));
   h->SetTitle(Form("%s projected on %s",GetTitle(),GetVarTitle(ivar)));
   return h ;
 } 
@@ -257,9 +262,10 @@ TH2D *AliCFEffGrid::Project(Int_t ivar1,Int_t ivar2) const
   THnSparse* ratio = (THnSparse*)hNum->Clone();
   ratio->Divide(hNum,hDen,1.,1.,"B");
   delete hNum; delete hDen;
-  TH2D* h = ratio->Projection(0,1);
+  TH2D* h = ratio->Projection(1,0);
   h->SetXTitle(GetVarTitle(ivar1));
   h->SetYTitle(GetVarTitle(ivar2));
+  h->SetName(Form("%s_proj-%s,%s",GetName(),GetVarTitle(ivar1),GetVarTitle(ivar2)));
   h->SetTitle(Form("%s projected on %s-%s",GetTitle(),GetVarTitle(ivar1),GetVarTitle(ivar2)));
   return h;
 } 
@@ -285,6 +291,7 @@ TH3D *AliCFEffGrid::Project(Int_t ivar1, Int_t ivar2, Int_t ivar3) const
   h->SetXTitle(GetVarTitle(ivar1));
   h->SetYTitle(GetVarTitle(ivar2));
   h->SetZTitle(GetVarTitle(ivar3));
+  h->SetName(Form("%s_proj-%s,%s,%s",GetName(),GetVarTitle(ivar1),GetVarTitle(ivar2),GetVarTitle(ivar3)));
   h->SetTitle(Form("%s projected on %s-%s-%s",GetTitle(),GetVarTitle(ivar1),GetVarTitle(ivar2),GetVarTitle(ivar3)));
   return h;
 } 
index 12eed5eee53f1e49c4a69da52b5cc486e4367ef3..a72e160fb24df9107f8a152ad1093fa90c59498b 100755 (executable)
@@ -126,6 +126,7 @@ TH1D *AliCFGridSparse::Project(Int_t ivar) const
 
   TH1D *hist=fData->Projection(ivar);
   hist->SetXTitle(GetVarTitle(ivar));
+  hist->SetName(Form("%s_proj-%s",GetName(),GetVarTitle(ivar)));
   hist->SetTitle(Form("%s: projection on %s",GetTitle(),GetVarTitle(ivar)));
   return hist;
 }
@@ -139,6 +140,7 @@ TH2D *AliCFGridSparse::Project(Int_t ivar1, Int_t ivar2) const
   TH2D *hist=fData->Projection(ivar2,ivar1); //notice inverted axis (THnSparse uses TH3 2d-projection convention...)
   hist->SetXTitle(GetVarTitle(ivar1));
   hist->SetYTitle(GetVarTitle(ivar2));
+  hist->SetName(Form("%s_proj-%s,%s",GetName(),GetVarTitle(ivar1),GetVarTitle(ivar2)));
   hist->SetTitle(Form("%s: projection on %s-%s",GetTitle(),GetVarTitle(ivar1),GetVarTitle(ivar2)));
   return hist;
 }
@@ -153,6 +155,7 @@ TH3D *AliCFGridSparse::Project(Int_t ivar1, Int_t ivar2, Int_t ivar3) const
   hist->SetXTitle(GetVarTitle(ivar1));
   hist->SetYTitle(GetVarTitle(ivar2));
   hist->SetZTitle(GetVarTitle(ivar3));
+  hist->SetName(Form("%s_proj-%s,%s,%s",GetName(),GetVarTitle(ivar1),GetVarTitle(ivar2),GetVarTitle(ivar3)));
   hist->SetTitle(Form("%s: projection on %s-%s-%s",GetTitle(),GetVarTitle(ivar1),GetVarTitle(ivar2),GetVarTitle(ivar3)));
   return hist;
 }