GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Ratemeter.h
Go to the documentation of this file.
1 // $Id: TGo4Ratemeter.h 1464 2015-05-29 12:37:43Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4RATEMETER_H
15 #define TGO4RATEMETER_H
16 
17 #include "TNamed.h"
18 
19 #include "TTimeStamp.h"
20 
24 class TGo4Ratemeter : public TNamed {
25  private:
26  Bool_t fbRunning; // Indicates if analysis running
27  ULong64_t fuCurrentCount; // Number of events processed since last start.
28  Double_t fdRate; // Current eventrate (events/sec)
29  Double_t fdTime; // Time sum since last ratemeter reset. in s.
30  TString fxDateString; // Time and date of the last update of this status as sql string.
31  TString fxEventSource; // Name of eventsource of first step / current filelist name
32 
33  ULong64_t fuLastCount;
34  TTimeStamp fLastTm;
35  Bool_t fbUpdateDone;
36 
37  ULong64_t fuNextCheckCnt;
38  ULong64_t fuCheckInterval;
39  Double_t fdUpdateInterval;
40 
41  static const Double_t fgdUPDATEINTERVAL;
42 
43  public:
44  TGo4Ratemeter();
45 
46  virtual ~TGo4Ratemeter();
47 
48  Bool_t IsRunning() const { return fbRunning; }
49 
50  Double_t GetRate() const { return fdRate; }
51 
52  Double_t GetTime() const { return fdTime; }
53 
54  ULong64_t GetCurrentCount() const { return fuCurrentCount; }
55 
56  Double_t GetAvRate() const { return (fdTime > 0) ? fuCurrentCount/fdTime : 0.; }
57 
58  const char* GetDateTime() const { return fxDateString.Data(); }
59 
60  const char* GetCurrentSource() const { return fxEventSource.Data(); }
61 
62  void UpdateFrom(const TGo4Ratemeter* r);
63 
67  Bool_t Update(Int_t increment = 1);
68 
69  void SetRunning(Bool_t on = kTRUE) { fbRunning = on; }
70  void SetDateTime(const char* str) { fxDateString = str; }
71  void SetCurrentSource(const char* str) { fxEventSource = str; }
72 
74  void Reset();
75 
79  Bool_t TestUpdate();
80 
82  void SetUpdateInterval(double v) { if (v>0) fdUpdateInterval = v; }
83 
84  ClassDef(TGo4Ratemeter, 1)
85 };
86 
87 #endif //TGO4RATEMETER_H
static const Double_t fgdUPDATEINTERVAL
Configured interval in seconds before two updates.
Definition: TGo4Ratemeter.h:41
void UpdateFrom(const TGo4Ratemeter *r)
Bool_t TestUpdate()
ULong64_t fuCheckInterval
Next counter value when time will be checked.
Definition: TGo4Ratemeter.h:38
Double_t GetTime() const
Definition: TGo4Ratemeter.h:52
void SetDateTime(const char *str)
Definition: TGo4Ratemeter.h:70
const char * GetCurrentSource() const
Definition: TGo4Ratemeter.h:60
void SetCurrentSource(const char *str)
Definition: TGo4Ratemeter.h:71
Bool_t IsRunning() const
Definition: TGo4Ratemeter.h:48
ULong64_t fuLastCount
Definition: TGo4Ratemeter.h:33
const char * GetDateTime() const
Definition: TGo4Ratemeter.h:58
Double_t GetAvRate() const
Definition: TGo4Ratemeter.h:56
TString fxEventSource
Definition: TGo4Ratemeter.h:31
void SetUpdateInterval(double v)
Definition: TGo4Ratemeter.h:82
ULong64_t fuNextCheckCnt
True if update has been performed since last TestZero call.
Definition: TGo4Ratemeter.h:37
Bool_t fbRunning
Definition: TGo4Ratemeter.h:26
void SetRunning(Bool_t on=kTRUE)
Definition: TGo4Ratemeter.h:69
Double_t fdTime
Definition: TGo4Ratemeter.h:29
Double_t fdRate
Definition: TGo4Ratemeter.h:28
ULong64_t fuCurrentCount
Definition: TGo4Ratemeter.h:27
Double_t GetRate() const
Definition: TGo4Ratemeter.h:50
Double_t fdUpdateInterval
How often time should be checked.
Definition: TGo4Ratemeter.h:39
Bool_t fbUpdateDone
Time when last rate measurement was done.
Definition: TGo4Ratemeter.h:35
Bool_t Update(Int_t increment=1)
virtual ~TGo4Ratemeter()
ULong64_t GetCurrentCount() const
Definition: TGo4Ratemeter.h:54
TTimeStamp fLastTm
Number of events processed at last ratemeter update.
Definition: TGo4Ratemeter.h:34
TString fxDateString
Definition: TGo4Ratemeter.h:30