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