Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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/// @file
16/// @brief TTVSession and TTVRecord - I/O classes for TreeViewer session handling
17
18#include "TObject.h"
19#include "TString.h"
20
21class TTreeViewer;
22class TClonesArray;
23class TGVButtonGroup;
24
25class TTVRecord : public TObject {
26
27public:
28 TString fName; ///< Name of this record
29 TString fX; ///< X expression
30 TString fXAlias; ///< X alias
31 TString fY; ///< Y expression
32 TString fYAlias; ///< Y alias
33 TString fZ; ///< Z expression
34 TString fZAlias; ///< Z alias
35 TString fCut; ///< Cut expression
36 TString fCutAlias; ///< Cut alias
37 TString fOption; ///< Graphic option
38 bool fScanRedirected; ///< Redirect switch
39 bool fCutEnabled; ///< True if current cut is active
40 TString fUserCode; ///< Command executed when record is connected
41 bool fAutoexec; ///< Autoexecute user code command
42
43public:
44 TTVRecord(); ///< Default constructor
45 ~TTVRecord() override {} ///< 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 const char *GetName() const override {return fName;}
54 const char *GetUserCode() const {return fUserCode;}
55 bool HasUserCode() const {return fUserCode.Length() != 0 ? true : false;}
56 bool MustExecuteCode() const {return fAutoexec;}
57 void SetAutoexec(bool autoexec=true) {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 redirect = false, bool cut = true) {fScanRedirected = redirect; fCutEnabled = cut;}
65 void SetUserCode(const char *code, bool autoexec=true) {fUserCode = code; fAutoexec=autoexec;} // *MENU*
66 void SaveSource(std::ofstream &out);
67
68 ClassDefOverride(TTVRecord, 0) // A draw record for TTreeViewer
69};
70
71class TTVSession : public TObject {
72
73private:
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
80public:
82 ~TTVSession() override;
83 const char *GetName() const override {return fName;}
84 void SetName(const char *name) {fName = name;}
85 void SetRecordName(const char* name);
86 TTVRecord *AddRecord(bool fromFile = false);
90 TTVRecord *First() {return GetRecord(0);}
94
95 void RemoveLastRecord();
96 void Show(TTVRecord *rec);
97 void SaveSource(std::ofstream &out);
98 void UpdateRecord(const char *name);
99
100 ClassDefOverride(TTVSession, 0) // A tree viewer session
101};
102
103#endif
int Int_t
Definition RtypesCore.h:45
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
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:139
Ssiz_t Length() const
Definition TString.h:417
I/O classes for TreeViewer session handling.
Definition TTVSession.h:25
void SetX(const char *x="", const char *xal="-empty-")
Definition TTVSession.h:59
TString fXAlias
X alias.
Definition TTVSession.h:30
void SetOption(const char *option="")
Definition TTVSession.h:63
TString fName
Name of this record.
Definition TTVSession.h:28
void SetRC(bool redirect=false, bool cut=true)
Definition TTVSession.h:64
TString fZ
Z expression.
Definition TTVSession.h:33
TString fCutAlias
Cut alias.
Definition TTVSession.h:36
bool fScanRedirected
Redirect switch.
Definition TTVSession.h:38
TString fX
X expression.
Definition TTVSession.h:29
bool fCutEnabled
True if current cut is active.
Definition TTVSession.h:39
void ExecuteUserCode()
Execute user-defined code.
const char * GetY() const
Definition TTVSession.h:51
void SetZ(const char *z="", const char *zal="-empty-")
Definition TTVSession.h:61
bool MustExecuteCode() const
Definition TTVSession.h:56
void SetName(const char *name="")
Definition TTVSession.h:58
void SetAutoexec(bool autoexec=true)
Definition TTVSession.h:57
void SaveSource(std::ofstream &out)
Save the TTVRecord in a C++ macro file.
bool fAutoexec
Autoexecute user code command.
Definition TTVSession.h:41
void SetUserCode(const char *code, bool autoexec=true)
Definition TTVSession.h:65
void FormFrom(TTreeViewer *tv)
Populate members from treeviewer tv.
const char * GetX() const
Definition TTVSession.h:50
void SetY(const char *y="", const char *yal="-empty-")
Definition TTVSession.h:60
TString fZAlias
Z alias.
Definition TTVSession.h:34
TString fYAlias
Y alias.
Definition TTVSession.h:32
TString fUserCode
Command executed when record is connected.
Definition TTVSession.h:40
const char * GetName() const override
Returns name of object.
Definition TTVSession.h:53
const char * GetUserCode() const
Definition TTVSession.h:54
void PlugIn(TTreeViewer *tv)
Change treeviewer status to this record.
TTVRecord()
Default constructor.
TString fCut
Cut expression.
Definition TTVSession.h:35
TString fOption
Graphic option.
Definition TTVSession.h:37
~TTVRecord() override
Destructor.
Definition TTVSession.h:45
bool HasUserCode() const
Definition TTVSession.h:55
void SetCut(const char *cut="", const char *cal="-empty-")
Definition TTVSession.h:62
TString fY
Y expression.
Definition TTVSession.h:31
const char * GetZ() const
Definition TTVSession.h:52
I/O classes for TreeViewer session handling.
Definition TTVSession.h:71
TTVRecord * Last()
Definition TTVSession.h:91
TTVSession(TTreeViewer *tv)
Constructor.
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
TTVRecord * GetRecord(Int_t i)
Return record at index i.
TTreeViewer * fViewer
Associated tree viewer.
Definition TTVSession.h:76
void SetRecordName(const char *name)
Set record name.
void Show(TTVRecord *rec)
Display record rec.
TTVRecord * GetCurrent()
Definition TTVSession.h:88
TTVRecord * AddRecord(bool fromFile=false)
Add a record.
TClonesArray * fList
List of TV records.
Definition TTVSession.h:74
TTVRecord * Previous()
Definition TTVSession.h:93
Int_t fCurrent
Index of current record.
Definition TTVSession.h:77
const char * GetName() const override
Returns name of object.
Definition TTVSession.h:83
void SetName(const char *name)
Definition TTVSession.h:84
TString fName
Name of this session.
Definition TTVSession.h:75
Int_t GetEntries()
Definition TTVSession.h:87
~TTVSession() override
Destructor.
TTVRecord * First()
Definition TTVSession.h:90
void RemoveLastRecord()
Remove current record from list.
TTVRecord * Next()
Definition TTVSession.h:92
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Int_t fRecords
Number of records.
Definition TTVSession.h:78
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