Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTVSession.h
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2//Author : Andrei Gheata 21/02/01
3
4/*************************************************************************
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 *************************************************************************/
11
12#ifndef ROOT_TTVSession
13#define ROOT_TTVSession
14
15///////////////////////////////////////////////////////////////////////////////
16// //
17// TTVSession and TTVRecord - I/O classes for TreeViewer session handling //
18// TTreeViewer //
19// //
20///////////////////////////////////////////////////////////////////////////////
21
22#include "TObject.h"
23#include "TString.h"
24
25class TTreeViewer;
26class TClonesArray;
27class TGVButtonGroup;
28
29class TTVRecord : public TObject {
30
31public:
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
46
47public:
48 TTVRecord(); ///< Default constructor
49 ~TTVRecord() {} ///< Destructor
50
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);
71
72 ClassDef(TTVRecord, 0) // A draw record for TTreeViewer
73};
74
75class TTVSession : public TObject {
76
77private:
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
83
84public:
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);}
98
99 void RemoveLastRecord();
100 void Show(TTVRecord *rec);
101 void SaveSource(std::ofstream &out);
102 void UpdateRecord(const char *name);
103
104 ClassDef(TTVSession, 0) // A tree viewer session
105};
106
107#endif
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:325
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: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
~TTVRecord()
Destructor.
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.
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.
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.
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.
TTVRecord()
Default constructor.
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
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
~TTVSession()
Destructor.
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
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.
TTVRecord * Next()
Definition TTVSession.h:96
TTVRecord * AddRecord(Bool_t fromFile=kFALSE)
Add a record.
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