Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4ComSetPrintEvent.h"
00015
00016 #include "TGo4Log.h"
00017 #include "TGo4AnalysisClientImp.h"
00018 #include "TGo4AnalysisImp.h"
00019 #include "TGo4EventElement.h"
00020 #include "TGo4MbsSource.h"
00021 #include "TGo4RemoteCommand.h"
00022
00023 TGo4ComSetPrintEvent::TGo4ComSetPrintEvent(const char* obname)
00024 :TGo4AnalysisObjectCommand("ANSetPrintEvent","Set event printout for analysis",obname)
00025 {
00026 SetReceiverName("AnalysisClient");
00027
00028 }
00029 TGo4ComSetPrintEvent::TGo4ComSetPrintEvent()
00030 :TGo4AnalysisObjectCommand("ANSetPrintEvent","Set event printout for analysis","dummy")
00031 {
00032 SetReceiverName("AnalysisClient");
00033
00034 }
00035
00036 TGo4ComSetPrintEvent::~TGo4ComSetPrintEvent()
00037 {
00038 }
00039
00040 void TGo4ComSetPrintEvent::Set(TGo4RemoteCommand* remcom)
00041 {
00042 if(remcom==0) return;
00043 TGo4AnalysisObjectCommand::Set(remcom);
00044 fxPrintPar.fiNum = remcom->GetValue(0);
00045 fxPrintPar.fiSid = remcom->GetValue(1);
00046 fxPrintPar.fiLong = remcom->GetValue(2);
00047 fxPrintPar.fiHex = remcom->GetValue(3);
00048 fxPrintPar.fiData = remcom->GetValue(4);
00049 }
00050
00051 Int_t TGo4ComSetPrintEvent::ExeCom()
00052 {
00053 TGo4Log::Debug(" Executing %s : Printout for %s requested for %d events of subid %d, long:%d, hex:%d, data:%d",
00054 GetObjectName(), fxPrintPar.fiNum, fxPrintPar.fiSid, fxPrintPar.fiLong, fxPrintPar.fiHex, fxPrintPar.fiData);
00055 TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00056
00057 if (cli==0) {
00058 GO4TRACE((11,"TGo4ComSetPrintEvent::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00059 TGo4Log::Debug(" !!! %s : NO or WRONG RECEIVER ERROR!!!",GetName());
00060 return 1;
00061 }
00062
00063 TGo4Analysis* ana = TGo4Analysis::Instance();
00064 if(ana==0) {
00065
00066 cli->SendStatusMessage(3, kTRUE,TString::Format(" %s ERROR no analysis ",GetName()));
00067 return -2;
00068 }
00069
00070
00071 TGo4EventElement* eve = ana->GetEventStructure(GetObjectName());
00072 if (eve == 0) {
00073 cli->SendStatusMessage(2, kTRUE,TString::Format(" Event %s was not found to set printout mode!",GetObjectName()));
00074 return -1;
00075 }
00076
00077 TGo4MbsSource* mbs_src = dynamic_cast<TGo4MbsSource*> (eve->GetEventSource());
00078
00079 if (mbs_src==0) {
00080 cli->SendStatusMessage(2, kTRUE,TString::Format(" Source of event %s of class %s is not yet supported for printevent mode!", GetObjectName(), eve->ClassName()));
00081 return -1;
00082 }
00083
00084 mbs_src->SetPrintEvent(fxPrintPar.fiNum,
00085 fxPrintPar.fiSid,
00086 fxPrintPar.fiLong,
00087 fxPrintPar.fiHex,
00088 fxPrintPar.fiData);
00089 return -1;
00090 }