Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TGo4AnalysisClient Class Reference

#include <TGo4AnalysisClientImp.h>

Inheritance diagram for TGo4AnalysisClient:

TGo4Slave TGo4TaskOwner TGo4CommandReceiver List of all members.

Public Methods

 TGo4AnalysisClient (const char *name, TGo4Analysis *analysis, const char *host="localhost", UInt_t negport=0, Bool_t histoserver=kFALSE, const char *basename="Go4", const char *passwd="abcd", Bool_t servermode=kFALSE, Bool_t autorun=kFALSE, Bool_t clientmode=kFALSE)
 TGo4AnalysisClient (int argc, char **argv, TGo4Analysis *analysis, Bool_t histoserver=kFALSE, const char *basename="Go4", const char *passwd="abcd", Bool_t servermode=kFALSE, Bool_t autorun=kFALSE)
virtual ~TGo4AnalysisClient ()
TGo4AnalysisGetAnalysis () const
virtual void Start ()
 General start method of slave application to be called from remote command; should be re-implemented by application. More...

virtual void Stop ()
 General stop method of slave application to be called from remote command; should be re-implemented by application. More...

virtual void KillMain ()
 Kill the main thread; method to be called from command, should be overridden in user implementation. More...

virtual void RestartMain ()
 Restart the main thread; method to be called from command, should be overridden in user implementation. More...

virtual TGo4TaskStatusCreateStatus ()
 create a status object with information on the current client state. More...

virtual Int_t Initialization ()
 Override the ClientTask/ThreadManager Initialization used by AppControlTimer to init event classes before the threads are started. More...

void SendAnalysisObject (const Text_t *name)
 Fetch object of name from analysis instance and put it into the data queue of the client. More...

void SendAnalysisStatus ()
 Send a complete status object of the analysis via the status queue. More...

void SendAnalysisClientStatus ()
 Send a complete status object of the analysis client via the status queue. More...

void SendNamesList ()
 Send the list of object names (folder structure) as status object to the gui. More...

void UpdateRate (Int_t counts=1)
 Update ratemeter. More...

UInt_t GetCurrentCount ()
 Number of currently processed events since last start. More...

Bool_t TestRatemeter ()
 Test if ratemeter has been updated. More...

Bool_t TestBufferUpdateConditions ()
 Test if status buffer shall be updated now. More...

void StartObjectServer (const Text_t *basename, const Text_t *passwd)
 Start the object (histogram) server. More...

void StopObjectServer ()
 Stop the object (histogram) server. More...

virtual Int_t StartWorkThreads ()
 start the working threads of the slave implementation;. More...

virtual Int_t StopWorkThreads ()
 stop the working threads of the slave implementation;. More...

virtual void Terminate ()
 Overwrites the Threadmanager Terminate to shutdown the objectserver properly. More...

virtual void TerminateFast ()
 Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly. More...

virtual void ExecuteString (const Text_t *command)
 Execute string command. More...

void SetCintMode (Bool_t on=kTRUE)
Bool_t & IsCintMode ()

Static Public Attributes

const Text_t fgcMAINTHREAD [] = "MAIN-"
 suffix for main thread name. More...

const Text_t fgcWATCHTHREAD [] = "WATCH-"
 suffix for watch thread name. More...

const UInt_t fguSTATUSUPDATE = 1000
 Number of mainloop runs between two updates of the client status object. More...

const Double_t fgdSTATUSTIMEOUT = 2
 Maximum time (in s) between two updates of the client status object. More...

const UInt_t fguCINTTIMERPERIOD = 200
 Timer period (in ms) for cint locking timer. More...


Private Methods

void Constructor (Bool_t starthistserv=kFALSE, const char *basename="Go4", const char *passwd="abcd")
void UpdateStatus (TGo4TaskStatus *state)
 Method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object. More...

 TGo4AnalysisClient ()

Private Attributes

TGo4AnalysisfxAnalysis
 The analysis the client is working on. More...

Text_t * fcMainName
 remember name of main thread. More...

Text_t * fcWatchName
 remember name of watch thread. More...

Double_t fdBufferUpdateTime
 absoulute time of the last status buffer update. More...

TStopwatch * fxUpdateWatch
 Stopwatch controlling the buffer update time. More...

TGo4RatemeterfxRatemeter
  More...

TGo4HistogramServerfxHistoServer
  More...

Bool_t fbAutoStart
 If true, this slave will initialize and start analysis immediately without waiting for a submit/start command. More...

Bool_t fbCintMode
 If true, this slave runs to control CINT macro. More...

TTimer * fxCintLockTimer
 For cintmode, we only allow to release the main lock within a certain time window, triggered by this timer. More...

TGo4InterruptHandlerfxInterruptHandler
 use to treat Ctrl-C interrupts in CINT mode. More...


Detailed Description

Author:
J. Adamczewski
Since:
12/2000, last 5/2005

Definition at line 37 of file TGo4AnalysisClientImp.h.


Constructor & Destructor Documentation

TGo4AnalysisClient::TGo4AnalysisClient const char *    name,
TGo4Analysis   analysis,
const char *    host = "localhost",
UInt_t    negport = 0,
Bool_t    histoserver = kFALSE,
const char *    basename = "Go4",
const char *    passwd = "abcd",
Bool_t    servermode = kFALSE,
Bool_t    autorun = kFALSE,
Bool_t    clientmode = kFALSE
 

Definition at line 90 of file TGo4AnalysisClientImp.cxx.

References Constructor(), TGo4Log::Debug(), fxAnalysis, fxInterruptHandler, TGo4TaskOwner::GetName(), TGo4Analysis::Instance(), TGo4Analysis::SetAnalysisClient(), SetCintMode(), and TRACE.

TGo4AnalysisClient::TGo4AnalysisClient int    argc,
char **    argv,
TGo4Analysis   analysis,
Bool_t    histoserver = kFALSE,
const char *    basename = "Go4",
const char *    passwd = "abcd",
Bool_t    servermode = kFALSE,
Bool_t    autorun = kFALSE
 

Definition at line 128 of file TGo4AnalysisClientImp.cxx.

References argv, Constructor(), TGo4Log::Debug(), TGo4Log::Error(), fxAnalysis, TGo4TaskOwner::GetName(), TGo4Analysis::Instance(), TGo4Analysis::SetAnalysisClient(), and TRACE.

TGo4AnalysisClient::~TGo4AnalysisClient   [virtual]
 

Definition at line 195 of file TGo4AnalysisClientImp.cxx.

References TGo4ThreadHandler::CancelAll(), TGo4TaskHandler::DisConnect(), fcMainName, fcWatchName, fxAnalysis, fxCintLockTimer, fxInterruptHandler, fxRatemeter, fxUpdateWatch, TGo4TaskOwner::GetTask(), TGo4Task::GetTaskHandler(), TGo4Slave::GetThreadHandler(), TGo4Analysis::LockAutoSave(), TGo4TaskHandler::SetAborting(), StopObjectServer(), TRACE, and TGo4Analysis::UnLockAutoSave().

TGo4AnalysisClient::TGo4AnalysisClient   [private]
 


Member Function Documentation

TGo4Analysis* TGo4AnalysisClient::GetAnalysis   const [inline]
 

Definition at line 60 of file TGo4AnalysisClientImp.h.

References fxAnalysis.

Referenced by SendAnalysisStatus(), and TGo4HistogramServer::TGo4HistogramServer().

void TGo4AnalysisClient::Start   [virtual]
 

General start method of slave application to be called from remote command; should be re-implemented by application.

Reimplemented from TGo4Slave.

Definition at line 324 of file TGo4AnalysisClientImp.cxx.

References fcMainName, fdBufferUpdateTime, fxAnalysis, fxRatemeter, fxUpdateWatch, TGo4TaskOwner::GetName(), TGo4Slave::GetThreadHandler(), TGo4Analysis::IsInitDone(), TGo4Slave::MainIsRunning(), TGo4Analysis::PreLoop(), TGo4Ratemeter::Reset(), SendAnalysisClientStatus(), TGo4Slave::SendStatusMessage(), TGo4Slave::Start(), TGo4ThreadHandler::Start(), TRACE, UpdateRate(), and TGo4Slave::UpdateStatusBuffer().

Referenced by Initialization(), and TGo4Analysis::SetRunning().

void TGo4AnalysisClient::Stop   [virtual]
 

General stop method of slave application to be called from remote command; should be re-implemented by application.

Reimplemented from TGo4Slave.

Definition at line 429 of file TGo4AnalysisClientImp.cxx.

References fxAnalysis, TGo4TaskOwner::GetName(), TGo4Slave::MainIsRunning(), TGo4Analysis::PostLoop(), SendAnalysisClientStatus(), TGo4Slave::SendStatusMessage(), TGo4Slave::Stop(), TRACE, UpdateRate(), and TGo4Slave::UpdateStatusBuffer().

Referenced by TGo4Analysis::Process(), TGo4AnalysisMainRunnable::Run(), and TGo4Analysis::SetRunning().

void TGo4AnalysisClient::KillMain   [virtual]
 

Kill the main thread; method to be called from command, should be overridden in user implementation.

Reimplemented from TGo4Slave.

Definition at line 404 of file TGo4AnalysisClientImp.cxx.

References TGo4ThreadHandler::Cancel(), fcMainName, TGo4TaskOwner::GetName(), TGo4TaskOwner::GetTask(), TGo4Slave::GetThreadHandler(), TGo4Slave::SendStatusMessage(), TGo4ThreadHandler::Stop(), TRACE, and TGo4Task::WakeCommandQueue().

void TGo4AnalysisClient::RestartMain   [virtual]
 

Restart the main thread; method to be called from command, should be overridden in user implementation.

Reimplemented from TGo4Slave.

Definition at line 414 of file TGo4AnalysisClientImp.cxx.

References fcMainName, fxRatemeter, TGo4TaskOwner::GetName(), TGo4TaskOwner::GetTask(), TGo4Slave::GetThreadHandler(), TGo4ThreadHandler::ReCreate(), TGo4Ratemeter::Reset(), TGo4Slave::SendStatusMessage(), TGo4ThreadHandler::Start(), TGo4ThreadHandler::Stop(), TRACE, and TGo4Task::WakeCommandQueue().

TGo4TaskStatus * TGo4AnalysisClient::CreateStatus   [virtual]
 

create a status object with information on the current client state.

this object may be sent to the server or may be used to restore current status by memento mechanism. Overridden from superclass

Reimplemented from TGo4Slave.

Definition at line 315 of file TGo4AnalysisClientImp.cxx.

References TGo4TaskOwner::GetName(), TRACE, and UpdateStatus().

Int_t TGo4AnalysisClient::Initialization   [virtual]
 

Override the ClientTask/ThreadManager Initialization used by AppControlTimer to init event classes before the threads are started.

Reimplemented from TGo4Slave.

Definition at line 229 of file TGo4AnalysisClientImp.cxx.

References fbAutoStart, TGo4Analysis::fgcDEFAULTSTATUSFILENAME, fxAnalysis, TGo4TaskOwner::GetName(), TGo4Analysis::InitEventClasses(), IsCintMode(), TGo4Analysis::LoadObjects(), TGo4Analysis::LoadStatus(), SendAnalysisClientStatus(), SendAnalysisStatus(), TGo4Slave::SendStatusMessage(), Start(), TGo4Slave::Stop(), and TGo4Slave::UpdateStatusBuffer().

void TGo4AnalysisClient::SendAnalysisObject const Text_t *    name
 

Fetch object of name from analysis instance and put it into the data queue of the client.

Send an error status object via status queue if there is no such object.

Definition at line 348 of file TGo4AnalysisClientImp.cxx.

References fxAnalysis, TGo4Analysis::GetObject(), TGo4Slave::SendObject(), and TRACE.

void TGo4AnalysisClient::SendAnalysisStatus  
 

Send a complete status object of the analysis via the status queue.

Definition at line 355 of file TGo4AnalysisClientImp.cxx.

References TGo4Analysis::CreateStatus(), TGo4Log::Debug(), GetAnalysis(), TGo4Slave::SendStatus(), TGo4Slave::SendStatusMessage(), and TRACE.

Referenced by Initialization().

void TGo4AnalysisClient::SendAnalysisClientStatus  
 

Send a complete status object of the analysis client via the status queue.

Definition at line 373 of file TGo4AnalysisClientImp.cxx.

References TGo4Log::Debug(), TGo4Slave::SendStatusBuffer(), and TRACE.

Referenced by Initialization(), TGo4AnalysisWatchRunnable::Run(), Start(), and Stop().

void TGo4AnalysisClient::SendNamesList  
 

Send the list of object names (folder structure) as status object to the gui.

Definition at line 386 of file TGo4AnalysisClientImp.cxx.

References TGo4Log::Debug(), fxAnalysis, TGo4Analysis::GetNamesList(), TGo4Slave::SendObject(), TGo4Slave::SendStatusMessage(), TRACE, and TGo4Analysis::UpdateNamesList().

void TGo4AnalysisClient::UpdateRate Int_t    counts = 1
 

Update ratemeter.

To be used from main thread.

Definition at line 442 of file TGo4AnalysisClientImp.cxx.

References fxRatemeter, TRACE, and TGo4Ratemeter::Update().

Referenced by TGo4Analysis::MainCycle(), TGo4AnalysisWatchRunnable::Run(), Start(), and Stop().

UInt_t TGo4AnalysisClient::GetCurrentCount  
 

Number of currently processed events since last start.

Definition at line 447 of file TGo4AnalysisClientImp.cxx.

References fxRatemeter, and TGo4Ratemeter::GetCurrentCount().

Referenced by TestBufferUpdateConditions().

Bool_t TGo4AnalysisClient::TestRatemeter  
 

Test if ratemeter has been updated.

Definition at line 452 of file TGo4AnalysisClientImp.cxx.

References fxRatemeter, and TGo4Ratemeter::TestUpdate().

Referenced by TGo4AnalysisWatchRunnable::Run().

Bool_t TGo4AnalysisClient::TestBufferUpdateConditions  
 

Test if status buffer shall be updated now.

Definition at line 457 of file TGo4AnalysisClientImp.cxx.

References fdBufferUpdateTime, fgdSTATUSTIMEOUT, fguSTATUSUPDATE, fxUpdateWatch, and GetCurrentCount().

Referenced by TGo4Analysis::MainCycle().

void TGo4AnalysisClient::StartObjectServer const Text_t *    basename,
const Text_t *    passwd
 

Start the object (histogram) server.

Existing server will be stopped and replaced by new server with different basename and password.

Definition at line 477 of file TGo4AnalysisClientImp.cxx.

References fxHistoServer, and StopObjectServer().

Referenced by Constructor(), and ExecuteString().

void TGo4AnalysisClient::StopObjectServer  
 

Stop the object (histogram) server.

Definition at line 485 of file TGo4AnalysisClientImp.cxx.

References fxHistoServer.

Referenced by ExecuteString(), StartObjectServer(), Terminate(), TerminateFast(), and ~TGo4AnalysisClient().

Int_t TGo4AnalysisClient::StartWorkThreads   [virtual]
 

start the working threads of the slave implementation;.

Reimplemented from TGo4TaskOwner.

Definition at line 567 of file TGo4AnalysisClientImp.cxx.

References fcMainName, fcWatchName, TGo4Slave::GetThreadHandler(), TGo4ThreadHandler::Start(), and TGo4TaskOwner::StartWorkThreads().

Int_t TGo4AnalysisClient::StopWorkThreads   [virtual]
 

stop the working threads of the slave implementation;.

Reimplemented from TGo4TaskOwner.

Definition at line 579 of file TGo4AnalysisClientImp.cxx.

References fcMainName, fcWatchName, TGo4Slave::GetThreadHandler(), TGo4ThreadHandler::Stop(), and TGo4TaskOwner::StopWorkThreads().

void TGo4AnalysisClient::Terminate   [virtual]
 

Overwrites the Threadmanager Terminate to shutdown the objectserver properly.

Definition at line 497 of file TGo4AnalysisClientImp.cxx.

References TGo4TaskOwner::GetTask(), and StopObjectServer().

void TGo4AnalysisClient::TerminateFast   [virtual]
 

Overwrites the Threadmanager TerminateFast to shutdown the objectserver properly.

Reimplemented from TGo4Slave.

Definition at line 505 of file TGo4AnalysisClientImp.cxx.

References TGo4ThreadHandler::Cancel(), TGo4Log::Debug(), fcMainName, fcWatchName, fxAnalysis, TGo4TaskOwner::GetTask(), TGo4Slave::GetThreadHandler(), TGo4ThreadHandler::StopAll(), and StopObjectServer().

void TGo4AnalysisClient::ExecuteString const Text_t *    command [virtual]
 

Execute string command.

Overrides base class implementation to decouple some commands from analysis client.

Reimplemented from TGo4Slave.

Definition at line 522 of file TGo4AnalysisClientImp.cxx.

References TGo4Slave::ExecuteString(), TGo4ThreadManager::fguTEXTLENGTH, StartObjectServer(), and StopObjectServer().

Referenced by TGo4ComStopHistoServ::ExeCom(), and TGo4ComStartHistoServ::ExeCom().

void TGo4AnalysisClient::SetCintMode Bool_t    on = kTRUE
 

Definition at line 591 of file TGo4AnalysisClientImp.cxx.

References fbCintMode, fguCINTTIMERPERIOD, fxAnalysis, fxCintLockTimer, and TGo4Analysis::SetAutoSave().

Referenced by TGo4AnalysisClient().

Bool_t& TGo4AnalysisClient::IsCintMode   [inline]
 

Definition at line 142 of file TGo4AnalysisClientImp.h.

References fbCintMode.

Referenced by Initialization(), and TGo4AnalysisMainRunnable::Run().

void TGo4AnalysisClient::Constructor Bool_t    starthistserv = kFALSE,
const char *    basename = "Go4",
const char *    passwd = "abcd"
[private]
 

Definition at line 166 of file TGo4AnalysisClientImp.cxx.

References TGo4Log::Debug(), fcMainName, fcWatchName, fgcMAINTHREAD, fgcWATCHTHREAD, TGo4ThreadManager::fguTEXTLENGTH, fxInterruptHandler, fxRatemeter, fxUpdateWatch, TGo4TaskOwner::GetName(), TGo4TaskOwner::GetTask(), TGo4Slave::GetThreadHandler(), TGo4CommandInvoker::Instance(), TGo4ThreadManager::Launch(), TGo4ThreadHandler::NewThread(), TGo4CommandInvoker::Register(), StartObjectServer(), TGo4Slave::Stop(), and TGo4Slave::UpdateStatusBuffer().

Referenced by TGo4AnalysisClient().

void TGo4AnalysisClient::UpdateStatus TGo4TaskStatus   state [private, virtual]
 

Method needed by method CreateStatus of any status subclasses to set the values of the clienttask specific part of the status object.

Reimplemented from TGo4Slave.

Definition at line 297 of file TGo4AnalysisClientImp.cxx.

References fxRatemeter, TGo4Ratemeter::GetAvRate(), TGo4Ratemeter::GetCurrentCount(), TGo4Ratemeter::GetRate(), TGo4Ratemeter::GetTime(), n, TGo4AnalysisClientStatus::SetRates(), TRACE, and TGo4Slave::UpdateStatus().

Referenced by CreateStatus().


Member Data Documentation

const Text_t TGo4AnalysisClient::fgcMAINTHREAD = "MAIN-" [static]
 

suffix for main thread name.

Definition at line 85 of file TGo4AnalysisClientImp.cxx.

Referenced by Constructor().

const Text_t TGo4AnalysisClient::fgcWATCHTHREAD = "WATCH-" [static]
 

suffix for watch thread name.

Definition at line 84 of file TGo4AnalysisClientImp.cxx.

Referenced by Constructor().

const UInt_t TGo4AnalysisClient::fguSTATUSUPDATE = 1000 [static]
 

Number of mainloop runs between two updates of the client status object.

Definition at line 86 of file TGo4AnalysisClientImp.cxx.

Referenced by TestBufferUpdateConditions().

const Double_t TGo4AnalysisClient::fgdSTATUSTIMEOUT = 2 [static]
 

Maximum time (in s) between two updates of the client status object.

Definition at line 87 of file TGo4AnalysisClientImp.cxx.

Referenced by TestBufferUpdateConditions().

const UInt_t TGo4AnalysisClient::fguCINTTIMERPERIOD = 200 [static]
 

Timer period (in ms) for cint locking timer.

Definition at line 88 of file TGo4AnalysisClientImp.cxx.

Referenced by SetCintMode().

TGo4Analysis* TGo4AnalysisClient::fxAnalysis [private]
 

The analysis the client is working on.

Definition at line 174 of file TGo4AnalysisClientImp.h.

Referenced by GetAnalysis(), Initialization(), SendAnalysisObject(), SendNamesList(), SetCintMode(), Start(), Stop(), TerminateFast(), TGo4AnalysisClient(), and ~TGo4AnalysisClient().

Text_t* TGo4AnalysisClient::fcMainName [private]
 

remember name of main thread.

Definition at line 177 of file TGo4AnalysisClientImp.h.

Referenced by Constructor(), KillMain(), RestartMain(), Start(), StartWorkThreads(), StopWorkThreads(), TerminateFast(), and ~TGo4AnalysisClient().

Text_t* TGo4AnalysisClient::fcWatchName [private]
 

remember name of watch thread.

Definition at line 180 of file TGo4AnalysisClientImp.h.

Referenced by Constructor(), StartWorkThreads(), StopWorkThreads(), TerminateFast(), and ~TGo4AnalysisClient().

Double_t TGo4AnalysisClient::fdBufferUpdateTime [private]
 

absoulute time of the last status buffer update.

Reset by TestBufferUpdateCondition

Definition at line 183 of file TGo4AnalysisClientImp.h.

Referenced by Start(), and TestBufferUpdateConditions().

TStopwatch* TGo4AnalysisClient::fxUpdateWatch [private]
 

Stopwatch controlling the buffer update time.

Definition at line 186 of file TGo4AnalysisClientImp.h.

Referenced by Constructor(), Start(), TestBufferUpdateConditions(), and ~TGo4AnalysisClient().

TGo4Ratemeter* TGo4AnalysisClient::fxRatemeter [private]
 

Definition at line 190 of file TGo4AnalysisClientImp.h.

Referenced by Constructor(), GetCurrentCount(), RestartMain(), Start(), TestRatemeter(), UpdateRate(), UpdateStatus(), and ~TGo4AnalysisClient().

TGo4HistogramServer* TGo4AnalysisClient::fxHistoServer [private]
 

Definition at line 195 of file TGo4AnalysisClientImp.h.

Referenced by StartObjectServer(), and StopObjectServer().

Bool_t TGo4AnalysisClient::fbAutoStart [private]
 

If true, this slave will initialize and start analysis immediately without waiting for a submit/start command.

Definition at line 199 of file TGo4AnalysisClientImp.h.

Referenced by Initialization().

Bool_t TGo4AnalysisClient::fbCintMode [private]
 

If true, this slave runs to control CINT macro.

Will have effect on some initialization behaviour.

Definition at line 203 of file TGo4AnalysisClientImp.h.

Referenced by IsCintMode(), and SetCintMode().

TTimer* TGo4AnalysisClient::fxCintLockTimer [private]
 

For cintmode, we only allow to release the main lock within a certain time window, triggered by this timer.

Definition at line 208 of file TGo4AnalysisClientImp.h.

Referenced by SetCintMode(), and ~TGo4AnalysisClient().

TGo4InterruptHandler* TGo4AnalysisClient::fxInterruptHandler [private]
 

use to treat Ctrl-C interrupts in CINT mode.

Definition at line 211 of file TGo4AnalysisClientImp.h.

Referenced by Constructor(), TGo4AnalysisClient(), and ~TGo4AnalysisClient().


The documentation for this class was generated from the following files:
Generated on Tue Nov 8 10:56:27 2005 for Go4-v2.10-5 by doxygen1.2.15