GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4SimpleEventProcessor.cxx
Go to the documentation of this file.
1 // $Id: TGo4SimpleEventProcessor.cxx 999 2013-07-25 11:58:59Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
15 
16 #include "TGo4Log.h"
17 #include "TGo4SimpleEvent.h"
18 #include "TGo4SimpleSubEvent.h"
19 #include "Go4EventServer.h"
20 
22 :TGo4EventProcessor("Go4 Standard SimpleEvent Processor")
23 {
24 GO4TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
25 
26 }
27 
29 {
30 GO4TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
31 
32 }
33 
35 {
36 GO4TRACE((11,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
38  TGo4MbsSubEvent* insub;
39  TGo4SimpleSubEvent* outsubix;
40  TGo4SimpleSubEvent* outsub;
41  if(input)
42  {
43  Short_t procid;
44  input->ResetIterator();
45  while ( (insub= input->NextSubEvent() ) !=0 )
46  {
47  // find out procid
48  procid=insub->GetProcid();
49  outsubix=target->GetSubEvent(procid);
50  if (outsubix!=0)
51  {
52  outsub=outsubix;
53  }
54  else
55  {
56  // no such procid in array, add new one
57  outsub=target->AddSubEvent(procid);
58  if (outsub==0)
59  {
60  TGo4Log::Error("simple event processor: error adding subevent");
61  return;
62  }
63  else { }
64 
65  } // if (outsubix!=0)
66 
67  // copy subevent data of that procid into target struct
68  outsub->Clear();
69  Int_t fieldsize= (insub->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
70  outsub->fiFieldLen=fieldsize;
71  void* sourcefield = (void*) (insub->GetDataField());
72  void* destfield = (void*) &(outsub->fiD0);
73  memcpy(destfield,
74  sourcefield,
75  fieldsize*sizeof(Int_t));
76 
77  } // while
78  target->fiCount= input->GetCount();
79 
80 
81  } // if(input)
82  else
83  {
84  TGo4Log::Error("Simple Event Processor: no input event !");
85  }
86 
87 }
Int_t GetDlen() const
TGo4SimpleSubEvent * AddSubEvent(Short_t procid)
TGo4MbsSubEvent * NextSubEvent(Bool_t all=kFALSE)
TGo4SimpleSubEvent * GetSubEvent(Short_t procid)
void BuildSimpleEvent(TGo4SimpleEvent *target)
Int_t * GetDataField()
virtual void Clear(Option_t *t="")
Int_t GetCount() const
Definition: TGo4MbsEvent.h:149
TGo4EventElement * GetInputEvent()
#define GO4TRACE(X)
Definition: TGo4Log.h:26
Short_t GetProcid() const
void ResetIterator()
Definition: TGo4MbsEvent.h:98
static void Error(const char *text,...)
Definition: TGo4Log.cxx:309