STB/TFndStbMon.h

00001 // @(#)fROOT/STB:$Name:  $:$Id: TFndStbMon.h,v 1.13 2007/09/05 10:48:18 Diego_Faso Exp $
00002 // Revision Author: Diego Faso <mailto:faso@to.infn.it>, 2005/06/24
00003 // Original Author: Piergiorgio Cerello <mailto:cerello@to.infn.it>, 2001
00004 
00005 #ifndef FROOT_TFndStbMon
00006 #define FROOT_TFndStbMon
00007 
00009 //                                                //
00010 //                 TFnsStbMon                     //
00011 //                                                //
00012 //  Base Class for the STB monitoring             //
00013 //   - histograms collection and filling          //
00014 //   - shared memories management                 //
00015 //                                                //
00016 //  (see GTS relative class for descriptions)     //
00017 //                                                //
00018 //                                                //
00020 
00021 #include "FROOT.h"
00022 
00023 #include "TObject.h"
00024 #include "TClonesArray.h"
00025 #include "TFile.h"
00026 #ifdef _FND_ONL_USE_MAP_FILES_
00027 #include "TMapFile.h"
00028 #endif
00029 #include "TH1.h"
00030 #include "TH2.h"
00031 #include "TCanvas.h"
00032 #include "TLine.h"
00033 
00034 using namespace FROOT;
00035 
00036 class TFndHdt;
00037 
00038 class TFndStbMon : public TObject {
00039   
00040  protected:
00041 
00042   Int_t    shmflg;               // Shared Memory flag
00043   TFile    *fout;
00044   TFile    *fstb;                // Stb histogram file
00045   
00046 #if defined _FND_ONL_USE_MAP_FILES_
00047   TMapFile *fShmStbMain;                // main STB shared memory
00048   TMapFile *fShmStbTdc[K_N_STB_CROWNS];
00049 #elif defined _FND_ONL_USE_SHARED_FILES_
00050   TFile *fShmStbMain;                // main STB shared memory
00051   TFile *fShmStbTdc[K_N_STB_CROWNS];
00052 #endif
00053  
00054   // --- shared memories/files names
00055   Bool_t fMustRecoverHistos; // true if a recovery must be performed after a break
00056   
00057   TString fSharedMemName_Main;
00058   TString fSharedMemName_Tdc[K_N_STB_CROWNS];
00059   
00060   TString fSharedFileName_Main;
00061   TString fSharedFileName_Tdc[K_N_STB_CROWNS];
00062   
00063   // --- 
00064   
00065   TH1F *stbmult;                 // STB multiplicity
00066   TH2F *stbmaptdc;               // STB TDC pattern
00067 
00068   TH1F *stb_pattern[K_N_STB_CROWNS];       // hit pattern for various crowns
00069    
00070   TH1F *stbtdc[K_N_STB_CROWNS][K_N_STB_TUBES]; // TDCs for Tubes 
00071   TH1F *stb1d;
00072   TH2F *stb2d;
00073   TLine *fLine;
00074   
00075  private:
00076   void Init();
00077   void InitHistos(const Int_t &stb_tdc_bins,const Double_t &stb_tdc_min,const Double_t &stb_tdc_max);
00078   void OpenSharedFiles(const TString &fmode);
00079 
00080  public:
00081 
00082   TFndStbMon(const TString &fmode,Int_t stb_tdc_bins=50,Double_t stb_tdc_min=1000.,Double_t stb_tdc_max=3000.);
00083   TFndStbMon();                              // Constructor for Consumer
00084   TFndStbMon(TString *filename);             // Constructor from ROOT filename
00085   ~TFndStbMon();                             // Destructor
00086   void Fill();                               // Fill Histograms in shared memories
00087   void Fill(const TClonesArray &StbHit);     // Fill Histograms in shared memories
00088   void Update(Bool_t purge=kTRUE);           // Update shared memories
00089   void ResetHistos();
00090   void WriteToFile(TString filename=0,Bool_t IsShared = kFALSE);       // Write histograms to file
00091   /*   void TimeCalibration(Int_t,Int_t); */
00092   /*   void TimeCalibration(Int_t); */
00093   /*   void TimeCalibration(); */
00094   /*   void DisplayTube(Int_t crown,Int_t number); // Display tube "number" in crown "crown" */
00095   /*   void DisplayTZero(Int_t crown,Int_t number, Int_t maxcont); // Display t-zero in crown "crown" */
00096   /*   void DisplayPattern(Int_t crown); // Display hit pattern for crown "crown"     TH1F *TimeMap(); */
00097   /*   void CloseDisplay(); */
00098   /*   void WriteTimeToMsql();  //write time calibration constants to msql */
00099   void Add(TFndStbMon *stbmon); // merge histograms
00100   inline TH1F *StbMult() { return stbmult; }           // Multiplicity
00101   //  inline TH2F *StbDiff(Int_t i) { return stbdiff[i-1]; } // Triplets
00102   inline TH2F *StbMapTdc() { return stbmaptdc; }           // TDC maps
00103   inline TH1F *StbTdc(Int_t crown, Int_t tube) { return stbtdc[crown-1][tube-1]; }           // TDC
00104   inline TH1F *StbPattern(Int_t crown) { return stb_pattern[crown-1]; }           // TDC pattern for crown "crown"
00105   
00106   ClassDef(TFndStbMon,1)      // The STB monitor
00107   };
00108 
00109 #endif // FROOT_TFndStbMon
00110 
00111 
00112 
00113 
00114 
00115 

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