00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTVSession
00013 #define ROOT_TTVSession
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ROOT_TGFrame
00023 #include "TGFrame.h"
00024 #endif
00025
00026 class TTreeViewer;
00027 class TClonesArray;
00028 class TGVButtonGroup;
00029
00030 class TTVRecord : public TObject {
00031
00032 public:
00033 TString fName;
00034 TString fX, fXAlias;
00035 TString fY, fYAlias;
00036 TString fZ, fZAlias;
00037 TString fCut, fCutAlias;
00038 TString fOption;
00039 Bool_t fScanRedirected;
00040 Bool_t fCutEnabled;
00041 TString fUserCode;
00042 Bool_t fAutoexec;
00043 public:
00044 TTVRecord();
00045 ~TTVRecord() {}
00046
00047 void ExecuteUserCode();
00048 void FormFrom(TTreeViewer *tv);
00049 void PlugIn(TTreeViewer *tv);
00050 const char *GetX() const {return fX;}
00051 const char *GetY() const {return fY;}
00052 const char *GetZ() const {return fZ;}
00053 virtual const char *GetName() const {return fName;}
00054 const char *GetUserCode() const {return fUserCode;}
00055 Bool_t HasUserCode() const {return fUserCode.Length() != 0 ? kTRUE : kFALSE;}
00056 Bool_t MustExecuteCode() const {return fAutoexec;}
00057 void SetAutoexec(Bool_t autoexec=kTRUE) {fAutoexec=autoexec;}
00058 void SetName(const char* name = "") {fName = name;}
00059 void SetX(const char *x = "", const char *xal = "-empty-") {fX = x; fXAlias = xal;}
00060 void SetY(const char *y = "", const char *yal = "-empty-") {fY = y; fYAlias = yal;}
00061 void SetZ(const char *z = "", const char *zal = "-empty-") {fZ = z; fZAlias = zal;}
00062 void SetCut(const char *cut = "", const char *cal = "-empty-") {fCut = cut; fCutAlias = cal;}
00063 void SetOption(const char *option = "") {fOption = option;}
00064 void SetRC(Bool_t redirect = kFALSE, Bool_t cut = kTRUE) {fScanRedirected = redirect; fCutEnabled = cut;}
00065 void SetUserCode(const char *code, Bool_t autoexec=kTRUE) {fUserCode = code; fAutoexec=autoexec;}
00066 void SaveSource(ofstream &out);
00067
00068 ClassDef(TTVRecord, 0)
00069 };
00070
00071 class TTVSession : public TObject {
00072
00073 private:
00074 TClonesArray *fList;
00075 TString fName;
00076 TTreeViewer *fViewer;
00077 Int_t fCurrent;
00078 Int_t fRecords;
00079
00080 public:
00081 TTVSession(TTreeViewer *tv);
00082 ~TTVSession();
00083 virtual const char *GetName() const {return fName;}
00084 void SetName(const char *name) {fName = name;}
00085 void SetRecordName(const char* name);
00086 TTVRecord *AddRecord(Bool_t fromFile = kFALSE);
00087 Int_t GetEntries() {return fRecords;}
00088 TTVRecord *GetCurrent() {return GetRecord(fCurrent);}
00089 TTVRecord *GetRecord(Int_t i);
00090 TTVRecord *First() {return GetRecord(0);}
00091 TTVRecord *Last() {return GetRecord(fRecords-1);}
00092 TTVRecord *Next() {return GetRecord(fCurrent+1);}
00093 TTVRecord *Previous() {return GetRecord(fCurrent-1);}
00094
00095 void RemoveLastRecord();
00096 void Show(TTVRecord *rec);
00097 void SaveSource(ofstream &out);
00098 void UpdateRecord(const char *name);
00099
00100 ClassDef(TTVSession, 0)
00101 };
00102
00103 #endif