STEER/TFndGeb2hdtMan.h

00001 // @(#)fROOT/STEER:$Name:  $:$Id: TFndGeb2hdtMan.h,v 1.24 2007/09/06 16:21:56 Diego_Faso Exp $
00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2006/06/05
00003 
00004 #ifndef FROOT_TFndGeb2hdtMan
00005 #define FROOT_TFndGeb2hdtMan
00006 
00007 #ifndef ROOT_Gtypes
00008 #include "Gtypes.h"
00009 #endif
00010 
00011 // --- root
00012 //#include <fstream>
00013 #include "TDatime.h"
00014 #include "TROOT.h"
00015 #include "TSystem.h"
00016 #include "TGClient.h"
00017 #include "TThread.h"
00018 #include "TApplication.h"
00019 #include "TTree.h"
00020 
00021 #include <RQ_OBJECT.h>
00022 
00023 // --- froot
00024 #include "TFndRun.h"
00025 #include "TFndGtsMon.h"
00026 #include "TFndTofMon.h"
00027 #include "TFndStbMon.h"
00028 #include "TFndSilMon.h"
00029 #include "TFndLmdMon.h"
00030 
00031 class TFndGeb2hdtMan: public TObject {
00032   RQ_OBJECT("TFndGeb2hdtMan")
00033   
00034  protected:
00035 
00036   TFndRun *fRun;
00037   Int_t fDebug; // Taken from RunConfig
00038   Int_t fDebugRaw; // Taken from RunConfig
00039 
00040   Bool_t fUsingGUI; // true [default] if GUI (TFndGeb2hdtGUI) must be used
00041    
00042   TString fMsqlHost;
00043   TString fDataPath;
00044   TString fFileName;
00045   Int_t   fNevents;
00046   Int_t   fGebIp;
00047   
00048   Int_t fStartTime;
00049   Int_t fStopTime;
00050   
00051   Int_t fOnlFlg;
00052   TString fConsumControlFile; // path+name of the shared text file for producer->consumer(s) control
00053   
00054   Float_t fkSCALE;
00055   Int_t fTimeLimit;     // -1 (default) means "unlimited"
00056   Bool_t fTimedOut;     // TRUE if timed out
00057   Int_t fUpdateEvGap;   // Number of events for shared memories update
00058   Bool_t fUpdatingProd; // true while updating producers  
00059 
00060   Int_t fCurEv; // current event (inside the loop)
00061   Int_t fLastUpdEv; // event corresponding to the last update
00062   Int_t fRate;  // producer rate (produced events/s)
00063   Int_t fExitVal; // stop condition (0:don't stop ; 1: end of run; 2: time-out)
00064   Bool_t fManStop;
00065   Bool_t fPaused;
00066 
00067   TFile *fHdtRootFile; // root-file (in $FND_HDR) with the hits tree
00068 
00069   TThread *fMonSaveThread;
00070  
00071   Bool_t fConfFileRead; // check on RunConfig.C reading
00072 
00073   TTree *fHdtTree; // tree with HDT events
00074   Bool_t fMustSaveHdt; // used by geb2hdt
00075 
00076 private:
00077   Int_t PrintInfo(Int_t &rate1,Int_t &rate2); // also checks if producer must be updated
00078   void StartMonitors();
00079   void FlushHdtTree(); // used in online-mode only
00080 
00081  public:
00082   TFndGeb2hdtMan();
00083 /*   TFndGeb2hdtMan(TString msqlhost,TString fpth,TString fnam,Int_t nevts,Int_t gebip); */
00084   TFndGeb2hdtMan(const TString &msqlhost,const TString &fpth,const TString &run_type,const Int_t &run_num,const Int_t &nevts,Int_t gebip=0);
00085   ~TFndGeb2hdtMan();
00086   
00087   Bool_t UsingGUI() { return fUsingGUI; }
00088   void ReadConfFile();  
00089 
00090   void UpdateProducers(); // Update producer shared files in a new thread
00091 
00092   Int_t GetOnlFlag() { return fOnlFlg; }
00093 
00094   Int_t GetCurrentEvent() { return fCurEv; }
00095   Int_t GetUpdateEvGap()  { return fUpdateEvGap; }
00096   Int_t GetRate() { return fRate; }
00097 
00098   void InitRun();
00099   void EventLoop();
00100   void FinishRun();
00101 
00102   void CreateHdtFile(); // create new hdt.root file (in $FND_HDT) depending on current run name/number
00103   void WriteHdtFile();
00104 
00105   void SetUpdateEvGap(Int_t ev)      { fUpdateEvGap = ev; }
00106   void SetTimeLimit(Int_t TimeLimit) { fTimeLimit = TimeLimit;}
00107 
00108   void ResetGts();
00109   void ResetTof();
00110   void ResetSil();
00111   void ResetLmd();
00112   void ResetStb();
00113 
00114   // --- producer->consumer(s) communication (support for NFS file sharing)
00115   Int_t TouchMapFiles();
00116   void HandleConsumerActions(Bool_t allow);
00117   
00118   void PauseProducer();
00119   void StopProducer();
00120   static void KillYourself();
00121 
00122   void RealTimeInfo(Int_t Info_id,TString method,TString info);
00123   void SendRealTimeInfo(Int_t Info_id); // required by the related GUI (if used)
00124 
00125   static void *SavingThread(void *arg); // Update producer outputs within a dedicate thread
00126   void StartSavingThread();
00127   void StopSavingThread();
00128 
00129   
00130   ClassDef(TFndGeb2hdtMan,1)
00131 };
00132     
00133 #endif // FROOT_TFndGeb2hdtMan

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