GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4CompositeProcessor.cxx
Go to the documentation of this file.
1 // $Id: TGo4CompositeProcessor.cxx 2748 2020-04-16 09:50:56Z 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 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  fMbsInput(0),
21  fMbsTriggerNumber(0),
22  fMbsEventNumber(0),
23  fSubProcessors()
24 {
25 } // streamer dummy
26 
27 
29  TGo4EventProcessor(name),
30  fMbsInput(0),
31  fMbsTriggerNumber(0),
32  fMbsEventNumber(0),
33  fSubProcessors()
34 {
35 }
36 
38 {
39  fSubProcessors.Delete();
40 }
41 
43 {
44  if (proc!=0) fSubProcessors.AddLast(proc);
45 }
46 
48 {
49  //std::cout << "Dummy, should be reimplemented " << std::endl; // but must not if this is the top beamtime event JAM
50 }
51 
52 
54 {
55  // if there is no container event as output, subclass may run in standalone mode
56  InitEvent(outevnt); // for plain subclass mode
57 
58  // first need to call SetEvent of all subprocessors to set the input/output structures:
59 
60  for (Int_t n=0;n<=fSubProcessors.GetLast();n++) {
62  proc->SetInputEvent(GetInputEvent()); //forward input to subprocessors
63  proc->InitEvent(outevnt); // subprocessors may set own eventpointers here
64  } // while
65 
66  // treat mbs input if we are in the first step:
67  fMbsInput = dynamic_cast<TGo4MbsEvent*>(GetInputEvent());
68 
69 // printf("TGo4CompositeProcessor::BuildEvent this = %p name = %s evnt = %p \n", this, GetName(), fMbsInput);
70 
71  if(fMbsInput)
72  {
73 // if(fMbsInput->GetTrigger() > 11) {
74 // std::cout << "**** TGo4CompositeProcessor: Skip trigger event"<< std::endl;
75 // return kFALSE;
77 
80 
81  TGo4MbsSubEvent* psubevt = 0;
83  while((psubevt = fMbsInput->NextSubEvent()) != 0)
84  { // loop over subevents
85  ProcessSubevent(psubevt); // process in our own subclass, if implemented
86 
87  for (Int_t n=0;n<=fSubProcessors.GetLast();n++) {
88 
89  TGo4CompositeProcessor* subcomp = dynamic_cast<TGo4CompositeProcessor*> (fSubProcessors[n]);
90 
91  if (subcomp) {
94  subcomp->ProcessSubevent(psubevt); // actions implemented in component subclass
95  }
96  } // while proc
97  } // whilesubevents
98  } // mbs input
99 
100 
101  // in any case, call finalize processing in all subclasses/components:
102  // this is the way to implement actions in second step processors
103  // for first step processors, this can be used to do actions after all subevents are done
104  FinalizeEvent(); // process in our own subclass, if implemented
105 
106  for (Int_t n=0;n<=fSubProcessors.GetLast();n++) {
108  proc->FinalizeEvent(); // actions implemented in component subclass
109  } // while proc
110 
111  return kTRUE;
112 }
113 
virtual Bool_t BuildEvent(TGo4EventElement *)
TGo4MbsSubEvent * NextSubEvent(Bool_t all=kFALSE)
virtual void InitEvent(TGo4EventElement *)
void SetInputEvent(TGo4EventElement *raw)
Int_t GetCount() const
Definition: TGo4MbsEvent.h:152
virtual void ProcessSubevent(TGo4MbsSubEvent *subevt)
virtual void InitEvent(TGo4EventElement *)
TGo4EventElement * GetInputEvent()
virtual void FinalizeEvent()
Short_t GetTrigger() const
Definition: TGo4MbsEvent.h:149
void AddSubProcessor(TGo4EventProcessor *)
void ResetIterator()
Definition: TGo4MbsEvent.h:101