00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4ComGetCurrentEvent.h"
00017
00018 #include "TTree.h"
00019
00020 #include "TGo4Log.h"
00021 #include "TGo4AnalysisClientImp.h"
00022 #include "TGo4AnalysisImp.h"
00023 #include "TGo4EventElement.h"
00024 #include "TGo4RemoteCommand.h"
00025
00026 TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent(const char* obname)
00027 :TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis",obname),
00028 fbOutputEvent(kTRUE), fbPrintoutOnly(kFALSE), fbTreeMode(kTRUE)
00029 {
00030 TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent(const Text_t*) ctor",__LINE__, __FILE__));
00031 SetReceiverName("AnalysisClient");
00032
00033 }
00034
00035 TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent()
00036 :TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis","his"),
00037 fbOutputEvent(kTRUE), fbPrintoutOnly(kFALSE), fbTreeMode(kTRUE)
00038 {
00039 TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent() ctor",__LINE__, __FILE__));
00040 SetReceiverName("AnalysisClient");
00041
00042 }
00043
00044 TGo4ComGetCurrentEvent::~TGo4ComGetCurrentEvent()
00045 {
00046 TRACE((12,"TGo4ComGetCurrentEvent::~TGo4ComGetCurrentEvent() dtor",__LINE__, __FILE__));
00047 }
00048
00049
00050 Int_t TGo4ComGetCurrentEvent::ExeCom()
00051 {
00052 TRACE((12,"TGo4ComGetCurrentEvent::ExeCom()",__LINE__, __FILE__));
00053
00054 TGo4Log::Debug(" Executing %s : Event %s requested, isoutput=%d, printoutonly=%d ",
00055 GetName(), GetObjectName(), IsOutputEvent(), IsPrintoutOnly() );
00056 TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00057 if (cli!=0)
00058 {
00059 TGo4Analysis* ana=TGo4Analysis::Instance();
00060 if(ana==0)
00061 {
00062
00063 cli->SendStatusMessage(3, kTRUE," %s ERROR no analysis ",GetName());
00064 return -2;
00065 } else {}
00066 if(IsTreeMode())
00067 {
00068
00069 if(IsPrintoutOnly())
00070 {
00071
00072 ana->ShowEvent(GetObjectName(), IsOutputEvent());
00073 }
00074 else
00075 {
00076 TTree* sampletree=ana->CreateSingleEventTree(GetObjectName(), IsOutputEvent());
00077 if(sampletree)
00078 {
00079 cli->SendObject(sampletree, GetTaskName());
00080 delete sampletree;
00081 }
00082 else
00083 {
00084 cli->SendStatusMessage(3, kTRUE,"GetCurrentEvent %s - ERROR: no such event ",
00085 GetObjectName());
00086 }
00087 }
00088 }
00089 else
00090 {
00091
00092 TGo4EventElement* event=0;
00093 if(IsOutputEvent())
00094 event=ana->GetOutputEvent(GetObjectName());
00095 else
00096 event=ana->GetInputEvent(GetObjectName());
00097 if(event==0)
00098
00099 event=ana->GetEventStructure(GetObjectName());
00100 if(event)
00101 {
00102 if(IsPrintoutOnly())
00103 event->PrintEvent();
00104 else
00105 cli->SendObject(event, GetTaskName());
00106 }
00107 else
00108 {
00109 cli->SendStatusMessage(3, kTRUE,"GetCurrentEvent %s - ERROR: no such event ",
00110 GetObjectName());
00111 }
00112 }
00113 }
00114 else
00115 {
00116 TRACE((11,"TGo4ComGetCurrentEvent::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00117 TGo4Log::Debug(" !!! %s : NO or WRONG RECEIVER ERROR!!!",GetName());
00118 return 1;
00119 }
00120 return -1;
00121 }
00122
00123 void TGo4ComGetCurrentEvent::Set(TGo4RemoteCommand* remcom)
00124 {
00125 if(remcom==0) return;
00126 TGo4AnalysisObjectCommand::Set(remcom);
00127 fbOutputEvent=remcom->GetValue(0);
00128 fbPrintoutOnly=remcom->GetValue(1);
00129 fbTreeMode=remcom->GetValue(2);
00130
00131 }
00132
00133