Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4SimpleEventProcessor.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "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             // find out procid
00054             procid=insub->GetProcid();
00055             outsubix=target->GetSubEvent(procid);
00056             if (outsubix!=0)
00057                {
00058                   outsub=outsubix;
00059                }
00060             else
00061                {
00062                   // no such procid in array, add new one
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                } // if (outsubix!=0)
00072 
00073             // copy subevent data of that procid into target struct
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          }  // while
00084          target->fiCount= input->GetCount();
00085 
00086 
00087       } // if(input)
00088    else
00089       {
00090          cout << "Simple Event Processor: no input event !"<< endl;
00091       }
00092 
00093 }
00094 
00095 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:09 2008 for Go4-v3.04-1 by  doxygen 1.4.2