TTVSession.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TTVSession.h 20882 2007-11-19 11:31:26Z rdm $
00002 //Author : Andrei Gheata   21/02/01
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TTVSession
00013 #define ROOT_TTVSession
00014 
00015 ///////////////////////////////////////////////////////////////////////////////
00016 //                                                                           //
00017 // TTVSession and TTVRecord - I/O classes for TreeViewer session handling    //
00018 //     TTreeViewer                                                           //
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;                  // name of this record
00034    TString              fX, fXAlias;            // X expression and alias
00035    TString              fY, fYAlias;            // Y expression and alias
00036    TString              fZ, fZAlias;            // Z expression and alias
00037    TString              fCut, fCutAlias;        // cut expression and alias
00038    TString              fOption;                // graphic option
00039    Bool_t               fScanRedirected;        // redirect switch
00040    Bool_t               fCutEnabled;            // true if current cut is active
00041    TString              fUserCode;              // command executed when record is conected
00042    Bool_t               fAutoexec;              // autoexecute user code command
00043 public:
00044    TTVRecord();                                 // default constructor
00045    ~TTVRecord() {}                              // destructor
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;} // *TOGGLE* *GETTER=MustExecuteCode
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;} // *MENU*
00066    void           SaveSource(ofstream &out);
00067 
00068    ClassDef(TTVRecord, 0)    // A draw record for TTreeViewer
00069 };
00070 
00071 class TTVSession : public TObject {
00072 
00073 private:
00074    TClonesArray  *fList;                        // list of TV records
00075    TString        fName;                        // name of this session
00076    TTreeViewer   *fViewer;                      // associated tree viewer
00077    Int_t          fCurrent;                     // index of current record
00078    Int_t          fRecords;                     // number of records
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)   // A tree viewer session
00101 };
00102 
00103 #endif

Generated on Tue Jul 5 14:28:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1