5 Plotter(
"canvas_" + (TString)histogram->GetName(), width, height),
6 _xAxisName(histogram->GetXaxis()->GetTitle()),
7 _yAxisName(histogram->GetYaxis()->GetTitle())
11 WELCOME_LOG <<
"Hello from the Plotter() constructor!";
33 void RootPlotter::addText(TString text,
double x,
double y,
int alignh,
int alignv,
double size,
int ndc,
int color){
37 TLatex* textL =
new TLatex(x, y, text);
39 if (ndc ==
true) textL->SetNDC();
40 textL->SetTextAlign(alignh*10 + alignv);
41 textL->SetTextSize(size);
42 textL->SetTextColor(color);
64 for (
unsigned int i = 1; i <
_histograms.size(); i++){
77 if (scaleFactor != 1.0){
86 gStyle->SetHistTopMargin(0.0);
88 THStack* histogramStack =
new THStack(
"stackedHistograms",
"stackedHistograms");
91 for (
unsigned int i = 0; i <
_histograms.size(); i++) {
98 histogramStack->Draw(
"hist");
101 histogramStack->GetYaxis()->SetNdivisions(
getHistogram(0)->GetYaxis()->GetNdivisions () );
102 histogramStack->GetYaxis()->CenterTitle (
getHistogram(0)->GetYaxis()->GetCenterTitle() );
103 histogramStack->GetXaxis()->SetNdivisions(
getHistogram(0)->GetXaxis()->GetNdivisions () );
104 histogramStack->GetXaxis()->CenterTitle (
getHistogram(0)->GetXaxis()->GetCenterTitle() );
112 if (scaleFactor != 1.0){
114 histogramStack->GetHistogram()->GetYaxis()->SetNdivisions(502);
118 histogramStack->DrawClone(
"hist");
120 delete histogramStack;
131 if (scaleFactor != 1.0){
156 for (
unsigned int i = 0; i <
_histograms.size(); i++){
168 for (
unsigned int i = 0; i <
_objToPlot.size(); i++){
169 if ( TString(
_objToPlot.at(i)->ClassName()).Contains(
"TGraph") ){
184 void RootPlotter::plot(TString plotDirectory, TString plotOptions, TPad* pad,
double scaleFactor){
192 if (plotOptions ==
"STACKED")
plotStacked(pad, scaleFactor);
193 else plotSame (pad, plotOptions, scaleFactor);
196 if (plotDirectory !=
"") {
200 pad->Print(plotDirectory +
".pdf");
201 pad->Print(plotDirectory +
".eps");
202 pad->Print(plotDirectory +
".png");
203 pad->Print(plotDirectory +
".C" );
static TString s_imageformat
void addObject(TObject *obj)
virtual void setCanvasDefaults(TPad *pad)
std::vector< TObject * > _histograms
std::vector< TObject * > _objToPlot
static TString s_imageformat2
void plotSame(TPad *pad, TString plotOptions, double scaleFactor=1.0)
TString & objDrawOptions(int i)
RootPlotter(TH1 *histogram, double width=300, double height=200)
virtual void plot(TString plotDirectory, TString plotOptions="", TPad *pad=0, double scaleFactor=1.0)
TString & drawOptions(int i)
void plotStacked(TPad *pad, double scaleFactor)
virtual void setHistogramStyle(TH1 *histogram, bool setMinMax=1)=0
void addText(TString text, double x, double y, int alignh=1, int alignv=2, double size=0.06, int ndc=true, int color=kBlack)
TH1 * getHistogram(int i)
std::vector< TString > _drawOptions
std::vector< TString > _objDrawOptions
static TString s_legend_position