File indexing completed on 2025-01-18 10:12:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TTreeViewer
0013 #define ROOT_TTreeViewer
0014
0015
0016
0017
0018
0019
0020
0021 #include "TGFrame.h"
0022
0023 #include "TTree.h"
0024
0025 class TTVLVContainer;
0026 class TTVLVEntry;
0027 class TTVSession;
0028 class TGSelectBox;
0029 class TBranch;
0030 class TContextMenu;
0031 class TList;
0032 class TGPicture;
0033 class TTimer;
0034 class TGLayoutHints;
0035 class TGMenuBar;
0036 class TGPopupMenu;
0037 class TGToolBar;
0038 class TGLabel;
0039 class TGCheckButton;
0040 class TGComboBox;
0041 class TGTextButton;
0042 class TGTextEntry;
0043 class TGDoubleVSlider;
0044 class TGPictureButton;
0045 class TGStatusBar;
0046 class TGCanvas;
0047 class TGListTree;
0048 class TGListTreeItem;
0049 class TGListView;
0050 class TGHProgressBar;
0051 class TGButton;
0052
0053
0054 class TTreeViewer : public TGMainFrame {
0055
0056 friend class TGClient;
0057 friend class TGButton;
0058
0059 public:
0060
0061 enum EListItemType {
0062 kLTNoType = 0,
0063 kLTPackType = BIT(0),
0064 kLTTreeType = BIT(1),
0065 kLTBranchType = BIT(2),
0066 kLTLeafType = BIT(3),
0067 kLTActionType = BIT(4),
0068 kLTDragType = BIT(5),
0069 kLTExpressionType = BIT(6),
0070 kLTCutType = BIT(7)
0071 };
0072
0073 private:
0074
0075
0076 TTree *fTree;
0077 TTVSession *fSession;
0078 const char *fFilename;
0079 const char *fSourceFile;
0080 TString fLastOption;
0081 TTree *fMappedTree;
0082 TBranch *fMappedBranch;
0083 Int_t fDimension;
0084 bool fVarDraw;
0085 bool fScanMode;
0086 TContextMenu *fContextMenu;
0087 TGSelectBox *fDialogBox;
0088 TList *fTreeList;
0089 Int_t fTreeIndex;
0090 const TGPicture *fPicX;
0091 const TGPicture *fPicY;
0092 const TGPicture *fPicZ;
0093 const TGPicture *fPicDraw;
0094 const TGPicture *fPicStop;
0095 const TGPicture *fPicRefr;
0096 Cursor_t fDefaultCursor;
0097 Cursor_t fWatchCursor;
0098 TTimer *fTimer;
0099 bool fCounting;
0100 bool fStopMapping;
0101 bool fEnableCut;
0102 Int_t fNexpressions;
0103
0104
0105
0106
0107 TGLayoutHints *fMenuBarLayout;
0108 TGLayoutHints *fMenuBarItemLayout;
0109 TGLayoutHints *fMenuBarHelpLayout;
0110 TGMenuBar *fMenuBar;
0111 TGPopupMenu *fFileMenu;
0112 TGPopupMenu *fEditMenu;
0113 TGPopupMenu *fRunMenu;
0114 TGPopupMenu *fOptionsMenu;
0115 TGPopupMenu *fOptionsGen;
0116 TGPopupMenu *fOptions1D;
0117 TGPopupMenu *fOptions2D;
0118 TGPopupMenu *fHelpMenu;
0119
0120
0121
0122
0123 TGToolBar *fToolBar;
0124 TGLayoutHints *fBarLayout;
0125
0126
0127
0128
0129 TGLabel *fBarLbl1;
0130 TGLabel *fBarLbl2;
0131 TGLabel *fBarLbl3;
0132 TGCheckButton *fBarH;
0133 TGCheckButton *fBarScan;
0134 TGCheckButton *fBarRec;
0135 TGTextEntry *fBarCommand;
0136 TGTextEntry *fBarOption;
0137 TGTextEntry *fBarHist;
0138
0139
0140
0141
0142 TGHorizontalFrame *fHf;
0143 TGDoubleVSlider *fSlider;
0144 TGVerticalFrame *fV1;
0145 TGVerticalFrame *fV2;
0146 TGCompositeFrame *fTreeHdr;
0147 TGCompositeFrame *fListHdr;
0148 TGLabel *fLbl1;
0149 TGLabel *fLbl2;
0150 TGHorizontalFrame *fBFrame;
0151 TGHorizontalFrame *fHpb;
0152 TGHProgressBar *fProgressBar;
0153 TGLabel *fBLbl4;
0154 TGLabel *fBLbl5;
0155 TGTextEntry *fBarListIn;
0156 TGTextEntry *fBarListOut;
0157 TGPictureButton *fDRAW;
0158 TGTextButton *fSPIDER;
0159 TGPictureButton *fSTOP;
0160 TGPictureButton *fREFR;
0161 TGStatusBar *fStatusBar;
0162 TGComboBox *fCombo;
0163 TGPictureButton *fBGFirst;
0164 TGPictureButton *fBGPrevious;
0165 TGPictureButton *fBGRecord;
0166 TGPictureButton *fBGNext;
0167 TGPictureButton *fBGLast;
0168 TGTextButton *fReset;
0169
0170
0171
0172
0173 TGCanvas *fTreeView;
0174 TGListTree *fLt;
0175
0176
0177
0178
0179 TGListView *fListView;
0180 TTVLVContainer *fLVContainer;
0181
0182 TList *fWidgets;
0183
0184
0185
0186 private:
0187
0188 void BuildInterface();
0189 const char *Cut();
0190 Int_t Dimension();
0191 const char *EmptyBrackets(const char* name);
0192 const char *Ex();
0193 const char *Ey();
0194 const char *Ez();
0195 const char *En(Int_t n);
0196 void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent = nullptr, bool listIt = true);
0197 void MapOptions(Long_t parm1);
0198 void MapTree(TTree *tree, TGListTreeItem *parent = nullptr, bool listIt = true);
0199 void SetFile();
0200 const char *ScanList();
0201 void SetParentTree(TGListTreeItem *item);
0202 void DoError(int level, const char *location, const char *fmt, va_list va) const override;
0203
0204 public:
0205 TTreeViewer(const char* treeName = nullptr);
0206 TTreeViewer(const TTree *tree);
0207 ~TTreeViewer() override;
0208
0209 void AppendTree(TTree *tree);
0210 void ActivateButtons(bool first, bool previous,
0211 bool next , bool last);
0212 void CloseWindow() override;
0213 void Delete(Option_t *) override { }
0214 void DoRefresh();
0215 void EditExpression();
0216 void Empty();
0217 void EmptyAll();
0218 void ExecuteCommand(const char* command, bool fast = false);
0219 void ExecuteDraw();
0220 void ExecuteSpider();
0221 TTVLVEntry *ExpressionItem(Int_t index);
0222 TList *ExpressionList();
0223 const char *GetGrOpt();
0224 TTree *GetTree() {return fTree;}
0225 bool HandleTimer(TTimer *timer) override;
0226 bool IsCutEnabled() {return fEnableCut;}
0227 bool IsScanRedirected();
0228 Int_t MakeSelector(const char* selector = nullptr);
0229 void Message(const char* msg) override;
0230 void NewExpression();
0231 void PrintEntries();
0232 Long64_t Process(const char* filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0);
0233 bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0234 void RemoveItem();
0235 void RemoveLastRecord();
0236 void SaveSource(const char* filename="", Option_t *option="") override;
0237 void SetHistogramTitle(const char *title);
0238 void SetCutMode(bool enabled = true) {fEnableCut = enabled;}
0239 void SetCurrentRecord(Long64_t entry);
0240 void SetGrOpt(const char *option);
0241 void SetNexpressions(Int_t expr);
0242 void SetRecordName(const char *name);
0243 void SetScanFileName(const char *name="");
0244 void SetScanMode(bool mode=true) {fScanMode = mode;}
0245 void SetScanRedirect(bool mode);
0246 void SetSession(TTVSession *session);
0247 void SetUserCode(const char *code, bool autoexec=true);
0248 void SetTree(TTree* tree);
0249 void SetTreeName(const char* treeName);
0250 bool SwitchTree(Int_t index);
0251 void UpdateCombo();
0252 void UpdateRecord(const char *name="new name");
0253
0254 ClassDefOverride(TTreeViewer,0)
0255 };
0256
0257 #endif