PREAN/TFndPreanGUI.h

00001 // @(#)fROOT/PREAN:$Name:  $:$Id: TFndPreanGUI.h,v 1.27 2007/10/04 14:10:26 Diego_Faso Exp $
00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2006/12/02
00003 
00004 #ifndef FROOT_TFndPreanGUI
00005 #define FROOT_TFndPreanGUI
00006 
00007 
00008 // This application is based on a Master/Slave selection
00009 //  (Combo1 is the Master)
00010 #include "TGFileDialog.h"
00011 #include "TObjString.h"
00012 
00013 #include "TFndBaseMonGUI.h"
00014 
00015 #include "TRandom.h"
00016 #include "TH1.h"
00017 
00018 #include "TFndPreanHistos.h"
00019 
00020 class TFndPreanGUI: public TFndBaseMonGUI {
00021   
00022 public:
00023   
00024   enum E_MasterMenuMode{
00025     E_MasMenu_GES = 0,
00026     E_MasMenu_BHABHA = 1,
00027     E_MasMenu_HYPE = 2,
00028     E_MasMenu_STAT = 3,
00029   };
00030 
00031   enum E_SlaveMenuMode{
00032     E_SlMenu_Ges_Main = 0,
00033     E_SlMenu_Ges_End = 1,
00034     //
00035     E_SlMenu_Bha_Part = 0,
00036     E_SlMenu_Bha_Int = 1,
00037     E_SlMenu_Bha_Tof = 2,
00038     E_SlMenu_Bha_End = 3,
00039     //
00040     E_SlMenu_Hyp_Km_Stop_2D = 0,
00041     E_SlMenu_Hyp_Kp_Stop_2D = 1,
00042     E_SlMenu_Hyp_K_Stop = 2,
00043     E_SlMenu_Hyp_K_Stat = 3, // P.R. error-code and statistics
00044     E_SlMenu_Hyp_K_PhiPos = 4, // Phy decay position (reconstructed)
00045     E_SlMenu_Hyp_K_KpluPosTrk_All = 5, // Positive tracks from K+ (All targets)
00046     E_SlMenu_Hyp_K_KpluPosTrk_Tgt = 6, // Positive tracks from K+ (target selection)
00047     E_SlMenu_Hyp_K_KpluPosTrk_Pth = 7, // Positive tracks from K+ (path selection)
00048     E_SlMenu_Hyp_K_KpluPosTrk_Tof = 8, // Mu+ TOF (all targets)
00049     E_SlMenu_Hyp_End = 9,
00050     //
00051     E_SlMenu_Stat_Events = 0,    // total number of collected events per run
00052     E_SlMenu_Stat_Lumin = 1,     // average luminosity per run
00053     E_SlMenu_Stat_LuminInt_NoInh = 2,   // integrated luminosity (run by run) [no inhibit]
00054     E_SlMenu_Stat_LuminInt_InjInh = 3, // integrated luminosity (run by run) [injection inhibit]
00055     E_SlMenu_Stat_LuminInt_AllInh = 4, // integrated luminosity (run by run) [inj+daq inhibit]
00056     E_SlMenu_Stat_BhaCount = 5,   // total number of BHABHA trigger (run by run)
00057     E_SlMenu_Stat_HypCount = 6,   // total number of HYPE   trigger (run by run)
00058     E_SlMenu_Stat_KaonsStop = 7, // number of stopped kaons (run by run)
00059     E_SlMenu_Stat_MuPluAll = 8, //  #Mu+/lumin ; Mu+ momentum(run by run)
00060     E_SlMenu_Stat_BhaECM = 9, // center of mass energy from BHABHA (e-e+ inv.mass) (run by run)
00061     E_SlMenu_Stat_BhaKshort = 10, // information from Kshort (pi-pi+ inv.mass) (run by run)
00062     E_SlMenu_Stat_BhaRatio = 11, // ratio #Kshort/#Bha (inv.masses) (run by run)
00063     E_SlMenu_Stat_End = 12, // used for arrays
00064   };
00065   
00066   enum E_SettingMenuMode{
00067     E_SetMenu_DEFAULT = 0,
00068     E_SetMenu_SHIFT = 1,
00069     E_SetMenu_End = 2
00070   };
00071 
00072   TString GetSettingName(Int_t set_id){
00073     switch(set_id){
00074     case (E_SettingMenuMode)E_SetMenu_DEFAULT: return "Default";
00075     case (E_SettingMenuMode)E_SetMenu_SHIFT: return "Shift";
00076     default: return 0;
00077     }
00078     return 0;
00079   }
00080 
00081 
00082   enum E_savemode {
00083     Esave_pdf = 0,
00084     Esave_root = 1,
00085   };
00086 
00087   TString GetExtFromMode(E_savemode mode) {
00088     switch(mode){
00089       case Esave_pdf  : return ".pdf";
00090       case Esave_root : return ".root";
00091       default: return 0;
00092     }
00093     return 0;
00094   }
00095 
00096 
00097 protected:
00098 
00099   enum E_PreanGUIBckColors{
00100     E_PreanBckCol_default = 42,
00101     E_PreanBckCol_save = 0
00102   };
00103 
00104   TGLabel *fFidaVer_Combo_Lbl;
00105   TGComboBox *fFidaVer_Combo; 
00106   TGCheckButton *fChkBox_Autoreset;
00107   TGCheckButton *fChkBox_Overwrite; // considered while saving to "pdf" file
00108 
00109   TGLabel *fSetting_Combo_Lbl; // pre-defined setting for histograms
00110   TGComboBox *fSetting_Combo; 
00111 
00112   TGCheckButton *fChkBox_SumW2; // used to compute errors on TH1
00113   
00114   TFndPreanHistos *PreanHistosRef; // reference for histograms
00115   E_MasterMenuMode fCurMasterMode;
00116   
00117   TGLabel *fWarningMsg_Lbl;
00118 
00119   TGTextButton *fTxtBut_SaveRootFile;
00120   TGTextButton *fTxtBut_LoadRootFile;
00121 
00122   // --- CUTS/SELECTIONS management
00123   TGLabel *fLbl_EvtCuts;
00124   //
00125   TGLabel *fLbl_TrkCuts;
00126   TGCheckButton *fChkBox_CutTrkFit;
00127   TGLabel *fLbl_TrkType;
00128   TGComboBox *fCombo_TrkType; 
00129 
00130   // --- transient window management
00131   TFndGTransientProgress *fTransientProgress; // transient window with progress
00132 
00133   // --- save management
00134   TGTransientFrame *fTrsnFrm_SaveName; // transient frame for save-name
00135   TGLabel *fSaveFnam_Trsn_Lbl;
00136   TGTextEntry *fSaveFnam_Trsn_Txt;
00137   TGTextButton *fSaveFnam_Trsn_ButOk;
00138   TGTextButton *fSaveFnam_Trsn_ButCancel;
00139 
00140   TString fStrSaveFilename;
00141   // --- 
00142   TString fTh1DrawOpt; // used to toggle error-bars
00143 
00144   enum NmaxMulGraph { NMaxMultiGraphs = 30 };
00145   TFndMultiGraph *fFndMultiGraph[NMaxMultiGraphs];
00146 
00147  private:
00148   void DrawFndGraph(Int_t pad_id,Option_t *opt,TFndGraph *graph1, TFndGraph *graph2=0, TFndGraph *graph3=0, TFndGraph *graph4=0);
00149   void ResetMultiGraphs(Bool_t recreate=kFALSE);
00150 
00151   void DisplayInfo_Ges(E_SlaveMenuMode mode);
00152   void DisplayInfo_Bhabha(E_SlaveMenuMode mode);
00153   void DisplayInfo_Hype(E_SlaveMenuMode mode);
00154   void DisplayInfo_Stat(E_SlaveMenuMode mode);
00155  
00156   Bool_t Do_CheckCanWriteFile();
00157 
00158  public:
00159 
00160   TFndPreanGUI();
00161   ~TFndPreanGUI();
00162   
00163   void BuildGUI();
00164   void CloseGUI();
00165 
00166   void CustomizeGUI();
00167   void ResetDaughter() { ResetMultiGraphs (kFALSE); }
00168   
00169   Bool_t MakeConnections(Bool_t Connect = kTRUE);
00170   
00171   void FillCombos()
00172   {
00173     FillCombo_Steer();
00174     FillCombo_Sel1();
00175     FillCombo_Sel2(-1); // empty
00176     FillCombo_Setting();
00177   }
00178   
00179   void FillCombo_Steer();
00180   void FillCombo_Sel1();
00181   void FillCombo_Sel2(Int_t mode);
00182   void FillCombo_Setting();
00183 
00184   void Exe_FidaVerCombo(Int_t sel);
00185   void Exe_SettingCombo(Int_t sel);
00186   void Exe_SteerCombo(Int_t id);
00187   void Exe_SelCombo1(Int_t id);
00188   void Exe_SelCombo2(Int_t id);
00189 
00190   void UpdateDisplayPad(Bool_t every_pad=kFALSE);
00191 
00192   void SetFirstRun(Long_t);
00193   void SetLastRun(Long_t);
00194 
00195   // --- Cuts management
00196   void SetTrkType(Int_t selected){
00197     TString dummystr = "";
00198     PreanHistosRef->fCut_TrkType = PreanHistosRef->TrkType(selected,dummystr);
00199     cout << "fCut_TrkType = " << PreanHistosRef->fCut_TrkType << " ( \"" << dummystr.Data() << " \")" << endl;
00200   }
00201 
00202   void SetCutFit(Bool_t cut_fit){
00203     PreanHistosRef->fCut_Fitted = cut_fit;
00204     cout << "fCut_Fitted = " << PreanHistosRef->fCut_Fitted << endl;
00205   }
00206   // --- Histogram management
00207   
00208   void FillHistos_GUI();
00209 
00210   void DisplayGes(E_SlaveMenuMode mode);
00211   void DisplayBhabha(E_SlaveMenuMode mode);
00212   void DisplayHype(E_SlaveMenuMode mode);
00213   void DisplayStat(E_SlaveMenuMode mode);
00214 
00215   void ToggleErrorBars(Bool_t sumw2);
00216 
00217   void SavePage();
00218   void SaveHistos();
00219   TString BrowseCurDir();
00220   void LoadHistos();
00221   void StartGUI_SaveFilename(E_savemode mode);
00222   void CloseGUI_SaveFilename();
00223   void Do_SaveDisplay();
00224   void Do_SaveHistos();
00225 
00226   void HandleMouseActionsDaughter(Int_t event, Int_t x, Int_t y, TObject *selected);
00227   void EnlargeHisto(TObject *selected);
00228   void PrintPaveInfo(TObject *selected);
00229  
00230 
00231   ClassDef(TFndPreanGUI,0)
00232 };
00233 
00234 #endif // FROOT_TFndPreanGUI

Generated on Tue Oct 16 15:40:47 2007 by  doxygen 1.5.2