GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4MbsEvent.h
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 #ifndef TGO4MBSEVENT_H
15 #define TGO4MBSEVENT_H
16 
17 #include "TGo4EventElement.h"
18 
19 #include "TGo4EventHeader10.h"
20 #include "TGo4MbsSubEvent.h"
21 
22 extern "C" {
23  #include "s_bufhe.h"
24  #include "s_filhe.h"
25 }
26 
27 class TObjArray;
28 class TGo4MbsSource;
29 class TGo4MbsSubEvent;
30 
36 
37  friend class TGo4MbsSource;
38 
39  public:
40 
41  // should only be used in streaming
42  TGo4MbsEvent();
43 
48  TGo4MbsEvent(UInt_t subnum, Short_t *subids, UInt_t datasize = 100);
49 
55  TGo4MbsEvent(UInt_t subnum, Char_t *subcrates, Char_t *controls, Short_t *procids, UInt_t *datasizes);
56 
59  TGo4MbsEvent(const char *name);
60 
61  virtual ~TGo4MbsEvent();
62 
64  void Clear(Option_t *opt = "") override;
65 
66  /* Declare this mbs event object as "reference" to another.
67  * This will just set event header accordingly and will use
68  * reference to subevents of original mbs event. No ownership is adopted!
69  * Use case: Mbsevent as Go4 output event that just uses input event data
70  * without copying, purpose: store to Go4 event store (root file)*/
71  void AssignReference(TGo4MbsEvent *ref);
72 
73  /* remove reference to external mbsevent object
74  * afterwards, this object will contain new subevtarray*/
75  void RemoveReference();
76 
77  void Set(Int_t dlen = 0, Short_t type = 10, Short_t subtype = 1,
78  Short_t dummy = 0, Short_t trigger = 0, Int_t count = 0);
79 
81  void PrintEvent() override;
82 
91  void PrintMbsEvent(Int_t subid = -1, Bool_t longw = kTRUE, Bool_t hexw = kTRUE, Bool_t dataw = kTRUE,
92  Bool_t bufhead = kFALSE, Bool_t filhead=kFALSE);
93 
96  void SetPrintEvent(Int_t num, Int_t sid, Int_t longw, Int_t hexw, Int_t dataw);
97 
100  inline void ResetIterator() { fiSubEvIndex = 0; }
101 
106  TGo4MbsSubEvent *NextSubEvent(Bool_t all=kFALSE);
107 
112  TGo4MbsSubEvent *GetSubEvent(Char_t subcrate,
113  Char_t ctrl,
114  Short_t procid);
115 
120  TGo4MbsSubEvent *GetSubEvent(Short_t procid);
121 
128  TGo4MbsSubEvent *AddSubEvent(Int_t fullID,
129  Short_t *source,
130  Int_t datalength,
131  Bool_t copydata = kFALSE);
132 
133  void SetDlen(Int_t dlen) { fxHeader.fxGSIHeader.fiDlen = dlen; }
134  Int_t GetDlen() const { return fxHeader.fxGSIHeader.fiDlen; }
135  Int_t GetIntLen() const { return (GetDlen()-4)*2/4; }
136  Int_t GetByteLen() const { return (GetDlen()-4)*2; }
137 
138  void SetType(Short_t type) { fxHeader.fxGSIHeader.fsType = type; }
139  Short_t GetType() const { return fxHeader.fxGSIHeader.fsType; }
140 
141  void SetSubtype(Short_t subtype) { fxHeader.fxGSIHeader.fsSubtype = subtype; }
142  Short_t GetSubtype() const { return fxHeader.fxGSIHeader.fsSubtype; }
143 
144  void SetDummy(Short_t dummy) { fxHeader.fsDummy = dummy; }
145  Short_t GetDummy() const { return fxHeader.fsDummy; }
146 
147  void SetTrigger(Short_t trigger) { fxHeader.fsTrigger = trigger; }
148  Short_t GetTrigger() const { return fxHeader.fsTrigger; }
149 
150  void SetCount(Int_t count) { fxHeader.fiCount = count; }
151  Int_t GetCount() const { return fxHeader.fiCount; }
152 
155 
157  void PrintMbsFileHeader();
158 
161 
163  void PrintMbsBufferHeader();
164 
165  private:
166 
169 
171  TObjArray *fxSubEvArray{nullptr};
172 
174  Int_t fiSubEvIndex{0};
175 
177  Bool_t fbIsReference{kFALSE};
178 
179  /* initialize this event with a simple dummy subevent*/
180  void SimpleInit();
181 
182  ClassDefOverride(TGo4MbsEvent,3)
183 };
184 
185 #endif //TGO4MBSEVENT_H
void SetCount(Int_t count)
Definition: TGo4MbsEvent.h:150
TGo4MbsSubEvent * AddSubEvent(Int_t fullID, Short_t *source, Int_t datalength, Bool_t copydata=kFALSE)
s_bufhe * GetMbsBufferHeader()
Int_t GetByteLen() const
Definition: TGo4MbsEvent.h:136
TGo4GSIEventHeader fxGSIHeader
void RemoveReference()
Int_t fiSubEvIndex
Definition: TGo4MbsEvent.h:174
TGo4MbsSubEvent * NextSubEvent(Bool_t all=kFALSE)
Bool_t fbIsReference
Definition: TGo4MbsEvent.h:177
TGo4EventHeader10 fxHeader
Definition: TGo4MbsEvent.h:168
void SetSubtype(Short_t subtype)
Definition: TGo4MbsEvent.h:141
void SetDummy(Short_t dummy)
Definition: TGo4MbsEvent.h:144
void SetDlen(Int_t dlen)
Definition: TGo4MbsEvent.h:133
void SetType(Short_t type)
Definition: TGo4MbsEvent.h:138
TObjArray * fxSubEvArray
Definition: TGo4MbsEvent.h:171
void PrintEvent() override
Int_t GetIntLen() const
Definition: TGo4MbsEvent.h:135
void SimpleInit()
void PrintMbsEvent(Int_t subid=-1, Bool_t longw=kTRUE, Bool_t hexw=kTRUE, Bool_t dataw=kTRUE, Bool_t bufhead=kFALSE, Bool_t filhead=kFALSE)
void AssignReference(TGo4MbsEvent *ref)
void PrintMbsFileHeader()
Int_t GetCount() const
Definition: TGo4MbsEvent.h:151
void PrintMbsBufferHeader()
s_filhe * GetMbsSourceHeader()
void SetPrintEvent(Int_t num, Int_t sid, Int_t longw, Int_t hexw, Int_t dataw)
virtual ~TGo4MbsEvent()
Short_t GetSubtype() const
Definition: TGo4MbsEvent.h:142
Short_t GetType() const
Definition: TGo4MbsEvent.h:139
void ResetIterator()
Definition: TGo4MbsEvent.h:100
void Clear(Option_t *opt="") override
TGo4MbsSubEvent * GetSubEvent(Char_t subcrate, Char_t ctrl, Short_t procid)
Int_t GetDlen() const
Definition: TGo4MbsEvent.h:134
void Set(Int_t dlen=0, Short_t type=10, Short_t subtype=1, Short_t dummy=0, Short_t trigger=0, Int_t count=0)
Short_t GetTrigger() const
Definition: TGo4MbsEvent.h:148
void SetTrigger(Short_t trigger)
Definition: TGo4MbsEvent.h:147
Short_t GetDummy() const
Definition: TGo4MbsEvent.h:145