GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4CompositeProcessor.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 
14 #include "TGo4CompositeProcessor.h"
15 
16 #include "TGo4MbsEvent.h"
17 
20  fMbsTriggerNumber(0),
21  fMbsEventNumber(0),
22  fSubProcessors()
23 {
24 } // streamer dummy
25 
26 
28  TGo4EventProcessor(name),
30  fMbsEventNumber(0),
32 {
33 }
34 
36 {
37  fSubProcessors.Delete();
38 }
39 
41 {
42  if (proc) fSubProcessors.AddLast(proc);
43 }
44 
46 {
47  // std::cout << "Dummy, should be reimplemented " << std::endl;
48  // but must not if this is the top beamtime event JAM
49 }
50 
51 
53 {
54  // if there is no container event as output, subclass may run in standalone mode
55  InitEvent(outevnt); // for plain subclass mode
56 
57  // first need to call SetEvent of all subprocessors to set the input/output structures:
58 
59  for (Int_t n = 0; n <= fSubProcessors.GetLast(); n++) {
61  proc->SetInputEvent(GetInputEvent()); //forward input to subprocessors
62  proc->InitEvent(outevnt); // subprocessors may set own eventpointers here
63  } // while
64 
65  // treat mbs input if we are in the first step:
66  fMbsInput = dynamic_cast<TGo4MbsEvent *>(GetInputEvent());
67 
68 // printf("TGo4CompositeProcessor::BuildEvent this = %p name = %s evnt = %p \n", this, GetName(), fMbsInput);
69 
70  if(fMbsInput)
71  {
72 // if(fMbsInput->GetTrigger() > 11) {
73 // std::cout << "**** TGo4CompositeProcessor: Skip trigger event"<< std::endl;
74 // return kFALSE;
76 
79 
81  while(auto psubevt = fMbsInput->NextSubEvent()) {
82  // loop over subevents
83  ProcessSubevent(psubevt); // process in our own subclass, if implemented
84 
85  for (Int_t n = 0; n <= fSubProcessors.GetLast(); n++) {
86 
87  TGo4CompositeProcessor* subcomp = dynamic_cast<TGo4CompositeProcessor*> (fSubProcessors[n]);
88 
89  if (subcomp) {
92  subcomp->ProcessSubevent(psubevt); // actions implemented in component subclass
93  }
94  } // while proc
95  } // whilesubevents
96  } // mbs input
97 
98 
99  // in any case, call finalize processing in all subclasses/components:
100  // this is the way to implement actions in second step processors
101  // for first step processors, this can be used to do actions after all subevents are done
102  FinalizeEvent(); // process in our own subclass, if implemented
103 
104  for (Int_t n = 0; n <= fSubProcessors.GetLast(); n++) {
106  proc->FinalizeEvent(); // actions implemented in component subclass
107  }
108 
109  return kTRUE;
110 }
111 
void InitEvent(TGo4EventElement *) override
TGo4MbsSubEvent * NextSubEvent(Bool_t all=kFALSE)
virtual void InitEvent(TGo4EventElement *)
void SetInputEvent(TGo4EventElement *raw)
virtual void ProcessSubevent(TGo4MbsSubEvent *subevt)
Int_t GetCount() const
Definition: TGo4MbsEvent.h:151
TGo4EventElement * GetInputEvent()
virtual void FinalizeEvent()
void AddSubProcessor(TGo4EventProcessor *)
void ResetIterator()
Definition: TGo4MbsEvent.h:100
Bool_t BuildEvent(TGo4EventElement *) override
Short_t GetTrigger() const
Definition: TGo4MbsEvent.h:148