16#include "TApplication.h"
22#include "TGo4LockGuard.h"
61 TGo4Slave(name, servermode, host, negport),
68 GO4TRACE((15,
"TGo4AnalysisClient::TGo4AnalysisClient(const char *,...)",__LINE__, __FILE__));
90 TGo4Slave(argv[2], servermode, argv[3], (argc>4) ? atoi(argv[4]) : 5000),
97 GO4TRACE((15,
"TGo4AnalysisClient::TGo4AnalysisClient(int, char**...)",__LINE__, __FILE__));
100 TGo4Log::Error(
"!!! AnalysisClient: missing commandline arguments, aborting !!");
101 gApplication->Terminate();
103 if (!strcmp(
"-lGUI", argv[1])) {
104 TGo4Log::Error(
" !!! AnalysisClient: GUI mode not specified, aborting !!");
105 gApplication->Terminate();
121 if (
fxAnalysis->fServerObserverPass.Length()>0)
157 GO4TRACE((15,
"TGo4AnalysisClient::~TGo4AnalysisClient()",__LINE__, __FILE__));
189 SendStatusMessage(1,kTRUE, TString::Format(
"AnalysisClient %s: Status loaded from %s",
192 SendStatusMessage(2,kTRUE, TString::Format(
"AnalysisClient %s: Could not load status from %s",
198 SendStatusMessage(1,kTRUE, TString::Format(
"AnalysisClient %s: AUTOSAVE is DISABLED, Initialization did NOT load analysis objects!",
206 SendStatusMessage(2,kTRUE, TString::Format(
"AnalysisClient %s: Initialization could not load analysis objects!",
GetName()));
209 SendStatusMessage(1,kTRUE, TString::Format(
"Analysis Slave %s waiting for submit and start commands...",
GetName()));
239 GO4TRACE((12,
"TGo4AnalysisClient::UpdateStatus(TGo4TaskStatus *)",__LINE__, __FILE__));
253 fxRatemeter->SetCurrentSource(
"- No event source -");
260 GO4TRACE((12,
"TGo4AnalysisClient::CreateStatus()",__LINE__, __FILE__));
269 GO4TRACE((12,
"TGo4AnalysisClient::Start()",__LINE__, __FILE__));
285 SendStatusMessage(2,kTRUE, TString::Format(
"Analysis %s was not initialized! Please SUBMIT settings first.",
fxAnalysis->GetName()));
291 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisObject(const char *name)",__LINE__, __FILE__));
298 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisStatus()",__LINE__, __FILE__));
300 TGo4Log::Debug(
" AnalysisClient - sending current analysis settings ");
313 GO4TRACE((12,
"TGo4AnalysisClient::SendAnalysisClientStatus()",__LINE__, __FILE__));
315 TGo4Log::Debug(
" AnalysisClient - sending current analysis client status ");
326 GO4TRACE((12,
"TGo4AnalysisClient::SendNamesList()",__LINE__, __FILE__));
338 SendStatusMessage(3,kTRUE,
"Analysis Client: Send Names List - ERROR: no nameslist !!! ");
344 GO4TRACE((12,
"TGo4AnalysisClient::KillMain()",__LINE__, __FILE__));
354 GO4TRACE((12,
"TGo4AnalysisClient::RestartMain()",__LINE__, __FILE__));
363 SendStatusMessage(2,kTRUE,TString::Format(
"AnalysisClient %s has killed and relaunched main analysis thread.",
GetName()));
368 GO4TRACE((12,
"TGo4AnalysisClient::Stop()",__LINE__, __FILE__));
373 if(
GetTask()->IsTerminating())
return;
394 GO4TRACE((12,
"TGo4AnalysisClient::UpdateRate(Int_t)",__LINE__, __FILE__));
423 Double_t currenttime = TTimeStamp().AsDouble();
466 GetTask()->TGo4ThreadManager::Terminate(termapp);
472 TGo4Log::Debug(
"TGo4AnalysisClient::TerminateFast with delete analysis");
482 gApplication->Terminate();
496 if(strstr(command,
"ANHServStart")) {
497 TString buffer = command;
498 strtok((
char *) buffer.Data(),
":");
499 TString base = strtok(
nullptr,
":");
500 TString pass = strtok(
nullptr,
":");
502 }
else if (!strcmp(command,
"ANHServStop")) {
535 gROOT->SetBatch(kFALSE);
545 if (sniff) sniff->StatusMessage(level, printout, text);
void SetRunning(Bool_t on)
void SetCurrentSource(const char *name)
void SetRates(Double_t rate, Double_t average, ULong64_t counts, Double_t time)
void Terminate(Bool_t termapp=kTRUE) override
Overwrites the Threadmanager Terminate to shutdown the objectserver properly.
TGo4Analysis * fxAnalysis
The analysis the client is working on.
static const UInt_t fguCINTTIMERPERIOD
Timer period (in ms) for cint locking timer.
Bool_t fbCintMode
If true, this slave runs to control CINT macro.
void StartObjectServer(const char *basename, const char *passwd)
Start the object (histogram) server.
void Stop() override
General stop method of slave application to be called from remote command; should be re-implemented b...
void KillMain() override
Kill the main thread; method to be called from command, should be overridden in user implementation.
void ExecuteString(const char *command) override
Execute string command.
Bool_t fbShowRate
Then enabled, show current rate on the analysis terminal window.
void TerminateFast() override
Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly.
TGo4TaskStatus * CreateStatus() override
create a status object with information on the current client state.
void SendAnalysisObject(const char *name)
Fetch object of name from analysis instance and put it into the data queue of the client.
TGo4Analysis * GetAnalysis() const
Int_t StopWorkThreads() override
stop the working threads of the slave implementation;
Bool_t TestRatemeter()
Test if ratemeter has been updated.
TGo4Ratemeter * fxRatemeter
aggregation 1
void SendAnalysisStatus()
Send a complete status object of the analysis via the status queue.
void SetCintMode(Bool_t on=kTRUE)
void StopObjectServer()
Stop the object (histogram) server.
void Start() override
General start method of slave application to be called from remote command; should be re-implemented ...
void UpdateRate(Int_t counts=1)
Update ratemeter.
Double_t fdBufferUpdateTime
absolute time of the last status buffer update.
static const UInt_t fguSTATUSUPDATE
Number of mainloop runs between two updates of the client status object.
UInt_t GetCurrentCount() const
Number of currently processed events since last start.
void UpdateStatus(TGo4TaskStatus *state) override
Method needed by method CreateStatus of any status subclasses to set the values of the clienttask spe...
Int_t StartWorkThreads() override
start the working threads of the slave implementation;
static const char * fgcMAINTHREAD
suffix for main thread name
void SendAnalysisClientStatus()
Send a complete status object of the analysis client via the status queue.
void Constructor(Bool_t starthistserv=kFALSE, const char *basename="Go4", const char *passwd="abcd")
Bool_t IsCintMode() const
Bool_t fbLoadPrefs
If true, this slave load preferences for analysis from default file.
void SendNamesList()
Send the list of object names (folder structure) as status object to the gui.
Bool_t TestBufferUpdateConditions()
Test if status buffer shall be updated now.
void SendStatusMessage(Int_t level, Bool_t printout, const TString &text) override
Send message to gui.
virtual ~TGo4AnalysisClient()
Int_t Initialization() override
Override the ClientTask/ThreadManager Initialization used by AppControlTimer to init event classes be...
Bool_t fbAutoStart
If true, this slave will initialize and start analysis immediately without waiting for a submit/start...
TString fcMainName
remember name of main thread
static const char * fgcWATCHTHREAD
suffix for watch thread name
void Quit() override
Quit this instance and the owned task; method to be called from command object, may be overridden in ...
static const Double_t fgdSTATUSTIMEOUT
Maximum time (in s) between two updates of the client status object.
TGo4HistogramServer * fxHistoServer
aggregation 1 histogram server (optional)
TString fcWatchName
remember name of watch thread
void RestartMain() override
Restart the main thread; method to be called from command, should be overridden in user implementatio...
list containing prototypes of all analysis command objects.
Main Runnable of the go4 analysis.
Contains the name (key) list of all objects in the analysis scope.
Status of the analysis instance.
Contains a single step of the analysis.
const char * GetEventSourceName() const
Access to name of currently active event source.
runnable performing control watcher functions of analysis client task: status of analysis is send to ...
The mother of all go4 analysis.
static TGo4Analysis * Instance()
return analysis instance
static const char * fgcDEFAULTSTATUSFILENAME
standard file name for analysis settings
Bool_t IsRunning() const
True if the analysis as controlled by slave process is running.
TGo4AnalysisStatus * CreateStatus()
Create a copy of the analysis internal state.
Server Command to quit (terminate) the server and the application all clients are removed before.
static TGo4CommandInvoker * Instance()
static void SetCommandList(TGo4CommandProtoList *list)
Application may exchange standard command list by own subclass with specialized commands,...
static void UnRegister(TGo4CommandReceiver *p)
static void Register(const char *name, TGo4CommandReceiver *p)
Handles a histogram server (mbs histogram protocol) for the histograms registered in the analysis.
static void PrintRate(ULong64_t cnt, double rate)
Printout rate and events count, handle redirection.
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Class containing event counter and ratemeter services.
virtual void Start()
General start method of slave application to be called from remote command; should be re-implemented ...
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
Send message string in a status object to the gui.
void SendStatus(TGo4Status *stat, const char *receiver=nullptr)
Send status object via status channel to the server.
TGo4ThreadHandler * GetThreadHandler()
void SendStatusBuffer()
Send internal status buffer to the server.
virtual void UpdateStatus(TGo4TaskStatus *state)
method needed by method CreateStatus of any status subclasses to set the values of the clienttask spe...
void SendObject(TObject *obj, const char *receiver=nullptr)
Send object via data channel to the server.
Bool_t MainIsRunning() const
virtual void Stop()
General stop method of slave application to be called from remote command; should be re-implemented b...
void UpdateStatusBuffer()
Create status object and stream it into the status send buffer.
static void SetCtrlAccount(const char *name, const char *passwd)
Specify login name and password for controller account.
static void SetAdminAccount(const char *name, const char *passwd)
Specify login name and password for administrator account.
static void SetObservAccount(const char *name, const char *passwd)
Specify login name and password for observer account.
virtual Int_t StartWorkThreads()
Start the working threads of the task owner implementation; this method is used after the current con...
virtual Int_t StopWorkThreads()
stop the working threads of the task owne implementation; this method is used before the current conn...
TGo4Task * GetTask() const
const char * GetName() const
Bool_t SubmitLocalCommand(TGo4Command *com)
Send given command to the current client task.
void WakeCommandQueue(Int_t id=0)
Put dummy object into command queue to wake up user threads which might wait for a command.
Int_t CancelAll()
Cancel all Threads in the thread list.
Int_t StopAll()
Start work function of all Threads in the thread list.
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
Creates new internal Go4 Thread with name and adds it to the List External runnable is passed to spec...
Bool_t Start(const char *thname)
Starts work function of the Go4 Thread of name 'name'.
Bool_t Stop(const char *thname)
Stops work function of the Go4 Thread of name 'name'.
Bool_t Cancel(const char *thname)
Cancels the ROOT Thread specified by the Go4 Thread of name 'name'.
Bool_t ReCreate(const char *thname)
ReCreate (Cancel and Create) all Threads in the thread list.
void Launch()
This Method has to be called to create the startup threads and to turn on the application control tim...