GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TMeshRawEvent.cxx
Go to the documentation of this file.
1 // $Id: TMeshRawEvent.cxx 2627 2019-10-01 08:02:45Z 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 "TMeshRawEvent.h"
15 
16 #include "TMeshUnpackProc.h"
17 #include "TGo4FileSource.h"
18 #include "TGo4Log.h"
19 
20 //***********************************************************
22  :TGo4EventElement("RawEvent"),fxUnpacker(0),fxFile(0)
23 {
24 }
25 //***********************************************************
27  :TGo4EventElement(name),fxUnpacker(0),fxFile(0)
28 {
29 }
30 //***********************************************************
32 {
33 }
34 //***********************************************************
35 
36 //-----------------------------------------------------------
38 {
39  Int_t rev=0;
40  //std::cout << "+++ Init event" << std::endl;
41  Clear();
42  if(CheckEventSource("TMeshUnpackProc"))
43  {
44  fxUnpacker = dynamic_cast<TMeshUnpackProc*>(GetEventSource());
45  // for the subcomponents, we have to set unpacker as source ?:
46  // only if we would use the subcomponents' Fill() methodsin our Fill()
47  // fxSub1.SetEventSource(fxUnpacker);
48  // fxSub1.Init();
49  // fxSub2.SetEventSource(fxUnpacker);
50  // fxSub1.Init();
51  // fxSub3.SetEventSource(fxUnpacker);
52  // fxSub1.Init();
53  TGo4Log::Info("TMeshRawEvent init for Unpack step");
54  }
55  else if(CheckEventSource("TGo4FileSource"))
56  {
57  fxFile = dynamic_cast<TGo4FileSource*> (GetEventSource());
58  TGo4Log::Info("TMeshRawEvent init for file input");
59  }
60  else
61  rev=1;
62  return rev;
63 }
64 //-----------------------------------------------------------
66 {
67  Int_t rev=0;
68  Clear();
69  if(fxUnpacker)
70  {
71  fxUnpacker->Unpack(this); // user event processing method
72  // alternatively, we could work with the Fill() of the subcomponents:
73  // fxSub1.Fill();
74  // fxSub2.Fill();
75  // fxSub3.Fill();
76  }
77  else if(fxFile)
78  fxFile->BuildEvent(this); // method from framework to restore event from file
79  else
80  rev=1;
81  return rev;
82 }
83 
84 //-----------------------------------------------------------
85 void TMeshRawEvent::Clear(Option_t *t)
86 {
87  fxSub1.Clear(t);
88  fxSub2.Clear(t);
89  fxSub3.Clear(t);
90 }
void Clear(Option_t *t="")
void Clear(Option_t *t="")
TGo4FileSource * fxFile
Don't put this to file.
Definition: TMeshRawEvent.h:53
TMeshUnpackProc * fxUnpacker
Definition: TMeshRawEvent.h:52
TGo4EventSource * GetEventSource() const
TMeshB1InputEvent fxSub1
Definition: TMeshRawEvent.h:47
Bool_t CheckEventSource(const char *classname)
virtual ~TMeshRawEvent()
void Unpack(TMeshRawEvent *target)
TMeshB2InputEvent fxSub2
Definition: TMeshRawEvent.h:48
virtual Bool_t BuildEvent(TGo4EventElement *dest)
TMeshB3InputEvent fxSub3
Definition: TMeshRawEvent.h:49
static void Info(const char *text,...)
Definition: TGo4Log.cxx:297
void Clear(Option_t *t="")
void Clear(Option_t *t="")