FuncChiRep.cxx
Go to the documentation of this file.
1 
12 #include "FuncChiRep.h"
13 
14 #include "graphics/ViewBase.h"
15 #include "pattern/string_convert.h"
17 
18 #include <iomanip>
19 #include <sstream>
20 
21 using std::string;
22 
23 using namespace hippodraw;
24 
26  : TextRepBase ( "Chi-squared" )
27 {
28 }
29 
31  : TextRepBase( rep )
32 {
33 }
34 
36 {
37  return new FuncChiRep ( *this );
38 }
39 
40 void
43  ViewBase & view )
44 {
45  const FunctionProjector & projector
46  = dynamic_cast< const FunctionProjector & > ( proj );
47 
48  int dof = projector.degreesOfFreedom ();
49 
50  std::ostringstream message;
51  message << "chi^2 / dof = "
52  << std::setprecision(3)
53  << projector.objectiveValue()
54  << " / " << dof;
55 
56  view.drawText ( message.str(), 5.0, 0.0, m_size, 0, 'l', 't', true,
57  0, &m_color );
58 }
int degreesOfFreedom() const
Returns the number of degrees of freedom in the fit.
FuncChiRep()
The default constructor.
Definition: FuncChiRep.cxx:25
A base class for representations that draws a value as text.
Definition: TextRepBase.h:27
return rep
Definition: Inspector.cxx:3843
The namespace for conversion to string.
double objectiveValue() const
Returns the objective value (chi2 or likelihood) between the function and the data.
Color m_color
The color of the representation.
Definition: RepBase.h:57
float m_size
The size of the representation.
Definition: RepBase.h:63
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
The abstract base class for views.
Definition: ViewBase.h:62
hippodraw::FunctionProjector class interface
virtual void drawText(const std::string &s, float x, float y, float fontsize, float angle=0.0, char xp= 'l', char yp= 't', bool resize=false, const FontBase *font=0, const Color *color=0)=0
Draws a text string at a point in the view&#39;s coordinate system.
A PointRep that draws the Chi-squared of a function on a display.
Definition: FuncChiRep.h:26
virtual RepBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
Definition: FuncChiRep.cxx:35
hippodraw::ViewBase class interface
virtual void drawProjectedValues(ProjectorBase &projector, ViewBase &view)
Draws the values from the projector to the view.
Definition: FuncChiRep.cxx:42
The base class for the point representation hierarchy.
Definition: RepBase.h:45
FuncChiRep class interface.
A projector that plots one function.

Generated for HippoDraw Class Library by doxygen