GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisClientStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisClientStatus.cxx 2770 2020-04-16 15:02:30Z 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 fuer 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 
15 
16 #include <iostream>
17 
18 #include "TDatime.h"
19 
20 #include "TGo4Log.h"
21 
24  fuCurrentCount(0),
25  fdRate(0),
26  fdAveRate(0),
27  fdTime(0),
28  fbAnalysisRunning(false)
29 {
30 }
31 
33  TGo4ClientStatus(name),
34  fuCurrentCount(0),
35  fdRate(0),
36  fdAveRate(0),
37  fdTime(0),
38  fbAnalysisRunning(false)
39 {
40  GO4TRACE((12,"TGo4AnalysisClientStatus::TGo4AnalysisClientStatus(const char*)",__LINE__, __FILE__));
41 }
42 
44 {
45 }
46 
47 Int_t TGo4AnalysisClientStatus::PrintStatus(Text_t* buffer, Int_t buflen)
48 {
49  GO4TRACE((12,"TGo4AnalysisClientStatus::PrintStatus()",__LINE__, __FILE__));
50  //
51  Int_t locallen=4096;
52  Text_t localbuf[4096];
53  if(buflen<=0 && buffer!=0) return 0;
54  Text_t* current=localbuf;
55  Int_t size=0;
56  Int_t restlen=locallen;
57  current=PrintBuffer(current,restlen,"G-OOOO-> Analysis Client Status Class %s Printout: <-OOOO-G\n",GetName());
58  current=PrintBuffer(current,restlen,"G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
59  current=PrintBuffer(current,restlen,"G-OOOO-> Analysis Running State: %d\n",IsAnalysisRunning());
60  current=PrintBuffer(current,restlen,"G-OOOO-> Current event rate: %f\n",GetRate());
61  current=PrintBuffer(current,restlen,"G-OOOO-> Average event rate: %f\n",GetAvRate());
62  current=PrintBuffer(current,restlen,"G-OOOO-> Total event counts: %d\n",GetCurrentCount());
63  current=PrintBuffer(current,restlen,"G-OOOO-> Total time: %f\n",GetTime());
64  current=PrintBuffer(current,restlen,"G-OOOO-> Current Event source: %s\n",GetCurrentSource());
65  current=PrintBuffer(current,restlen,"G-OOOO-> Creation date: %s\n",GetDateTime());
66  current=PrintBuffer(current,restlen,"G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
67  Int_t delta=TGo4ClientStatus::PrintStatus(current,restlen);
68  restlen-=delta;
69  current+=delta;
70  current = PrintBuffer(current, restlen, "G-OOOO-> END Analysis Client Status Class Printout END <-OOOO-G\n");
71  if (buffer == 0) {
72  std::cout << localbuf << std::endl;
73  } else {
74  size = locallen - restlen;
75  if (size > buflen - 1)
76  size = buflen - 1;
77  strncpy(buffer, localbuf, size);
78  }
79  return size;
80 }
81 
82 void TGo4AnalysisClientStatus::SetRates(Double_t rate, Double_t average, ULong64_t counts, Double_t time)
83 {
84  GO4TRACE((12,"TGo4AnalysisClientStatus::SetRates(...)",__LINE__, __FILE__));
85  fdRate=rate;
86  fdAveRate=average;
87  fuCurrentCount=counts;
88  fdTime=time;
89  TDatime now;
90  fxDateString=now.AsSQLString();
91 }
void SetRates(Double_t rate, Double_t average, ULong64_t counts, Double_t time)
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
const char * GetDateTime() const
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:84
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
const char * GetCurrentSource() const