Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2//Author : Andrei Gheata 21/02/01
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TTVSession
13#define ROOT_TTVSession
16// //
17// TTVSession and TTVRecord - I/O classes for TreeViewer session handling //
18// TTreeViewer //
19// //
22#include "TObject.h"
23#include "TString.h"
25class TTreeViewer;
26class TClonesArray;
27class TGVButtonGroup;
29class TTVRecord : public TObject {
32 TString fName; ///< Name of this record
33 TString fX; ///< X expression
34 TString fXAlias; ///< X alias
35 TString fY; ///< Y expression
36 TString fYAlias; ///< Y alias
37 TString fZ; ///< Z expression
38 TString fZAlias; ///< Z alias
39 TString fCut; ///< Cut expression
40 TString fCutAlias; ///< Cut alias
41 TString fOption; ///< Graphic option
42 bool fScanRedirected; ///< Redirect switch
43 bool fCutEnabled; ///< True if current cut is active
44 TString fUserCode; ///< Command executed when record is connected
45 bool fAutoexec; ///< Autoexecute user code command
48 TTVRecord(); ///< Default constructor
49 ~TTVRecord() override {} ///< Destructor
51 void ExecuteUserCode();
52 void FormFrom(TTreeViewer *tv);
53 void PlugIn(TTreeViewer *tv);
54 const char *GetX() const {return fX;}
55 const char *GetY() const {return fY;}
56 const char *GetZ() const {return fZ;}
57 const char *GetName() const override {return fName;}
58 const char *GetUserCode() const {return fUserCode;}
59 bool HasUserCode() const {return fUserCode.Length() != 0 ? true : false;}
60 bool MustExecuteCode() const {return fAutoexec;}
61 void SetAutoexec(bool autoexec=true) {fAutoexec=autoexec;} // *TOGGLE* *GETTER=MustExecuteCode
62 void SetName(const char* name = "") {fName = name;}
63 void SetX(const char *x = "", const char *xal = "-empty-") {fX = x; fXAlias = xal;}
64 void SetY(const char *y = "", const char *yal = "-empty-") {fY = y; fYAlias = yal;}
65 void SetZ(const char *z = "", const char *zal = "-empty-") {fZ = z; fZAlias = zal;}
66 void SetCut(const char *cut = "", const char *cal = "-empty-") {fCut = cut; fCutAlias = cal;}
67 void SetOption(const char *option = "") {fOption = option;}
68 void SetRC(bool redirect = false, bool cut = true) {fScanRedirected = redirect; fCutEnabled = cut;}
69 void SetUserCode(const char *code, bool autoexec=true) {fUserCode = code; fAutoexec=autoexec;} // *MENU*
70 void SaveSource(std::ofstream &out);
72 ClassDefOverride(TTVRecord, 0) // A draw record for TTreeViewer
75class TTVSession : public TObject {
78 TClonesArray *fList; ///< List of TV records
79 TString fName; ///< Name of this session
80 TTreeViewer *fViewer; ///< Associated tree viewer
81 Int_t fCurrent; ///< Index of current record
82 Int_t fRecords; ///< Number of records
86 ~TTVSession() override;
87 const char *GetName() const override {return fName;}
88 void SetName(const char *name) {fName = name;}
89 void SetRecordName(const char* name);
90 TTVRecord *AddRecord(bool fromFile = false);
94 TTVRecord *First() {return GetRecord(0);}
99 void RemoveLastRecord();
100 void Show(TTVRecord *rec);
101 void SaveSource(std::ofstream &out);
102 void UpdateRecord(const char *name);
104 ClassDefOverride(TTVSession, 0) // A tree viewer session
int Int_t
Definition RtypesCore.h:45
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
An array of clone (identical) objects.
Organizes TGButton widgets in a group with one vertical column.
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
I/O classes for TreeViewer session handling.
Definition TTVSession.h:29
void SetX(const char *x="", const char *xal="-empty-")
Definition TTVSession.h:63
TString fXAlias
X alias.
Definition TTVSession.h:34
void SetOption(const char *option="")
Definition TTVSession.h:67
TString fName
Name of this record.
Definition TTVSession.h:32
void SetRC(bool redirect=false, bool cut=true)
Definition TTVSession.h:68
TString fZ
Z expression.
Definition TTVSession.h:37
TString fCutAlias
Cut alias.
Definition TTVSession.h:40
bool fScanRedirected
Redirect switch.
Definition TTVSession.h:42
TString fX
X expression.
Definition TTVSession.h:33
bool fCutEnabled
True if current cut is active.
Definition TTVSession.h:43
void ExecuteUserCode()
Execute user-defined code.
const char * GetY() const
Definition TTVSession.h:55
void SetZ(const char *z="", const char *zal="-empty-")
Definition TTVSession.h:65
bool MustExecuteCode() const
Definition TTVSession.h:60
void SetName(const char *name="")
Definition TTVSession.h:62
void SetAutoexec(bool autoexec=true)
Definition TTVSession.h:61
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
bool fAutoexec
Autoexecute user code command.
Definition TTVSession.h:45
void SetUserCode(const char *code, bool autoexec=true)
Definition TTVSession.h:69
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
const char * GetX() const
Definition TTVSession.h:54
void SetY(const char *y="", const char *yal="-empty-")
Definition TTVSession.h:64
TString fZAlias
Z alias.
Definition TTVSession.h:38
TString fYAlias
Y alias.
Definition TTVSession.h:36
TString fUserCode
Command executed when record is connected.
Definition TTVSession.h:44
const char * GetName() const override
Returns name of object.
Definition TTVSession.h:57
const char * GetUserCode() const
Definition TTVSession.h:58
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
Default constructor.
TString fCut
Cut expression.
Definition TTVSession.h:39
TString fOption
Graphic option.
Definition TTVSession.h:41
~TTVRecord() override
Definition TTVSession.h:49
bool HasUserCode() const
Definition TTVSession.h:59
void SetCut(const char *cut="", const char *cal="-empty-")
Definition TTVSession.h:66
TString fY
Y expression.
Definition TTVSession.h:35
const char * GetZ() const
Definition TTVSession.h:56
I/O classes for TreeViewer session handling.
Definition TTVSession.h:75
TTVRecord * Last()
Definition TTVSession.h:95
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
TTVRecord * GetRecord(Int_t i)
Return record at index i.
TTreeViewer * fViewer
Associated tree viewer.
Definition TTVSession.h:80
void SetRecordName(const char *name)
Set record name.
void Show(TTVRecord *rec)
Display record rec.
TTVRecord * GetCurrent()
Definition TTVSession.h:92
TTVRecord * AddRecord(bool fromFile=false)
Add a record.
TClonesArray * fList
List of TV records.
Definition TTVSession.h:78
TTVRecord * Previous()
Definition TTVSession.h:97
Int_t fCurrent
Index of current record.
Definition TTVSession.h:81
const char * GetName() const override
Returns name of object.
Definition TTVSession.h:87
void SetName(const char *name)
Definition TTVSession.h:88
TString fName
Name of this session.
Definition TTVSession.h:79
Int_t GetEntries()
Definition TTVSession.h:91
~TTVSession() override
TTVRecord * First()
Definition TTVSession.h:94
void RemoveLastRecord()
Remove current record from list.
TTVRecord * Next()
Definition TTVSession.h:96
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Int_t fRecords
Number of records.
Definition TTVSession.h:82
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
Definition TTreeViewer.h:54
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17