199#include "RConfigure.h"
260 "",
"AXIS",
"HIST",
"SAME",
"CYL",
"POL",
"SPH",
"PSR",
"LEGO",
"LEGO1",
"LEGO2",
261 "SURF",
"SURF1",
"SURF2",
"SURF3",
"SURF4"
265 "",
"AH",
"B",
"C",
"E",
"E1",
"E2",
"E3",
"E4",
"L",
"P",
"*H"
269 "",
"ARR",
"BOX",
"COL",
"COL2",
"CONT",
"CONT0",
"CONT1",
"CONT2",
"CONT3",
270 "FB",
"BB",
"SCAT",
"PROF"
349 gROOT->ProcessLine(
"#ifndef GTV_DEFINED\n\
350 TTreeViewer *gTV = 0;\n\
351 TTree *tv__tree = 0;\n\
352 TList *tv__tree_list = 0;\n\
353 TFile *tv__tree_file = 0;\n\
354 #define GTV_DEFINED\n\
356 snprintf(command,128,
"gTV = (TTreeViewer*)0x%zx", (
size_t)
this);
357 gROOT->ProcessLine(command);
359 gROOT->ProcessLine(
"tv__tree_list = new TList;");
370 fDimension(0), fVarDraw(false), fScanMode(false),
371 fTreeIndex(0), fDefaultCursor(0), fWatchCursor(0),
372 fCounting(false), fStopMapping(false), fEnableCut(false),fNexpressions(0)
379 gROOT->ProcessLine(
"#ifndef GTV_DEFINED\n\
380 TTreeViewer *gTV = 0;\n\
381 TTree *tv__tree = 0;\n\
382 TList *tv__tree_list = 0;\n\
383 TFile *tv__tree_file = 0;\n\
384 #define GTV_DEFINED\n\
386 snprintf(command,128,
"gTV = (TTreeViewer*)0x%zx", (
size_t)
this);
387 gROOT->ProcessLine(command);
390 gROOT->ProcessLine(
"tv__tree_list = new TList;");
396 if (cdir) cdir->
cd();
405 if (dirsav) dirsav->
cd();
416 printf(
"Tree found\n");
419 while ((ftree = (TTree*)next())) {
420 if (ftree==tree) {printf(
"found at index %i\n", index);
break;}
430 TGListTreeItem *base =
nullptr;
431 TGListTreeItem *parent =
fLt->FindChildByName(base,
"TreeList");
432 TGListTreeItem *item =
fLt->FindChildByName(parent,
fTree->GetName());
433 fLt->ClearHighlighted();
434 fLt->HighlightItem(item);
446 snprintf(command,100,
"tv__tree = (TTree *)0x%zx;", (
size_t)tree);
453 TGListTreeItem *base =
nullptr;
454 TGListTreeItem *parent =
fLt->FindChildByName(base,
"TreeList");
458 TGListTreeItem *lTreeItem =
fLt->AddItem(parent, tree->
GetName(), itemType,
459 gClient->GetPicture(
"tree_t.xpm"),
gClient->GetPicture(
"tree_t.xpm"));
461 fLt->OpenItem(parent);
462 fLt->HighlightItem(lTreeItem);
478 if (diff <= 0)
return;
487 if (
fTree) ((TTreePlayer *)
fTree->GetPlayer())->SetScanFileName(
name);
510 TString command =
TString::Format(
"tv__tree = (TTree *)0x%zx;", (
size_t)tree);
517 TGListTreeItem *base =
nullptr;
518 TGListTreeItem *parent =
fLt->FindChildByName(base,
"TreeList");
522 TGListTreeItem *lTreeItem =
fLt->AddItem(parent, tree->
GetName(), itemType,
523 gClient->GetPicture(
"tree_t.xpm"),
gClient->GetPicture(
"tree_t.xpm"));
525 fLt->OpenItem(parent);
526 fLt->HighlightItem(lTreeItem);
541 if (!treeName)
return;
545 printf(
"Tree found\n");
548 while ((tree = (TTree*)next())) {
549 if (!strcmp(treeName, tree->
GetName())) {printf(
"found at index %i\n", index);
break;}
559 TGListTreeItem *base =
nullptr;
560 TGListTreeItem *parent =
fLt->FindChildByName(base,
"TreeList");
561 TGListTreeItem *item =
fLt->FindChildByName(parent,
fTree->GetName());
562 fLt->ClearHighlighted();
563 fLt->HighlightItem(item);
575 TString command =
TString::Format(
"tv__tree = (TTree *) gROOT->FindObject(\"%s\");", treeName);
582 TGListTreeItem *base =
nullptr;
583 TGListTreeItem *parent =
fLt->FindChildByName(base,
"TreeList");
587 TGListTreeItem *lTreeItem =
fLt->AddItem(parent, treeName, itemType,
588 gClient->GetPicture(
"tree_t.xpm"),
gClient->GetPicture(
"tree_t.xpm"));
590 fLt->OpenItem(parent);
591 fLt->HighlightItem(lTreeItem);
607 TSeqCollection *list =
gROOT->GetListOfFiles();
612 while ((obj=next())) {
615 tree = (TTree*)file->
Get(
fTree->GetName());
618 std::cout <<
"File name : "<<
fFilename << std::endl;
636 fTimer =
new TTimer(
this, 20,
true);
644 gClient->GetColorByName(
"blue",color);
651 fContextMenu =
new TContextMenu(
"TreeViewer context menu",
"");
805 fBarCommand->SetToolTipText(
"User commands executed via interpreter. Type <ENTER> to execute");
808 TGVertical3DLine *vSeparator =
new TGVertical3DLine(
fToolBar);
823 fBarOption->SetToolTipText(
"Histogram graphics option. Type option here and click <Draw> (or <ENTER> to update current histogram).");
826 vSeparator =
new TGVertical3DLine(
fToolBar);
851 fBarH->SetToolTipText(
"Checked : redraw only current histogram");
857 fBarScan->SetToolTipText(
"Check to redirect TTree::Scan command in a file");
862 fBarRec->SetToolTipText(
"Check to record commands in history file and be verbose");
865 TGHorizontal3DLine *toolBarSep =
new TGHorizontal3DLine(
this);
870 toolBarSep =
new TGHorizontal3DLine(
this);
875 fHf =
new TGHorizontalFrame(
this, 10, 10);
899 fLt->Associate(
this);
912 fDRAW->SetToolTipText(
"Draw current selection");
913 fDRAW->Associate(
this);
921 fSPIDER->SetToolTipText(
"Scan current selection using a spider plot");
928 fSPIDER->Connect(
"Clicked()",
"TTreeViewer",
this,
"ExecuteSpider()");
934 fSTOP->SetToolTipText(
"Abort current operation");
935 fSTOP->Associate(
this);
944 fREFR->SetToolTipText(
"Update the tree viewer");
949 fREFR->Connect(
"Clicked()",
"TTreeViewer",
this,
"DoRefresh()");
956 fV2 =
new TGVerticalFrame(
fHf, 10, 10);
974 fV1->Resize(
fTreeHdr->GetDefaultWidth()+100,
fV1->GetDefaultHeight());
983 TGVSplitter *splitter =
new TGVSplitter(
fHf);
988 fHf->AddFrame(splitter,lo);
1014 toolBarSep =
new TGHorizontal3DLine(
this);
1019 fBFrame =
new TGHorizontalFrame(
this,10,10);
1027 fBarListIn->SetToolTipText(
"Name of a previously created event list");
1035 fBarListOut->SetToolTipText(
"Output event list. Use <Draw> to generate it.");
1046 fReset->SetToolTipText(
"Reset variable's fields and drawing options");
1054 fBGFirst->SetToolTipText(
"First record");
1066 fBGNext->SetToolTipText(
"Next record");
1070 fBGLast->SetToolTipText(
"Last record");
1097 const TGPicture *pic, *spic;
1105 entry->
SetToolTipText(
"X expression. Drag and drop expressions here");
1114 entry->
SetToolTipText(
"Y expression. Drag and drop expressions here");
1123 entry->
SetToolTipText(
"Z expression. Drag and drop expressions here");
1133 entry->
SetToolTipText(
"Active cut. Double-click to enable/disable");
1143 entry->
SetToolTipText(
"Drag and drop expressions/leaves here. Double-click to scan. Check <Scan> to redirect on file.");
1156 entry->
SetToolTipText(
"User defined expression/cut. Double-click to edit");
1168 fSlider->SetRange(0LL,1000000LL);
1169 fSlider->SetPosition(0LL,1000000LL);
1276 bool next,
bool last)
1320 TString stripped(
name);
1321 if (!stripped.Contains(
"["))
return name;
1322 TString retstr(
name);
1325 while (stripped.Index(
"[", index) !=
kNPOS) {
1327 Int_t end = stripped.Index(
"]", index);
1329 objstr =
new TObjString(retstr.Data());
1331 return (objstr->
String()).Data();
1334 retstr = stripped.Remove(
start+1, end-
start-1);
1337 objstr =
new TObjString(retstr.Data());
1339 return (objstr->
String()).Data();
1356 TTVLVEntry *item =
nullptr;
1357 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) ==
nullptr) {
1358 Warning(
"Empty",
"No item selected.");
1363 Warning(
"Empty",
"Not expression type.");
1409 Int_t dimension = 0;
1417 if (!(item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)))
return;
1422 if (
Ez() && strlen(
Ez())) {
1429 if ((
Ez() && strlen(
Ez())) && ((
Ex() &&strlen(
Ex())) || (
Ey() && strlen(
Ey())))) varexp +=
":";
1430 if (
Ey() && strlen(
Ey())) {
1437 if (
Ey() && strlen(
Ey()) &&
Ex() && strlen(
Ex())) varexp +=
":";
1438 if (
Ex () && strlen(
Ex())) {
1447 Warning(
"ExecuteDraw",
"Nothing to draw on X,Y,Z.");
1451 fTree->SetEventList(
nullptr);
1452 TEventList *elist =
nullptr;
1455 if (elist)
fTree->SetEventList(elist);
1460 if (strcmp(
"htemp",
fBarHist->GetText())) {
1465 auto pad =
gROOT->GetSelectedPad();
1470 gROOT->SetInterrupt(
false);
1472 const char *cut =
"";
1477 fSlider->GetMinPositionD() + 1);
1485 command =
TString::Format(
"tv__tree->Scan(\"%s\",\"%s\",\"%s\", %lld, %lld);",
1488 ((TTreePlayer *)
fTree->GetPlayer())->SetScanRedirect(
true);
1490 ((TTreePlayer *)
fTree->GetPlayer())->SetScanRedirect(
false);
1499 TH1 *hist =
fTree->GetHistogram();
1505 TString current(gopt);
1508 if (current == last) {
1512 if (dimension == 3 && strlen(gopt)) {
1513 std::cout <<
"Graphics option " << gopt <<
" not valid for 3D histograms" << std::endl;
1516 std::cout <<
" Graphics option for current histogram changed to " << gopt << std::endl;
1530 if (dimension == 3 && strlen(gopt)) {
1531 std::cout <<
"Graphics option " << gopt <<
" not valid for 3D histograms" << std::endl;
1535 command =
TString::Format(
"tv__tree->Draw(\"%s\",\"%s\",\"%s\", %lld, %lld);",
1539 fTree->SetTimerInterval(200);
1544 fTree->SetTimerInterval(0);
1548 TH1 *hist =
fTree->GetHistogram();
1552 for (i=0; i<3; i++) {
1553 if (alias[i].Length()) {
1555 alias[current] = alias[i];
1566 for (
Int_t ind=0; ind<3; ind++) axis[ind]->SetTitle(alias[ind].Data());
1577 Int_t dimension = 0;
1580 bool previousexp =
false;
1582 if (
Ez() && strlen(
Ez())) {
1590 if ((
Ez() && strlen(
Ez())) && ((
Ex() && strlen(
Ex())) || (
Ey() && strlen(
Ey())))) varexp +=
":";
1591 if (
Ey() && strlen(
Ey())) {
1599 if (
Ey() && strlen(
Ey()) &&
Ex() && strlen(
Ex())) varexp +=
":";
1600 if (
Ex() && strlen(
Ex())) {
1608 for(
Int_t i=0;i<10;++i){
1609 if(
En(i+5) && strlen(
En(i+5))){
1614 }
else varexp =
En(i+5);
1619 Warning(
"ExecuteSpider",
"Need at least 3 variables");
1623 fTree->SetEventList(
nullptr);
1624 TEventList *elist =
nullptr;
1627 if (elist)
fTree->SetEventList(elist);
1632 auto pad =
gROOT->GetSelectedPad();
1637 gROOT->SetInterrupt(
false);
1639 const char *cut =
"";
1644 fSlider->GetMinPositionD() + 1);
1649 TSpider* spider =
new TSpider(
fTree,varexp.
Data(),cut,
Form(
"%s spider average",gopt),
nentries,firstentry);
1685 if(
e)
return e->ConvertAliases();
1696 TTVLVEntry *item =
nullptr;
1697 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) ==
nullptr) {
1698 Warning(
"EditExpression",
"No item selected.");
1704 Warning(
"EditExpression",
"Not expression type.");
1714 fDialogBox->SetWindowName(
"Expression editor");
1728 if (!
fTree)
return 0;
1729 return fTree->MakeSelector(selector);
1737 if (!
fTree)
return 0;
1738 return fTree->Process(filename, option,
nentries, firstentry);
1771 TTVLVEntry *item =
nullptr;
1773 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) ==
nullptr) {
1774 Warning(
"RemoveItem",
"No item selected.");
1780 Warning(
"RemoveItem",
"Not removable type.");
1804 Double_t percent = (current-first+1)/(last-first+1);
1817 TRootHelpDialog *hd;
1854 TGListTreeItem *ltItem =
nullptr;
1856 if ((ltItem =
fLt->GetSelected()) !=
nullptr) {
1961 gROOT->SetInterrupt(
true);
1971 if ((record =
fSession->Previous()))
1995 Warning(
"ProcessMessage",
"Edit expressions first.");
1999 Warning(
"ProcessMessage",
"You have only one expression active.");
2003 Warning(
"ProcessMessage",
"1D drawing options not apply to 2D histograms.");
2012 gROOT->MakeDefCanvas();
2016 static TString dir(
".");
2023 TString command =
TString::Format(
"tv__tree_file = new TFile(\"%s\");",
2027 std::cout <<
"Use SetTreeName() from context menu and supply a tree name" << std::endl;
2028 std::cout <<
"The context menu is activated by right-clicking the panel from right" << std::endl;
2037 event.fX =
event.fY = 1;
2044 static TString dir(
".");
2055 snprintf(command,1024,
"open_session((void*)0x%zx);", (
size_t)
this);
2085 new TWin32SplashThread(
true);
2089 hd =
new TRootHelpDialog(
this, str, 600, 400);
2096 hd =
new TRootHelpDialog(
this,
"About TreeViewer...", 600, 400);
2102 hd =
new TRootHelpDialog(
this,
"Quick start...", 600, 400);
2107 hd =
new TRootHelpDialog(
this,
"Layout...", 600, 400);
2112 hd =
new TRootHelpDialog(
this,
"Open/Save...", 600, 400);
2117 hd =
new TRootHelpDialog(
this,
"Dragging items...", 600, 400);
2122 hd =
new TRootHelpDialog(
this,
"Editing expressions...", 600, 400);
2127 hd =
new TRootHelpDialog(
this,
"Session...", 600, 400);
2132 hd =
new TRootHelpDialog(
this,
"Executing user commands...", 600, 400);
2137 hd =
new TRootHelpDialog(
this,
"Context menus...", 600, 400);
2142 hd =
new TRootHelpDialog(
this,
"Drawing histograms...", 600, 400);
2147 hd =
new TRootHelpDialog(
this,
"Using macros...", 600, 400);
2172 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) !=
nullptr) {
2174 TString trueName(vname);
2175 if (trueName.Contains(
"[]")) {
2176 TIter next(
fTree->GetListOfLeaves());
2178 while((leaf=(TLeaf*)next())) {
2183 char* msg2 =
new char[2000];
2188 char symbol = (char)((*itemType) >> 8);
2189 snprintf(msg2,2000,
"%c expression : %s", symbol, vname);
2193 snprintf(msg2,2000,
"Cut : %s", vname);
2196 snprintf(msg2,2000,
"Box : %s", vname);
2200 snprintf(msg2,2000,
"Expression : %s", vname);
2203 snprintf(msg2,2000,
"Branch : %s", vname);
2205 snprintf(msg2,2000,
"Leaf : %s", vname);
2212 TString message = msg2;
2213 message = message(0,150);
2220 if (item ==
fDialogBox->EditedEntry())
break;
2242 TTVLVEntry *item =
nullptr;
2243 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) !=
nullptr) {
2263 if ((item = (TTVLVEntry *)
fLVContainer->GetNextSelected(&p)) !=
nullptr) {
2332 if (strlen(command) > 1999) {
2333 Warning(
"ExecuteCommand",
"Command too long: aborting.");
2336 snprintf(comm,2000,
"%s", command);
2342 gROOT->ProcessLineFast(command);
2344 gROOT->ProcessLine(command);
2435 if (!branches)
return;
2439 for (
id=0;
id<branches->
GetEntries();
id++) {
2440 branch = (TBranch *)branches->
At(
id);
2443 if (
name.Contains(
"fBits") ||
name.Contains(
"fUniqueID"))
continue;
2453 while ((fr = (TFriendElement*)nextf())) {
2456 for (
id=0;
id<branches->
GetEntries();
id++) {
2457 branch = (TBranch *)branches->
At(
id);
2460 if (
name.Contains(
"fBits") ||
name.Contains(
"fUniqueID"))
continue;
2479 if (!branch)
return;
2481 if (prefix && strlen(prefix) > 0) {
2483 if (!
name.EndsWith(
"."))
name +=
".";
2488 TGListTreeItem *branchItem =
nullptr;
2491 if (
name.Contains(
"fBits") ||
name.Contains(
"fUniqueID"))
return;
2494 const TGPicture *pic, *spic;
2519 TLeaf *leaf =
nullptr;
2522 leaf = (TLeaf *)leaves->
At(lf);
2529 fLt->AddItem(branchItem, leafName.
Data(), itemType, pic, spic);
2542 TGString *textEntry =
nullptr;
2543 const TGPicture *pic, *spic;
2569 entry->
SetToolTipText(
"Branch with sub-branches. Can not be dragged");
2575 if (textEntry)
delete textEntry;
2581 entry->
SetToolTipText(
"Branch with more than one leaf. Can not be dragged");
2587 TLeaf *leaf =
nullptr;
2590 leaf = (TLeaf *)leaves->
At(lf);
2594 textEntry =
new TGString(leafName.
Data());
2599 entry->
SetToolTipText(
"Double-click to draw. Drag to X, Y, Z or scan box.");
2605 pic = (
gClient->GetMimeTypeList())->GetIcon(
"TLeaf",
false);
2607 spic =
gClient->GetMimeTypeList()->GetIcon(
"TLeaf",
true);
2611 entry->
SetToolTipText(
"Double-click to draw. Drag to X, Y, Z or scan box.");
2621 TBranch *branchDaughter =
nullptr;
2624 for (ind=0; ind<branches->
GetEntries(); ind++) {
2625 branchDaughter = (TBranch *)branches->
UncheckedAt(ind);
2627 MapBranch(branchDaughter,
"", branchItem, listIt);
2640 TTVLVEntry *entry =
new TTVLVEntry(
fLVContainer,pic,spic,
2659 if (!itemType)
return;
2660 TGListTreeItem *parent =
nullptr;
2666 index = (
Int_t)(*itemType >> 8);
2688 static const int buf_size = 2048;
2689 char buf[buf_size], *bp;
2691 int n = vsnprintf(buf, buf_size, fmt, va);
2694 if (
n == -1 ||
n >= buf_size) {
2702 const char *title =
"";
2710 title =
"System Error";
2721 char * msg =
new char[100];
2722 snprintf(msg,100,
"First entry : %lld Last entry : %lld",
2736 Int_t lenfile = strlen(filename);
2740 lenfile = strlen(fname);
2742 fname = (
char*)filename;
2748 out.open(fname, std::ios::out);
2750 fname =
new char[13];
2751 strlcpy(fname,
"treeviewer.C",13);
2752 out.open(fname, std::ios::out);
2755 printf(
"SaveSource cannot open file : %s\n", fname);
2757 if (!lenfile)
delete [] fname;
2762 out <<
"void open_session(void *p = 0);"<<std::endl<<std::endl;
2763 out <<
"void "<<std::filesystem::path(fname).stem()<<
"() {"<<std::endl;
2764 out <<
"//=========Macro generated by ROOT version"<<
gROOT->GetVersion()<<std::endl;
2765 out <<
"//=========for tree "<<quote<<
fTree->GetName()<<quote<<
" ("<<t.
AsString()<<
")"<<std::endl;
2766 out <<
"//===This macro can be opened from a TreeViewer session after loading"<<std::endl;
2767 out <<
"//===the corresponding tree, or by running root with the macro name argument"<<std::endl<<std::endl;
2768 out <<
" open_session();"<<std::endl;
2769 out <<
"}"<<std::endl<<std::endl;
2770 out <<
"void open_session(void *p = 0) {"<<std::endl;
2771 out <<
" gSystem->Load("<<quote<<
"libTreeViewer"<<quote<<
");"<<std::endl;
2772 out <<
" TTreeViewer *treeview = (TTreeViewer *) p;"<<std::endl;
2773 out <<
" if (!treeview) treeview = new TTreeViewer();"<<std::endl;
2774 out <<
" TTree *tv_tree = (TTree*)gROOT->FindObject("<<quote<<
fTree->GetName()<<quote<<
");"<<std::endl;
2775 out <<
" TFile *tv_file = (TFile*)gROOT->GetListOfFiles()->FindObject("<<quote<<
fFilename<<quote<<
");"<<std::endl;
2776 out <<
" if (!tv_tree) {"<<std::endl;
2777 out <<
" if (!tv_file) tv_file = new TFile("<<quote<<
fFilename<<quote<<
");"<<std::endl;
2778 out <<
" if (tv_file) tv_tree = (TTree*)tv_file->Get("<<quote<<
fTree->GetName()<<quote<<
");"<<std::endl;
2779 out <<
" if(!tv_tree) {"<<std::endl;
2780 out <<
" printf(\"Tree %s not found\", "<<quote<<
fTree->GetName()<<quote<<
");"<<std::endl;
2781 out <<
" return;"<<std::endl;
2782 out <<
" }"<<std::endl;
2783 out <<
" }"<<std::endl<<std::endl;
2784 out <<
" treeview->SetTreeName("<<quote<<
fTree->GetName()<<quote<<
");"<<std::endl;
2785 out <<
" treeview->SetNexpressions("<<
fNexpressions<<
");"<<std::endl;
2788 out <<
"// Set expressions on axis and cut"<<std::endl;
2789 out <<
" TTVLVEntry *item;"<<std::endl;
2790 for (
Int_t i=0; i<4; i++) {
2793 out <<
"// X expression"<<std::endl;
2796 out <<
"// Y expression"<<std::endl;
2799 out <<
"// Z expression"<<std::endl;
2802 out <<
"// Cut expression"<<std::endl;
2808 out <<
" item = treeview->ExpressionItem("<<i<<
");"<<std::endl;
2809 out <<
" item->SetExpression("<<quote<<item->
GetTrueName()<<quote
2810 <<
", "<<quote<<item->
GetAlias()<<quote<<
");"<<std::endl;
2812 out <<
"// Scan list"<<std::endl;
2814 out <<
" item = treeview->ExpressionItem(4);"<<std::endl;
2815 out <<
" item->SetExpression("<<quote<<item->
GetTrueName()<<quote
2816 <<
", "<<quote<<
"Scan box"<<quote<<
");"<<std::endl;
2817 out <<
"// User defined expressions"<<std::endl;
2825 out <<
" item = treeview->ExpressionItem("<<crt<<
");"<<std::endl;
2826 out <<
" item->SetExpression("<<quote<<item->
GetTrueName()<<quote
2827 <<
", "<<quote<<item->
GetAlias()<<quote<<
", "<<itemType.
Data()<<
");"<<std::endl;
2830 out <<
"}"<<std::endl;
2832 printf(
"C++ Macro file: %s has been generated\n", fname);
2833 if (!lenfile)
delete [] fname;
2841 TTree *tree = (TTree *)
fTreeList->At(index);
2843 Warning(
"SwitchTree",
"No tree found.");
2847 std::string command;
2848 if (tree !=
fTree) {
2849 command =
"tv__tree = (TTree *) tv__tree_list->At";
2850 command +=
Form(
"(%i)",index);
2857 command =
"Current Tree : ";
2858 command +=
fTree->GetName();
2859 fLbl2->SetText(
new TGString(command.c_str()));
2903 TTVRecord *rec =
fSession->GetCurrent();
2913 fCombo->RemoveEntries(0, 1000);
2915 if ((record =
fSession->GetRecord(entry)))
2937 fSlider->SetPosition(min,max);
EMouseButton
Button names.
R__EXTERN const char gTVHelpLayout[]
R__EXTERN const char gTVHelpStart[]
R__EXTERN const char gTVHelpDrawing[]
R__EXTERN const char gTVHelpOpenSave[]
R__EXTERN const char gTVHelpMacros[]
R__EXTERN const char gTVHelpEditExpressions[]
R__EXTERN const char gTVHelpAbout[]
R__EXTERN const char gTVHelpDraggingItems[]
R__EXTERN const char gTVHelpUserCommands[]
R__EXTERN const char gTVHelpSession[]
R__EXTERN const char gTVHelpContext[]
R__EXTERN const char gHelpAbout[]
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
externTApplication * gApplication
const Int_t kDoNotProcess
constexpr Int_t kSysError
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
static const char * gOpenTypes[]
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
TTVSession and TTVRecord - I/O classes for TreeViewer session handling.
static const char * gOpt2D[14]
static const char * gOptgen[16]
static const char * gOpt1D[12]
static const char * gMacroTypes[]
A TTree is a list of TBranches.
TObjArray * GetListOfBranches()
TObjArray * GetListOfLeaves()
const char * AsString() const
Return the date & time as a string (ctime() format).
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual TFile * GetFile() const
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TTree * GetTree()
Return pointer to friend TTree.
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
TGCompositeFrame(const TGCompositeFrame &)=delete
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
void SetIniDir(const char *inidir)
Set directory name.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
static Pixel_t GetWhitePixel()
Get white pixel value.
void MapWindow() override
map window
virtual void DeleteWindow()
Delete window.
void * GetUserData() const
void SetUserData(void *userData)
virtual const char * GetText() const =0
TGListTreeItem * GetParent() const
virtual void * GetUserData() const =0
Defines top level windows that interact with the system Window Manager.
TGMainFrame(const TGMainFrame &)=delete
virtual void SendCloseMessage()
Send close message to self.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
TGClient * fClient
Connection to display server.
Pixmap_t GetPicture() const
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
const char * GetString() const
void SetFrame(TGFrame *frame, Bool_t left) override
Set frame to be resized.
void SetTitle(const char *title) override
Change/set the title.
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
void Draw(Option_t *option="") override
Draw this histogram with options.
const char * GetName() const override
Returns name of object.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
Bool_t TestBit(UInt_t f) const
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
TObject()
TObject constructor.
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
void Draw(Option_t *options="") override
Draw the spider.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
This class represent entries that goes into the TreeViewer listview container.
TGItemContext * GetContext()
void SetSmallPic(const TGPicture *spic)
Set small picture.
void SetAlias(const char *alias)
void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this item.
void SetTrueName(const char *name)
const char * ConvertAliases()
Convert all aliases into true names.
void Empty()
Clear all names and alias.
const char * GetTrueName()
void SetUserCode(const char *code, bool autoexec=true)
const char * GetName() const override
Returns name of object.
I/O classes for TreeViewer session handling.
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
void SetScanRedirect(bool mode)
TGLabel * fBarLbl2
Label of option text entry.
TGSelectBox * fDialogBox
Expression editor.
void SetCurrentRecord(Long64_t entry)
TGCheckButton * fBarRec
Command recording toggle.
TGHProgressBar * fProgressBar
Progress bar.
bool HandleTimer(TTimer *timer) override
Execute action in response of a timer timing out.
void SetHistogramTitle(const char *title)
void UpdateRecord(const char *name="new name")
TGTextEntry * fBarOption
Histogram drawing option entry.
TGLabel * fBLbl4
Label for input list entry.
TGTextEntry * fBarCommand
User command entry.
TGListView * fListView
ListView with branches and leaves.
TGComboBox * fCombo
Combo box with session records.
TGListTree * fLt
ListTree with file and tree items.
TList * fWidgets
List of widgets to be deleted.
void SetNexpressions(Int_t expr)
TTreeViewer(const char *treeName=nullptr)
TTreeViewer default constructor.
TGCheckButton * fBarH
Checked for drawing current histogram with different graphic option.
TGPictureButton * fBGFirst
void SetUserCode(const char *code, bool autoexec=true)
Cursor_t fDefaultCursor
Default cursor.
void MapOptions(Long_t parm1)
TGLabel * fBLbl5
Label for output list entry.
TGCanvas * fTreeView
ListTree canvas container.
Int_t fTreeIndex
Index of current tree in list.
TGPictureButton * fSTOP
Interrupt current command (not yet).
void SetSession(TTVSession *session)
void SetParentTree(TGListTreeItem *item)
const char * EmptyBrackets(const char *name)
const TGPicture * fPicStop
Pictures for Stop buttons.
void CloseWindow() override
Close and delete main frame.
const TGPicture * fPicY
Pictures for Y expressions.
TGLabel * fLbl2
Label for list view.
TTVLVEntry * ExpressionItem(Int_t index)
Cursor_t fWatchCursor
Watch cursor.
void AppendTree(TTree *tree)
TGTextEntry * fBarListIn
Tree input event list name entry.
void ActivateButtons(bool first, bool previous, bool next, bool last)
TTimer * fTimer
Tree viewer timer.
void MapTree(TTree *tree, TGListTreeItem *parent=nullptr, bool listIt=true)
Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0)
TGCheckButton * fBarScan
Checked for tree scan.
const TGPicture * fPicRefr
Pictures for Refresh buttons ///<ia.
const char * fSourceFile
Name of the C++ source file - default treeviewer.C.
Int_t MakeSelector(const char *selector=nullptr)
bool fCounting
True if timer is counting.
const TGPicture * fPicX
Pictures for X expressions.
bool fScanMode
Flag activated when Scan Box is double-clicked.
void DoError(int level, const char *location, const char *fmt, va_list va) const override
Interface to ErrorHandler (protected).
void SetRecordName(const char *name)
TGPictureButton * fDRAW
DRAW button.
TString fLastOption
Last graphic option.
TList * fTreeList
List of mapped trees.
const char * fFilename
Name of the file containing the tree.
TGTextEntry * fBarHist
Histogram name entry.
TGLayoutHints * fBarLayout
TContextMenu * fContextMenu
Context menu for tree viewer.
TGHorizontalFrame * fHpb
Progress bar frame.
TGPictureButton * fBGNext
Int_t fNexpressions
Number of expression widgets.
void SetTreeName(const char *treeName)
TGVerticalFrame * fV2
List view mother.
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent=nullptr, bool listIt=true)
TGLayoutHints * fMenuBarItemLayout
void SaveSource(const char *filename="", Option_t *option="") override
Save the GUI main frame widget in a C++ macro file.
TClass * IsA() const override
TTree * fTree
Selected tree.
TGCompositeFrame * fTreeHdr
Header for list tree.
TGLabel * fBarLbl3
Label of histogram name text entry.
bool fEnableCut
True if cuts are enabled.
bool SwitchTree(Int_t index)
void SetTree(TTree *tree)
bool fVarDraw
True if an item is double-clicked.
TGDoubleVSlider * fSlider
Vertical slider to select processed tree entries;.
TTree * fMappedTree
Listed tree.
TGVerticalFrame * fV1
List tree mother.
void Message(const char *msg) override
void ExecuteCommand(const char *command, bool fast=false)
const TGPicture * fPicDraw
Pictures for Draw buttons.
TGPictureButton * fBGLast
TGPopupMenu * fOptionsMenu
TGLayoutHints * fMenuBarHelpLayout
TGPictureButton * fBGPrevious
TTVLVContainer * fLVContainer
Container for listview.
TGLabel * fLbl1
Label for list tree.
void SetGrOpt(const char *option)
TGPopupMenu * fOptionsGen
TGLayoutHints * fMenuBarLayout
TGLabel * fBarLbl1
Label of command text entry.
TGPictureButton * fREFR
REFRESH button ///<ia.
TGHorizontalFrame * fHf
Main horizontal frame.
const TGPicture * fPicZ
Pictures for Z expressions.
TGHorizontalFrame * fBFrame
Button frame.
TBranch * fMappedBranch
Listed branch.
TTVSession * fSession
Current tree-viewer session.
Int_t fDimension
Histogram dimension.
TGCompositeFrame * fListHdr
Header for list view.
bool fStopMapping
True if branch don't need remapping.
TGTextEntry * fBarListOut
Pree output event list name entry.
TGTextButton * fReset
clear expression's entries
bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
TGPictureButton * fBGRecord
void SetScanFileName(const char *name="")
TGStatusBar * fStatusBar
Status bar.
TGTextButton * fSPIDER
SPIDER button.
A TTree represents a columnar dataset.
TDirectory * GetDirectory() const
virtual TObjArray * GetListOfBranches()
virtual TTree * GetTree() const
virtual TList * GetListOfFriends() const
__device__ AFloat max(AFloat x, AFloat y)
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=nullptr)