QtDisplay.cxx
Go to the documentation of this file.
1 
13 #ifdef HAVE_CONFIG_H
14 #include "config.h" // for have_root and have_numarray
15 #endif
16 
17 // include first to avoid _POSIX_C_SOURCE warning.
18 #include <boost/python.hpp>
19 
20 // For truncation warning
21 #ifdef _MSC_VER
22 #include "msdevstudio/MSconfig.h"
23 #endif
24 
25 #include "QtDisplay.h"
26 
27 #include "ListTuple.h"
28 #include "PyFunctionRep.h"
29 #include "PyApp.h"
30 #include "PyDataRep.h"
31 #include "PyDataSource.h"
32 #include "PyNTuple.h"
33 #include "FunctionWrap.h"
34 
38 
40 #include "plotters/PlotterBase.h"
43 
45 #include "datareps/DataRep.h"
46 
48 
49 #include "reps/RepBase.h"
50 #include "reps/ContourPointRep.h"
52 #include "colorreps/BinToColor.h"
53 
54 #ifdef HAVE_ROOT
55 #include "root/QtRootNTuple.h"
56 #endif
57 
58 #include <algorithm>
59 #include <sstream>
60 #include <utility>
61 
62 
63 using std::runtime_error;
64 using std::string;
65 using std::vector;
66 
67 using namespace boost::python;
68 
69 namespace hippodraw {
70 namespace Python {
71 
72 void
74 {
75  class_< QtDisplay >
76  ( "Display",
77  "A wrapper for the HippoDraw PlotterBase C++ class.\n "
78  " See HippoDraw's QtDisplay documentation for more details.",
79  init < const std::string & >
80  (
81 #if __GNUC__ < 3
82  "Display ( string, DataSource, tuple ) -> Display\n"
83  "\n"
84  "Constructor for a Display."
85 #else // gcc 2.95.3 crashes on the following...
86  "Display ( string ) -> Display\n"
87  "Display ( string, DataSource, tuple ) -> Display\n"
88  "Display ( string, DataArray, tuple ) - > Display\n"
89  "Display ( string, tuple, tuple ) -> Display\n"
90  "Display ( string, list, tuple ) -> Display\n"
91  "Display ( string, RootNTuple, tuple ) -> Display\n"
92  "Display ( string, RootNTuple, tuple, tuple ) -> Display\n"
93  "\n"
94  "This method is used to create a Display object.\n"
95  "The first method is used for creating static version of\n"
96  "Histogram, etc., where the string is the type of DataRep.\n"
97  "The remaining methods are for dynamic versions.\n"
98  "The string argument is the type. The second argument\n"
99  "is the DataSource and the third argument is tuple of\n"
100  "string for the binding to the DataSource.\n"
101  "For the last method, the fourth argument is a tuple\n"
102  "of integers to access a RootNTuple array variable.\n\n"
103  "For the names of the types of DataRep classes available\n"
104  "call DataRep.names()."
105 #endif
106  ) )
107 
108  .def ( init < PyFunctionRep * > () )
109 
110  .def ( init < const std::string &,
111  const DataSource &,
112  const std::vector< std::string > & > ()
113  [ with_custodian_and_ward < 1, 3 > ()] )
114 
115  .def ( init < const std::string &,
116  const PyDataSource &,
117  const std::vector< std::string > & > () )
118 
119  .def ( init < const std::string &,
121  const std::vector< std::string > & > () )
122 
123  .def ( init < const std::string &,
125  const std::vector< std::string > & > () )
126 
127 #ifdef HAVE_ROOT
128  .def ( init < const std::string &,
129  const QtRootNTuple &,
130  const std::vector< std::string > & > () )
131 
132  .def ( init < const std::string &,
133  const QtRootNTuple &,
134  const std::vector< std::string > &,
135  boost::python::list > () )
136 #endif
137 
138  .def ( "applyCut", &QtDisplay::applyCut,
139  "applyCut ( Cut ) -> None\n"
140  "\n"
141  "Apply a Cut to the Display" )
142 
143  .def ( "applyCuts", &QtDisplay::applyCuts,
144  "applyCuts ( sequence ) -> None\n"
145  "\n"
146  "Apply each Cut in the sequence to the Display" )
147 
148  .def ( "createNTuple", &QtDisplay::createNTuple,
149  return_value_policy < manage_new_object > (),
150  "createNTuple ( ) -> NTuple\n"
151  "\n"
152  "Returns a NTuple representation of the Display's contents." )
153 
154  .def ( "createDataArray", &QtDisplay::createDataArray,
155  return_value_policy < manage_new_object > (),
156  "createDataArray ( ) -> DataArray\n"
157  "\n"
158  "Returns a DataArray representation of the Display's contents\n"
159  "(This method available if configured with numarray)" )
160 
161  .def ( "setNumberOfBins", &QtDisplay::setNumberOfBins,
162  "setNumberOfBins ( string, value ) -> None\n"
163  "\n"
164  "Sets the number of bins on named axis, e.g. 'x' to the given \n"
165  "value." )
166 
167  .def ( "setBinWidth",
168  ( void (QtDisplay::*) ( const std::string &,
169  double,
170  bool ) )
171  &QtDisplay::setBinWidth,
172  "Set the bin width, explicitly saving the value or not." )
173 
174  .def ( "getBinWidth",
175  ( double (QtDisplay::*) ( const std::string & ) )
176  &QtDisplay::getBinWidth,
177  "getBinWidth ( string ) -> value\n"
178  "\n"
179  "Returns the bin width on axis specified as a string,\n"
180  "e.g., 'x'." )
181 
182  .def ( "setBinWidth",
183  ( void (QtDisplay::*) ( const std::string &,
184  double ) )
185  &QtDisplay::setBinWidth,
186  "setBinWidth ( string, value ) -> None\n"
187  "\n"
188  "Set the bin width to value on axis specified as a string,\n"
189  "e.g., 'x'." )
190 
191  .def ( "reset", &QtDisplay::reset,
192  "reset () -> None\n"
193  "\n"
194  "Resets the contents of all bins. Only applicable to static\n"
195  "histograms." )
196 
197  .def ( "setOffset", &QtDisplay::setOffset,
198  "setOffset ( string, value ) -> None\n"
199  "\n"
200  "Sets the offset of the bins relative to their current width on\n"
201  "specified axis." )
202 
203  .def ( "setRange",
204  ( void (QtDisplay::*) (const std::string &,
205  double, double) )
206  &QtDisplay::setRange )
207 
208  .def ( "setRange",
209  ( void (QtDisplay::*) (const std::string &,
210  double, double, bool) )
211  &QtDisplay::setRange,
212  "setRange ( string, value, value ) -> None\n"
213  "setRange ( string, value, value, Boolean ) -> None\n"
214  "\n"
215  "Set the upper and lower bounds for the specified axis. For the\n"
216  "second form, also save them if the Boolean argument is true." )
217 
218 
219  .def ( "getRange", &QtDisplay::getRange,
220  "getRange ( string ) -> tuple\n"
221  "\n"
222  "Returns the tuple representing the range for the axis specified\n"
223  "as a string, e.g., 'x'." )
224 
225  .def ( "saveView", &QtDisplay::saveView,
226  "saveView ( ) -> int\n"
227  "\n"
228  "Saves the current set of x and y ranges and "
229  "returns the index of the saved view." )
230 
231  .def ( "setView", &QtDisplay::setView,
232  "setView ( int ) -> None\n"
233  "\n"
234  "Set the view by its index." )
235 
236  .def ( "nextView", &QtDisplay::nextView,
237  "nextView ( bool ) -> int\n"
238  "\n"
239  "Cycle to the next view in the view buffer. "
240  "Set the argument to True to cycle for wards, "
241  "False to cycle back wards.\n"
242  "Returns the index of the new view." )
243 
244  .def ( "numViews", &QtDisplay::numViews,
245  "numViews ( ) -> int\n"
246  "\n"
247  "Return the number of stored views." )
248 
249  .def ( "deleteView", &QtDisplay::deleteView,
250  "deleteView ( int ) -> None\n"
251  "\n"
252  "Delete a view by index." )
253 
254  .def ( "currentView", &QtDisplay::currentView,
255  "currentView ( ) -> int\n"
256  "\n"
257  "Index of the current view." )
258 
259  .def ( "setTitle", &QtDisplay::setTitle,
260  "setTitle ( string ) -> None\n"
261  "\n"
262  "Sets the title of the display." )
263 
264  .def ( "getTitle", &QtDisplay::getTitle,
265  return_value_policy < copy_const_reference > (),
266  "getTitle () -> string\n"
267  "\n"
268  "Returns the current title. The title will be the title of\n"
269  "the DataSource unless it has been explicitly changed." )
270 
271  .def ( "setLabel", &QtDisplay::setLabel,
272  "setLabel ( string, string ) -> None\n"
273  "\n"
274  "Sets the label for the axis specified by first argument to value\n"
275  "of the second argument." )
276 
277  .def ( "getLabel", &QtDisplay::getLabel,
278  return_value_policy< copy_const_reference > (),
279  "getLabel ( string ) -> string\n"
280  "\n"
281  "Returns the label of the axis specified as a string,\n"
282  "e.g., 'x'." )
283 
284  .def ( "getDataRep", &QtDisplay::getDataRep,
285  return_value_policy < manage_new_object > (),
286  "getDataRep ( ) -> DataRep\n"
287  "\n"
288  "Returns a reference to the active DataRep or if all DataRep objects are\n"
289  "active, returns a reference to the first one." )
290 
291  .def ( "getDataReps", &QtDisplay::getDataReps,
292  return_value_policy < copy_const_reference > (),
293  "getDataReps ( ) -> list\n"
294  "\n"
295  "Returns a list of DataRep objects contained by the Display.." )
296 
297  .def ( "addDataRep",
298  ( void (QtDisplay::*) (PyDataRep *) )
299  &QtDisplay::addDataRep,
300  "addDataRep ( DataRep ) -> Display\n"
301  "addDataRep ( Function ) -> Display\n"
302  "addDataRep ( string, DataSource, tuple ) -> Display\n"
303  "\n"
304  "Adds a DataRep to the display sharing the same Y axis range\n"
305  "The first two methods adds existing DataRep or Function to the\n"
306  "Display. The third method creates and adds DataRep to the\n"
307  "Display. Arguments are same as Display constructor." )
308 
309  .def ( "addDataRep",
310  ( void (QtDisplay::*) (const std::string &,
311  const DataSource *,
312  const std::vector <std::string > &) )
313  &QtDisplay::addDataRep )
314 
315  .def ( "addDataRep",
316  ( void (QtDisplay::*) (PyFunctionRep *) )
317  &QtDisplay::addDataRep )
318 
319  .def ( "addDataRepStacked",
320  ( void (QtDisplay::*) (const std::string &,
321  const DataSource *,
322  const std::vector <std::string > &) )
323  &QtDisplay::addDataRepStacked,
324  "addDataRepStacked ( string, DataSource, tuple ) -> Display\n"
325  "\n"
326  "Creates and adds a DataRep with independent Y axis ranges.\n"
327  "The arguments are the same as Display constructor." )
328 
329 #ifndef BOOST_DEFECT
330  .def ( "addFunction",
331  ( void (QtDisplay::*) (FunctionBase *) )
332  &QtDisplay::addFunction,
333  "addFunction ( FunctionBase ) -> None\n"
334  "\n"
335  "Adds a FunctionBase object to the display by appropriately\n"
336  "wrapping it with a Function." )
337 #endif // BOOST_DEFECT
338 
339  .def ( "setAutoRanging",
340  ( void (QtDisplay::*) (const std::string &,
341  bool flag ) )
342  &QtDisplay::setAutoRanging,
343  "setAutoRanging ( string, Boolean ) -> None\n"
344  "\n"
345  "Sets auto-ranging on axis specified as a string, e.g. 'x',n"
346  "on or off." )
347 
348  .def ( "setLog", &QtDisplay::setLog,
349  "setLog ( string, Boolean ) -> None\n"
350  "\n"
351  "Sets the axis specified by the first argument on log scale." )
352 
353  .def ( "getLog", &QtDisplay::getLog,
354  "getLog ( string ) -> value\n"
355  "\n"
356  "Returns True if axis specified as a string, e.g. 'x', is being\n"
357  "displayed on a logarithmic scale." )
358 
359  .def ( "setTransform", &QtDisplay::setTransform,
360  "setTransform ( string ) -> None\n"
361  "\n"
362  "Sets the transform object." )
363 
364  .def ( "addValues", &QtDisplay::addValues,
365  "addValue ( tuple ) -> None\n"
366  "\n"
367  "For static histograms, adds a value to the accumulation.\n"
368  "For 1D histogram, the tuple should contain one or two values,\n"
369  "the second used as a weight. For 2D histogram, the tuple should\n"
370  "contain two or three elements, the third being the weight.\n"
371  "non static Displays do nothing." )
372 
373  .def ( "setPointRep", &QtDisplay::setPointRep,
374  "setPointRep ( RepBase ) -> None\n"
375  "\n"
376  "Sets the point representation to be used." )
377 
378  .def ( "setContourLevels", &QtDisplay::setContourLevels,
379  "setContourLevels ( sequence ) -> None\n"
380  "\n"
381  "Sets the contour levels if the Display is using contour point\n"
382  "representation from the values in the sequence." )
383 
384  .def ( "setAspectRatio", &QtDisplay::setAspectRatio,
385  "setAspectRatio ( value ) -> None\n"
386  "\n"
387  "Sets the required aspect ratio of the Display to value, the\n"
388  "ratio of the width to the height." )
389 
390  .def ( "numberOfEntries", &QtDisplay::numberOfEntries,
391  "numberOfEntries ( ) -> value\n"
392  "\n"
393  "Returns the number of entries in the Display." )
394 
395  .def ( "resize", &QtDisplay::resize,
396  "resize () -> None\n"
397  "\n"
398  "Resizes the Display to its saved values." )
399 
400  .def ( "plotterId", &QtDisplay::plotterId,
401  "plotterId () -> value\n"
402  "\n"
403  "Returns a unique identifier for the Display." )
404 
405  .def ( "setColorMap", &QtDisplay::setColorMap,
406  "setColorMap ( string ) -> None\n"
407  "\n"
408  "Set the value-to-color map to one named by the argument.")
409 
410  .def ( "update", &QtDisplay::update,
411  "update () -> None\n"
412  "\n"
413  "Updates the display." )
414 
415  .def ( "addObserver", &QtDisplay::addObserver,
416  "addObserver ( Observer ) -> None\n"
417  "\n"
418  "Adds an Observer to the Display object." )
419 
420  .def ( "setAutoTicks", &QtDisplay::setAutoTicks,
421  "setAutoTicks ( Boolean ) -> None\n"
422  "\n"
423  "Set the ticks generation to be automatic (the default) or\n"
424  "manually." )
425 
426  .def ( "setTicks", &QtDisplay::setTicks,
427  "setTicks ( string, sequence, sequence ) -> None\n"
428  "\n"
429  "Sets the tick locations and labels. The first argument is the\n"
430  " axis, the second argument is a sequence containing the\n"
431  "locations, and the third argument is a sequence of tick labels." )
432 
433  .def ( "unlock", &QtDisplay::unlock,
434  "unlock () -> None\n"
435  "\n"
436  "Unlock the application thread." )
437 
438  ;
439 }
440 
441 } // namespace Python
442 } // namespace hippodraw
443 
444 using namespace hippodraw;
445 
448 void QtDisplay::createDisplay ( const std::string & type,
449  const DataSource & nt,
450  const std::vector < std::string > & bindings )
451 {
452  PyApp::lock();
453  DisplayController * controller = DisplayController::instance ();
454  try {
455  m_plotter = controller->createDisplay ( type, nt, bindings );
456  PyApp::unlock ();
457  }
458  catch ( const FactoryException & e ) {
459  PyApp::unlock ();
460  throw e;
461  }
462  catch ( const DataRepException & e ) {
463  PyApp::unlock ();
464  throw e;
465  }
466  catch ( const runtime_error & e ) {
467  PyApp::unlock ();
468  throw e;
469  }
470 }
471 
472 QtDisplay::
473 QtDisplay ( const std::string & type,
475  const std::vector < std::string > & labels )
476 {
477  PyApp::lock();
478 
479  object obj = seq.attr ( "__len__" ) ();
480 
481  ListTuple * ntuple = new ListTuple ( );
482 
483  try {
484  unsigned int size = extract < unsigned int > ( obj );
485 
486  if ( size > labels.size () ) {
487  string what ( "Display: Too few labels" );
488  throw runtime_error ( what );
489  }
490 
491  for ( unsigned int i = 0, j = 0; i < size; i++, j++ ) {
492  boost::python::list l = extract < boost::python::list > ( seq[i] );
493 
494  while ( labels[j] == "nil" ) {
495  j++; // skip such labels
496  if ( ! ( j < labels.size () ) ) {
497  string what ( "Display: Too few non 'nil' labels" );
498  throw runtime_error ( what );
499  }
500 
501  }
502  ntuple -> addColumn ( labels[j], l );
503  }
504  }
505  catch ( const runtime_error & e ) {
506  delete ntuple;
507  PyApp::unlock ();
508  throw e;
509  }
510 
511  // Do not call createDisplay() as exceptions wouldn't print nicely
512  try {
513  DisplayController * dc = DisplayController::instance ();
514  m_plotter = dc -> createDisplay ( type, *ntuple, labels );
515  }
516  catch ( const FactoryException & e ) {
517  delete ntuple;
518  PyApp::unlock ();
519  throw e;
520  }
521  catch ( const DataRepException & e ) {
522  delete ntuple;
523  PyApp::unlock ();
524  throw e;
525  }
526  catch ( const runtime_error & e ) {
527  delete ntuple;
528  PyApp::unlock ();
529  throw e;
530  }
531 
532  // No use telling controller about it until we are sure to accept it.
533  DataSourceController * dsc = DataSourceController::instance ();
534  dsc -> registerNTuple ( ntuple );
535 
536  PyApp::unlock ();
537 }
538 
539 QtDisplay::
540 QtDisplay ( const std::string & type,
542  const std::vector < std::string > & labels )
543 {
544  PyApp::lock();
545 
546  object obj = seq.attr ( "__len__" ) ();
547 
548  ListTuple * ntuple = new ListTuple ( );
549 
550  try {
551  unsigned int size = extract < unsigned int > ( obj );
552 
553  if ( size > labels.size () ) {
554  string what ( "Display: Too few labels" );
555  throw runtime_error ( what );
556  }
557 
558  // gcc 2.95.3 needs full scoping
559  for ( unsigned int i = 0, j = 0; i < size; i++, j++ ) {
560  boost::python::list l = extract < boost::python::list > ( seq[i] );
561 
562  while ( labels[j] == "nil" ) {
563  j++; // skip such labels
564  if ( ! ( j < labels.size () ) ) {
565  string what ( "Display: Too few non 'nil' labels" );
566  throw runtime_error ( what );
567  }
568 
569  }
570  ntuple -> addColumn ( labels[j], l );
571  }
572  }
573  catch ( const runtime_error & e ) {
574  delete ntuple;
575  PyApp::unlock ();
576  throw e;
577  }
578 
579  // Do not call createDisplay() as exceptions wouldn't print nicely
580  try {
581  DisplayController * dc = DisplayController::instance ();
582  m_plotter = dc -> createDisplay ( type, *ntuple, labels );
583  }
584  catch ( const FactoryException & e ) {
585  delete ntuple;
586  PyApp::unlock ();
587  throw e;
588  }
589  catch ( const DataRepException & e ) {
590  delete ntuple;
591  PyApp::unlock ();
592  throw e;
593  }
594  catch ( const runtime_error & e ) {
595  delete ntuple;
596  PyApp::unlock ();
597  throw e;
598  }
599 
600  // No use telling controller about it until we are sure to accept it.
601  DataSourceController * dsc = DataSourceController::instance ();
602  dsc -> registerNTuple ( ntuple );
603 
604  PyApp::unlock ();
605 }
606 
607 QtDisplay::QtDisplay ()
608  : m_plotter ( 0 )
609 {
610 }
611 
614 {
615  PyApp::lock();
617  try {
618  DataRep * dr = rep -> getRep ();
619  m_plotter = controller -> createDisplay ( dr );
620  PyApp::unlock ();
621  }
622  catch ( const FactoryException & e ) {
623  PyApp::unlock ();
624  throw e;
625  }
626  catch ( const DataRepException & e ) {
627  PyApp::unlock ();
628  throw e;
629  }
630 }
631 
633 QtDisplay ( const std::string & type )
634 {
635 // PyApp::lock();
637  try {
638  m_plotter = controller -> createDisplay ( type );
639  PyApp::unlock ();
640  }
641  catch ( const FactoryException & e ) {
642  PyApp::unlock ();
643  throw e;
644  }
645  catch ( const DataRepException & e ) {
646  PyApp::unlock ();
647  throw e;
648  }
649 // PyApp::unlock ();
650 }
651 
652 
653 QtDisplay::QtDisplay( const std::string & type,
654  const DataSource & nt,
655  const std::vector< std::string > & bindings )
656 {
657  createDisplay ( type, nt, bindings );
658 }
659 
660 QtDisplay::QtDisplay( const std::string & type,
661  const PyDataSource & nt,
662  const std::vector< std::string > & bindings )
663 {
664  createDisplay ( type, nt.dataSource(), bindings );
665 }
666 
667 #ifdef HAVE_ROOT
669 QtDisplay ( const std::string & type,
670  const QtRootNTuple & nt,
671  const std::vector < std::string > & bindings )
672 {
673  createDisplay ( type, nt, bindings );
674 }
675 
677 QtDisplay ( const std::string & type,
678  const QtRootNTuple & nt,
679  const std::vector < std::string > & variables,
680  boost::python::list indices )
681 {
682  object obj = indices.attr ( "__len__" ) ();
683  unsigned int size = extract < unsigned int > ( obj );
684 
685  if ( size != variables.size() ) {
686  const string what ( "Display: bindings and indexes not the same size." );
687  PyApp::unlock ();
688  throw runtime_error ( what );
689  }
690 
691  vector < vector < int > > vec ( size );
692  for ( unsigned int i = 0; i < size; i++ ) {
693  boost::python::list l = extract < boost::python::list > ( indices[i] );
694  object o = l.attr ( "__len__" ) ();
695  unsigned int len = extract < unsigned int > ( o );
696  for ( unsigned int j = 0; j < len; j++ ) {
697  unsigned int k = extract < unsigned int > ( l[j] );
698  vec[i].push_back ( k );
699  }
700  }
701 
702  vector < string > bindings ( size );
703 
704  for ( unsigned int i = 0; i < size; i++ ) {
705  const string & label = variables [ i ];
706  const vector < int > & indexes = vec [ i ];
707  const string name = nt.createBinding ( label, indexes );
708  bindings [ i ] = name;
709  }
710 
711  createDisplay ( type, nt, bindings );
712 }
713 
714 #endif // have_root
715 
717 QtDisplay ( PlotterBase * plotter) : m_plotter(plotter) {}
718 
720 {
721 // delete m_plotter;
722 }
723 
725 {
726  return m_plotter;
727 }
728 
731 void QtDisplay::addDataRep ( const std::string & type,
732  const DataSource * ntuple,
733  const std::vector < std::string > & bindings )
734 {
735  PyApp::lock();
736 
738  controller->addDataRep ( m_plotter, type, ntuple, bindings );
739 
740  PyApp::unlock ();
741 }
742 
743 void
745 addDataRepStacked ( const std::string & type,
746  const DataSource * ntuple,
747  const std::vector < std::string > & bindings )
748 {
749  PyApp::lock();
750 
752  controller->addDataRepStacked ( m_plotter, type, ntuple, bindings );
753 
754  PyApp::unlock ();
755 }
756 
758 {
759  PyApp::lock();
760 
762  controller->addDataRep ( m_plotter, pyRep->getDataRep() );
763 
764  PyApp::unlock ();
765 }
766 
768 {
769  PyApp::lock();
770 
772 
773  controller->addDataRep ( m_plotter, pyFuncRep->getRep() );
774 
775  PyApp::unlock ();
776 }
777 
778 #ifndef BOOST_DEFECT
779 void
781 addFunction ( FunctionBase * function )
782 {
783  PyApp::lock();
785  DataRep * dataRep = m_plotter->getDataRep( 0 );
786 
787 // The following datarep will be deleted by the CompositePlotter.
788  FunctionRep * funcRep =
789  funcController->createFunctionRep(function, dataRep);
790 
792  dataRep = reinterpret_cast<DataRep *>(funcRep);
793  controller->addDataRep(m_plotter, dataRep);
794 
795  PyApp::unlock ();
796 }
797 #endif // BOOST_DEFECT
798 
799 void
801 setRange ( const std::string & axis, double low, double high,
802  bool save)
803 {
804  PyApp::lock();
805 
806  if (save) {
807  if (axis == "x" || axis == "X")
808  m_ranges["x"] = std::make_pair(low, high);
809  if (axis == "y" || axis == "Y")
810  m_ranges["y"] = std::make_pair(low, high);
811  }
812 
813  m_plotter->setRange ( axis, low, high );
814 
815  PyApp::unlock ();
816 }
817 
818 void
820 setRange ( const std::string & axis, double low, double high )
821 {
822  PyApp::lock();
823  setRange( axis, low, high, false );
824  PyApp::unlock();
825 }
826 
827 std::vector<double>
829 getRange ( const std::string & axis )
830 {
831  PyApp::lock ();
832 
833  std::vector<double> myRange;
834  try {
835  Axes::Type type = Axes::convert ( axis );
836  const Range & axisRange = m_plotter->getRange( type, true );
837  myRange.push_back(axisRange.low());
838  myRange.push_back(axisRange.high());
839 
840  PyApp::unlock ();
841  }
842  catch ( const PlotterException & e ) {
843  PyApp::unlock ();
844  throw e;
845  }
846 
847  return myRange;
848 }
849 
851 {
852  std::vector<double> range_values;
853  std::vector<double> range = getRange("x");
854  range_values.push_back(range[0]);
855  range_values.push_back(range[1]);
856  m_ranges["x"] = std::make_pair(range[0], range[1]);
857 
858  range = getRange("y");
859  range_values.push_back(range[0]);
860  range_values.push_back(range[1]);
861  m_ranges["y"] = std::make_pair(range[0], range[1]);
862 
863  return m_plotter->saveView(range_values);
864 }
865 
867 {
868  PyApp::lock();
869  try {
870  m_plotter->setView( index );
871  } catch (...) {
872  PyApp::unlock ();
873  throw;
874  }
875  PyApp::unlock ();
876 }
877 
878 int QtDisplay::nextView( bool stepForward )
879 {
880  int index(-1);
881  PyApp::lock();
882  try {
883  index = m_plotter->nextView(stepForward);
884  } catch (...) {
885  PyApp::unlock ();
886  throw;
887  }
888  PyApp::unlock ();
889  return index;
890 }
891 
893  return m_plotter->numViews();
894 }
895 
897  PyApp::lock();
898  try {
899  m_plotter->deleteView(index);
900  } catch (...) {
901  PyApp::unlock ();
902  throw;
903  }
904  PyApp::unlock ();
905 }
906 
908  return m_plotter->currentView();
909 }
910 
911 void QtDisplay::setTitle ( const std::string & title )
912 {
913  PyApp::lock();
914  m_plotter->setTitle ( title );
915  PyApp::unlock ();
916 }
917 
918 const std::string & QtDisplay::getTitle() const {
919  return m_plotter->getTitle();
920 }
921 
922 void
925 {
926  PyApp::lock();
927  try {
928  m_plotter->setRepresentation ( rep );
929  } catch ( const std::runtime_error & e ) {
930  PyApp::unlock ();
931  throw e;
932  }
933  PyApp::unlock ();
934 }
935 
936 void
938 setContourLevels ( const std::vector<double> &levels )
939 {
940  PyApp::lock();
942 
943  if ( rep->name() == std::string("Contour") ) {
944  DataRep * datarep
946 
947  dynamic_cast<ContourPointRep *>(rep)
948  ->setContourValues( const_cast<std::vector<double>&>(levels),
949  datarep->getProjector() );
950 
951  datarep->notifyObservers();
952 
953  } else {
954  // do nothing
955  }
956  PyApp::unlock ();
957 }
958 
959 void QtDisplay::setLabel ( const std::string & axis,
960  const std::string & label )
961 {
962  PyApp::lock();
963 
964  Axes::Type at = Axes::convert ( axis );
965  m_plotter->setLabel ( at, label );
966 
967  PyApp::unlock ();
968 }
969 
970 const std::string &
972 getLabel ( const std::string & axis ) const
973 {
974  PyApp::lock ();
975  Axes::Type at = Axes::convert ( axis );
976  const std::string & label = m_plotter -> getLabel( at );
977  PyApp::unlock ();
978 
979  return label;
980 }
981 
982 void
984 setNumberOfBins ( const std::string & axis, unsigned int number )
985 {
986  PyApp::lock();
987  m_plotter->setNumberOfBins ( axis, number );
988  PyApp::unlock();
989 }
990 
991 void
994 {
995  PyApp::lock();
996  m_plotter -> reset ();
997  PyApp::unlock ();
998 }
999 
1000 void QtDisplay::setBinWidth ( const std::string & axis, double width,
1001  bool save )
1002 {
1003  PyApp::lock();
1004 
1005  if (save) {
1006  if (axis == "x" || axis == "X")
1007  m_binWidths["x"] = width;
1008  if (axis == "y" || axis == "Y")
1009  m_binWidths["y"] = width;
1010  }
1011 
1012  m_plotter->setBinWidth ( axis, width );
1013 
1014  PyApp::unlock ();
1015 }
1016 
1017 double
1019 getBinWidth ( const std::string & axis ) const
1020 {
1021  return m_plotter->getBinWidth ( axis);
1022 }
1023 
1024 void
1026 setBinWidth ( const std::string & axis, double width )
1027 {
1028  PyApp::lock();
1029  setBinWidth( axis, width, false );
1030  PyApp::unlock ();
1031 }
1032 
1033 void QtDisplay::setOffset ( const std::string & axis, double offset )
1034 {
1035  PyApp::lock();
1037  Axes::Type type = Axes::convert ( axis );
1038 
1039  controller->setOffset ( m_plotter, type, offset );
1040  PyApp::unlock();
1041 }
1042 
1045 void QtDisplay::setTransform ( const std::string & name )
1046 {
1047  PyApp::lock();
1048 
1050  try {
1051  controller->setTransform ( m_plotter, name );
1052  PyApp::unlock ();
1053  } catch (PlotterException & eObj) {
1054  PyApp::unlock ();
1055  throw eObj;
1056  } catch (FactoryException & eObj) {
1057  PyApp::unlock ();
1058  throw eObj;
1059  }
1060 }
1061 
1063  PyApp::unlock ();
1064 }
1065 
1066 void QtDisplay::setLog ( const std::string & axis, int flag )
1067 {
1068  PyApp::lock();
1069  Axes::Type type = Axes::convert ( axis );
1071  bool yes = flag != 0;
1072 
1073  controller->setLog ( m_plotter, type, yes );
1074  PyApp::unlock ();
1075 }
1076 
1077 int QtDisplay::getLog ( const std::string & axis )
1078 {
1080  if ( controller->getLog ( m_plotter, axis) ) {
1081  return 1;
1082  } else {
1083  return 0;
1084  }
1085 }
1086 
1087 void QtDisplay::setAutoRanging ( const std::string & axis, bool flag )
1088 {
1089  PyApp::lock();
1090  Axes::Type type = Axes::convert ( axis );
1091  m_plotter->setAutoRanging ( type, flag );
1092  PyApp::unlock ();
1093 }
1094 
1095 PyDataRep *
1098 {
1099  PyApp::lock ();
1100 
1101  int index = m_plotter->activePlotIndex();
1102  if ( index < 0 ) index = 0;
1103  DataRep * rep = m_plotter->getDataRep ( index );
1104  PyDataRep * pyrep = new PyDataRep ( rep );
1105 
1106  PyApp::unlock ();
1107 
1108  return pyrep;
1109 }
1110 
1111 const std::vector<PyDataRep *> &
1113 getDataReps () const
1114 {
1115  PyApp::lock ();
1116 
1117  m_pyDataReps.clear();
1118  int nReps = m_plotter->getNumDataReps();
1119  for (int i = 0; i < nReps; i++) {
1120  m_pyDataReps.push_back( new PyDataRep ( m_plotter->getDataRep( i ) ) );
1121  }
1122  PyApp::unlock ();
1123 
1124  return m_pyDataReps;
1125 }
1126 
1127 void
1129 setAspectRatio ( double ratio )
1130 {
1131  PyApp::lock();
1132  m_plotter->setAspectRatio ( ratio );
1133  PyApp::unlock ();
1134 }
1135 
1136 void
1138 addValues ( const std::vector < double > & v )
1139 {
1140  PyApp::lock();
1141  m_plotter -> addValues ( v );
1142  PyApp::unlock ();
1143 }
1144 
1145 PyNTuple *
1148 {
1149  // Need to lock else could create NTuple not yet displayed
1150  PyApp::lock();
1152  const NTuple * ntuple = controller -> createNTuple ( m_plotter, 0 );
1153 
1154  PyNTuple * pytuple = new PyNTuple ( *ntuple );
1155  delete ntuple;
1156 
1157  PyApp::unlock ();
1158 
1159  return pytuple;
1160 }
1161 
1162 double
1165 {
1166  ProjectorBase * projector = m_plotter->activeProjector();
1167  return projector->getNumberOfEntries();
1168 }
1169 
1170 void
1173 {
1174  PyApp::lock();
1175 
1176  if (m_binWidths.count("x")) {
1177  m_plotter->setBinWidth("x", m_binWidths["x"]);
1178  } else {
1179 // set and unset log-scale to get decent bin sizes
1181  if ( controller->getLog( m_plotter, "x" ) ) {
1182  setLog( "x", 0 );
1183  setLog( "x", 1 );
1184  } else {
1185  setLog( "x", 1 );
1186  setLog( "x", 0 );
1187  }
1188  }
1189 
1190  if (m_binWidths.count("y")) {
1191  m_plotter->setBinWidth("y", m_binWidths["y"]);
1192  } else {
1193  // set and unset log-scale to get decent bin sizes
1195  if ( controller->getLog( m_plotter, "y" ) ) {
1196  setLog( "y", 0 );
1197  setLog( "y", 1 );
1198  } else {
1199  setLog( "y", 1 );
1200  setLog( "y", 0 );
1201  }
1202  }
1203 
1204  if (m_ranges.count("x")) {
1205  m_plotter->setRange("x", m_ranges["x"].first, m_ranges["x"].second);
1206  } else {
1207  m_plotter->setAutoRanging("x", true);
1208  }
1209 
1210  if (m_ranges.count("y")) {
1211  m_plotter->setRange("y", m_ranges["y"].first, m_ranges["y"].second);
1212  } else {
1213  m_plotter->setAutoRanging("y", true);
1214  }
1215 
1216  PyApp::unlock ();
1217 }
1218 
1220 {
1221  return m_plotter->plotterId();
1222 }
1223 
1227 void QtDisplay::
1228 setColorMap ( const std::string & name ) {
1229  PyApp::lock();
1231  const vector< std::string > & names = factory -> names();
1232  if ( std::find(names.begin(), names.end(), name) != names.end() ) {
1233  BinToColor * rep = factory -> create ( name );
1234  m_plotter -> setValueRep( rep );
1235  PyApp::unlock ();
1236  } else {
1237  PyApp::unlock();
1238  std::ostringstream message;
1239  message << "QtDisplay::setColorMap:\n"
1240  << "BinToColor rep '" << name << "' does not exist.\n"
1241  << "Valid rep names are \n\n";
1242  for (unsigned int i = 0; i < names.size() ; i++) {
1243  message << "'" << names[i] << "'\n";
1244  }
1245  throw std::runtime_error(message.str());
1246  }
1247 }
1248 
1249 void
1252 {
1253  PyApp::lock();
1254 
1255  m_plotter -> update ();
1256 
1257  PyApp::unlock ();
1258 }
1259 
1260 void
1262 addObserver ( Observer * observer )
1263 {
1264  m_plotter -> addObserver ( observer );
1265 }
1266 
1267 void
1269 setTicks ( const std::string & axis,
1270  const std::vector < double > & values,
1271  const std::vector < std::string > & labels )
1272 {
1273  PyApp::lock();
1274  m_plotter -> setTicks ( axis, values, labels );
1275  PyApp::unlock ();
1276 }
1277 
1278 void
1280 setAutoTicks ( const std::string & axis, bool yes )
1281 {
1282  PyApp::lock();
1283  m_plotter -> setAutoTicks ( axis, yes );
1284  PyApp::unlock ();
1285 }
1286 
1287 PyDataSource *
1290 {
1291  // Need to lock else could create NTuple not yet displayed
1292 #ifdef HAVE_NUMARRAY
1293  PyApp::lock();
1294 
1296  NTuple * ntuple = controller -> createNTuple ( m_plotter, 0 );
1297  PyDataSource * ds = new PyDataSource ( "NTuple", ntuple );
1298 
1299  PyApp::unlock ();
1300 
1301  return ds;
1302 #else
1303  runtime_error e ( "HippoDraw was not built with numeric Python support" );
1304  throw e;
1305 #endif
1306 }
1307 
1308 void
1311 {
1312  PyApp::lock();
1313 
1314  PlotterBase * cut_plotter = cut -> display();
1315  PlotterBase * target_plotter = display ();
1316 
1317  CutController * controller = CutController::instance();
1318  controller -> addCut ( cut_plotter, target_plotter );
1319 
1320  PyApp::unlock ();
1321 }
1322 
1323 void
1325 applyCuts ( const std::vector < QtDisplay * > & cuts )
1326 {
1327  PyApp::lock();
1328 
1329  vector < PlotterBase * > cut_plotters;
1330  unsigned int size = cuts.size ();
1331  for ( unsigned int i = 0; i < size; i++ ) {
1332  QtDisplay * cut_display = cuts[i];
1333  PlotterBase * plotter = cut_display -> display();
1334  cut_plotters.push_back ( plotter );
1335  }
1336 
1337  PlotterBase * target_plotter = display ();
1338  CutController * controller = CutController::instance();
1339  controller -> addCuts ( cut_plotters, target_plotter );
1340 
1341  PyApp::unlock ();
1342 }
int saveView()
Save the current set of plot ranges which define a &quot;view&quot; for this plot.
Definition: QtDisplay.cxx:850
void setTitle(const std::string &title)
Sets the title of the display.
Definition: QtDisplay.cxx:911
void setPointRep(RepBase *rep)
Sets the PointRep for the display.
Definition: QtDisplay.cxx:924
virtual RepBase * representation() const =0
Returns the representation used by the plotter.
PyNTuple * createNTuple() const
Creates and returns an PyNTuple representing the display.
Definition: QtDisplay.cxx:1147
void addDataRep(PlotterBase *, hippodraw::DataRep *) const
Adds the DataRep to the PlotterBase object by including it.
unsigned int i
A PointRep class that draws a contour lines.
const std::string & getTitle() const
Returns the title of the display.
Definition: QtDisplay.cxx:918
void setOffset(const std::string &axis, double offset)
Sets the offset of the bins on the specified axis.
Definition: QtDisplay.cxx:1033
int currentView()
Return the current view index.
Definition: QtDisplay.cxx:907
int nextView(bool stepForward=true)
Cycle through each set of plot ranges, thereby changing the view with each call.
Definition: QtDisplay.cxx:878
A singleton class that is the interface between GUI and the displays.
double high() const
Returns the maximum of the range object.
Definition: Range.cxx:100
void unlock()
Unlock the QApplication in case of exception.
Definition: QtDisplay.cxx:1062
virtual void notifyObservers() const
Notifies Observer objects of a change.
Definition: Observable.cxx:93
virtual int plotterId() const
The unique ID number of this plotter.
void update()
Updates the display.
Definition: QtDisplay.cxx:1251
const std::vector< PyDataRep * > & getDataReps() const
Returns a vector of all DataReps in the plotter.
Definition: QtDisplay.cxx:1113
static CutController * instance()
Returns the pointer to the singleton instance.
void createDisplay(const std::string &type, const DataSource &nt, const std::vector< std::string > &bindings)
Create a QtDisplay.
Definition: QtDisplay.cxx:448
A wrapper class for Python tuple objects.
Definition: python.dir:45
hippodraw::QtRootNTuple class interface.
void export_QtDisplay()
Exports the QtDisplay class to Python.
Definition: QtDisplay.cxx:73
The base class for the value to the color transformation.
Definition: BinToColor.h:30
static BinToColorFactory * instance()
Returns a pointer to the singleton instance.
hippodraw::PyDataRep class interface
static FunctionController * instance()
Returns the pointer to the singleton instance.
virtual int activePlotIndex() const
Returns the index of the active plotter.
void setColorMap(const std::string &name)
Set the color map by name.
Definition: QtDisplay.cxx:1228
hippodraw::DataRep * addDataRepStacked(PlotterBase *plotter, const std::string &name, const DataSource *source, const std::vector< std::string > &bindings) const
Creates a new DataRep object with class name name and adds it to the existing plotter by stacking it...
int getLog(const std::string &axis)
Return 1 if the specified axis is logarithmically scaled.
Definition: QtDisplay.cxx:1077
void applyCuts(const std::vector< QtDisplay * > &cuts)
Applies a cuts to the wrapped PlotterBase.
Definition: QtDisplay.cxx:1325
static void lock()
Obtains a lock on the application&#39;s mutex.
Definition: PyApp.cxx:331
void setTransform(const std::string &name)
Sets the Transform.
Definition: QtDisplay.cxx:1045
void reset()
Resets all bins.
Definition: QtDisplay.cxx:993
int nextView(bool stepForward=true)
Cycle through each set of plot ranges, thereby changing the view with each call.
void setLog(PlotterBase *plotter, const std::string &axis, bool flag)
Sets a log scale on or off for the specified axis for the plotter.
void setTitle(const std::string &title)
Sets the title to be displayed.
hippodraw::FunctionController class interface
hippodraw::DataRep class interface.
void setView(int index)
Set the view by index.
hippodraw::PyNTuple class interface.
A singleton class is the interface between an application and the list of FunctionRep objects contain...
void setAutoRanging(const std::string &axis, bool flag)
Sets the auto ranging flag on specified axis.
Definition: QtDisplay.cxx:1087
int numViews()
Return the number of stored views.
Definition: QtDisplay.cxx:892
std::map< std::string, double > m_binWidths
The saved X and Y bin widths to be used with the resize() method.
Definition: QtDisplay.h:84
A derived class of DataRep which is a base class for displaying a function.
Definition: FunctionRep.h:34
void setAspectRatio(double ratio)
Sets the aspect ratio.
Definition: QtDisplay.cxx:1129
return rep
Definition: Inspector.cxx:3843
virtual double getBinWidth(Axes::Type axis) const
Returns the bin width.
int numViews() const
Return the number of stored views.
void applyCut(QtDisplay *cut)
Applies a cut to the wrapped PlotterBase.
Definition: QtDisplay.cxx:1310
int currentView() const
Return the current view index.
const std::string & getTitle() const
Gets the title to be displayed.
virtual void setRepresentation(RepBase *pointrep)=0
Sets the representation.
return yes
Definition: CanvasView.cxx:883
QtDisplay()
A default constructor for derived classes.
Definition: QtDisplay.cxx:607
void setBinWidth(const std::string &axis, double width, bool save=false)
Sets the bin width on the specified axis.
Definition: QtDisplay.cxx:1000
A wrapper for RootNTuple, so that when RootNTuple is used in Qt based application, the application object can be locked and unlocked before calling any ROOT functions.
Definition: QtRootNTuple.h:37
hippodraw::PyDataSource class interface
void setAutoTicks(const std::string &axis, bool yes)
Sets the ticks to be automatic or manual.
Definition: QtDisplay.cxx:1280
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
virtual ProjectorBase * activeProjector() const
Returns the active projector.
virtual int getNumDataReps() const
Returns the number of DataRep objects contained in the plot.
void addFunction(FunctionBase *function)
Adds a Function (as a FunctionBase object)
Definition: QtDisplay.cxx:781
int plotterId() const
Return the Id to the plotter object.
Definition: QtDisplay.cxx:1219
virtual void setNumberOfBins(const std::string &axis, unsigned int number)
Sets the number of bins.
void setContourLevels(const std::vector< double > &levels)
Set the contour levels if a ContourPointRep.
Definition: QtDisplay.cxx:938
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
The base class for data representations.
Definition: DataRep.h:68
std::string createBinding(const std::string &name, const std::vector< int > &indices) const
PyDataSource * createDataArray() const
Creates a data array wrapper for the contents of the display.
Definition: QtDisplay.cxx:1289
void setTicks(const std::string &axis, const std::vector< double > &values, const std::vector< std::string > &labels)
Sets the axis ticks to specified points and values.
Definition: QtDisplay.cxx:1269
hippodraw::DataRep * getRep() const
Returns the wrapped FunctionRep object.
hippodraw::PyApp class interface.
hippodraw::ListTuple class interface.
hippodraw::ContourPointRep class interface
virtual void setBinWidth(Axes::Type axis, double width)
Sets the bin width.
PlotterBase * m_plotter
The contained PlotterBase object.
Definition: QtDisplay.h:97
ViewBase * v
Definition: PlotTable.cxx:104
hippodraw::BinToColor class interface
FunctionRep * createFunctionRep(const std::string &name, DataRep *rep)
Returns a newly created FunctionRep object with function of type name and target rep.
intp size(numeric::array arr)
Definition: num_util.cpp:296
void addObserver(hippodraw::Observer *observer)
Adds an observer to PlotterBase object.
Definition: QtDisplay.cxx:1262
hippodraw::QtDisplay class interface.
void setRange(const std::string &axis, double low, double high, bool save=false)
Sets the Range on the specified axis.
Definition: QtDisplay.cxx:801
void setView(int index)
Set the view by index.
Definition: QtDisplay.cxx:866
This class is the public interface to a DataSource object that the user sees as the DataArray object ...
Definition: PyDataSource.h:43
hippodraw::ProjectorBase class interface.
void deleteView(int index)
Delete a view by index.
FactoryException class interface.
hippodraw::RepBase class interface
A singleton class that is the interface between GUI and the DataSource objects.
int saveView(const std::vector< double > &range_values)
Save the current set of plot ranges which define a &quot;view&quot; for this plot.
static DisplayController * instance()
Returns the pointer to the singleton instance.
virtual void setLabel(const std::string &axis, const std::string &label)
Sets the label of specified axis to label.
Part of an implementation of the Observable Observer pattern based on the example implementation in t...
Definition: Observer.h:34
PlotterException class interface.
PlotterBase * display()
Returns the wrapped display object.
Definition: QtDisplay.cxx:724
const std::string & getLabel(const std::string &axis) const
Returns the label on the specified axis.
Definition: QtDisplay.cxx:972
This class is the public Python interface wrap for the FunctionRep class.
Definition: PyFunctionRep.h:41
virtual DataRep * getDataRep(int index) const
Returns the specified DataRep or null pointer if it doesn&#39;t exits.
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
A function that can be added to a DataRep and used in a fitter.
Definition: FunctionBase.h:90
PlotterBase * createDisplay(const std::string &name)
Creates a display object.
void setLabel(const std::string &axis, const std::string &label)
Sets the label on the corresponding axis.
Definition: QtDisplay.cxx:959
hippodraw::CutController class interface
Qt Displays wraps a derived class of PlotterBase.
Definition: QtDisplay.h:71
virtual void setRange(Axes::Type axis, const Range &range, bool scaled=false, bool adjust_width=true)
Sets the range on the specified axis.
static void unlock()
Releases the lock on the application&#39;s mutex.
Definition: PyApp.cxx:357
const DataSource & dataSource() const
Return a reference to the underlying DataSource.
Definition: PyDataSource.h:89
An exception class that is thrown when attempting an illegal operation on a PlotterBase object...
An xception class that is thrown when attempting to bind a DataRep to a NTuple with a column name tha...
A factory for creation of objects whose class is derived from BinToColor.
double low() const
Returns the minimum of the range object.
Definition: Range.cxx:87
double numberOfEntries() const
Return the number of entries in the display.
Definition: QtDisplay.cxx:1164
void setNumberOfBins(const std::string &axis, unsigned int number)
Sets the number of bins.
Definition: QtDisplay.cxx:984
const std::string & name() const
Returns the name of the representation.
Definition: RepBase.cxx:47
void setTransform(PlotterBase *plotter, const std::string &name)
Creates and sets a new transform for the display.
Expresses a range of values.
Definition: Range.h:33
std::vector< double > getRange(const std::string &axis)
Get the Range of the specified axis.
Definition: QtDisplay.cxx:829
return index
Definition: PickTable.cxx:182
void addDataRepStacked(const std::string &type, const DataSource *ntuple, const std::vector< std::string > &bindings)
Adds a DataRep to the display by stacking, i.e.
Definition: QtDisplay.cxx:745
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
hippodraw::PyFunctionRep class interface.
void resize()
Restore the X and Y dimensions of the display to their saved values.
Definition: QtDisplay.cxx:1172
hippodraw::DataRep * getDataRep()
The get method.
Definition: PyDataRep.cxx:308
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
Definition: AxesType.cxx:32
A wrapper for NTuple, so that when NTuple is used in Qt based application, the application object can...
Definition: PyNTuple.h:28
An exception class that is thrown when the factory fails to find the request class by its name...
A singleton class that handles the application logic for cuts.
Definition: CutController.h:38
DataSourceController class interface.
void addValues(const std::vector< double > &v)
Adds the values to the display.
Definition: QtDisplay.cxx:1138
virtual int getNumberOfEntries() const =0
Returns the total number of entries that went into creating the projected values. ...
std::map< std::string, std::pair< double, double > > m_ranges
The saved X and Y ranges to be used with the resize() method.
Definition: QtDisplay.h:81
std::vector< PyDataRep * > m_pyDataReps
A vector to store the PyDataRep pointers to be returned by reference via the getDataReps() method...
Definition: QtDisplay.h:78
void setAspectRatio(double ratio)
Sets the aspect ratio.
virtual void setAutoRanging(const std::string &axis, bool flag)
Sets the auto-ranging.
virtual ProjectorBase * getProjector() const
Returns the Projector object controlling the data.
Definition: DataRep.cxx:138
void deleteView(int index)
Delete a view by index.
Definition: QtDisplay.cxx:896
A wrapper class for Python list objects.
Definition: python.dir:41
A DataSource class implemented with a Python list to store the column data.
Definition: ListTuple.h:40
hippodraw::FunctionWrap class interface.
DisplayController class interface declaration.
void addDataRep(const std::string &type, const DataSource *ntuple, const std::vector< std::string > &bindings)
Creates and adds a DataRep to the display.
Definition: QtDisplay.cxx:731
Type
Axes constants.
Definition: AxesType.h:31
void setLog(const std::string &axis, int flag)
Sets the specified axis to Logarithmic binning (if applicable ) and display.
Definition: QtDisplay.cxx:1066
double getBinWidth(const std::string &axis) const
Returns the bin width on the specified axis.
Definition: QtDisplay.cxx:1019
The base class for the point representation hierarchy.
Definition: RepBase.h:45
PyDataRep * getDataRep()
Returns the selected DataRep in the plotter.
Definition: QtDisplay.cxx:1097
This class is the public interface the what the user sees as the DataRep object from Python...
Definition: PyDataRep.h:37
bool getLog(const PlotterBase *plotter, const std::string &axis) const
Returns true if the designated axis is on a logarithmic scale.
void setOffset(PlotterBase *plotter, const std::string &axis, int parm, bool dragging)
Sets the offset from dragging slider.
hippodraw::PlotterBase class interface.
BinToColorFactory class interface.
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen