00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4SimpleEventProcessor.h"
00017
00018 #include "Riostream.h"
00019
00020 #include "TGo4Log.h"
00021
00022 #include "TGo4SimpleEvent.h"
00023 #include "TGo4SimpleSubEvent.h"
00024
00025 #include "Go4EventServer.h"
00026
00027 TGo4SimpleEventProcessor::TGo4SimpleEventProcessor()
00028 :TGo4EventProcessor("Go4 Standard SimpleEvent Processor")
00029 {
00030 TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00031
00032 }
00033
00034 TGo4SimpleEventProcessor::~TGo4SimpleEventProcessor()
00035 {
00036 TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00037
00038 }
00039
00040 void TGo4SimpleEventProcessor::BuildSimpleEvent(TGo4SimpleEvent* target)
00041 {
00042 TRACE((11,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00043 TGo4MbsEvent* input= (TGo4MbsEvent* ) GetInputEvent();
00044 TGo4MbsSubEvent* insub;
00045 TGo4SimpleSubEvent* outsubix;
00046 TGo4SimpleSubEvent* outsub;
00047 if(input)
00048 {
00049 Short_t procid;
00050 input->ResetIterator();
00051 while ( (insub= input->NextSubEvent() ) !=0 )
00052 {
00053
00054 procid=insub->GetProcid();
00055 outsubix=target->GetSubEvent(procid);
00056 if (outsubix!=0)
00057 {
00058 outsub=outsubix;
00059 }
00060 else
00061 {
00062
00063 outsub=target->AddSubEvent(procid);
00064 if (outsub==0)
00065 {
00066 cout << "simple event processor: error adding subevent"<< endl;
00067 return;
00068 }
00069 else { }
00070
00071 }
00072
00073
00074 outsub->Clear();
00075 Int_t fieldsize= (insub->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
00076 outsub->fiFieldLen=fieldsize;
00077 void* sourcefield = (void*) (insub->GetDataField());
00078 void* destfield = (void*) &(outsub->fiD0);
00079 memcpy(destfield,
00080 sourcefield,
00081 fieldsize*sizeof(Int_t));
00082
00083 }
00084 target->fiCount= input->GetCount();
00085
00086
00087 }
00088 else
00089 {
00090 cout << "Simple Event Processor: no input event !"<< endl;
00091 }
00092
00093 }
00094
00095