RootShower.h

Go to the documentation of this file.
00001 // Author: Bertrand Bellenot   22/08/02
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2002, Bertrand Bellenot.                           *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see the LICENSE file.                         *
00008  *************************************************************************/
00009 
00010 //////////////////////////////////////////////////////////////////////////
00011 //                                                                      //
00012 // This File contains the declaration of the RootShower-class           //
00013 //                                                                      //
00014 //////////////////////////////////////////////////////////////////////////
00015 
00016 #ifndef ROOTSHOWER_H
00017 #define ROOTSHOWER_H
00018 
00019 #ifndef ROOT_TGFrame
00020 #include "TGFrame.h"
00021 #endif
00022 #ifndef ROOT_TDatime
00023 #include "TDatime.h"
00024 #endif
00025 #ifndef ROOT_TCanvas
00026 #include "TCanvas.h"
00027 #endif
00028 
00029 class TGMenuBar;
00030 class TGPopupMenu;
00031 class GTitleFrame;
00032 class GButtonFrame;
00033 class TGButton;
00034 class TGListTree;
00035 class TGListTreeItem;
00036 class TRootEmbeddedCanvas;
00037 class TGCanvas;
00038 class TGStatusBar;
00039 class TGTextEdit;
00040 class TGTab;
00041 class TCanvas;
00042 class TPad;
00043 class MyEvent;
00044 class TEnv;
00045 class TTimer;
00046 class TH1F;
00047 class TGToolBar;
00048 class TContextMenu;
00049 
00050 
00051 extern TGListTree       *gEventListTree;    // Event selection TGListTree
00052 extern TGListTreeItem   *gBaseLTI;          // First ListTree item
00053 extern TGListTreeItem   *gTmpLTI;           // Temporary ListTree item
00054 extern TGListTreeItem   *gLTI[];            // Array of ListTree items (particles)
00055 
00056 extern Int_t            gColIndex;          // Global gradient color table used 
00057                                             // for tracks color
00058 
00059 class RootShower: public TGMainFrame {
00060 
00061 friend class SettingsDialog;
00062 
00063 private:
00064    // Statics
00065    static Int_t         fgDefaultXPosition; // default X position of top left corner
00066    static Int_t         fgDefaultYPosition; // default Y position of top left corner
00067 
00068    Bool_t               fOk;                // Return code from settings dialog
00069    Bool_t               fModified;          // kTRUE if setting mods not saved
00070    Bool_t               fSettingsModified;  // kTRUE if settings have been modified
00071    Bool_t               fIsRunning;         // Simulation running flag
00072    Bool_t               fInterrupted;       // Interrupts current simulation
00073    Bool_t               fShowProcess;       // Display process details
00074    Bool_t               fCreateGIFs;        // GIFs creation of current event
00075 
00076    ULong_t              fEventNr;           // Event number
00077    UInt_t               fNRun;              // Run number
00078    TDatime              fEventTime;         // Event generation date
00079 
00080    Int_t                fPicIndex;          // Index of animation images
00081    Int_t                 fPicNumber;         // Number of images used for animation
00082    Int_t                fPicDelay;          // Delay between animation images
00083    Int_t                fPicReset;          // kTRUE to display first anim picture
00084 
00085    TEnv                *fRootShowerEnv;     // RootShower environment variables
00086    // MenuBar Frame
00087    TGMenuBar           *fMenuBar;           // Main menu bar
00088    TGPopupMenu         *fMenuFile;          // "File" popup menu
00089    TGPopupMenu         *fMenuEvent;         // "Event" popup menu
00090    TGPopupMenu         *fMenuTools;         // "Tools" popup menu
00091    TGPopupMenu         *fMenuView;          // "View" popup menu
00092    TGPopupMenu         *fMenuHelp;          // "Help" popup menu
00093    TGLayoutHints       *fMenuBarLayout;
00094    TGLayoutHints       *fMenuBarItemLayout;
00095    TGLayoutHints       *fMenuBarHelpLayout;
00096    void                 MakeMenuBarFrame();
00097    void                 CloseMenuBarFrame();
00098 
00099    // ToolBar Frame
00100    TGToolBar           *fToolBar;
00101    void ShowToolBar(Bool_t show = kTRUE);
00102 
00103    // Layout hints
00104    TGLayoutHints       *fL1;
00105    TGLayoutHints       *fL2;
00106    TGLayoutHints       *fL3;
00107    TGLayoutHints       *fL4;
00108    TGLayoutHints       *fL5;
00109    TGLayoutHints       *fL6;
00110    TGLayoutHints       *fL7;
00111    TGLayoutHints       *fL8;
00112 
00113    // Title Frame
00114    GTitleFrame         *fTitleFrame;        // Title frame
00115 
00116    // Main Frame
00117    TGCompositeFrame    *fMainFrame;         // Main frame
00118 
00119    // Selection frame
00120    TGCompositeFrame    *fSelectionFrame;    // Frame containing list tree and button frame
00121    GButtonFrame        *fButtonFrame;       // Frame containing control buttons
00122    TGListTreeItem      *AddToTree(const char *name = 0);
00123    void                 BuildEventTree();
00124    TGCanvas            *fTreeView;          // Canvas containing event selection list tree
00125    TGListTree          *fEventListTree;     // Event selection TGListTree
00126    TGListTreeItem      *fCurListItem;       // Current TGlistTreeItem (level) in TGListTree
00127    TContextMenu        *fContextMenu;       // pointer to context menu
00128 
00129    // Display frame
00130    TGTab               *fDisplayFrame;      // TGTab for graphical and text display
00131    TRootEmbeddedCanvas *fEmbeddedCanvas;    // Events frame
00132    TRootEmbeddedCanvas *fEmbeddedCanvas2;   // Selected event frame
00133    TRootEmbeddedCanvas *fEmbeddedCanvas3;   // Statistics frame
00134    TGTextEdit          *fTextView;          // PDG infos frame
00135 
00136    // Zooming stuff...
00137    TGHorizontalFrame   *fHFrame,*fHFrame2;  // Frame containing zoom buttons
00138    TGLayoutHints       *fZoomButtonsLayout; // Layout of zoom buttons
00139    TGButton            *fZoomPlusButton,*fZoomMoinsButton;  // Zoom buttons
00140    TGButton            *fZoomPlusButton2,*fZoomMoinsButton2;// Zoom buttons
00141 
00142    // Statusbar
00143    TGStatusBar         *fStatusBar;         // Status bar reporting event info
00144 
00145    TTimer              *fTimer;             // Timer used for animation
00146    TCanvas             *fCA;                // Events view
00147    TCanvas             *fCB;                // Selected event view
00148    TCanvas             *fCC;                // Statistics
00149     
00150    MyEvent             *fEvent;             // Pointer on actual event
00151    TPad                *fPadC;              // TPad of statistics histo
00152     
00153    TH1F                *fHisto_dEdX;        // histogram of particle's energy loss
00154 
00155 protected:
00156    Int_t                fFirstParticle;     // Primary particle type
00157    Double_t             fE0;                // Initial particle energy
00158    Double_t             fB;                 // Magnetic field
00159 
00160 public:
00161    // statics
00162    static void         setDefaultPosition(Int_t x, Int_t y);
00163 
00164    // Constructors & destructor
00165    RootShower(const TGWindow *p, UInt_t w, UInt_t h);
00166    virtual ~RootShower();
00167 
00168    void                SetOk(Bool_t ok=true) { fOk = ok; }
00169    void                Modified(Bool_t modified=true) { fModified = modified; }
00170    void                SettingsModified(Bool_t modified=true) { fSettingsModified = modified; }
00171    void                Interrupt(Bool_t inter=true) { fInterrupted = inter; }
00172    Bool_t              IsInterrupted() { return fInterrupted; }
00173    virtual void        Initialize(Int_t first);
00174    virtual void        OnOpenFile(const Char_t *filename);
00175    virtual void        OnSaveFile(const Char_t *filename);
00176    virtual void        OnShowerProduce();
00177    virtual void        Produce();
00178    virtual void        ShowInfos();
00179    virtual void        HighLight(TGListTreeItem *item);
00180    virtual void        OnShowSelected(TGListTreeItem *item);
00181    virtual void        Layout();
00182    virtual void        CloseWindow();
00183    virtual Bool_t      HandleConfigureNotify(Event_t *event);
00184    virtual Bool_t      HandleKey(Event_t *event);
00185    virtual Bool_t      ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00186    virtual Bool_t      HandleTimer(TTimer *);
00187    virtual Int_t       DistancetoPrimitive(Int_t px, Int_t py);
00188    void                Clicked(TGListTreeItem *item, Int_t x, Int_t y);
00189    void                UpdateDisplay() { fCA->Modified(); fCA->Update(); }
00190 };
00191 
00192 extern RootShower   *gRootShower;
00193 
00194 #endif // EMSHOWER_H

Generated on Tue Jul 5 15:15:13 2011 for ROOT_528-00b_version by  doxygen 1.5.1