Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 476

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>HippoDraw Class Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="hippoApp.ico">
</head><body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_974d432048ef135a7d3fc83794dbf3e9.html">binners</a>
  </div>
</div>
<div class="contents">
<h1>BinnerAxisLog.cxx</h1><a href="BinnerAxisLog_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#endif</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="BinnerAxisLog_8h.html" title="hippodraw::BinnerAxisLog class interface">binners/BinnerAxisLog.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#ifdef ITERATOR_MEMBER_DEFECT</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="keyword">using namespace </span>std;
<a name="l00027"></a>00027 <span class="preprocessor">#else</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="keyword">using</span> std::max;
<a name="l00029"></a>00029 <span class="keyword">using</span> std::pow;
<a name="l00030"></a>00030 <span class="keyword">using</span> std::upper_bound;
<a name="l00031"></a>00031 <span class="keyword">using</span> std::vector;
<a name="l00032"></a>00032 <span class="preprocessor">#endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="keyword">using namespace </span>hippodraw;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 BinnerAxisLog::
<a name="l00037"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a2dd549dec7c960f7045a526967e4b05f">00037</a> BinnerAxisLog ()
<a name="l00038"></a>00038   : <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> ( <span class="stringliteral">&quot;BinnerLog&quot;</span> )
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a5f4f376b4452578da1b52d8f3ed88f03">00042</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a2dd549dec7c960f7045a526967e4b05f" title="The default constructor.">BinnerAxisLog::BinnerAxisLog</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html" title="The class for bins of logarithmically increasing widths.">BinnerAxisLog</a> &amp; binner )
<a name="l00043"></a>00043   : <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> ( binner ),
<a name="l00044"></a>00044     bins ( binner.bins )
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 
<a name="l00048"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a350fcde41246632ffc521b6326194751">00048</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a350fcde41246632ffc521b6326194751" title="The destructor.">BinnerAxisLog::~BinnerAxisLog</a> ()
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> *
<a name="l00053"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#aa089c15ed3c9ba5476b4605b225da812">00053</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#aa089c15ed3c9ba5476b4605b225da812" title="The clone function returns an object of its own kind which is a copy of this object...">BinnerAxisLog::clone</a> ()
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a2dd549dec7c960f7045a526967e4b05f" title="The default constructor.">BinnerAxisLog</a> ( *<span class="keyword">this</span> );
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="keywordtype">void</span>
<a name="l00059"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac91b4ebc1353aa40d8f7d1b2f3131ad5">00059</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac91b4ebc1353aa40d8f7d1b2f3131ad5" title="Sets m_num_bins.">BinnerAxisLog::axisSetNumberOfBins</a>( <span class="keywordtype">int</span> nb )
<a name="l00060"></a>00060 {
<a name="l00061"></a>00061   <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> = nb;
<a name="l00062"></a>00062 }
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 <span class="keywordtype">int</span>
<a name="l00065"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac7c9148cc33946148bb0fcec1d7f3858">00065</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac7c9148cc33946148bb0fcec1d7f3858" title="Returns the number of the bin in which the x value and y value are situated.">BinnerAxisLog::axisBinNumber</a> ( <span class="keywordtype">double</span> x )<span class="keyword"> const</span>
<a name="l00066"></a>00066 <span class="keyword"></span>{
<a name="l00067"></a>00067   vector&lt;double&gt;::const_iterator it
<a name="l00068"></a>00068     = upper_bound ( <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.begin(), <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.end(), x );
<a name="l00069"></a>00069   <span class="keywordtype">int</span> i = it - <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.begin();
<a name="l00070"></a>00070   <span class="keywordflow">if</span>( i &lt; 1 ) i = 0;
<a name="l00071"></a>00071   <span class="keywordflow">if</span> ( i &gt; <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> ) i = <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> + 1;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keywordflow">return</span> i;
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="keywordtype">double</span>
<a name="l00077"></a>00077 <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a0fc177fd499d6aaa162a30aae0aaca11" title="Returns the coordinate.">BinnerAxisLog::</a>
<a name="l00078"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a0fc177fd499d6aaa162a30aae0aaca11">00078</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a0fc177fd499d6aaa162a30aae0aaca11" title="Returns the coordinate.">getCoordinate</a> ( <span class="keywordtype">int</span> i )<span class="keyword"> const</span>
<a name="l00079"></a>00079 <span class="keyword"></span>{
<a name="l00080"></a>00080   assert ( i &lt; <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> &amp;&amp; !( i &lt; 0 ) );
<a name="l00081"></a>00081 
<a name="l00082"></a>00082   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>[i];
<a name="l00083"></a>00083   <span class="keywordtype">double</span> high = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>[i+1];
<a name="l00084"></a>00084 
<a name="l00085"></a>00085   <span class="keywordflow">return</span> sqrt(low*high);
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 
<a name="l00088"></a>00088 <span class="keywordtype">double</span>
<a name="l00089"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a113025dbd6a8179a0079d82cc083bc1c">00089</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a113025dbd6a8179a0079d82cc083bc1c" title="Returns the width of the bin designated by its place number in the bins structure...">BinnerAxisLog::axisBinWidth</a> ( <span class="keywordtype">int</span> bins_number)<span class="keyword"> const</span>
<a name="l00090"></a>00090 <span class="keyword"></span>{
<a name="l00091"></a>00091   bins_number = std::min ( bins_number, <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> -1 );
<a name="l00092"></a>00092   bins_number = std::max ( bins_number, 0 );
<a name="l00093"></a>00093 
<a name="l00094"></a>00094   <span class="keywordtype">double</span> width = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>[bins_number+1] - <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>[bins_number];
<a name="l00095"></a>00095   assert ( width &gt;= 0.0 );
<a name="l00096"></a>00096 
<a name="l00097"></a>00097   <span class="keywordflow">return</span> width;
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 <span class="comment">/* virtual */</span>
<a name="l00101"></a>00101 <span class="keywordtype">double</span>
<a name="l00102"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac2fa5fe7ba94d6178f27ad84b2f0bf74">00102</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ac2fa5fe7ba94d6178f27ad84b2f0bf74" title="Returns the constant width parameter.">BinnerAxisLog::getConstWid</a> ( )<span class="keyword"> const</span>
<a name="l00103"></a>00103 <span class="keyword"></span>{
<a name="l00104"></a>00104   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a>;
<a name="l00105"></a>00105 }  
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 <span class="keywordtype">double</span>
<a name="l00108"></a>00108 <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ad94bacafd887f5089bded26d043f4250" title="Returns the bin width parameter.">BinnerAxisLog::</a>
<a name="l00109"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ad94bacafd887f5089bded26d043f4250">00109</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ad94bacafd887f5089bded26d043f4250" title="Returns the bin width parameter.">getBinWidth</a> ( )<span class="keyword"> const</span>
<a name="l00110"></a>00110 <span class="keyword"></span>{
<a name="l00111"></a>00111   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a>;
<a name="l00112"></a>00112 }  
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="keywordtype">void</span>
<a name="l00115"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ad04b03af2e5f646df959c542e6ebe2ae">00115</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ad04b03af2e5f646df959c542e6ebe2ae" title="Sets the constant width parameter.">BinnerAxisLog::setConstWid</a> ( )
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a221b3b127fb8b4d68ef531db6a83dd60" title="Calculates the bin width parameter given the number of bins.">calcWidthParm</a> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> );
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 <span class="keywordtype">double</span>
<a name="l00121"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a221b3b127fb8b4d68ef531db6a83dd60">00121</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a221b3b127fb8b4d68ef531db6a83dd60" title="Calculates the bin width parameter given the number of bins.">BinnerAxisLog::calcWidthParm</a> ( <span class="keywordtype">int</span> num_bins )<span class="keyword"> const</span>
<a name="l00122"></a>00122 <span class="keyword"></span>{
<a name="l00123"></a>00123   <span class="keywordtype">double</span> width_parm = 0;
<a name="l00124"></a>00124   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00125"></a>00125   <span class="keywordtype">double</span> high = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>();
<a name="l00126"></a>00126   width_parm = log10 ( high / low ) / num_bins;
<a name="l00127"></a>00127 
<a name="l00128"></a>00128   <span class="keywordflow">return</span> width_parm;
<a name="l00129"></a>00129 }
<a name="l00130"></a>00130 
<a name="l00131"></a>00131 <span class="keywordtype">void</span>
<a name="l00132"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ae788cedda98a0237467afe9a2a75428a">00132</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ae788cedda98a0237467afe9a2a75428a" title="Sets the bins structure by calculating the lower edge of each bin.">BinnerAxisLog::setBins</a> ()
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00135"></a>00135   assert ( low &gt; 0.0 );
<a name="l00136"></a>00136 
<a name="l00137"></a>00137   vector&lt;double&gt;::iterator it = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.begin();
<a name="l00138"></a>00138   *it++ = low;
<a name="l00139"></a>00139 
<a name="l00140"></a>00140   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 1; it != <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.end(); ++it, i++ ) {
<a name="l00141"></a>00141     *it = low * pow ( 10.0, i * <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> );
<a name="l00142"></a>00142   }
<a name="l00143"></a>00143 }
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00146"></a>00146 <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a91e70e4149117cd7eefa0684ff8360fa" title="Sets the range.">BinnerAxisLog::</a>
<a name="l00147"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a91e70e4149117cd7eefa0684ff8360fa">00147</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a91e70e4149117cd7eefa0684ff8360fa" title="Sets the range.">setRange</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range, <span class="keywordtype">bool</span> hold_width )
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149   <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a> = range;
<a name="l00150"></a>00150 
<a name="l00151"></a>00151   <span class="keywordflow">if</span> ( hold_width ) {
<a name="l00152"></a>00152     <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a08d21bfc65c1f134b542644ef5d0bfae" title="Returns the number of bins given the width parameter width.">getNob</a> ( range );
<a name="l00153"></a>00153   }
<a name="l00154"></a>00154   <span class="keywordflow">else</span> {
<a name="l00155"></a>00155     <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a221b3b127fb8b4d68ef531db6a83dd60" title="Calculates the bin width parameter given the number of bins.">calcWidthParm</a> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> );
<a name="l00156"></a>00156   }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00159"></a>00159   <span class="keywordtype">double</span>  high = 1.0;
<a name="l00160"></a>00160   <span class="keywordflow">if</span> (low &lt;= 0) {
<a name="l00161"></a>00161      low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>()/pow(10., <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a>*<a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a>);
<a name="l00162"></a>00162      <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a2618a41860251089e4ab57a83429c27f" title="Sets the minimum of the range object.">setLow</a>(low);
<a name="l00163"></a>00163   } <span class="keywordflow">else</span> {
<a name="l00164"></a>00164      high = low * pow ( 10.0, <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> * <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> );
<a name="l00165"></a>00165      <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a57518687fc2be69b208d7424048b9baa" title="Sets the maximum of the range object.">setHigh</a>(high);
<a name="l00166"></a>00166   }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168   <span class="keywordflow">if</span> (high &lt;= 0) { <span class="comment">//sloppy, using high as a flag</span>
<a name="l00169"></a>00169      <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;BinnerAxisLog::Range: attempt to set range &quot;</span>
<a name="l00170"></a>00170                               <span class="stringliteral">&quot;to negative values.&quot;</span>);
<a name="l00171"></a>00171   }
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.resize( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> + 1, 0.0 );
<a name="l00174"></a>00174   <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ae788cedda98a0237467afe9a2a75428a" title="Sets the bins structure by calculating the lower edge of each bin.">setBins</a>();
<a name="l00175"></a>00175 
<a name="l00176"></a>00176   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>;
<a name="l00177"></a>00177 }
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00180"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a51678894b1b988f9bbcbacbf55e3669c">00180</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a51678894b1b988f9bbcbacbf55e3669c" title="Sets the bin width and adjusts the range and number of bins accordingly.">BinnerAxisLog::setBinWidth</a> ( <span class="keywordtype">double</span> wid )
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182   assert ( wid &gt; 0.0 );
<a name="l00183"></a>00183 
<a name="l00184"></a>00184   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> = wid;
<a name="l00185"></a>00185   <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> = <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a08d21bfc65c1f134b542644ef5d0bfae" title="Returns the number of bins given the width parameter width.">getNob</a> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> );
<a name="l00186"></a>00186 
<a name="l00187"></a>00187   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00188"></a>00188   <span class="keywordtype">double</span> high = low * pow ( 10.0, <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> * wid );
<a name="l00189"></a>00189   <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a57518687fc2be69b208d7424048b9baa" title="Sets the maximum of the range object.">setHigh</a> ( high );
<a name="l00190"></a>00190   <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.resize( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> + 1, 0.0 );
<a name="l00191"></a>00191   <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#ae788cedda98a0237467afe9a2a75428a" title="Sets the bins structure by calculating the lower edge of each bin.">setBins</a>();
<a name="l00192"></a>00192 
<a name="l00193"></a>00193   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>;
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00196"></a>00196 <span class="keywordtype">double</span>
<a name="l00197"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#adc687ca0f1f607e75fcc5490545a565e">00197</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#adc687ca0f1f607e75fcc5490545a565e" title="Calculates and returns a double corresponding to a bin offset when dragging a slider...">BinnerAxisLog::calcOffset</a> ( <span class="keywordtype">int</span> parm, <span class="keywordtype">bool</span> dragging )<span class="keyword"> const</span>
<a name="l00198"></a>00198 <span class="keyword"></span>{
<a name="l00199"></a>00199   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a8ad5aca9b2416bbdacc4efb718d9e9f7" title="Sets the starting Range.">setStartRange</a> ( dragging );
<a name="l00200"></a>00200 
<a name="l00201"></a>00201   <span class="keywordflow">return</span> ( parm - 50 ) / 50.0;
<a name="l00202"></a>00202 }
<a name="l00203"></a>00203 
<a name="l00206"></a>00206 <span class="keywordtype">double</span>
<a name="l00207"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a09cc56b8985acee32c7d5c0fd6c52e02">00207</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a09cc56b8985acee32c7d5c0fd6c52e02" title="Returns the offset.">BinnerAxisLog::getOffset</a> ()<span class="keyword"> const</span>
<a name="l00208"></a>00208 <span class="keyword"></span>{
<a name="l00209"></a>00209   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a94cb65e719e93111afc51628783b2945" title="The offset.">m_offset</a>;
<a name="l00210"></a>00210 }
<a name="l00211"></a>00211 
<a name="l00212"></a>00212 <span class="keyword">const</span> <span class="keywordtype">void</span>
<a name="l00213"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a626e2eaeafcfd4a1b69dc15b555117a4">00213</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a626e2eaeafcfd4a1b69dc15b555117a4" title="Sets the offset and adjusts the range accordingly.">BinnerAxisLog::setOffset</a> ( <span class="keywordtype">double</span> offset )
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215   <span class="keywordtype">double</span> oldoff = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a94cb65e719e93111afc51628783b2945" title="The offset.">m_offset</a>;
<a name="l00216"></a>00216   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a94cb65e719e93111afc51628783b2945" title="The offset.">m_offset</a> = offset;
<a name="l00217"></a>00217   <span class="keywordtype">double</span> change = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a94cb65e719e93111afc51628783b2945" title="The offset.">m_offset</a> - oldoff;
<a name="l00218"></a>00218 
<a name="l00219"></a>00219   <span class="keywordflow">if</span>( offset == 0.0 ) <span class="keywordflow">return</span>; <span class="comment">// resetting...</span>
<a name="l00220"></a>00220   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a54269bfb843c9b6d664ac39a28c07cdb" title="The Range at the start of dragging.">m_range_start</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00221"></a>00221   <span class="keywordtype">double</span> width = low * pow ( 10.0,  <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> ); <span class="comment">// first bin width</span>
<a name="l00222"></a>00222   <span class="keywordtype">double</span> woffset = width * change;
<a name="l00223"></a>00223   <span class="keywordtype">double</span> new_low = low * pow ( 10.0, woffset * <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a> );
<a name="l00224"></a>00224   <span class="keywordtype">double</span> new_high = new_low * pow ( 10.0, ( <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a3cf8669bd37bed15d5bfd0831796f866" title="Has the lower edge of each bin, starting with [0] = the first one.">bins</a>.size() -1 ) * m_width );
<a name="l00225"></a>00225 
<a name="l00226"></a>00226   <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> r( new_low, new_high );
<a name="l00227"></a>00227   <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a91e70e4149117cd7eefa0684ff8360fa" title="Sets the range.">setRange</a>( r );
<a name="l00228"></a>00228 }
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 <span class="keywordtype">double</span>
<a name="l00231"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#aa2591536937e0277a554335d4cb89c76">00231</a> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#aa2591536937e0277a554335d4cb89c76" title="Returns the bin width associated with the scale factor - in the case of log binning...">BinnerAxisLog::scaleFactorWid</a> ( )
<a name="l00232"></a>00232 {
<a name="l00233"></a>00233   <span class="keywordflow">return</span> 1.0;
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a92f001590905450b84d33b5d3bc0e46d">00236</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a08d21bfc65c1f134b542644ef5d0bfae" title="Returns the number of bins given the width parameter width.">BinnerAxisLog::getNob</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range )<span class="keyword"> const</span>
<a name="l00237"></a>00237 <span class="keyword"></span>{
<a name="l00238"></a>00238   <span class="keywordtype">double</span> low = range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00239"></a>00239   <span class="keywordtype">double</span> high = range.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00240"></a>00240   <span class="keywordtype">int</span> tmp = <span class="keyword">static_cast&lt;</span> <span class="keywordtype">int</span> <span class="keyword">&gt;</span> ( ceil ( log10 ( high/low ) /  
<a name="l00241"></a>00241                                         <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a>  ) );
<a name="l00242"></a>00242 
<a name="l00243"></a>00243   <span class="keywordflow">return</span> tmp ? tmp : 1;
<a name="l00244"></a>00244 }
<a name="l00245"></a>00245 
<a name="l00246"></a><a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a08d21bfc65c1f134b542644ef5d0bfae">00246</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1BinnerAxisLog.html#a08d21bfc65c1f134b542644ef5d0bfae" title="Returns the number of bins given the width parameter width.">BinnerAxisLog::getNob</a> ( <span class="keywordtype">double</span> wid )<span class="keyword"> const</span>
<a name="l00247"></a>00247 <span class="keyword"></span>{
<a name="l00248"></a>00248   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00249"></a>00249   <span class="keywordtype">double</span> high = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00250"></a>00250   <span class="keywordtype">int</span> tmp = static_cast &lt; <span class="keywordtype">int</span> &gt; ( ceil ( log10 ( high/low ) / 
<a name="l00251"></a>00251                                           wid  ) );
<a name="l00252"></a>00252   <span class="keywordflow">return</span> tmp ? tmp : 1;
<a name="l00253"></a>00253 }
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</a> </small></address>
</body>
</html>