Sophie

Sophie

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

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>Bins1DProfile.cxx</h1><a href="Bins1DProfile_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="Bins1DProfile_8h.html" title="hippodraw::Bins1DProfile class interface">binners/Bins1DProfile.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="DataPointTuple_8h.html" title="hippodraw::DataPointTuple namespace interface">datasrcs/DataPointTuple.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="NTuple_8h.html" title="hippodraw::NTuple class interface.">datasrcs/NTuple.h</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;numeric&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#ifdef ITERATOR_MEMBER_DEFECT</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="keyword">using namespace </span>std;
<a name="l00031"></a>00031 <span class="preprocessor">#else</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="keyword">using</span> std::fill;
<a name="l00033"></a>00033 <span class="keyword">using</span> std::list;
<a name="l00034"></a>00034 <span class="keyword">using</span> std::sqrt;
<a name="l00035"></a>00035 <span class="keyword">using</span> std::string;
<a name="l00036"></a>00036 <span class="keyword">using</span> std::vector;
<a name="l00037"></a>00037 <span class="keyword">using</span> std::min_element;
<a name="l00038"></a>00038 <span class="keyword">using</span> std::max_element;
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="keyword">using namespace </span>hippodraw;
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a7c53d22c474cea11282c2763ba75d213">00043</a> Bins1DProfile::Bins1DProfile ( )
<a name="l00044"></a>00044   : <a class="code" href="classhippodraw_1_1Bins1DBase.html" title="The base class for the one-dimensional binner hierarchy.">Bins1DBase</a> ( <span class="stringliteral">&quot;Bins1DProfile&quot;</span> )
<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_1Bins1DProfile.html#a7faec5c674cdd3fda25bcdbd70478355">00048</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a7c53d22c474cea11282c2763ba75d213" title="The default constructor.">Bins1DProfile::Bins1DProfile</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html" title="The class for the 1D profile binner hierarchy.">Bins1DProfile</a> &amp; binner )
<a name="l00049"></a>00049   : <a class="code" href="classhippodraw_1_1Bins1DBase.html" title="The base class for the one-dimensional binner hierarchy.">Bins1DBase</a> ( binner ),
<a name="l00050"></a>00050     m_sum( binner.m_sum ), 
<a name="l00051"></a>00051     m_sumsq( binner.m_sumsq ),
<a name="l00052"></a>00052     m_num( binner.m_num ),
<a name="l00053"></a>00053     m_sumwtsq (binner.m_sumwtsq )
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <a class="code" href="classhippodraw_1_1BinsBase.html" title="The base class for the binner hierarchy.">BinsBase</a> *
<a name="l00058"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a41d15e336355204fd336f7ef9bae6ced">00058</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a41d15e336355204fd336f7ef9bae6ced" title="The clone function returns an object of its own kind which is a copy of this object...">Bins1DProfile::clone</a> ()<span class="keyword"> const</span>
<a name="l00059"></a>00059 <span class="keyword"></span>{
<a name="l00060"></a>00060   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a7c53d22c474cea11282c2763ba75d213" title="The default constructor.">Bins1DProfile</a>(*<span class="keyword">this</span>);
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4c079d9d3bf80d881da9a8a1b6ed0493">00063</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4c079d9d3bf80d881da9a8a1b6ed0493" title="The destructor.">Bins1DProfile::~Bins1DProfile</a> ()
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066 
<a name="l00067"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#aad678b04c23e9d850196dce40e3c0fa6">00067</a> <span class="keywordtype">double</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#aad678b04c23e9d850196dce40e3c0fa6" title="Returns the value of the bin with the smallest value.">Bins1DProfile::minBin</a>()
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069   <span class="keywordflow">return</span> *min_element ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.begin() + 1, <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.end ( ) - 1 );
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a9a18297c41aa2385b96cd8a6eb57e099">00072</a> <span class="keywordtype">double</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a9a18297c41aa2385b96cd8a6eb57e099" title="Returns the value of the bin with the largest value.">Bins1DProfile::maxBin</a>()
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074   <span class="keywordflow">return</span> *max_element ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.begin () + 1, <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.end () - 1 );
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a0bee2dd4e007b3e0a90fbad895e0916a">00077</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Bins1DBase.html#a0fc3d585aa53859602ac79c9c421f2a9" title="Resizes the internal arrays.">Bins1DProfile::resize</a> ( <span class="keywordtype">int</span> number )
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.resize( number + 2 );
<a name="l00080"></a>00080   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>.resize( number + 2 );
<a name="l00081"></a>00081   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4a9e808b3f47a9758f33c22d5014984d" title="The sum of the data squared along the y axis.">m_sumsq</a>.resize( number + 2 );
<a name="l00082"></a>00082   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ab5a07bb850f224ed27ccb9ab6e886930" title="The sum of weight squared.">m_sumwtsq</a>.resize( number + 2);
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ad20897c5c8bd47f5d4005989bead0e55" title="Resets the accumulation to zero.">reset</a>();
<a name="l00085"></a>00085 
<a name="l00086"></a>00086   <a class="code" href="classhippodraw_1_1BinsBase.html#aae63ef60775a9645568646b6a033f905" title="A flag to indicate that the objects in m_values are not correct.">m_values_dirty</a> = <span class="keyword">true</span>;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00089"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#ad20897c5c8bd47f5d4005989bead0e55">00089</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ad20897c5c8bd47f5d4005989bead0e55" title="Resets the accumulation to zero.">Bins1DProfile::reset</a>()
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091   fill( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.begin(), <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.end(), 0.0 );
<a name="l00092"></a>00092   fill( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>.begin(), <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>.end(), 0 ); <span class="comment">// This is an int array</span>
<a name="l00093"></a>00093   fill( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4a9e808b3f47a9758f33c22d5014984d" title="The sum of the data squared along the y axis.">m_sumsq</a>.begin(), <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4a9e808b3f47a9758f33c22d5014984d" title="The sum of the data squared along the y axis.">m_sumsq</a>.end(), 0.0 );
<a name="l00094"></a>00094   fill( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ab5a07bb850f224ed27ccb9ab6e886930" title="The sum of weight squared.">m_sumwtsq</a>.begin(), <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ab5a07bb850f224ed27ccb9ab6e886930" title="The sum of weight squared.">m_sumwtsq</a>.end(), 0.0 );
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <a class="code" href="classhippodraw_1_1BinsBase.html#ac21f18624d637a3e48f64730fb79c479" title="A flag set to true, when no accumulation has yet occurred, otherwise is set false...">m_empty</a> = <span class="keyword">true</span>;
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00099"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8e2544f7315631c6c4357d2f09bdcafc">00099</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8e2544f7315631c6c4357d2f09bdcafc" title="Returns the true number of entries.">Bins1DProfile::getNumberOfEntries</a> ()<span class="keyword"> const</span>
<a name="l00100"></a>00100 <span class="keyword"></span>{
<a name="l00101"></a>00101   <span class="keywordflow">return</span> static_cast &lt; <span class="keywordtype">int</span> &gt; ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#aa6d022c3a2ec9009248e0e79db4dc718" title="Accumulate a data point x, y into a bin.">std::accumulate</a> ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>.begin() + 1, 
<a name="l00102"></a>00102                                                  <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>.end() - 2, 0.0 ) );
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8df172da3a583df49a82a59eff928026">00105</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8e2544f7315631c6c4357d2f09bdcafc" title="Returns the true number of entries.">Bins1DProfile::getNumberOfEntries</a> ( <span class="keywordtype">int</span> i )<span class="keyword"> const</span>
<a name="l00106"></a>00106 <span class="keyword"></span>{
<a name="l00107"></a>00107 <span class="comment">//   return *( m_num.begin() + i + 1 );</span>
<a name="l00108"></a>00108   <span class="keywordflow">return</span> static_cast &lt; <span class="keywordtype">int</span> &gt; (<a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a> [ i+1] );
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110 
<a name="l00111"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a35cdd67c6245217febba7aa474120526">00111</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a35cdd67c6245217febba7aa474120526" title="Returns the underflow.">Bins1DProfile::getUnderflow</a> ()<span class="keyword"> const</span>
<a name="l00112"></a>00112 <span class="keyword"></span>{
<a name="l00113"></a>00113   <span class="keywordflow">return</span> -1;
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a94fdcfac38ba98c6263f9ed44110e639">00116</a> <span class="keywordtype">int</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a94fdcfac38ba98c6263f9ed44110e639" title="Returns the overflow.">Bins1DProfile::getOverflow</a> ()<span class="keyword"> const</span>
<a name="l00117"></a>00117 <span class="keyword"></span>{
<a name="l00118"></a>00118   <span class="keywordflow">return</span> -1;
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 
<a name="l00122"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#aa6d022c3a2ec9009248e0e79db4dc718">00122</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#aa6d022c3a2ec9009248e0e79db4dc718" title="Accumulate a data point x, y into a bin.">Bins1DProfile::accumulate</a>( <span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> wt, <span class="keywordtype">double</span> )
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124   <span class="keywordtype">int</span> i = <a class="code" href="classhippodraw_1_1Bins1DBase.html#a3d9b21ad28ed7d68735c8a6232503f57" title="Returns the number of the bin in which the x value is situated.">binNumber</a> ( x );
<a name="l00125"></a>00125 
<a name="l00126"></a>00126   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>[i] += y * wt;           <span class="comment">// sum(w*y)</span>
<a name="l00127"></a>00127   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4a9e808b3f47a9758f33c22d5014984d" title="The sum of the data squared along the y axis.">m_sumsq</a>[i] += y * y * wt;     <span class="comment">// sum(w*y*y)</span>
<a name="l00128"></a>00128   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>[i] += wt;               <span class="comment">// sum(w), actually m_sumwt</span>
<a name="l00129"></a>00129 
<a name="l00130"></a>00130   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ab5a07bb850f224ed27ccb9ab6e886930" title="The sum of weight squared.">m_sumwtsq</a>[i] += wt * wt;      <span class="comment">// sum(w*w)</span>
<a name="l00131"></a>00131 
<a name="l00132"></a>00132   <a class="code" href="classhippodraw_1_1BinsBase.html#ac21f18624d637a3e48f64730fb79c479" title="A flag set to true, when no accumulation has yet occurred, otherwise is set false...">m_empty</a> = <span class="keyword">false</span>;
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 
<a name="l00136"></a>00136 <a class="code" href="classhippodraw_1_1NTuple.html" title="A DataSource class implemented with std::vector&amp;lt;double&amp;gt; to store the column...">NTuple</a> *
<a name="l00137"></a>00137 <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a68e4ca34a0c4aa4d4eeaa0e521fe6386" title="Creates an NTuple.">Bins1DProfile::</a>
<a name="l00138"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a68e4ca34a0c4aa4d4eeaa0e521fe6386">00138</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a68e4ca34a0c4aa4d4eeaa0e521fe6386" title="Creates an NTuple.">createNTuple</a> ()<span class="keyword"> const</span>
<a name="l00139"></a>00139 <span class="keyword"></span>{
<a name="l00140"></a>00140   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>.size ();
<a name="l00141"></a>00141   <a class="code" href="classhippodraw_1_1NTuple.html" title="A DataSource class implemented with std::vector&amp;lt;double&amp;gt; to store the column...">NTuple</a> * ntuple = <a class="code" href="classhippodraw_1_1Bins1DBase.html#af67b204e810ea7f82cfe60d9cd8f9455" title="Prepares the NTuple.">prepareNTuple</a> ( size );
<a name="l00142"></a>00142 
<a name="l00143"></a>00143   <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8442b1eaff8330d90497659f2853c5aa" title="Fills the DataSource.">fillDataSource</a> ( ntuple );
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="keywordflow">return</span> ntuple;
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147 
<a name="l00148"></a>00148 <span class="keyword">namespace </span>dp = hippodraw::DataPoint2DTuple;
<a name="l00149"></a>00149 
<a name="l00150"></a>00150 <span class="keywordtype">void</span>
<a name="l00151"></a>00151 <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8442b1eaff8330d90497659f2853c5aa" title="Fills the DataSource.">Bins1DProfile::</a>
<a name="l00152"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8442b1eaff8330d90497659f2853c5aa">00152</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a8442b1eaff8330d90497659f2853c5aa" title="Fills the DataSource.">fillDataSource</a> ( <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ntuple )<span class="keyword"> const</span>
<a name="l00153"></a>00153 <span class="keyword"></span>{
<a name="l00154"></a>00154   ntuple -&gt; clear();
<a name="l00155"></a>00155   vector &lt; double &gt; row ( <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a4aa71180778b711338785695df5d7c52" title="number of columns">dp::SIZE</a> );
<a name="l00156"></a>00156 
<a name="l00157"></a>00157   <span class="keywordtype">double</span> width;
<a name="l00158"></a>00158   <span class="keywordtype">double</span> x = <a class="code" href="classhippodraw_1_1Bins1DBase.html#a338cb7f6876cb3c4a8cbbb5c8990642c" title="Returns the low value of the bins on the specified axis.">getLow</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> );
<a name="l00159"></a>00159   <span class="keywordtype">int</span> x_number = <a class="code" href="classhippodraw_1_1Bins1DBase.html#afb054c36098d59ea80a5d4f57eba6cd9" title="Returns the number of bins on specified axis.">numberOfBins</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> );
<a name="l00160"></a>00160   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; x_number; i++ ) {
<a name="l00161"></a>00161     width = <a class="code" href="classhippodraw_1_1Bins1DBase.html#a7f438d8932b7faff617f4f4ee4cc435d" title="Returns the width of each bin.">binWidth</a> ( i );
<a name="l00162"></a>00162     <span class="keywordtype">double</span> half_width = 0.5 * width;
<a name="l00163"></a>00163     x += half_width;
<a name="l00164"></a>00164     <span class="keywordtype">double</span> y = 0;
<a name="l00165"></a>00165     <span class="keywordtype">double</span> num = <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a> [ i+1 ];
<a name="l00166"></a>00166     <span class="keywordflow">if</span> ( num &lt;= 0 ) {
<a name="l00167"></a>00167       x += half_width;
<a name="l00168"></a>00168       <span class="keywordflow">continue</span>;
<a name="l00169"></a>00169     }
<a name="l00170"></a>00170     <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>[i+1] != 0 ) {
<a name="l00171"></a>00171       y = <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>[i+1] / <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>[i+1];
<a name="l00172"></a>00172     }
<a name="l00173"></a>00173     <span class="keywordflow">else</span> y = 0.;
<a name="l00174"></a>00174 
<a name="l00175"></a>00175     <span class="keywordtype">double</span> yerr = 0.0;
<a name="l00176"></a>00176 
<a name="l00177"></a>00177     <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>[i+1] &gt; 1. ) {
<a name="l00178"></a>00178       <span class="keywordtype">double</span> num = <a class="code" href="classhippodraw_1_1Bins1DProfile.html#a24b062ff95d8746bb70bb918d67ec3b5" title="The total number of entries for each bin.">m_num</a>[i+1];
<a name="l00179"></a>00179       <span class="comment">/* Weighted function from</span>
<a name="l00180"></a>00180 <span class="comment">         http://pygsl.sourceforge.net/reference/pygsl/node36.html</span>
<a name="l00181"></a>00181 <span class="comment"></span>
<a name="l00182"></a>00182 <span class="comment">         Special case: when all wt==1;</span>
<a name="l00183"></a>00183 <span class="comment">         yerr = sqrt ( m_sumsq[i+1] / (num - 1 ) - y * y * ( num/ (num-1) ) );</span>
<a name="l00184"></a>00184 <span class="comment"></span>
<a name="l00185"></a>00185 <span class="comment">         When num &gt;&gt; 1, same as unweighed case. But what if num == 2?</span>
<a name="l00186"></a>00186 <span class="comment">      */</span>
<a name="l00187"></a>00187       yerr = sqrt ( (num/((num*num)-<a class="code" href="classhippodraw_1_1Bins1DProfile.html#ab5a07bb850f224ed27ccb9ab6e886930" title="The sum of weight squared.">m_sumwtsq</a>[i+1]))*
<a name="l00188"></a>00188                     (<a class="code" href="classhippodraw_1_1Bins1DProfile.html#a4a9e808b3f47a9758f33c22d5014984d" title="The sum of the data squared along the y axis.">m_sumsq</a>[i+1]-2.0*y*<a class="code" href="classhippodraw_1_1Bins1DProfile.html#a3dffa9405c42c2de787c254f683d1a34" title="The sum of the data along the y axis.">m_sum</a>[i+1]+y*y*num) );
<a name="l00189"></a>00189 
<a name="l00190"></a>00190       <span class="comment">/* Unweight RMS function</span>
<a name="l00191"></a>00191 <span class="comment">         yerr = sqrt ( ( m_sumsq[i+1] / ( num - 1. )  - y * y ) );</span>
<a name="l00192"></a>00192 <span class="comment">      */</span>
<a name="l00193"></a>00193     }
<a name="l00194"></a>00194     <span class="keywordflow">else</span> {
<a name="l00195"></a>00195       yerr = 0.0;
<a name="l00196"></a>00196     }
<a name="l00197"></a>00197 
<a name="l00198"></a>00198     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">dp::X</a>] = x;
<a name="l00199"></a>00199     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">dp::Y</a>] = y;
<a name="l00200"></a>00200     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15ac577aa01d3f00f9cfae6e981756f5402" title="error on X or half bin width">dp::XERR</a>] = half_width;
<a name="l00201"></a>00201     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a877f1ecdc13e795de8b440216711b10d" title="error on Y">dp::YERR</a>] = yerr;
<a name="l00202"></a>00202 
<a name="l00203"></a>00203     ntuple -&gt; addRow ( row );
<a name="l00204"></a>00204 
<a name="l00205"></a>00205     x += half_width;
<a name="l00206"></a>00206   }
<a name="l00207"></a>00207 }
<a name="l00208"></a>00208 
<a name="l00212"></a>00212 <span class="keywordtype">void</span>
<a name="l00213"></a>00213 <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ac667673ef9254d312f398893f7bf2c53">Bins1DProfile::</a>
<a name="l00214"></a><a class="code" href="classhippodraw_1_1Bins1DProfile.html#ac667673ef9254d312f398893f7bf2c53">00214</a> <a class="code" href="classhippodraw_1_1Bins1DProfile.html#ac667673ef9254d312f398893f7bf2c53">setBinContents</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ) <span class="comment">//  ntuple )</span>
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216 }
</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>