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, fXAlias; // X expression and alias
34 TString fY, fYAlias; // Y expression and alias
35 TString fZ, fZAlias; // Z expression and alias
36 TString fCut, fCutAlias; // cut expression and alias
37 TString fOption; // graphic option
38 Bool_t fScanRedirected; // redirect switch
39 Bool_t fCutEnabled; // true if current cut is active
40 TString fUserCode; // command executed when record is conected
41 Bool_t fAutoexec; // autoexecute user code command
43 TTVRecord(); // default constructor
44 ~TTVRecord() {} // destructor
46 void ExecuteUserCode();
47 void FormFrom(TTreeViewer *tv);
48 void PlugIn(TTreeViewer *tv);
49 const char *GetX() const {return fX;}
50 const char *GetY() const {return fY;}
51 const char *GetZ() const {return fZ;}
52 virtual const char *GetName() const {return fName;}
53 const char *GetUserCode() const {return fUserCode;}
54 Bool_t HasUserCode() const {return fUserCode.Length() != 0 ? kTRUE : kFALSE;}
56 void SetAutoexec(Bool_t autoexec=kTRUE) {fAutoexec=autoexec;} // *TOGGLE* *GETTER=MustExecuteCode
57 void SetName(const char* name = "") {fName = name;}
58 void SetX(const char *x = "", const char *xal = "-empty-") {fX = x; fXAlias = xal;}
59 void SetY(const char *y = "", const char *yal = "-empty-") {fY = y; fYAlias = yal;}
60 void SetZ(const char *z = "", const char *zal = "-empty-") {fZ = z; fZAlias = zal;}
61 void SetCut(const char *cut = "", const char *cal = "-empty-") {fCut = cut; fCutAlias = cal;}
62 void SetOption(const char *option = "") {fOption = option;}
63 void SetRC(Bool_t redirect = kFALSE, Bool_t cut = kTRUE) {fScanRedirected = redirect; fCutEnabled = cut;}
64 void SetUserCode(const char *code, Bool_t autoexec=kTRUE) {fUserCode = code; fAutoexec=autoexec;} // *MENU*
65 void SaveSource(std::ofstream &out);
67 ClassDef(TTVRecord, 0) // A draw record for TTreeViewer
70class TTVSession : public TObject {
73 TClonesArray *fList; // list of TV records
74 TString fName; // name of this session
75 TTreeViewer *fViewer; // associated tree viewer
76 Int_t fCurrent; // index of current record
77 Int_t fRecords; // number of records
82 virtual const char *GetName() const {return fName;}
83 void SetName(const char *name) {fName = name;}
84 void SetRecordName(const char* name);
85 TTVRecord *AddRecord(Bool_t fromFile = kFALSE);
89 TTVRecord *First() {return GetRecord(0);}
94 void RemoveLastRecord();
95 void Show(TTVRecord *rec);
96 void SaveSource(std::ofstream &out);
97 void UpdateRecord(const char *name);
99 ClassDef(TTVSession, 0) // A tree viewer session
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
An array of clone (identical) objects.
Definition: TClonesArray.h:32
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:29
void SetX(const char *x="", const char *xal="-empty-")
Definition: TTVSession.h:58
TString fXAlias
Definition: TTVSession.h:33
Bool_t MustExecuteCode() const
Definition: TTVSession.h:55
void SetOption(const char *option="")
Definition: TTVSession.h:62
Bool_t fScanRedirected
Definition: TTVSession.h:38
Definition: TTVSession.h:44
TString fName
Definition: TTVSession.h:32
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
Definition: TTVSession.h:64
TString fZ
Definition: TTVSession.h:35
Bool_t fCutEnabled
Definition: TTVSession.h:39
TString fCutAlias
Definition: TTVSession.h:36
TString fX
Definition: TTVSession.h:33
void ExecuteUserCode()
Execute user-defined code.
Definition: TTVSession.cxx:42
const char * GetY() const
Definition: TTVSession.h:50
void SetZ(const char *z="", const char *zal="-empty-")
Definition: TTVSession.h:60
Bool_t HasUserCode() const
Definition: TTVSession.h:54
void SetName(const char *name="")
Definition: TTVSession.h:57
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
Definition: TTVSession.cxx:98
void SetRC(Bool_t redirect=kFALSE, Bool_t cut=kTRUE)
Definition: TTVSession.h:63
Bool_t fAutoexec
Definition: TTVSession.h:41
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
Definition: TTVSession.cxx:55
const char * GetX() const
Definition: TTVSession.h:49
void SetY(const char *y="", const char *yal="-empty-")
Definition: TTVSession.h:59
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:52
TString fZAlias
Definition: TTVSession.h:35
TString fYAlias
Definition: TTVSession.h:34
TString fUserCode
Definition: TTVSession.h:40
void SetAutoexec(Bool_t autoexec=kTRUE)
Definition: TTVSession.h:56
const char * GetUserCode() const
Definition: TTVSession.h:53
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
Definition: TTVSession.cxx:74
TTVRecord default constructor.
Definition: TTVSession.cxx:30
TString fCut
Definition: TTVSession.h:36
TString fOption
Definition: TTVSession.h:37
void SetCut(const char *cut="", const char *cal="-empty-")
Definition: TTVSession.h:61
TString fY
Definition: TTVSession.h:34
const char * GetZ() const
Definition: TTVSession.h:51
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:70
TTVRecord * Last()
Definition: TTVSession.h:90
TTVSession(TTreeViewer *tv)
Definition: TTVSession.cxx:138
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
Definition: TTVSession.cxx:253
Definition: TTVSession.cxx:150
TTVRecord * GetRecord(Int_t i)
Return record at index i.
Definition: TTVSession.cxx:186
TTreeViewer * fViewer
Definition: TTVSession.h:75
void SetRecordName(const char *name)
Set record name.
Definition: TTVSession.cxx:209
void Show(TTVRecord *rec)
Display record rec.
Definition: TTVSession.cxx:242
TTVRecord * GetCurrent()
Definition: TTVSession.h:87
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:82
TClonesArray * fList
Definition: TTVSession.h:73
TTVRecord * Previous()
Definition: TTVSession.h:92
Int_t fCurrent
Definition: TTVSession.h:76
void SetName(const char *name)
Definition: TTVSession.h:83
TString fName
Definition: TTVSession.h:74
Int_t GetEntries()
Definition: TTVSession.h:86
TTVRecord * First()
Definition: TTVSession.h:89
void RemoveLastRecord()
Remove current record from list.
Definition: TTVSession.cxx:222
TTVRecord * Next()
Definition: TTVSession.h:91
TTVRecord * AddRecord(Bool_t fromFile=kFALSE)
Add a record.
Definition: TTVSession.cxx:159
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Definition: TTVSession.cxx:270
Int_t fRecords
Definition: TTVSession.h:77
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