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