CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ExclusionBandPlot Class Reference

ExclusionBandPlot: plot a la tevatron for SM eclusion in function of mass. More...

#include <ExclusionBandPlot.h>

Inheritance diagram for ExclusionBandPlot:
StatisticalPlot

Public Member Functions

void draw (const char *options="") override
 Draw on canvas. More...
 
void dumpToFile (const char *RootFileName, const char *options) override
 All the objects are written to rootfile. More...
 
 ExclusionBandPlot (const char *name, const char *title, const int n_points, double *x_vals, double *y_vals, double *y_up_bars1, double *y_down_bars1, double *y_up_bars2, double *y_down_bars2)
 Constructor. More...
 
void print (const char *options="") override
 Print the relevant information. More...
 
void setTitle (const char *title)
 Set the title of the plot. More...
 
void setXaxisTitle (const char *title)
 Set the title of the x axis. More...
 
void setYaxisTitle (const char *title)
 Set the title of the x axis. More...
 
 ~ExclusionBandPlot () override
 Destructor. More...
 
- Public Member Functions inherited from StatisticalPlot
void dumpToImage (const char *filename)
 Write an image on disk. More...
 
TCanvas * getCanvas ()
 Get the canvas. More...
 
bool is_verbose ()
 get the verbosity More...
 
void setCanvas (TCanvas *new_canvas)
 Set the canvas. More...
 
void setVerbosity (bool verbosity)
 Set the verbosity. More...
 
 StatisticalPlot (const char *name, const char *title, bool verbosity=true)
 Constructor. More...
 
 ~StatisticalPlot () override
 Destructor. More...
 

Private Attributes

TLegend * m_legend
 The legend. More...
 
TLine * m_one_line
 The line at 1. More...
 
TGraph * m_y_band_graph_1sigma
 The band 1 sigma. More...
 
TGraph * m_y_band_graph_2sigma
 The band 2 sigma. More...
 
TGraph * m_y_line_graph
 The line. More...
 

Detailed Description

ExclusionBandPlot: plot a la tevatron for SM eclusion in function of mass.

Revision
1.4
Date
2009/05/15 09:55:42
Author
D. Piparo (danilo.piparo<at>cern.ch), G. Schott - Universitaet Karlsruhe

Yet another band plot, this time for sm exclusion, following the examples of the Tevatron Higgs WG.

Definition at line 29 of file ExclusionBandPlot.h.

Constructor & Destructor Documentation

ExclusionBandPlot::ExclusionBandPlot ( const char *  name,
const char *  title,
const int  n_points,
double *  x_vals,
double *  y_vals,
double *  y_up_bars1,
double *  y_down_bars1,
double *  y_up_bars2,
double *  y_down_bars2 
)

Constructor.

ExclusionBandPlot::~ExclusionBandPlot ( )
override

Destructor.

Definition at line 102 of file ExclusionBandPlot.cc.

References m_legend, m_one_line, m_y_band_graph_1sigma, m_y_band_graph_2sigma, and m_y_line_graph.

102  {
103 
104  delete m_y_line_graph;
105 
106  delete m_y_band_graph_1sigma;
107  delete m_y_band_graph_2sigma;
108 
109  delete m_one_line;
110 
111  delete m_legend;
112 
113  }
TGraph * m_y_band_graph_1sigma
The band 1 sigma.
TGraph * m_y_band_graph_2sigma
The band 2 sigma.
TGraph * m_y_line_graph
The line.
TLegend * m_legend
The legend.
TLine * m_one_line
The line at 1.

Member Function Documentation

void ExclusionBandPlot::draw ( const char *  options = "")
overridevirtual

Draw on canvas.

Implements StatisticalPlot.

Definition at line 147 of file ExclusionBandPlot.cc.

References StatisticalPlot::getCanvas(), m_legend, m_one_line, m_y_band_graph_1sigma, m_y_band_graph_2sigma, m_y_line_graph, and StatisticalPlot::setCanvas().

147  {
148 
149  setCanvas(new TCanvas(GetName(),GetTitle()));
150  getCanvas()->cd();
151 
152  getCanvas()->SetGridx();
153  getCanvas()->SetGridy();
154 
155  TString opt(options);
156  // Bands
157  if (opt.Contains("4")==0){
158  m_y_band_graph_2sigma->Draw("A3");
159  m_y_band_graph_1sigma->Draw("3");
160  }
161  else{
162  m_y_band_graph_2sigma->Draw("A4");
163  m_y_band_graph_1sigma->Draw("4");
164  }
165 
166  // Lines
167  if (opt.Contains("4")==0){
168  m_y_line_graph->Draw("L");
169  }
170  else{
171  m_y_line_graph->Draw("C");
172  }
173 
174  m_one_line->Draw("Same");
175 
176  // Legend
177  m_legend->Draw("Same");
178 
179  }
TGraph * m_y_band_graph_1sigma
The band 1 sigma.
TGraph * m_y_band_graph_2sigma
The band 2 sigma.
TGraph * m_y_line_graph
The line.
void setCanvas(TCanvas *new_canvas)
Set the canvas.
TLegend * m_legend
The legend.
TLine * m_one_line
The line at 1.
TCanvas * getCanvas()
Get the canvas.
void ExclusionBandPlot::dumpToFile ( const char *  RootFileName,
const char *  options 
)
overridevirtual

All the objects are written to rootfile.

Implements StatisticalPlot.

Definition at line 183 of file ExclusionBandPlot.cc.

References m_legend, m_y_band_graph_1sigma, m_y_band_graph_2sigma, m_y_line_graph, and checklumidiff::ofile.

183  {
184 
185  TFile ofile(RootFileName,options);
186  ofile.cd();
187 
188  // Bands
189  m_y_band_graph_2sigma->Write("band_2sigma");
190  m_y_band_graph_1sigma->Draw("band_1sigma");
191 
192  // Lines
193  m_y_line_graph->Draw("line");
194 
195  // Legend
196  m_legend->Draw("IamTheLegend");
197 
198  ofile.Close();
199 
200  }
TGraph * m_y_band_graph_1sigma
The band 1 sigma.
TGraph * m_y_band_graph_2sigma
The band 2 sigma.
TGraph * m_y_line_graph
The line.
TLegend * m_legend
The legend.
void ExclusionBandPlot::print ( const char *  options = "")
overridevirtual

Print the relevant information.

Implements StatisticalPlot.

Definition at line 204 of file ExclusionBandPlot.cc.

References gather_cfg::cout.

204  {
205  std::cout << "\nExclusionBandPlot object " << GetName() << ":\n";
206  }
void ExclusionBandPlot::setTitle ( const char *  title)

Set the title of the plot.

The title is here set only for the plot of the 2sigma band plot. Indeed its axes will be the only one to be drawn.

Definition at line 141 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

141  {
142  m_y_band_graph_2sigma->SetTitle(title);
143  }
TGraph * m_y_band_graph_2sigma
The band 2 sigma.
void ExclusionBandPlot::setXaxisTitle ( const char *  title)

Set the title of the x axis.

The title of the x axis is here set only for the plot of the 2sigma band plot. Indeed its axes will be the only one to be drawn.

Definition at line 121 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

121  {
122  m_y_band_graph_2sigma->GetXaxis()->SetTitle(title);
123  }
TGraph * m_y_band_graph_2sigma
The band 2 sigma.
void ExclusionBandPlot::setYaxisTitle ( const char *  title)

Set the title of the x axis.

The title of the y axis is here set only for the plot of the 2sigma band plot. Indeed its axes will be the only one to be drawn.

Definition at line 131 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

131  {
132  m_y_band_graph_2sigma->GetYaxis()->SetTitle(title);
133  }
TGraph * m_y_band_graph_2sigma
The band 2 sigma.

Member Data Documentation

TLegend* ExclusionBandPlot::m_legend
private

The legend.

Definition at line 80 of file ExclusionBandPlot.h.

Referenced by draw(), dumpToFile(), and ~ExclusionBandPlot().

TLine* ExclusionBandPlot::m_one_line
private

The line at 1.

Definition at line 77 of file ExclusionBandPlot.h.

Referenced by draw(), and ~ExclusionBandPlot().

TGraph* ExclusionBandPlot::m_y_band_graph_1sigma
private

The band 1 sigma.

Definition at line 71 of file ExclusionBandPlot.h.

Referenced by draw(), dumpToFile(), and ~ExclusionBandPlot().

TGraph* ExclusionBandPlot::m_y_band_graph_2sigma
private

The band 2 sigma.

Definition at line 74 of file ExclusionBandPlot.h.

Referenced by draw(), dumpToFile(), setTitle(), setXaxisTitle(), setYaxisTitle(), and ~ExclusionBandPlot().

TGraph* ExclusionBandPlot::m_y_line_graph
private

The line.

Definition at line 68 of file ExclusionBandPlot.h.

Referenced by draw(), dumpToFile(), and ~ExclusionBandPlot().