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