Sophie

Sophie

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

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_bd46360b4c6a7cd846adf95fa79d46e4.html">python</a>
  </div>
</div>
<div class="contents">
<h1>export_RootNTuple.cxx</h1><a href="export__RootNTuple_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 HAVE_CONFIG_H</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="comment">// for have numarray</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;config.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="comment">// For truncation warning</span>
<a name="l00018"></a>00018 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#endif</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="comment">// include first to avoid _POSIX_C_SOURCE warning.</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;boost/python.hpp&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="QtRootNTuple_8h.html" title="hippodraw::QtRootNTuple class interface.">root/QtRootNTuple.h</a>&quot;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#ifdef HAVE_NUMARRAY</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="num__util_8h.html">numarray/num_util.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#endif</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;utility&gt;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">using</span> std::string;
<a name="l00034"></a>00034 <span class="keyword">using</span> std::vector;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="keyword">using namespace </span>boost::python;
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keyword">namespace </span>hippodraw {
<a name="l00039"></a>00039 <span class="keyword">namespace </span>Python {
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="keywordtype">void</span>
<a name="l00042"></a>00042 <a class="code" href="namespacehippodraw_1_1Python.html#adc59f2d0f4e3daa7fb7c7bc4fa109158" title="Exports the RootNTuple.">export_RootNTuple</a>()
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   class_ &lt; QtRootNTuple, bases&lt;DataSource&gt;,
<a name="l00045"></a>00045     QtRootNTuple, boost::noncopyable&gt;
<a name="l00046"></a>00046     ( <span class="stringliteral">&quot;RootNTuple&quot;</span>,
<a name="l00047"></a>00047       <span class="stringliteral">&quot;The RootNTuple class provides access to data in a ROOT file.\n&quot;</span>
<a name="l00048"></a>00048       <span class="stringliteral">&quot;A ROOT TTree is taken as an ntuple and a ROOT TBranch is taken as a\n&quot;</span>
<a name="l00049"></a>00049       <span class="stringliteral">&quot;column, the TBranch name as the column label.\n\n&quot;</span>
<a name="l00050"></a>00050       <span class="stringliteral">&quot;If the hippo module was configured with numeric array support,\n&quot;</span>
<a name="l00051"></a>00051       <span class="stringliteral">&quot;consider using DataArray to wrap an object of this class.&quot;</span>,
<a name="l00052"></a>00052       no_init )
<a name="l00053"></a>00053 
<a name="l00054"></a>00054     .add_property ( <span class="stringliteral">&quot;rows&quot;</span>, &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b" title="Returns the number of rows.">QtRootNTuple::rows</a> )
<a name="l00055"></a>00055 
<a name="l00056"></a>00056     .add_property ( <span class="stringliteral">&quot;columns&quot;</span>, &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#a903d6ffef3ddea0d904a5336e231b643" title="Returns the number of columns.">QtRootNTuple::columns</a> )
<a name="l00057"></a>00057 
<a name="l00058"></a>00058     .def ( <span class="stringliteral">&quot;addColumn&quot;</span>,
<a name="l00059"></a>00059            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#aa5a78f2eda7ae260a6fbc0a06d809559" title="Adds a column to the object.">QtRootNTuple::addColumn</a>,
<a name="l00060"></a>00060            <span class="stringliteral">&quot;addColumn ( label, list ) -&gt; value\n&quot;</span>
<a name="l00061"></a>00061            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00062"></a>00062            <span class="stringliteral">&quot;Adds a column to the ntuple.  Adds a column to the ntuple by \n&quot;</span>
<a name="l00063"></a>00063            <span class="stringliteral">&quot;copying the contents of the list.   The new column will take its\n&quot;</span>
<a name="l00064"></a>00064            <span class="stringliteral">&quot;label from the first argument.   Returns the index of the newly \n&quot;</span>
<a name="l00065"></a>00065            <span class="stringliteral">&quot;created column.\n\n&quot;</span>
<a name="l00066"></a>00066            <span class="stringliteral">&quot;Note: The column is not added to the ROOT file, just logically\n&quot;</span>
<a name="l00067"></a>00067            <span class="stringliteral">&quot;to it for the current session.\n&quot;</span>)
<a name="l00068"></a>00068 
<a name="l00069"></a>00069     .def ( <span class="stringliteral">&quot;replaceColumn&quot;</span>,
<a name="l00070"></a>00070            ( <span class="keywordtype">void</span> ( RootNTuple::* ) <span class="comment">// function pointer</span>
<a name="l00071"></a>00071              ( <span class="keyword">const</span> std::string &amp;,
<a name="l00072"></a>00072                <span class="keyword">const</span> std::vector &lt; double &gt; &amp; ) ) <span class="comment">// signature</span>
<a name="l00073"></a>00073            &amp;<a class="code" href="classhippodraw_1_1RootNTuple.html#a724450b5a011ae06a5cdcb43ce599754" title="Replaces the data in column index.">RootNTuple::replaceColumn</a>,
<a name="l00074"></a>00074            <span class="stringliteral">&quot;replaceColumn ( index, list ) -&gt; None\n&quot;</span>
<a name="l00075"></a>00075            <span class="stringliteral">&quot;replaceColumn ( label, list ) -&gt; None\n&quot;</span>
<a name="l00076"></a>00076            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00077"></a>00077            <span class="stringliteral">&quot;Replaces the column of data by index or label.   Does not\n&quot;</span>
<a name="l00078"></a>00078            <span class="stringliteral">&quot;modify the ROOT file.&quot;</span> )
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     .def ( <span class="stringliteral">&quot;replaceColumn&quot;</span>,
<a name="l00081"></a>00081            ( <span class="keywordtype">void</span> ( RootNTuple::* ) <span class="comment">// function pointer</span>
<a name="l00082"></a>00082              ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>,
<a name="l00083"></a>00083                <span class="keyword">const</span> std::vector &lt; double &gt; &amp; ) ) <span class="comment">// signature</span>
<a name="l00084"></a>00084            &amp;RootNTuple::replaceColumn )
<a name="l00085"></a>00085 
<a name="l00086"></a>00086     .def ( <span class="stringliteral">&quot;getColumn&quot;</span>, 
<a name="l00087"></a>00087            ( <span class="keyword">const</span> std::vector &lt; double &gt; &amp; (QtRootNTuple::* ) <span class="comment">// fptr</span>
<a name="l00088"></a>00088              ( <span class="keyword">const</span> std::string &amp; ) <span class="keyword">const</span>) <span class="comment">// function signature</span>
<a name="l00089"></a>00089            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#a0504a66c08cf544452f613aa8ea2390d" title="Returns copy of TBranch data by name.">QtRootNTuple::getColumn</a>,
<a name="l00090"></a>00090            return_value_policy &lt; copy_const_reference&gt; (),
<a name="l00091"></a>00091            <span class="stringliteral">&quot;getColumn ( index ) -&gt; list\n&quot;</span>
<a name="l00092"></a>00092            <span class="stringliteral">&quot;getColumn ( label ) -&gt; list\n&quot;</span>
<a name="l00093"></a>00093            <span class="stringliteral">&quot;getColumn ( label, indices ) -&gt; list\n&quot;</span>
<a name="l00094"></a>00094            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00095"></a>00095            <span class="stringliteral">&quot;Returns a copy of the column as a list.  In the first form the\n&quot;</span>
<a name="l00096"></a>00096            <span class="stringliteral">&quot;the column is specified by its index.   In the second form it\n&quot;</span>
<a name="l00097"></a>00097            <span class="stringliteral">&quot;is specified by its label which could be a simple variable or\n&quot;</span>
<a name="l00098"></a>00098            <span class="stringliteral">&quot;an array variable.  If an array variable, the indices should be\n&quot;</span>
<a name="l00099"></a>00099            <span class="stringliteral">&quot;part of the label.   The third form, the column is specified by\n&quot;</span>
<a name="l00100"></a>00100            <span class="stringliteral">&quot;an array variables name and list of indices.\n&quot;</span> )
<a name="l00101"></a>00101 
<a name="l00102"></a>00102     .def ( <span class="stringliteral">&quot;getColumn&quot;</span>, 
<a name="l00103"></a>00103            ( <span class="keyword">const</span> std::vector &lt; double &gt; &amp; (QtRootNTuple::* ) <span class="comment">// fptr</span>
<a name="l00104"></a>00104              ( <span class="keyword">const</span> std::string &amp;,
<a name="l00105"></a>00105                <span class="keyword">const</span> std::vector &lt; int &gt; &amp; ) <span class="keyword">const</span>) <span class="comment">// function signature</span>
<a name="l00106"></a>00106            &amp;QtRootNTuple::getColumn,
<a name="l00107"></a>00107            return_value_policy &lt; copy_const_reference&gt; () )
<a name="l00108"></a>00108 
<a name="l00109"></a>00109     .def ( <span class="stringliteral">&quot;getColumn&quot;</span>, 
<a name="l00110"></a>00110            ( <span class="keyword">const</span> std::vector &lt; double &gt; &amp; (QtRootNTuple::* ) <span class="comment">// fptr</span>
<a name="l00111"></a>00111              ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) <span class="keyword">const</span>) <span class="comment">// function signature</span>
<a name="l00112"></a>00112            &amp;QtRootNTuple::getColumn,
<a name="l00113"></a>00113            return_value_policy &lt; copy_const_reference&gt; () )
<a name="l00114"></a>00114 
<a name="l00115"></a>00115     .def ( <span class="stringliteral">&quot;getRow&quot;</span>,
<a name="l00116"></a>00116            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#ac295953ac88bc39038e4f22781577ec8" title="Returns the row indexed by index.">QtRootNTuple::getRow</a>,
<a name="l00117"></a>00117            return_value_policy &lt; copy_const_reference&gt; (),
<a name="l00118"></a>00118            <span class="stringliteral">&quot;getRow ( index ) -&gt; tuple\n&quot;</span>
<a name="l00119"></a>00119            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00120"></a>00120            <span class="stringliteral">&quot;Returns a row from the ROOT file.&quot;</span> )
<a name="l00121"></a>00121 
<a name="l00122"></a>00122     .def ( <span class="stringliteral">&quot;isMultiDimensional&quot;</span>,
<a name="l00123"></a>00123            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#a73a2410876410c45df9885e57e0bad63" title="Returns true if the column named column, is an array, rather then simple type.">QtRootNTuple::isMultiDimensional</a>,
<a name="l00124"></a>00124            <span class="stringliteral">&quot;isMultiDimensional ( label ) -&gt; Boolean\n&quot;</span>
<a name="l00125"></a>00125            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00126"></a>00126            <span class="stringliteral">&quot;Returns True if the column specified by label is an array.&quot;</span> )
<a name="l00127"></a>00127 
<a name="l00128"></a>00128      .def ( <span class="stringliteral">&quot;rowDataDimSize&quot;</span>,
<a name="l00129"></a>00129             &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#a2966fbcf595f6f9ec8c688976317bd53" title="Returns the shape of multidimensional array excluding row dimension.">QtRootNTuple::getColumnShape</a>,
<a name="l00130"></a>00130             return_value_policy &lt; return_by_value &gt; (),
<a name="l00131"></a>00131             <span class="stringliteral">&quot;rowDataDimSize ( label )\n&quot;</span>
<a name="l00132"></a>00132             <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00133"></a>00133             <span class="stringliteral">&quot;Returns a tuple of the dimensions (shape) of the array elements\n&quot;</span>
<a name="l00134"></a>00134             <span class="stringliteral">&quot;for the column specified by label.&quot;</span> )
<a name="l00135"></a>00135 
<a name="l00136"></a>00136     .def ( <span class="stringliteral">&quot;getLabels&quot;</span>,
<a name="l00137"></a>00137            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#aa369dc17424da2fe359d1ce9dd2c8b81" title="Returns the labels of the column, i.e.">QtRootNTuple::getLabels</a>,
<a name="l00138"></a>00138            return_value_policy &lt; copy_const_reference &gt; (),
<a name="l00139"></a>00139            <span class="stringliteral">&quot;getLabels () -&gt; list\n&quot;</span>
<a name="l00140"></a>00140            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00141"></a>00141            <span class="stringliteral">&quot;Returns the column labels.  Note: if a column is an array the\n&quot;</span>
<a name="l00142"></a>00142            <span class="stringliteral">&quot;shape does not appear as part of the label.\n&quot;</span> )
<a name="l00143"></a>00143 
<a name="l00144"></a>00144 <span class="preprocessor">#ifdef HAVE_NUMARRAY</span>
<a name="l00145"></a>00145 <span class="preprocessor"></span>    .def ( <span class="stringliteral">&quot;valueAt&quot;</span>,
<a name="l00146"></a>00146            &amp;<a class="code" href="classhippodraw_1_1QtRootNTuple.html#add78001a2fa02472876247926da10c7b" title="Returns a numarray for variable in row of NTuple.">QtRootNTuple::valueAt</a>,
<a name="l00147"></a>00147            return_value_policy &lt; return_by_value &gt; (),
<a name="l00148"></a>00148            <span class="stringliteral">&quot;valueAt ( index, label ) -&gt; array\n&quot;</span>
<a name="l00149"></a>00149            <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00150"></a>00150            <span class="stringliteral">&quot;Returns the numerical array for the array variable in column\n&quot;</span>
<a name="l00151"></a>00151            <span class="stringliteral">&quot;specified by label, for the row index.   Note: this method is\n&quot;</span>
<a name="l00152"></a>00152            <span class="stringliteral">&quot;only available if the hippo module was configured for numerical\n&quot;</span>
<a name="l00153"></a>00153            <span class="stringliteral">&quot;array support.&quot;</span> )
<a name="l00154"></a>00154 <span class="preprocessor">#endif</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span>    ;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 } <span class="comment">// namespace Python</span>
<a name="l00159"></a>00159 } <span class="comment">// namespace hippodraw</span>
</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>