QtRootController.cxx
Go to the documentation of this file.
1 
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15 
16 #include "QtRootController.h"
17 
18 #include "RootController.h"
19 #include "QtRootNTuple.h"
20 
22 
23 #include "python/PyApp.h"
24 #include "python/PyDataSource.h"
25 
26 using namespace hippodraw;
27 
30 
33 {
34 }
35 
39 {
40  if ( s_instance == 0 ) {
43  }
44 
45  return s_instance;
46 }
47 
48 DataSource *
50 createNTuple ( const std::string & filename, const std::string & treename )
51 {
52  PyApp::lock();
53 
54  TTree * tree = m_instance -> getTree ( filename, treename );
55  QtRootNTuple * rtuple = new QtRootNTuple ( tree );
56  DataSource * ntuple = rtuple;
57 
58  PyApp::unlock ();
59 
60  return m_instance -> initNTuple ( ntuple, filename, treename );
61 }
62 
65 createDataArray ( const std::string & filename, const std::string & treename )
66 {
67 #ifdef HAVE_NUMARRAY
68  DataSource * rtuple = createNTuple ( filename, treename );
69  PyDataSource * ds = new PyDataSource ( "RootNTuple", rtuple );
70 
71  return ds;
72 #else
73  std::runtime_error e ( "HippoDraw was not built with "
74  "numeric Python support" );
75  throw e;
76 #endif
77 }
78 
79 const std::vector < std::string > &
81 getNTupleNames ( const std::string & filename )
82 {
83  PyApp::lock();
84 
85  try {
86  const std::vector< std::string > & names
87  = m_instance -> getNTupleNames ( filename );
88  PyApp::unlock ();
89  return names;
90  }
91  catch ( const std::runtime_error & e ) {
92  PyApp::unlock ();
93  throw e;
94  }
95  static const std::vector < std::string > names;
96  // never reach following but VC++ insists on return value.
97  return names;
98 }

Generated for HippoDraw Class Library by doxygen