Logo ROOT  
Reference Guide
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_t fScanRedirected; ///< Redirect switch
43 Bool_t fCutEnabled; ///< True if current cut is active
44 TString fUserCode; ///< Command executed when record is connected
45 Bool_t fAutoexec; ///< Autoexecute user code command
48 TTVRecord(); ///< Default constructor
49 ~TTVRecord() {} ///< 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 virtual const char *GetName() const {return fName;}
58 const char *GetUserCode() const {return fUserCode;}
59 Bool_t HasUserCode() const {return fUserCode.Length() != 0 ? kTRUE : kFALSE;}
61 void SetAutoexec(Bool_t autoexec=kTRUE) {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_t redirect = kFALSE, Bool_t cut = kTRUE) {fScanRedirected = redirect; fCutEnabled = cut;}
69 void SetUserCode(const char *code, Bool_t autoexec=kTRUE) {fUserCode = code; fAutoexec=autoexec;} // *MENU*
70 void SaveSource(std::ofstream &out);
72 ClassDef(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
87 virtual const char *GetName() const {return fName;}
88 void SetName(const char *name) {fName = name;}
89 void SetRecordName(const char* name);
90 TTVRecord *AddRecord(Bool_t fromFile = kFALSE);
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 ClassDef(TTVSession, 0) // A tree viewer session
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDef(name, id)
Definition: Rtypes.h:335
Option_t Option_t option
char name[80]
Definition: TGX11.cxx:110
An array of clone (identical) objects.
Definition: TClonesArray.h:29
Organizes TGButton widgets in a group with one vertical column.
Definition: TGButtonGroup.h:94
Mother of all ROOT objects.
Definition: TObject.h:41
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
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
Bool_t MustExecuteCode() const
Definition: TTVSession.h:60
void SetOption(const char *option="")
Definition: TTVSession.h:67
Bool_t fScanRedirected
Redirect switch.
Definition: TTVSession.h:42
Definition: TTVSession.h:49
TString fName
Name of this record.
Definition: TTVSession.h:32
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
Definition: TTVSession.h:69
TString fZ
Z expression.
Definition: TTVSession.h:37
Bool_t fCutEnabled
True if current cut is active.
Definition: TTVSession.h:43
TString fCutAlias
Cut alias.
Definition: TTVSession.h:40
TString fX
X expression.
Definition: TTVSession.h:33
void ExecuteUserCode()
Execute user-defined code.
Definition: TTVSession.cxx:44
const char * GetY() const
Definition: TTVSession.h:55
void SetZ(const char *z="", const char *zal="-empty-")
Definition: TTVSession.h:65
Bool_t HasUserCode() const
Definition: TTVSession.h:59
void SetName(const char *name="")
Definition: TTVSession.h:62
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
Definition: TTVSession.cxx:100
void SetRC(Bool_t redirect=kFALSE, Bool_t cut=kTRUE)
Definition: TTVSession.h:68
Bool_t fAutoexec
Autoexecute user code command.
Definition: TTVSession.h:45
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
Definition: TTVSession.cxx:57
const char * GetX() const
Definition: TTVSession.h:54
void SetY(const char *y="", const char *yal="-empty-")
Definition: TTVSession.h:64
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:57
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
void SetAutoexec(Bool_t autoexec=kTRUE)
Definition: TTVSession.h:61
const char * GetUserCode() const
Definition: TTVSession.h:58
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
Definition: TTVSession.cxx:76
Default constructor.
Definition: TTVSession.cxx:32
TString fCut
Cut expression.
Definition: TTVSession.h:39
TString fOption
Graphic option.
Definition: TTVSession.h:41
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
TTVSession(TTreeViewer *tv)
Definition: TTVSession.cxx:140
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
Definition: TTVSession.cxx:255
Definition: TTVSession.cxx:152
TTVRecord * GetRecord(Int_t i)
Return record at index i.
Definition: TTVSession.cxx:188
TTreeViewer * fViewer
Associated tree viewer.
Definition: TTVSession.h:80
void SetRecordName(const char *name)
Set record name.
Definition: TTVSession.cxx:211
void Show(TTVRecord *rec)
Display record rec.
Definition: TTVSession.cxx:244
TTVRecord * GetCurrent()
Definition: TTVSession.h:92
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:87
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
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
TTVRecord * First()
Definition: TTVSession.h:94
void RemoveLastRecord()
Remove current record from list.
Definition: TTVSession.cxx:224
TTVRecord * Next()
Definition: TTVSession.h:96
TTVRecord * AddRecord(Bool_t fromFile=kFALSE)
Add a record.
Definition: TTVSession.cxx:161
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Definition: TTVSession.cxx:272
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