Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4EventServerExample/TGo4SimpleEventProcessor.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4SimpleEventProcessor.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TGo4SimpleEvent.h"
00021 #include "Go4EventServer/Go4EventServer.h"
00022 
00023 
00024 TGo4SimpleEventProcessor::TGo4SimpleEventProcessor()
00025 :TGo4EventProcessor("Go4 Standard SimpleEvent Processor")
00026 {
00027 TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00028 
00029 }
00030 
00031 TGo4SimpleEventProcessor::~TGo4SimpleEventProcessor()
00032 {
00033 TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00034 
00035 }
00036 
00037 void TGo4SimpleEventProcessor::BuildSimpleEvent(TGo4SimpleEvent* target)
00038 {
00039 TRACE((11,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
00040    TGo4MbsEvent* input= (TGo4MbsEvent* ) GetInputEvent();
00041    TGo4MbsSubEvent* insub;
00042    TGo4SimpleSubEvent* outsubix;
00043    TGo4SimpleSubEvent* outsub;
00044    if(input)
00045       {
00046          Short_t procid;
00047          input->ResetIterator();
00048          while ( (insub= input->NextSubEvent() ) !=0 )
00049          {
00050             // find out procid
00051             procid=insub->GetProcid();
00052             outsubix=target->GetSubEvent(procid);
00053             if (outsubix!=0)
00054                {
00055                   outsub=outsubix;
00056                }
00057             else
00058                {
00059                   // no such procid in array, add new one
00060                   outsub=target->AddSubEvent(procid);
00061                   if (outsub==0)
00062                      {
00063                         cout << "simple event processor: error adding subevent"<< endl;
00064                         return;
00065                      }
00066                   else { }
00067 
00068                } // if (outsubix!=0)
00069 
00070             // copy subevent data of that procid into target struct
00071             outsub->Clear();
00072             Int_t fieldsize= (insub->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
00073             outsub->fiFieldLen=fieldsize;
00074             void* sourcefield = (void*) (insub->GetDataField());
00075             void* destfield = (void*) &(outsub->fiD0);
00076             memcpy(destfield,
00077                      sourcefield,
00078                         fieldsize*sizeof(Int_t));
00079 
00080          }  // while
00081          target->fiCount= input->GetCount();
00082 
00083 
00084       } // if(input)
00085    else
00086       {
00087          cout << "Simple Event Processor: no input event !"<< endl;
00088       }
00089 
00090 }
00091 
00092 
00093 
00094 ClassImp(TGo4SimpleEventProcessor)
00095 
00096 
00097 
00098 
00099 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:54 2005 for Go4-v2.10-5 by doxygen1.2.15