File indexing completed on 2025-09-18 09:34:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TTVSession
0013 #define ROOT_TTVSession
0014
0015
0016
0017
0018 #include "TObject.h"
0019 #include "TString.h"
0020
0021 class TTreeViewer;
0022 class TClonesArray;
0023 class TGVButtonGroup;
0024
0025 class TTVRecord : public TObject {
0026
0027 public:
0028 TString fName;
0029 TString fX;
0030 TString fXAlias;
0031 TString fY;
0032 TString fYAlias;
0033 TString fZ;
0034 TString fZAlias;
0035 TString fCut;
0036 TString fCutAlias;
0037 TString fOption;
0038 bool fScanRedirected;
0039 bool fCutEnabled;
0040 TString fUserCode;
0041 bool fAutoexec;
0042
0043 public:
0044 TTVRecord();
0045 ~TTVRecord() override {}
0046
0047 void ExecuteUserCode();
0048 void FormFrom(TTreeViewer *tv);
0049 void PlugIn(TTreeViewer *tv);
0050 const char *GetX() const {return fX;}
0051 const char *GetY() const {return fY;}
0052 const char *GetZ() const {return fZ;}
0053 const char *GetName() const override {return fName;}
0054 const char *GetUserCode() const {return fUserCode;}
0055 bool HasUserCode() const {return fUserCode.Length() != 0 ? true : false;}
0056 bool MustExecuteCode() const {return fAutoexec;}
0057 void SetAutoexec(bool autoexec=true) {fAutoexec=autoexec;}
0058 void SetName(const char* name = "") {fName = name;}
0059 void SetX(const char *x = "", const char *xal = "-empty-") {fX = x; fXAlias = xal;}
0060 void SetY(const char *y = "", const char *yal = "-empty-") {fY = y; fYAlias = yal;}
0061 void SetZ(const char *z = "", const char *zal = "-empty-") {fZ = z; fZAlias = zal;}
0062 void SetCut(const char *cut = "", const char *cal = "-empty-") {fCut = cut; fCutAlias = cal;}
0063 void SetOption(const char *option = "") {fOption = option;}
0064 void SetRC(bool redirect = false, bool cut = true) {fScanRedirected = redirect; fCutEnabled = cut;}
0065 void SetUserCode(const char *code, bool autoexec=true) {fUserCode = code; fAutoexec=autoexec;}
0066 void SaveSource(std::ofstream &out);
0067
0068 ClassDefOverride(TTVRecord, 0)
0069 };
0070
0071 class TTVSession : public TObject {
0072
0073 private:
0074 TClonesArray *fList;
0075 TString fName;
0076 TTreeViewer *fViewer;
0077 Int_t fCurrent;
0078 Int_t fRecords;
0079
0080 public:
0081 TTVSession(TTreeViewer *tv);
0082 ~TTVSession() override;
0083 const char *GetName() const override {return fName;}
0084 void SetName(const char *name) {fName = name;}
0085 void SetRecordName(const char* name);
0086 TTVRecord *AddRecord(bool fromFile = false);
0087 Int_t GetEntries() {return fRecords;}
0088 TTVRecord *GetCurrent() {return GetRecord(fCurrent);}
0089 TTVRecord *GetRecord(Int_t i);
0090 TTVRecord *First() {return GetRecord(0);}
0091 TTVRecord *Last() {return GetRecord(fRecords-1);}
0092 TTVRecord *Next() {return GetRecord(fCurrent+1);}
0093 TTVRecord *Previous() {return GetRecord(fCurrent-1);}
0094
0095 void RemoveLastRecord();
0096 void Show(TTVRecord *rec);
0097 void SaveSource(std::ofstream &out);
0098 void UpdateRecord(const char *name);
0099
0100 ClassDefOverride(TTVSession, 0)
0101 };
0102
0103 #endif