36 Int_t GetUnID(
void) {
return ++nID ; }
39 class TableTest :
public TGMainFrame {
44 UInt_t fNTableColumns;
48 TTreeTableInterface *fInterface;
51 TableTest(
const TGWindow *p, UInt_t ntrows, UInt_t ntcols,
52 UInt_t w = 100, UInt_t h = 100) ;
53 virtual ~TableTest() ;
57 TGTable *GetTable() {
return fTable; }
58 TTreeTableInterface *GetInterface() {
return fInterface; }
60 ClassDef(TableTest, 0)
63 TableTest::TableTest(
const TGWindow *p, UInt_t ntrows, UInt_t ntcols,
65 : TGMainFrame(p, w, h), fNTableRows(ntrows), fNTableColumns(ntcols),
68 SetCleanup(kDeepCleanup) ;
69 Connect(
"CloseWindow()",
"TableTest",
this,
"DoExit()") ;
73 fFile =
new TFile(
"$ROOTSYS/tutorials/hsimple.root");
75 if (!fFile || fFile->IsZombie()) {
76 printf(
"Please run <ROOT location>/tutorials/hsimple.C first.");
81 TNtuple *ntuple = (TNtuple *)fFile->Get(
"ntuple");
85 TString varexp =
"px:py:pz:random:sin(px):log(px/py):log(pz)";
90 fInterface =
new TTreeTableInterface(ntuple, varexp.Data(), select.Data(),
94 fTable =
new TGTable(
this, fIDs.GetUnID(), fInterface, fNTableRows,
96 AddFrame(fTable,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
99 SetWindowName(
"Tree Table Test") ;
102 Resize(GetDefaultWidth()+20, 600) ;
107 TableTest::~TableTest()
115 void TableTest::DoExit()
126 TGTable *ntupleTableTest(UInt_t ntrows = 50, UInt_t ntcols = 10) {
127 TableTest *test =
new TableTest(0, ntrows, ntcols, 500, 200);
128 return test->GetTable();