]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding Title decription for the graphs
authormivanov <marian.ivanov@cern.ch>
Fri, 14 Feb 2014 15:27:06 +0000 (16:27 +0100)
committermivanov <marian.ivanov@cern.ch>
Fri, 14 Feb 2014 15:27:06 +0000 (16:27 +0100)
STAT/TStatToolkit.cxx
STAT/TStatToolkit.h

index ec1ea5bbe500bf3ea0f9b3c648bc0d3595f65bf9..4a5fc4480fee4ad34e86aaa6da7e14010e90e28c 100644 (file)
@@ -1433,6 +1433,12 @@ TGraphErrors * TStatToolkit::MakeGraphErrors(TTree * tree, const char * expr, co
   graph->SetMarkerStyle(mstyle); 
   graph->SetMarkerColor(mcolor);
   graph->SetLineColor(mcolor);
+  graph->SetTitle(expr);
+  TString chstring(expr);
+  TObjArray *charray = chstring.Tokenize(":");
+  graph->GetXaxis()->SetTitle(charray->At(1)->GetName());
+  graph->GetYaxis()->SetTitle(charray->At(0)->GetName());
+  delete charray;
   if (msize>0) graph->SetMarkerSize(msize);
   for(Int_t i=0;i<graph->GetN();i++) graph->GetX()[i]+=offset;
   return graph;
@@ -1523,7 +1529,13 @@ TGraph * TStatToolkit::MakeGraphSparse(TTree * tree, const char * expr, const ch
   delete [] runNumber;
   delete [] index;
   delete [] newBins;
-  //
+  // 
+  graphNew->SetTitle(expr);
+  TString chstring(expr);
+  TObjArray *charray = chstring.Tokenize(":");
+  graphNew->GetXaxis()->SetTitle(charray->At(1)->GetName());
+  graphNew->GetYaxis()->SetTitle(charray->At(0)->GetName());
+  delete charray;
   return graphNew;
 }
 
@@ -1759,7 +1771,7 @@ void  TStatToolkit::DrawStatusGraphs(TObjArray* oaMultGr)
 }
 
 
-void TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const char* cuts, const char* histoname, const char* histotitle, Int_t nsigma, Float_t fraction )
+TH1* TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const char* cuts, const char* histoname, const char* histotitle, Int_t nsigma, Float_t fraction )
 {
   //
   // Draw histogram from TTree with robust range
@@ -1778,14 +1790,14 @@ void TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const ch
 
    if(!tree) {
      cerr<<" Tree pointer is NULL!"<<endl;
-     return;
+     return 0;
    }
 
    // get entries
    Int_t entries = tree->Draw(drawStr.Data(), cutStr.Data(), "goff");
    if (entries == -1) {
      cerr<<"TTree draw returns -1"<<endl;
-     return;
+     return 0;
    }
 
    // get dimension
@@ -1794,7 +1806,7 @@ void TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const ch
    if(tree->GetV3()) dim = 3;
    if(dim > 2){
      cerr<<"TTree has more than 2 dimensions (not yet supported)"<<endl;
-     return;
+     return 0;
    }
 
    // draw robust
@@ -1819,5 +1831,5 @@ void TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const ch
      hOut->GetYaxis()->SetTitle(tree->GetHistogram()->GetYaxis()->GetTitle());
      hOut->Draw("colz");
    }
-
+   return hOut;
 }
index a6c9205a15dead0b5b6ec90809ee9a02404a8987..0c798221e668b9ee421697dad6fe861810561fa6 100644 (file)
@@ -81,7 +81,7 @@ class TStatToolkit : public TObject
   //
   // TTree function for robust draw
   //
-  static void DrawHistogram(TTree * tree, const char* drawCommand, const char* cuts = "1", const char* hname = "histo", const char* htitle = "histo", Int_t nsigma = 4, Float_t fraction = 0.75);
+  static TH1* DrawHistogram(TTree * tree, const char* drawCommand, const char* cuts = "1", const char* hname = "histo", const char* htitle = "histo", Int_t nsigma = 4, Float_t fraction = 0.75);
   //
   // TestFunctions:
   //