16 #include "Riostream.h"
20 #include "TApplication.h"
21 #include "TTimeStamp.h"
22 #include "TDataType.h"
26 #include "TGo4LockGuard.h"
68 TGo4Slave(name, servermode, host, negport),
69 fdBufferUpdateTime(0),
73 fbLoadPrefs(loadprefs),
76 GO4TRACE((15,
"TGo4AnalysisClient::TGo4AnalysisClient(const char*,...)",__LINE__, __FILE__));
98 TGo4Slave(argv[2], servermode, argv[3] , (argc>4) ? atoi(argv[4]) : 5000),
99 fdBufferUpdateTime(0),
101 fbAutoStart(autorun),
106 GO4TRACE((15,
"TGo4AnalysisClient::TGo4AnalysisClient(int, char**...)",__LINE__, __FILE__));
110 TGo4Log::Error(
"!!! AnalysisClient: missing commandline arguments, aborting !!");
111 gApplication->Terminate();
113 if(!strcmp(
"-lGUI",argv[1]))
115 TGo4Log::Error(
" !!! AnalysisClient: GUI mode not specified, aborting !!");
116 gApplication->Terminate();
171 GO4TRACE((15,
"TGo4AnalysisClient::~TGo4AnalysisClient()",__LINE__, __FILE__));
201 SendStatusMessage(1,kTRUE, TString::Format(
"AnalysisClient %s: Status loaded from %s",
204 SendStatusMessage(2,kTRUE, TString::Format(
"AnalysisClient %s: Could not load status from %s",
210 SendStatusMessage(1,kTRUE, TString::Format(
"AnalysisClient %s: AUTOSAVE is DISABLED, Initialization did NOT load analysis objects!",
218 SendStatusMessage(2,kTRUE, TString::Format(
"AnalysisClient %s: Initialization could not load analysis objects!",
GetName()));
221 SendStatusMessage(1,kTRUE, TString::Format(
"Analysis Slave %s waiting for submit and start commands...",
GetName()));
252 GO4TRACE((12,
"TGo4AnalysisClient::UpdateStatus(TGo4ClientStatus*)",__LINE__, __FILE__));
274 GO4TRACE((12,
"TGo4AnalysisClient::CreateStatus()",__LINE__, __FILE__));
283 GO4TRACE((12,
"TGo4AnalysisClient::Start()",__LINE__, __FILE__));
305 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisObject(char* name)",__LINE__, __FILE__));
312 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisStatus()",__LINE__, __FILE__));
314 TGo4Log::Debug(
" AnalysisClient - sending current analysis settings ");
327 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisClientStatus()",__LINE__, __FILE__));
329 TGo4Log::Debug(
" AnalysisClient - sending current analysis client status ");
340 GO4TRACE((12,
"TGo4AnalysisClient::SendNamesList()",__LINE__, __FILE__));
352 SendStatusMessage(3,kTRUE,
"Analysis Client: Send Names List - ERROR: no nameslist !!! ");
358 GO4TRACE((12,
"TGo4AnalysisClient::KillMain()",__LINE__, __FILE__));
368 GO4TRACE((12,
"TGo4AnalysisClient::RestartMain()",__LINE__, __FILE__));
377 SendStatusMessage(2,kTRUE,TString::Format(
"AnalysisClient %s has killed and relaunched main analysis thread.",
GetName()));
382 GO4TRACE((12,
"TGo4AnalysisClient::Stop()",__LINE__, __FILE__));
387 if(
GetTask()->IsTerminating())
return;
412 GO4TRACE((12,
"TGo4AnalysisClient::UpdateRate(Int_t)",__LINE__, __FILE__));
448 Double_t currenttime = TTimeStamp().AsDouble();
454 fdBufferUpdateTime = currenttime;
497 GetTask()->TGo4ThreadManager::Terminate(termapp);
503 TGo4Log::Debug(
"TGo4AnalysisClient::TerminateFast with delete analysis");
512 gApplication->Terminate();
529 if(strstr(command,
"ANHServStart")) {
530 TString buffer = command;
531 strtok((
char*) buffer.Data(),
":");
532 TString base = strtok(0,
":");
533 TString pass = strtok(0,
":");
537 if (!strcmp(command,
"ANHServStop")) {
574 gROOT->SetBatch(kFALSE);
virtual void TerminateFast()
Bool_t IsInitDone() const
TGo4HistogramServer * fxHistoServer
TGo4ThreadHandler * GetThreadHandler()
virtual void StatusMessage(int level, Bool_t printout, const TString &)
Bool_t SubmitLocalCommand(TGo4Command *com)
Bool_t LoadStatus(const char *filename=0)
void SetDateTime(const char *str)
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
Bool_t IsAutoSaveOn() const
void WakeCommandQueue(Int_t id=0)
virtual void UpdateStatus(TGo4TaskStatus *state)
static void SetCommandList(TGo4CommandProtoList *list)
static void UnRegister(TGo4CommandReceiver *p)
virtual void CloseAnalysis()
TGo4AnalysisSniffer * GetSniffer() const
static void SetObservAccount(const char *name, const char *passwd)
void SetCurrentSource(const char *str)
Bool_t LoadObjects(const char *filename=0)
virtual Int_t Initialization()
void Constructor(Bool_t starthistserv=kFALSE, const char *basename="Go4", const char *passwd="abcd")
void SetCintMode(Bool_t on=kTRUE)
static const char * fgcDEFAULTSTATUSFILENAME
void SendAnalysisStatus()
Double_t GetAvRate() const
static const char * GetPrintfArg(Int_t type_id)
void SetRates(Double_t rate, Double_t average, ULong64_t counts, Double_t time)
static void SetCtrlAccount(const char *name, const char *passwd)
Bool_t ReCreate(const char *thname)
static void Register(const char *name, TGo4CommandReceiver *p)
virtual void RatemeterUpdate(TGo4Ratemeter *)
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
void SetRunning(Bool_t on=kTRUE)
virtual Int_t StartWorkThreads()
virtual Int_t StopWorkThreads()
virtual void Terminate(Bool_t termapp=kTRUE)
TGo4AnalysisStep * GetAnalysisStep(const char *name)
TGo4Analysis * fxAnalysis
static const Double_t fgdSTATUSTIMEOUT
void SetRunning(Bool_t on)
void SendAnalysisClientStatus()
static const char * fgcMAINTHREAD
void SendAnalysisObject(const char *name)
void SetAutoSave(Bool_t on=kTRUE)
TString fServerObserverPass
static TGo4CommandInvoker * Instance()
void SetCurrentSource(const char *name)
TGo4Analysis * GetAnalysis() const
void SendObject(TObject *obj, const char *receiver=0)
static const char * fgcWATCHTHREAD
virtual void RestartMain()
Bool_t Stop(const char *thname)
virtual TGo4TaskStatus * CreateStatus()
const char * GetName() const
Bool_t Start(const char *thname)
virtual Int_t StopWorkThreads()
Bool_t Cancel(const char *thname)
virtual const char * GetName() const
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
Bool_t IsCintMode() const
Bool_t Update(Int_t increment=1)
virtual Bool_t InitEventClasses()
void SetAnalysisClient(TGo4AnalysisClient *cli)
Long_t ExecuteLine(const char *command, Int_t *errcode=0)
TGo4AnalysisObjectNames * GetNamesList() const
void SendStatus(TGo4Status *stat, const char *receiver=0)
ULong64_t GetCurrentCount() const
TGo4Ratemeter * fxRatemeter
void UpdateStatusBuffer()
static void SetAdminAccount(const char *name, const char *passwd)
static const UInt_t fguCINTTIMERPERIOD
Bool_t TestBufferUpdateConditions()
TNamed * GetObject(const char *name, const char *folder=0)
TGo4AnalysisStatus * CreateStatus()
void UpdateRate(Int_t counts=1)
void UpdateStatus(TGo4TaskStatus *state)
virtual void ExecuteString(const char *command)
static const UInt_t fguSTATUSUPDATE
Double_t fdBufferUpdateTime
static TGo4Analysis * Instance()
const char * GetEventSourceName()
static void Error(const char *text,...)
virtual ~TGo4AnalysisClient()
virtual Int_t StartWorkThreads()
static void Debug(const char *text,...)
void StartObjectServer(const char *basename, const char *passwd)