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