From 5d6816d1348ea9b7fc4f214e30513d988e803704 Mon Sep 17 00:00:00 2001 From: mivanov Date: Fri, 14 Feb 2014 16:27:06 +0100 Subject: [PATCH] Adding Title decription for the graphs --- STAT/TStatToolkit.cxx | 24 ++++++++++++++++++------ STAT/TStatToolkit.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/STAT/TStatToolkit.cxx b/STAT/TStatToolkit.cxx index ec1ea5bbe50..4a5fc4480fe 100644 --- a/STAT/TStatToolkit.cxx +++ b/STAT/TStatToolkit.cxx @@ -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;iGetN();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!"<Draw(drawStr.Data(), cutStr.Data(), "goff"); if (entries == -1) { cerr<<"TTree draw returns -1"<GetV3()) dim = 3; if(dim > 2){ cerr<<"TTree has more than 2 dimensions (not yet supported)"<GetYaxis()->SetTitle(tree->GetHistogram()->GetYaxis()->GetTitle()); hOut->Draw("colz"); } - + return hOut; } diff --git a/STAT/TStatToolkit.h b/STAT/TStatToolkit.h index a6c9205a15d..0c798221e66 100644 --- a/STAT/TStatToolkit.h +++ b/STAT/TStatToolkit.h @@ -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: // -- 2.39.3