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