ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef ROOT_TGFrame
23 #include "TGFrame.h"
24 #endif
25 
26 class TTreeViewer;
27 class TClonesArray;
28 class TGVButtonGroup;
29 
30 class TTVRecord : public TObject {
31 
32 public:
33  TString fName; // name of this record
34  TString fX, fXAlias; // X expression and alias
35  TString fY, fYAlias; // Y expression and alias
36  TString fZ, fZAlias; // Z expression and alias
37  TString fCut, fCutAlias; // cut expression and alias
38  TString fOption; // graphic option
39  Bool_t fScanRedirected; // redirect switch
40  Bool_t fCutEnabled; // true if current cut is active
41  TString fUserCode; // command executed when record is conected
42  Bool_t fAutoexec; // autoexecute user code command
43 public:
44  TTVRecord(); // default constructor
45  ~TTVRecord() {} // destructor
46 
47  void ExecuteUserCode();
48  void FormFrom(TTreeViewer *tv);
49  void PlugIn(TTreeViewer *tv);
50  const char *GetX() const {return fX;}
51  const char *GetY() const {return fY;}
52  const char *GetZ() const {return fZ;}
53  virtual const char *GetName() const {return fName;}
54  const char *GetUserCode() const {return fUserCode;}
55  Bool_t HasUserCode() const {return fUserCode.Length() != 0 ? kTRUE : kFALSE;}
56  Bool_t MustExecuteCode() const {return fAutoexec;}
57  void SetAutoexec(Bool_t autoexec=kTRUE) {fAutoexec=autoexec;} // *TOGGLE* *GETTER=MustExecuteCode
58  void SetName(const char* name = "") {fName = name;}
59  void SetX(const char *x = "", const char *xal = "-empty-") {fX = x; fXAlias = xal;}
60  void SetY(const char *y = "", const char *yal = "-empty-") {fY = y; fYAlias = yal;}
61  void SetZ(const char *z = "", const char *zal = "-empty-") {fZ = z; fZAlias = zal;}
62  void SetCut(const char *cut = "", const char *cal = "-empty-") {fCut = cut; fCutAlias = cal;}
63  void SetOption(const char *option = "") {fOption = option;}
64  void SetRC(Bool_t redirect = kFALSE, Bool_t cut = kTRUE) {fScanRedirected = redirect; fCutEnabled = cut;}
65  void SetUserCode(const char *code, Bool_t autoexec=kTRUE) {fUserCode = code; fAutoexec=autoexec;} // *MENU*
66  void SaveSource(std::ofstream &out);
67 
68  ClassDef(TTVRecord, 0) // A draw record for TTreeViewer
69 };
70 
71 class TTVSession : public TObject {
72 
73 private:
74  TClonesArray *fList; // list of TV records
75  TString fName; // name of this session
76  TTreeViewer *fViewer; // associated tree viewer
77  Int_t fCurrent; // index of current record
78  Int_t fRecords; // number of records
79 
80 public:
82  ~TTVSession();
83  virtual const char *GetName() const {return fName;}
84  void SetName(const char *name) {fName = name;}
85  void SetRecordName(const char* name);
86  TTVRecord *AddRecord(Bool_t fromFile = kFALSE);
90  TTVRecord *First() {return GetRecord(0);}
91  TTVRecord *Last() {return GetRecord(fRecords-1);}
92  TTVRecord *Next() {return GetRecord(fCurrent+1);}
94 
95  void RemoveLastRecord();
96  void Show(TTVRecord *rec);
97  void SaveSource(std::ofstream &out);
98  void UpdateRecord(const char *name);
99 
100  ClassDef(TTVSession, 0) // A tree viewer session
101 };
102 
103 #endif
TTVRecord * First()
Definition: TTVSession.h:90
TString fX
Definition: TTVSession.h:34
TTVRecord * Previous()
Definition: TTVSession.h:93
Ssiz_t Length() const
Definition: TString.h:390
TTVSession(TTreeViewer *tv)
TString fYAlias
Definition: TTVSession.h:35
Bool_t fScanRedirected
Definition: TTVSession.h:39
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TString fOption
Definition: TTVSession.h:38
Int_t fRecords
Definition: TTVSession.h:78
void SetCut(const char *cut="", const char *cal="-empty-")
Definition: TTVSession.h:62
TString fY
Definition: TTVSession.h:35
Int_t GetEntries()
Definition: TTVSession.h:87
void RemoveLastRecord()
Remove current record from list.
Definition: TTVSession.cxx:222
TTVRecord * Last()
Definition: TTVSession.h:91
TString fXAlias
Definition: TTVSession.h:34
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
void SetRecordName(const char *name)
Set record name.
Definition: TTVSession.cxx:209
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
Definition: TTVSession.h:65
void SetOption(const char *option="")
Definition: TTVSession.h:63
Bool_t MustExecuteCode() const
Definition: TTVSession.h:56
TString fCutAlias
Definition: TTVSession.h:37
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features...
Definition: TTreeViewer.h:60
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
Definition: TTVSession.cxx:253
const char * GetZ() const
Definition: TTVSession.h:52
Float_t z[5]
Definition: Ifit.C:16
TTVRecord * GetCurrent()
Definition: TTVSession.h:88
char * out
Definition: TBase64.cxx:29
TString fZ
Definition: TTVSession.h:36
~TTVSession()
Destructor.
Definition: TTVSession.cxx:150
TString fUserCode
Definition: TTVSession.h:41
void SetName(const char *name="")
Definition: TTVSession.h:58
Bool_t fAutoexec
Definition: TTVSession.h:42
void SetName(const char *name)
Definition: TTVSession.h:84
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:30
TString fCut
Definition: TTVSession.h:37
TTVRecord * GetRecord(Int_t i)
Return record at index i.
Definition: TTVSession.cxx:186
Bool_t fCutEnabled
Definition: TTVSession.h:40
TString fName
Definition: TTVSession.h:33
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
Definition: TTVSession.cxx:98
~TTVRecord()
Definition: TTVSession.h:45
TString fZAlias
Definition: TTVSession.h:36
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:53
void SetY(const char *y="", const char *yal="-empty-")
Definition: TTVSession.h:60
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
Definition: TTVSession.cxx:55
void SetX(const char *x="", const char *xal="-empty-")
Definition: TTVSession.h:59
const char * GetX() const
Definition: TTVSession.h:50
Double_t y[n]
Definition: legend1.C:17
const char * GetUserCode() const
Definition: TTVSession.h:54
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
Definition: TTVSession.cxx:74
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
Bool_t HasUserCode() const
Definition: TTVSession.h:55
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:71
void SetRC(Bool_t redirect=kFALSE, Bool_t cut=kTRUE)
Definition: TTVSession.h:64
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Definition: TTVSession.cxx:270
An array of clone (identical) objects.
Definition: TClonesArray.h:32
const char * GetY() const
Definition: TTVSession.h:51
TTreeViewer * fViewer
Definition: TTVSession.h:76
TTVRecord * AddRecord(Bool_t fromFile=kFALSE)
Add a record.
Definition: TTVSession.cxx:159
void ExecuteUserCode()
Execute user-defined code.
Definition: TTVSession.cxx:42
Int_t fCurrent
Definition: TTVSession.h:77
void SetZ(const char *z="", const char *zal="-empty-")
Definition: TTVSession.h:61
TString fName
Definition: TTVSession.h:75
void Show(TTVRecord *rec)
Display record rec.
Definition: TTVSession.cxx:242
const Bool_t kTRUE
Definition: Rtypes.h:91
void SetAutoexec(Bool_t autoexec=kTRUE)
Definition: TTVSession.h:57
TTVRecord * Next()
Definition: TTVSession.h:92
TClonesArray * fList
Definition: TTVSession.h:74
virtual const char * GetName() const
Returns name of object.
Definition: TTVSession.h:83