CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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="")
 Draw on canvas. More...
 
void dumpToFile (const char *RootFileName, const char *options)
 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="")
 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 ()
 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 ()
 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.5
Date:
2009/09/23 19:41:22
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.

Definition at line 22 of file ExclusionBandPlot.cc.

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

30  :
31  StatisticalPlot(name,title,false){
32 
33  // Prepare errorbars
34  double* y_down_bars2 = new double[n_points];
35  double* y_down_bars1 = new double[n_points];
36  double* y_up_bars1 = new double[n_points];
37  double* y_up_bars2 = new double[n_points];
38 
39  for (int i=0;i<n_points;++i){
40  y_down_bars2[i]=y_vals[i]-y_down_points2[i];
41  y_down_bars1[i]=y_vals[i]-y_down_points1[i];
42  y_up_bars2[i]=y_up_points2[i]-y_vals[i];
43  y_up_bars1[i]=y_up_points1[i]-y_vals[i];
44  }
45 
46  // bline
47  m_y_line_graph = new TGraph(n_points, x_vals, y_vals);
48  m_y_line_graph->SetLineWidth(2);
49  m_y_line_graph->SetLineStyle(2);
50  m_y_line_graph->SetFillColor(kWhite);
51 
52 
53 
54  // y band 1 sigma
55  m_y_band_graph_1sigma = new TGraphAsymmErrors(n_points,
56  x_vals,
57  y_vals,
58  0,
59  0,
60  y_down_bars1,
61  y_up_bars1);
62  m_y_band_graph_1sigma->SetFillColor(kGreen);
63  m_y_band_graph_1sigma->SetLineColor(kGreen);
64  m_y_band_graph_1sigma->SetMarkerColor(kGreen);
65 
66  // y band 2 sigma
67  m_y_band_graph_2sigma = new TGraphAsymmErrors(n_points,
68  x_vals,
69  y_vals,
70  0,
71  0,
72  y_down_bars2,
73  y_up_bars2);
74  m_y_band_graph_2sigma->SetFillColor(kYellow);
75  m_y_band_graph_2sigma->SetFillColor(kYellow);
76  m_y_band_graph_2sigma->SetLineColor(kYellow);
77  m_y_band_graph_2sigma->SetMarkerColor(kYellow);
78  m_y_band_graph_2sigma->GetYaxis()->SetTitle("#sigma/#sigma_{SM}");
79 
80  // Line for 1
81  m_one_line = new TLine(m_y_line_graph->GetXaxis()->GetXmin(),1,
82  m_y_line_graph->GetXaxis()->GetXmax(),1);
83 
84  // The legend
85 
86  m_legend = new TLegend(0.60,0.78,0.98,0.98);
87  m_legend->SetName("SM exclusion");
88  m_legend->AddEntry(m_y_band_graph_1sigma,"#pm 1#sigma");
89  m_legend->AddEntry(m_y_band_graph_2sigma,"#pm 2#sigma");
90  m_legend->AddEntry(m_y_line_graph,title);
91 
92  m_legend->SetFillColor(0);
93 
94  delete[] y_down_bars2;
95  delete[] y_down_bars1;
96  delete[] y_up_bars2;
97  delete[] y_up_bars1;
98 
99  }
int i
Definition: DBlmapReader.cc:9
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.
StatisticalPlot(const char *name, const char *title, bool verbosity=true)
Constructor.
ExclusionBandPlot::~ExclusionBandPlot ( )

Destructor.

Definition at line 103 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.

103  {
104 
105  delete m_y_line_graph;
106 
107  delete m_y_band_graph_1sigma;
108  delete m_y_band_graph_2sigma;
109 
110  delete m_one_line;
111 
112  delete m_legend;
113 
114  }
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 = "")
virtual

Draw on canvas.

Implements StatisticalPlot.

Definition at line 148 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().

148  {
149 
150  setCanvas(new TCanvas(GetName(),GetTitle()));
151  getCanvas()->cd();
152 
153  getCanvas()->SetGridx();
154  getCanvas()->SetGridy();
155 
156  TString opt(options);
157  // Bands
158  if (opt.Contains("4")==0){
159  m_y_band_graph_2sigma->Draw("A3");
160  m_y_band_graph_1sigma->Draw("3");
161  }
162  else{
163  m_y_band_graph_2sigma->Draw("A4");
164  m_y_band_graph_1sigma->Draw("4");
165  }
166 
167  // Lines
168  if (opt.Contains("4")==0){
169  m_y_line_graph->Draw("L");
170  }
171  else{
172  m_y_line_graph->Draw("C");
173  }
174 
175  m_one_line->Draw("Same");
176 
177  // Legend
178  m_legend->Draw("Same");
179 
180  }
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 
)
virtual

All the objects are written to rootfile.

Implements StatisticalPlot.

Definition at line 184 of file ExclusionBandPlot.cc.

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

184  {
185 
186  TFile ofile(RootFileName,options);
187  ofile.cd();
188 
189  // Bands
190  m_y_band_graph_2sigma->Write("band_2sigma");
191  m_y_band_graph_1sigma->Draw("band_1sigma");
192 
193  // Lines
194  m_y_line_graph->Draw("line");
195 
196  // Legend
197  m_legend->Draw("IamTheLegend");
198 
199  ofile.Close();
200 
201  }
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 = "")
virtual

Print the relevant information.

Implements StatisticalPlot.

Definition at line 205 of file ExclusionBandPlot.cc.

References gather_cfg::cout.

205  {
206  std::cout << "\nExclusionBandPlot object " << GetName() << ":\n";
207  }
tuple cout
Definition: gather_cfg.py:121
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 142 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

142  {
143  m_y_band_graph_2sigma->SetTitle(title);
144  }
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 122 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

122  {
123  m_y_band_graph_2sigma->GetXaxis()->SetTitle(title);
124  }
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 132 of file ExclusionBandPlot.cc.

References m_y_band_graph_2sigma.

132  {
133  m_y_band_graph_2sigma->GetYaxis()->SetTitle(title);
134  }
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(), ExclusionBandPlot(), and ~ExclusionBandPlot().

TLine* ExclusionBandPlot::m_one_line
private

The line at 1.

Definition at line 77 of file ExclusionBandPlot.h.

Referenced by draw(), ExclusionBandPlot(), 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(), ExclusionBandPlot(), 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(), ExclusionBandPlot(), 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(), ExclusionBandPlot(), and ~ExclusionBandPlot().