00001 // ===================================================================== 00036 // ===================================================================== 00037 #ifndef CLDAQ__TRUNMANAGER_HH 00038 #define CLDAQ__TRUNMANAGER_HH 00039 00040 #include "Tglobals.h" 00041 #include "TRun.hh" 00042 #include "TSystemTimer.hh" 00043 #include "TSystemClock.hh" 00044 #include "TEnvironmentVariableTable.hh" 00045 00046 class TUserInterface; 00047 class TCommand; 00048 class TSystemAction; 00049 class TRunAction; 00050 class TEventAction; 00051 class TEventManager; 00052 class TSoftwareRunInformationModule; 00053 class TAnalysisManager; 00054 class TSystemTimer; 00055 class TReadoutBookDefinition; 00056 class TReadoutBook; 00057 class TCrateDefinition; 00058 class TCrate; 00059 00060 00135 class TRunManager 00136 { 00137 00138 protected: 00140 static TRunManager* theRunManager; 00141 00142 protected: 00144 Tstatus_t theStatus; 00145 00147 TRun theRun; 00148 00150 TSystemAction* theSystemAction; 00151 00153 TRunAction* theRunAction; 00154 00156 TEventManager* theEventManager; 00157 00159 TUserInterface* theUserInterface; 00160 00162 Tthread_t theThreadOfEventLoop; 00163 00165 TSoftwareRunInformationModule* theRunInformationModule; 00166 00168 TAnalysisManager* theAnalysisManager; 00169 00171 TSystemTimer theRunTimer; 00172 00174 TSystemClock theRunClock; 00175 00177 TReadoutBookDefinition* theReadoutBookDefinition; 00178 00180 TReadoutBook* theReadoutBook; 00181 00183 TCrateDefinition* theCrateDefinition; 00184 00186 TCrate* theCrate; 00187 00189 TEnvironmentVariableTable theEnvironmentVariableTable; 00190 00192 Tint theEventLimit; 00193 00194 public: 00196 00201 TRunManager( TUserInterface* ui = 0 ); 00202 00204 virtual ~TRunManager(); 00205 00206 public: 00208 TUserInterface* GetUserInterface() const; 00209 00211 const TRun& GetRun() const; 00212 00214 TRun& GetRun(); 00215 00217 Tint GetRunID() const; 00218 00220 Tvoid SetRunID( Tint id ); 00221 00223 TSystemAction* GetSystemAction() const; 00224 00226 TRunAction* GetRunAction() const; 00227 00229 TEventManager* GetEventManager() const; 00230 00232 Tvoid SetUserInterface( TUserInterface* ui ); 00233 00235 Tint SetUserCommand( TCommand* command ); 00236 00238 Tvoid SetRun( const TRun& run ); 00239 00241 Tvoid SetSystemAction( TSystemAction* action ); 00242 00244 Tvoid SetRunAction( TRunAction* action ); 00245 00247 Tvoid SetEventAction( TEventAction* action ); 00248 00250 Tvoid SetEventManager( TEventManager* manager ); 00251 00253 Tstatus_t GetStatus() const; 00254 00256 Tvoid SetStatus( Tstatus_t status ); 00257 00259 Tthread_t GetThreadOfEventLoop() const; 00260 00262 Tvoid SetThreadOfEventLoop( Tthread_t thread ); 00263 00265 TSoftwareRunInformationModule* GetRunInformationModule() const; 00266 00268 TAnalysisManager* GetAnalysisManager() const; 00269 00271 const TSystemTimer& GetRunTimer() const; 00272 00274 TSystemTimer& GetRunTimer(); 00275 00277 Tvoid SetRunTimer( const TSystemTimer& timer ); 00278 00280 const TSystemClock& GetRunClock() const; 00281 00283 TSystemClock& GetRunClock(); 00284 00286 Tvoid SetRunClock( const TSystemClock& clock ); 00287 00289 TReadoutBookDefinition* GetReadoutBookDefinition() const; 00290 00292 TReadoutBook* GetReadoutBook() const; 00293 00295 TCrateDefinition* GetCrateDefinition() const; 00296 00298 TCrate* GetCrate() const; 00299 00301 Tvoid SetReadoutBookDefinition( TReadoutBookDefinition* definition ); 00302 00304 Tvoid SetCrateDefinition( TCrateDefinition* definition ); 00305 00307 const TEnvironmentVariableTable& GetEnvironmentVariableTable() const; 00308 00310 TEnvironmentVariableTable& GetEnvironmentVariableTable(); 00311 00313 Tvoid SetEnvironmentVariableTable( const TEnvironmentVariableTable& table ); 00314 00316 Tint GetEventLimit() const; 00317 00319 Tvoid SetEventLimit( Tint nevents ); 00320 00321 public: 00323 virtual Tvoid SessionStart(); 00324 00326 virtual Tvoid ShowStatus() const; 00327 00329 virtual Tvoid PopupLogo() const; 00330 00332 virtual Tvoid PopdownLogo() const; 00333 00335 virtual Tvoid PrintAuthorInformation( Tostream& tos = Tcout ) const; 00336 00338 virtual Tvoid ShutdownRun(); 00339 00341 virtual Tvoid StartRun(); 00342 00344 virtual Tvoid StartRun( Tint runid ); 00345 00347 virtual Tvoid StopRun(); 00348 00350 virtual Tvoid SuspendRun(); 00351 00353 virtual Tvoid ResumeRun(); 00354 00356 virtual Tvoid SetRunInformationModule( TSoftwareRunInformationModule* module ); 00357 00359 virtual Tvoid SetRunInformationModule( const Tstring& id ); 00360 00362 virtual Tvoid SetRunInformationModule( Tint slot ); 00363 00365 virtual Tvoid SetAnalysisManager( TAnalysisManager* manager ); 00366 00367 public: 00369 static TRunManager* GetRunManager(); 00370 00371 protected: 00373 static Tvoid* doEventLoop( Tvoid* arguments ); 00374 00376 static Tvoid* showLogo( Tvoid* arguments ); 00377 00379 static Tvoid catchAlarmSignal( Tint sigid ); 00380 00381 public: 00383 virtual Tvoid GoEventLoop(); 00384 00386 virtual Tvoid WaitReturnFromEventLoop(); 00387 00388 protected: 00390 virtual TstringList divide( const Tstring& input ) const; 00391 00393 virtual Tvoid installDefaultCommand(); 00394 00395 #ifdef __CLDAQ_ROOT_DLL 00396 ClassDef(TRunManager,0) 00397 #endif 00398 00399 }; 00400 00401 inline TRunManager* TRunManager::GetRunManager() 00402 { 00403 return theRunManager; 00404 } 00405 00406 inline TUserInterface* TRunManager::GetUserInterface() const 00407 { 00408 return theUserInterface; 00409 } 00410 00411 inline Tvoid TRunManager::SetRun( const TRun& run ) 00412 { 00413 theRun = run; 00414 return; 00415 } 00416 00417 inline const TRun& TRunManager::GetRun() const 00418 { 00419 return theRun; 00420 } 00421 00422 inline TRun& TRunManager::GetRun() 00423 { 00424 return theRun; 00425 } 00426 00427 inline Tint TRunManager::GetRunID() const 00428 { 00429 return theRun.GetRunID(); 00430 } 00431 00432 inline Tvoid TRunManager::SetRunID( Tint id ) 00433 { 00434 theRun.SetRunID( id ); 00435 return; 00436 } 00437 00438 inline TSystemAction* TRunManager::GetSystemAction() const 00439 { 00440 return theSystemAction; 00441 } 00442 00443 inline TRunAction* TRunManager::GetRunAction() const 00444 { 00445 return theRunAction; 00446 } 00447 00448 inline TEventManager* TRunManager::GetEventManager() const 00449 { 00450 return theEventManager; 00451 } 00452 00453 inline Tstatus_t TRunManager::GetStatus() const 00454 { 00455 return theStatus; 00456 } 00457 00458 inline Tvoid TRunManager::SetStatus( Tstatus_t status ) 00459 { 00460 theStatus = status; 00461 return; 00462 } 00463 00464 inline Tthread_t TRunManager::GetThreadOfEventLoop() const 00465 { 00466 return theThreadOfEventLoop; 00467 } 00468 00469 inline Tvoid TRunManager::SetThreadOfEventLoop( Tthread_t thread ) 00470 { 00471 theThreadOfEventLoop = thread; 00472 return; 00473 } 00474 00475 inline TSoftwareRunInformationModule* TRunManager::GetRunInformationModule() const 00476 { 00477 return theRunInformationModule; 00478 } 00479 00480 inline TAnalysisManager* TRunManager::GetAnalysisManager() const 00481 { 00482 return theAnalysisManager; 00483 } 00484 00485 inline const TSystemTimer& TRunManager::GetRunTimer() const 00486 { 00487 return theRunTimer; 00488 } 00489 00490 inline TSystemTimer& TRunManager::GetRunTimer() 00491 { 00492 return theRunTimer; 00493 } 00494 00495 inline TReadoutBookDefinition* TRunManager::GetReadoutBookDefinition() const 00496 { 00497 return theReadoutBookDefinition; 00498 } 00499 00500 inline TReadoutBook* TRunManager::GetReadoutBook() const 00501 { 00502 return theReadoutBook; 00503 } 00504 00505 inline TCrateDefinition* TRunManager::GetCrateDefinition() const 00506 { 00507 return theCrateDefinition; 00508 } 00509 00510 inline TCrate* TRunManager::GetCrate() const 00511 { 00512 return theCrate; 00513 } 00514 00515 inline Tvoid TRunManager::SetRunTimer( const TSystemTimer& timer ) 00516 { 00517 theRunTimer = timer; 00518 return; 00519 } 00520 00521 inline const TEnvironmentVariableTable& TRunManager::GetEnvironmentVariableTable() const 00522 { 00523 return theEnvironmentVariableTable; 00524 } 00525 00526 inline TEnvironmentVariableTable& TRunManager::GetEnvironmentVariableTable() 00527 { 00528 return theEnvironmentVariableTable; 00529 } 00530 00531 inline Tvoid TRunManager::SetEnvironmentVariableTable( const TEnvironmentVariableTable& table ) 00532 { 00533 theEnvironmentVariableTable = table; 00534 return; 00535 } 00536 00537 inline const TSystemClock& TRunManager::GetRunClock() const 00538 { 00539 return theRunClock; 00540 } 00541 00542 inline TSystemClock& TRunManager::GetRunClock() 00543 { 00544 return theRunClock; 00545 } 00546 00547 inline Tvoid TRunManager::SetRunClock( const TSystemClock& clock ) 00548 { 00549 theRunClock = clock; 00550 return; 00551 } 00552 00553 inline Tint TRunManager::GetEventLimit() const 00554 { 00555 return theEventLimit; 00556 } 00557 00558 inline Tvoid TRunManager::SetEventLimit( Tint nevents ) 00559 { 00560 theEventLimit = nevents; 00561 return; 00562 } 00563 00564 #endif