00001 // $Id: TGo4Ratemeter.h 828 2011-12-20 12:37:57Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGO4RATEMETER_H 00015 #define TGO4RATEMETER_H 00016 00017 #include "TObject.h" 00018 00019 #include "TTimeStamp.h" 00020 00024 class TGo4Ratemeter : public TObject { 00025 public: 00026 TGo4Ratemeter() ; 00027 00028 virtual ~TGo4Ratemeter() ; 00029 00030 Double_t GetRate() const { return fdRate; } 00031 00032 Double_t GetTime() const { return fdTime; } 00033 00034 ULong64_t GetCurrentCount() const { return fuCurrentCount; } 00035 00036 Double_t GetAvRate() const { return fdTime>0 ? fuCurrentCount/fdTime : 0.; } 00037 00041 Bool_t Update(Int_t increment=1); 00042 00044 void Reset(); 00045 00049 Bool_t TestUpdate(); 00050 00053 void SetUpdateInterval(double v) { if (v>0) fdUpdateInterval = v; } 00054 00055 private: 00056 00057 static const Double_t fgdUPDATEINTERVAL; 00058 00060 ULong64_t fuCurrentCount; 00061 00063 ULong64_t fuLastCount; 00064 00066 Double_t fdRate; 00067 00069 Double_t fdTime; 00070 00072 TTimeStamp fLastTm; 00073 00075 Bool_t fbUpdateDone; 00076 00078 ULong64_t fuNextCheckCnt; 00079 00081 ULong64_t fuCheckInterval; 00082 00084 Double_t fdUpdateInterval; 00085 }; 00086 00087 #endif //TGO4RATEMETER_H