Sophie

Sophie

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

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_58b38df2e31e2ca35feeee31429c3534.html">projectors</a>
  </div>
</div>
<div class="contents">
<h1>StripChartProjector.cxx</h1><a href="StripChartProjector_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="comment">// For truncation warning</span>
<a name="l00013"></a>00013 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#endif</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="StripChartProjector_8h.html" title="Copyright (C) 2000-2005 The Board of Trustees of The Leland Stanford Junior University...">StripChartProjector.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <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="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="DataSource_8h.html" title="hippodraw::DataSource class interface.">datasrcs/DataSource.h</a>&quot;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;climits&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">using</span> std::distance;
<a name="l00028"></a>00028 <span class="keyword">using</span> std::min_element;
<a name="l00029"></a>00029 <span class="keyword">using</span> std::vector;
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">namespace </span>hippodraw {
<a name="l00032"></a>00032 
<a name="l00033"></a><a class="code" href="classhippodraw_1_1StripChartProjector.html#ac1c245d4bd69fdf9ee90519ec021f37a">00033</a> <a class="code" href="classhippodraw_1_1StripChartProjector.html#ac1c245d4bd69fdf9ee90519ec021f37a" title="The following default constructor binds to the first two columns.">StripChartProjector::StripChartProjector</a>( )
<a name="l00034"></a>00034   : <a class="code" href="classhippodraw_1_1Map2Projector.html" title="A derived class of NTupleProjector that maps 2 ntuple columns to a two dimensional...">Map2Projector</a>()
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036   <a class="code" href="classhippodraw_1_1StripChartProjector.html#ab8990698c3ce06c084cdfc0a0345c316" title="Function to add the acceptable point reps.">addPointReps</a>();
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
<a name="l00043"></a>00043 <a class="code" href="classhippodraw_1_1StripChartProjector.html#ac1c245d4bd69fdf9ee90519ec021f37a" title="The following default constructor binds to the first two columns.">StripChartProjector::</a>
<a name="l00044"></a><a class="code" href="classhippodraw_1_1StripChartProjector.html#ad2f15c2548c63211e114f2c6cf906015">00044</a> <a class="code" href="classhippodraw_1_1StripChartProjector.html#ac1c245d4bd69fdf9ee90519ec021f37a" title="The following default constructor binds to the first two columns.">StripChartProjector</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1StripChartProjector.html">StripChartProjector</a> &amp; projector )
<a name="l00045"></a>00045   : <a class="code" href="classhippodraw_1_1ProjectorBase.html" title="The base class for the Projector hierarchy.">ProjectorBase</a> ( projector ), <span class="comment">// already done in Map2Proj, but no harm</span>
<a name="l00046"></a>00046     <a class="code" href="classhippodraw_1_1Map2Projector.html" title="A derived class of NTupleProjector that maps 2 ntuple columns to a two dimensional...">Map2Projector</a>( projector )
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048   <a class="code" href="classhippodraw_1_1StripChartProjector.html#ab8990698c3ce06c084cdfc0a0345c316" title="Function to add the acceptable point reps.">addPointReps</a>();
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classhippodraw_1_1StripChartProjector.html#a1c21293cc4656448b450db7bd3eb6ecb">00051</a> <a class="code" href="classhippodraw_1_1ProjectorBase.html" title="The base class for the Projector hierarchy.">ProjectorBase</a> * <a class="code" href="classhippodraw_1_1StripChartProjector.html#a1c21293cc4656448b450db7bd3eb6ecb" title="The clone function returns an object of its own kind which is a copy of this object...">StripChartProjector::clone</a>()
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1StripChartProjector.html#ac1c245d4bd69fdf9ee90519ec021f37a" title="The following default constructor binds to the first two columns.">StripChartProjector</a> ( *<span class="keyword">this</span> );
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a><a class="code" href="classhippodraw_1_1StripChartProjector.html#ab8990698c3ce06c084cdfc0a0345c316">00056</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1StripChartProjector.html#ab8990698c3ce06c084cdfc0a0345c316" title="Function to add the acceptable point reps.">StripChartProjector::addPointReps</a>()
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058   <a class="code" href="classhippodraw_1_1ProjectorBase.html#a41b31f85b35a1b9f559bbfc3f6c14f97" title="Vector of acceptable PointReps.">m_pointreps</a>.clear();
<a name="l00059"></a>00059   <a class="code" href="classhippodraw_1_1ProjectorBase.html#a41b31f85b35a1b9f559bbfc3f6c14f97" title="Vector of acceptable PointReps.">m_pointreps</a>.push_back ( <span class="stringliteral">&quot;Line&quot;</span> );
<a name="l00060"></a>00060   <a class="code" href="classhippodraw_1_1ProjectorBase.html#a41b31f85b35a1b9f559bbfc3f6c14f97" title="Vector of acceptable PointReps.">m_pointreps</a>.push_back ( <span class="stringliteral">&quot;Symbol&quot;</span> );
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="keyword">namespace </span>dp = hippodraw::DataPoint2DTuple;
<a name="l00064"></a>00064 
<a name="l00067"></a>00067 <span class="keywordtype">void</span>
<a name="l00068"></a>00068 <a class="code" href="classhippodraw_1_1StripChartProjector.html#ab230897ad265a7dfe15e2d5e263bbd65" title="Fills the data source with projected values.">StripChartProjector::</a>
<a name="l00069"></a><a class="code" href="classhippodraw_1_1StripChartProjector.html#ab230897ad265a7dfe15e2d5e263bbd65">00069</a> <a class="code" href="classhippodraw_1_1StripChartProjector.html#ab230897ad265a7dfe15e2d5e263bbd65" title="Fills the data source with projected values.">fillProjectedValues</a> ( <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> * ntuple, <span class="keywordtype">bool</span> ) const <span class="comment">//in_range ) const</span>
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071   ntuple -&gt; clear();
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x_col = <a class="code" href="classhippodraw_1_1NTupleProjector.html#a0b4e25802dd74e1f7c8d41f85a9bda5a" title="A vector containing indexes to the columns of the DataSource.">m_columns</a>[0];
<a name="l00074"></a>00074   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y_col = <a class="code" href="classhippodraw_1_1NTupleProjector.html#a0b4e25802dd74e1f7c8d41f85a9bda5a" title="A vector containing indexes to the columns of the DataSource.">m_columns</a>[1];
<a name="l00075"></a>00075   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x_err = <a class="code" href="classhippodraw_1_1NTupleProjector.html#a0b4e25802dd74e1f7c8d41f85a9bda5a" title="A vector containing indexes to the columns of the DataSource.">m_columns</a>[2];
<a name="l00076"></a>00076   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y_err = <a class="code" href="classhippodraw_1_1NTupleProjector.html#a0b4e25802dd74e1f7c8d41f85a9bda5a" title="A vector containing indexes to the columns of the DataSource.">m_columns</a>[3];
<a name="l00077"></a>00077 
<a name="l00078"></a>00078   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> min_row = <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; indexOfMinElement ( x_col );
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <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_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; rows ();
<a name="l00081"></a>00081 
<a name="l00082"></a>00082   vector &lt; double &gt; row ( <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a4aa71180778b711338785695df5d7c52" title="number of columns">dp::SIZE</a> );
<a name="l00083"></a>00083   <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = min_row; i &lt; size; i++ ) {
<a name="l00084"></a>00084 <span class="comment">//     if ( acceptRow ( i ) == false ||</span>
<a name="l00085"></a>00085 <span class="comment">//       ( in_range == true &amp;&amp; inRange ( i ) == false ) ) continue;</span>
<a name="l00086"></a>00086     <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1NTupleProjector.html#a970763825cc9f3f05a6ac3ce5352d554" title="For row i of the column in the DataSource, returns true if all the cuts accept the...">acceptRow</a> ( i, <a class="code" href="classhippodraw_1_1NTupleProjector.html#a1c2feed36aaa9baed5108683a08333a9" title="A list of cuts that filter the projection.">m_cut_list</a> ) == <span class="keyword">false</span> ) <span class="keywordflow">continue</span>;
<a name="l00087"></a>00087 
<a name="l00088"></a>00088     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">dp::X</a>] = <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, x_col );
<a name="l00089"></a>00089     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">dp::Y</a>] = <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, y_col );
<a name="l00090"></a>00090 
<a name="l00091"></a>00091     <span class="keywordtype">double</span> xe 
<a name="l00092"></a>00092       = x_err &lt; UINT_MAX ? <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, x_err ) : 0.0;
<a name="l00093"></a>00093     <span class="keywordtype">double</span> ye 
<a name="l00094"></a>00094       = y_err &lt; UINT_MAX ? <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, y_err ) : 0.0;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15ac577aa01d3f00f9cfae6e981756f5402" title="error on X or half bin width">dp::XERR</a>] = xe;
<a name="l00097"></a>00097     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a877f1ecdc13e795de8b440216711b10d" title="error on Y">dp::YERR</a>] = ye;
<a name="l00098"></a>00098     ntuple -&gt; addRow ( row );
<a name="l00099"></a>00099   }
<a name="l00100"></a>00100   <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; min_row; i++ ) {
<a name="l00101"></a>00101     <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1NTupleProjector.html#a970763825cc9f3f05a6ac3ce5352d554" title="For row i of the column in the DataSource, returns true if all the cuts accept the...">acceptRow</a> ( i, <a class="code" href="classhippodraw_1_1NTupleProjector.html#a1c2feed36aaa9baed5108683a08333a9" title="A list of cuts that filter the projection.">m_cut_list</a> ) == <span class="keyword">false</span> ||
<a name="l00102"></a>00102          <a class="code" href="classhippodraw_1_1NTupleProjector.html#ac494c25dcbe8066639d9e87d1bd1d5ad" title="Checks if the entries in a given row are within the range of the axis model.">inRange</a> ( i ) == <span class="keyword">false</span> ) <span class="keywordflow">continue</span>;
<a name="l00103"></a>00103 
<a name="l00104"></a>00104     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">dp::X</a>] = <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, x_col );
<a name="l00105"></a>00105     row[<a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">dp::Y</a>] = <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, y_col );
<a name="l00106"></a>00106     <span class="keywordtype">double</span> xe 
<a name="l00107"></a>00107       = x_err &lt; UINT_MAX ? <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, x_err ) : 0.0;
<a name="l00108"></a>00108     <span class="keywordtype">double</span> ye 
<a name="l00109"></a>00109       = y_err &lt; UINT_MAX ? <a class="code" href="classhippodraw_1_1NTupleProjector.html#aa4ce14472599ca738e3caba3e166be12" title="The pointer to the data source being projected.">m_ntuple</a> -&gt; valueAt ( i, y_err ) : 0.0;
<a name="l00110"></a>00110 
<a name="l00111"></a>00111     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15ac577aa01d3f00f9cfae6e981756f5402" title="error on X or half bin width">dp::XERR</a>] = xe;
<a name="l00112"></a>00112     row[<a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15a877f1ecdc13e795de8b440216711b10d" title="error on Y">dp::YERR</a>] = ye;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114     ntuple -&gt; addRow ( row );
<a name="l00115"></a>00115   }
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 } <span class="comment">// namespace hippodraw</span>
<a name="l00119"></a>00119 
</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>