19 #include "msdevstudio/MSconfig.h"
23 #include <boost/python.hpp>
36 using namespace boost::python;
44 class_ < QtRootNTuple, bases<DataSource>,
47 "The RootNTuple class provides access to data in a ROOT file.\n"
48 "A ROOT TTree is taken as an ntuple and a ROOT TBranch is taken as a\n"
49 "column, the TBranch name as the column label.\n\n"
50 "If the hippo module was configured with numeric array support,\n"
51 "consider using DataArray to wrap an object of this class.",
54 .add_property (
"rows", &QtRootNTuple::rows )
56 .add_property (
"columns", &QtRootNTuple::columns )
59 &QtRootNTuple::addColumn,
60 "addColumn ( label, list ) -> value\n"
62 "Adds a column to the ntuple. Adds a column to the ntuple by \n"
63 "copying the contents of the list. The new column will take its\n"
64 "label from the first argument. Returns the index of the newly \n"
66 "Note: The column is not added to the ROOT file, just logically\n"
67 "to it for the current session.\n")
69 .def (
"replaceColumn",
71 (
const std::string &,
72 const std::vector < double > & ) )
73 &RootNTuple::replaceColumn,
74 "replaceColumn ( index, list ) -> None\n"
75 "replaceColumn ( label, list ) -> None\n"
77 "Replaces the column of data by index or label. Does not\n"
78 "modify the ROOT file." )
80 .def (
"replaceColumn",
83 const std::vector < double > & ) )
84 &RootNTuple::replaceColumn )
87 (
const std::vector < double > & (QtRootNTuple::* )
88 (
const std::string & )
const)
89 &QtRootNTuple::getColumn,
90 return_value_policy < copy_const_reference> (),
91 "getColumn ( index ) -> list\n"
92 "getColumn ( label ) -> list\n"
93 "getColumn ( label, indices ) -> list\n"
95 "Returns a copy of the column as a list. In the first form the\n"
96 "the column is specified by its index. In the second form it\n"
97 "is specified by its label which could be a simple variable or\n"
98 "an array variable. If an array variable, the indices should be\n"
99 "part of the label. The third form, the column is specified by\n"
100 "an array variables name and list of indices.\n" )
103 (
const std::vector < double > & (QtRootNTuple::* )
104 (
const std::string &,
105 const std::vector < int > & )
const)
106 &QtRootNTuple::getColumn,
107 return_value_policy < copy_const_reference> () )
110 (
const std::vector < double > & (QtRootNTuple::* )
111 (
unsigned int )
const)
112 &QtRootNTuple::getColumn,
113 return_value_policy < copy_const_reference> () )
116 &QtRootNTuple::getRow,
117 return_value_policy < copy_const_reference> (),
118 "getRow ( index ) -> tuple\n"
120 "Returns a row from the ROOT file." )
122 .def (
"isMultiDimensional",
123 &QtRootNTuple::isMultiDimensional,
124 "isMultiDimensional ( label ) -> Boolean\n"
126 "Returns True if the column specified by label is an array." )
128 .def (
"rowDataDimSize",
129 &QtRootNTuple::getColumnShape,
130 return_value_policy < return_by_value > (),
131 "rowDataDimSize ( label )\n"
133 "Returns a tuple of the dimensions (shape) of the array elements\n"
134 "for the column specified by label." )
137 &QtRootNTuple::getLabels,
138 return_value_policy < copy_const_reference > (),
139 "getLabels () -> list\n"
141 "Returns the column labels. Note: if a column is an array the\n"
142 "shape does not appear as part of the label.\n" )
146 &QtRootNTuple::valueAt,
147 return_value_policy < return_by_value > (),
148 "valueAt ( index, label ) -> array\n"
150 "Returns the numerical array for the array variable in column\n"
151 "specified by label, for the row index. Note: this method is\n"
152 "only available if the hippo module was configured for numerical\n"