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