00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4AnalysisClientStatus.h"
00015
00016 #include "TDatime.h"
00017 #include "Riostream.h"
00018
00019 #include "TGo4Log.h"
00020
00021 TGo4AnalysisClientStatus::TGo4AnalysisClientStatus() :
00022 TGo4ClientStatus(),
00023 fuCurrentCount(0),
00024 fdRate(0),
00025 fdAveRate(0),
00026 fdTime(0),
00027 fbAnalysisRunning(false)
00028 {
00029 }
00030
00031 TGo4AnalysisClientStatus::TGo4AnalysisClientStatus(const char* name) :
00032 TGo4ClientStatus(name),
00033 fuCurrentCount(0),
00034 fdRate(0),
00035 fdAveRate(0),
00036 fdTime(0),
00037 fbAnalysisRunning(false)
00038 {
00039 GO4TRACE((12,"TGo4AnalysisClientStatus::TGo4AnalysisClientStatus(const char*)",__LINE__, __FILE__));
00040 }
00041
00042 TGo4AnalysisClientStatus::~TGo4AnalysisClientStatus()
00043 {
00044 }
00045
00046 Int_t TGo4AnalysisClientStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00047 {
00048 GO4TRACE((12,"TGo4AnalysisClientStatus::PrintStatus()",__LINE__, __FILE__));
00049
00050 Int_t locallen=4096;
00051 Text_t localbuf[4096];
00052 if(buflen<=0 && buffer!=0) return 0;
00053 Text_t* current=localbuf;
00054 Int_t size=0;
00055 Int_t restlen=locallen;
00056 current=PrintBuffer(current,restlen,"G-OOOO-> Analysis Client Status Class %s Printout: <-OOOO-G\n",GetName());
00057 current=PrintBuffer(current,restlen,"G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00058 current=PrintBuffer(current,restlen,"G-OOOO-> Analysis Running State: %d\n",IsAnalysisRunning());
00059 current=PrintBuffer(current,restlen,"G-OOOO-> Current event rate: %f\n",GetRate());
00060 current=PrintBuffer(current,restlen,"G-OOOO-> Average event rate: %f\n",GetAvRate());
00061 current=PrintBuffer(current,restlen,"G-OOOO-> Total event counts: %d\n",GetCurrentCount());
00062 current=PrintBuffer(current,restlen,"G-OOOO-> Total time: %f\n",GetTime());
00063 current=PrintBuffer(current,restlen,"G-OOOO-> Current Event source: %s\n",GetCurrentSource());
00064 current=PrintBuffer(current,restlen,"G-OOOO-> Creation date: %s\n",GetDateTime());
00065 current=PrintBuffer(current,restlen,"G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00066 Int_t delta=TGo4ClientStatus::PrintStatus(current,restlen);
00067 restlen-=delta;
00068 current+=delta;
00069 current=PrintBuffer(current,restlen,"G-OOOO-> END Analysis Client Status Class Printout END <-OOOO-G\n");
00070 if(buffer==0)
00071 {
00072 std::cout << localbuf << std::endl;
00073 }
00074 else
00075 {
00076 if(size>buflen-1)
00077 size=buflen-1;
00078 strncpy(buffer,localbuf,size);
00079 }
00080 return size;
00081 }
00082
00083 void TGo4AnalysisClientStatus::SetRates(Double_t rate, Double_t average, ULong64_t counts, Double_t time)
00084 {
00085 GO4TRACE((12,"TGo4AnalysisClientStatus::SetRates(...)",__LINE__, __FILE__));
00086 fdRate=rate;
00087 fdAveRate=average;
00088 fuCurrentCount=counts;
00089 fdTime=time;
00090 TDatime now;
00091 fxDateString=now.AsSQLString();
00092 }