GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4SimpleEventProcessor.cxx
Go to the documentation of this file.
1// $Id$
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 fuer 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
28{
29 GO4TRACE((14,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
30}
31
33{
34 GO4TRACE((11,"TGo4SimpleEventProcessor::TGo4SimpleEventProcessor(Int_t)",__LINE__, __FILE__));
36
37 if (!input) {
38 TGo4Log::Error("Simple Event Processor: no input event !");
39 return kFALSE;
40 }
41
42
43 Short_t procid;
44 input->ResetIterator();
45 while (auto insub = input->NextSubEvent()) {
46 // find out procid
47 procid = insub->GetProcid();
48 auto outsubix = target->GetSubEvent(procid);
49 TGo4SimpleSubEvent *outsub = nullptr;
50 if (outsubix) {
51 outsub = outsubix;
52 } else {
53 // no such procid in array, add new one
54 outsub = target->AddSubEvent(procid);
55 if (!outsub) {
56 TGo4Log::Error("simple event processor: error adding subevent");
57 return kFALSE;
58 }
59
60 } // if (outsubix)
61
62 // copy subevent data of that procid into target struct
63 outsub->Clear();
64 Int_t fieldsize = (insub->GetDlen() - 2) * sizeof(Short_t) / sizeof(Int_t);
65 outsub->fiFieldLen = fieldsize;
66 void *sourcefield = (void *)(insub->GetDataField());
67 void *destfield = (void *)&(outsub->fiD0);
68 memcpy(destfield, sourcefield, fieldsize * sizeof(Int_t));
69
70 } // while
71 target->fiCount = input->GetCount();
72 return kTRUE;
73}
#define GO4TRACE(X)
Definition TGo4Log.h:25
TGo4EventProcessor(const char *name)
TGo4EventElement * GetInputEvent()
Access to external raw event which is set as association member.
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Definition TGo4Log.cxx:320
Wrapper for the standard gsi event structure as delivered from mbs.
Int_t GetCount() const
TGo4MbsSubEvent * NextSubEvent(Bool_t all=kFALSE)
Iterator for subevent array.
void ResetIterator()
Set the internal iterator of the subevent array to the beginning of the array.
Bool_t BuildSimpleEvent(TGo4SimpleEvent *target)
Simple Event structure containing a fixed size TClonesArray of subevents.
TGo4SimpleSubEvent * GetSubEvent(Short_t procid)
Access to subevent in list by procid.
TGo4SimpleSubEvent * AddSubEvent(Short_t procid)
Add subevent ito clonesarray with new procid.
void Clear(Option_t *opt="") override
Method called by the event owner (analysis step) to clear the event element.
Int_t fiFieldLen
Length of the used data field (number of longwords).
Int_t fiD0
Data longword.