Logo ROOT  
Reference Guide
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 
25 class TTreeViewer;
26 class TClonesArray;
27 class TGVButtonGroup;
28 
29 class TTVRecord : public TObject {
30 
31 public:
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 
47 public:
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;}
60  Bool_t MustExecuteCode() const {return fAutoexec;}
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 
75 class TTVSession : public TObject {
76 
77 private:
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 
84 public:
86  ~TTVSession();
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);}
95  TTVRecord *Last() {return GetRecord(fRecords-1);}
96  TTVRecord *Next() {return GetRecord(fCurrent+1);}
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
TTVSession
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:75
TTVSession::~TTVSession
~TTVSession()
Destructor.
Definition: TTVSession.cxx:152
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TTVRecord::SetRC
void SetRC(Bool_t redirect=kFALSE, Bool_t cut=kTRUE)
Definition: TTVSession.h:68
TTVRecord::SetAutoexec
void SetAutoexec(Bool_t autoexec=kTRUE)
Definition: TTVSession.h:61
TTVRecord::fZ
TString fZ
Z expression.
Definition: TTVSession.h:37
TTVRecord::TTVRecord
TTVRecord()
Default constructor.
Definition: TTVSession.cxx:32
TTVRecord::SetUserCode
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
Definition: TTVSession.h:69
TTVSession::GetRecord
TTVRecord * GetRecord(Int_t i)
Return record at index i.
Definition: TTVSession.cxx:188
TTVSession::UpdateRecord
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Definition: TTVSession.cxx:272
TTVSession::SetName
void SetName(const char *name)
Definition: TTVSession.h:88
TTVRecord::PlugIn
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
Definition: TTVSession.cxx:76
TTVRecord::HasUserCode
Bool_t HasUserCode() const
Definition: TTVSession.h:59
TTVSession::fCurrent
Int_t fCurrent
Index of current record.
Definition: TTVSession.h:81
TTVRecord::GetZ
const char * GetZ() const
Definition: TTVSession.h:56
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TTreeViewer
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
Definition: TTreeViewer.h:54
TString
Basic string class.
Definition: TString.h:136
TTVSession::fName
TString fName
Name of this session.
Definition: TTVSession.h:79
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TTVRecord::fCut
TString fCut
Cut expression.
Definition: TTVSession.h:39
TTVSession::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:87
TString.h
TTVSession::First
TTVRecord * First()
Definition: TTVSession.h:94
bool
TTVSession::fViewer
TTreeViewer * fViewer
Associated tree viewer.
Definition: TTVSession.h:80
TTVRecord
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:29
TTVSession::AddRecord
TTVRecord * AddRecord(Bool_t fromFile=kFALSE)
Add a record.
Definition: TTVSession.cxx:161
TTVSession::Next
TTVRecord * Next()
Definition: TTVSession.h:96
TGVButtonGroup
Organizes TGButton widgets in a group with one vertical column.
Definition: TGButtonGroup.h:94
TTVRecord::fY
TString fY
Y expression.
Definition: TTVSession.h:35
TTVRecord::FormFrom
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
Definition: TTVSession.cxx:57
TTVRecord::GetX
const char * GetX() const
Definition: TTVSession.h:54
TTVSession::fList
TClonesArray * fList
List of TV records.
Definition: TTVSession.h:78
TTVRecord::fName
TString fName
Name of this record.
Definition: TTVSession.h:32
TTVRecord::~TTVRecord
~TTVRecord()
Destructor.
Definition: TTVSession.h:49
TTVSession::Show
void Show(TTVRecord *rec)
Display record rec.
Definition: TTVSession.cxx:244
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TTVRecord::MustExecuteCode
Bool_t MustExecuteCode() const
Definition: TTVSession.h:60
TTVRecord::fCutEnabled
Bool_t fCutEnabled
True if current cut is active.
Definition: TTVSession.h:43
TTVRecord::fOption
TString fOption
Graphic option.
Definition: TTVSession.h:41
TTVRecord::fXAlias
TString fXAlias
X alias.
Definition: TTVSession.h:34
y
Double_t y[n]
Definition: legend1.C:17
TTVRecord::fAutoexec
Bool_t fAutoexec
Autoexecute user code command.
Definition: TTVSession.h:45
TTVRecord::ExecuteUserCode
void ExecuteUserCode()
Execute user-defined code.
Definition: TTVSession.cxx:44
TTVSession::Previous
TTVRecord * Previous()
Definition: TTVSession.h:97
TTVSession::GetEntries
Int_t GetEntries()
Definition: TTVSession.h:91
TTVRecord::fYAlias
TString fYAlias
Y alias.
Definition: TTVSession.h:36
TTVRecord::SetX
void SetX(const char *x="", const char *xal="-empty-")
Definition: TTVSession.h:63
TTVRecord::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:57
TTVRecord::SetY
void SetY(const char *y="", const char *yal="-empty-")
Definition: TTVSession.h:64
TTVSession::SetRecordName
void SetRecordName(const char *name)
Set record name.
Definition: TTVSession.cxx:211
TObject.h
TTVRecord::fCutAlias
TString fCutAlias
Cut alias.
Definition: TTVSession.h:40
TTVSession::TTVSession
TTVSession(TTreeViewer *tv)
Constructor.
Definition: TTVSession.cxx:140
TTVSession::Last
TTVRecord * Last()
Definition: TTVSession.h:95
TTVSession::fRecords
Int_t fRecords
Number of records.
Definition: TTVSession.h:82
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TTVRecord::SetOption
void SetOption(const char *option="")
Definition: TTVSession.h:67
name
char name[80]
Definition: TGX11.cxx:110
TTVSession::RemoveLastRecord
void RemoveLastRecord()
Remove current record from list.
Definition: TTVSession.cxx:224
TTVRecord::GetUserCode
const char * GetUserCode() const
Definition: TTVSession.h:58
TTVRecord::fX
TString fX
X expression.
Definition: TTVSession.h:33
TTVRecord::fScanRedirected
Bool_t fScanRedirected
Redirect switch.
Definition: TTVSession.h:42
TTVRecord::SaveSource
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
Definition: TTVSession.cxx:100
TTVRecord::SetZ
void SetZ(const char *z="", const char *zal="-empty-")
Definition: TTVSession.h:65
TTVRecord::fUserCode
TString fUserCode
Command executed when record is connected.
Definition: TTVSession.h:44
TTVRecord::fZAlias
TString fZAlias
Z alias.
Definition: TTVSession.h:38
TTVRecord::GetY
const char * GetY() const
Definition: TTVSession.h:55
TTVRecord::SetName
void SetName(const char *name="")
Definition: TTVSession.h:62
TClonesArray
An array of clone (identical) objects.
Definition: TClonesArray.h:29
TTVRecord::SetCut
void SetCut(const char *cut="", const char *cal="-empty-")
Definition: TTVSession.h:66
TTVSession::SaveSource
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
Definition: TTVSession.cxx:255
int
TTVSession::GetCurrent
TTVRecord * GetCurrent()
Definition: TTVSession.h:92