GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4MbsSubEvent.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 TGO4MBSSUBEVENT_H
15#define TGO4MBSSUBEVENT_H
16
17#include "TGo4EventElement.h"
18
20
21class TGo4MbsEvent;
22
27
28 friend class TGo4MbsSource;
29 friend class TGo4MbsEvent;
30
31 public:
32
33 // only for streaming
35
36 TGo4MbsSubEvent(Int_t datasize);
37
38 virtual ~TGo4MbsSubEvent();
39
40 Int_t Fill() override { return -1; } // method not used
41
42 void Clear(Option_t *opt = "") override;
43
45 void PrintEvent() override;
46
51 void PrintMbsSubevent(Bool_t longw = kTRUE, Bool_t hexw = kTRUE, Bool_t dataw = kTRUE);
52
53 void Set(Int_t dlen, Short_t type = 10, Short_t subtype = 1,
54 Short_t procid = 0, Char_t subcrate = 0, Char_t ctrl = 0);
55
56 void SetDlen(Int_t dlen) { fxHeader.fxGSIHeader.fiDlen = dlen; }
57 Int_t GetDlen() const { return fxHeader.fxGSIHeader.fiDlen; }
58
60 Int_t GetByteLen() const { return (GetDlen()-2) * 2; }
61
63 Int_t GetIntLen() const { return GetByteLen() / 4; }
64
65 void SetType(Short_t type) { fxHeader.fxGSIHeader.fsType = type; }
66 Short_t GetType() const { return fxHeader.fxGSIHeader.fsType; }
67
68 void SetSubtype(Short_t subtype) { fxHeader.fxGSIHeader.fsSubtype = subtype; }
69 Short_t GetSubtype() const { return fxHeader.fxGSIHeader.fsSubtype; }
70
71 void SetProcid(Short_t procid) { fxHeader.fsProcid = procid; }
72 Short_t GetProcid() const { return fxHeader.fsProcid; }
73
74 void SetSubcrate(Char_t subcrate) { fxHeader.fcSubcrate = subcrate; }
75 Char_t GetSubcrate() const { return fxHeader.fcSubcrate; }
76
77 void SetControl(Char_t control) { fxHeader.fcControl = control; }
78 Char_t GetControl() const { return fxHeader.fcControl; }
79
80 void SetFullId(Int_t fullid) { fxHeader.fiFullid = fullid; }
81 Int_t GetFullId() const { return fxHeader.fiFullid; }
82
84 Int_t GetAllocatedLength() const { return fiAllocLen; }
85
88 Int_t *GetDataField() const { return fiData; }
89
92 Int_t Data(Int_t i) const { return ((i < 0) || (i >= GetAllocatedLength())) ? 0 : fiData[i]; }
93
95 Bool_t IsFilled() const { return fbIsFilled; }
96
97 private:
98
101 void ReAllocate(Int_t newsize);
102
105 Bool_t fbIsFilled{kFALSE};
106
109 Bool_t fbIsDataOwner{kFALSE};
110
113
122 Int_t fiAllocLen{0};
123
128 Int_t *fiData{nullptr}; //[fiAllocLen]
129
130 ClassDefOverride(TGo4MbsSubEvent,2)
131};
132
133#endif //TGO4MBSSUBEVENT_H
Wrapper for the standard gsi event structure as delivered from mbs.
Subevent class for gsi mbs data.
Int_t Data(Int_t i) const
Returns the value at position i in the fiData field.
Bool_t fbIsFilled
True if this subevent has already been filled in this event cycle.
void SetProcid(Short_t procid)
friend class TGo4MbsEvent
Int_t * GetDataField() const
Direct access to the fiData field pointer.
TGo4SubEventHeader10 fxHeader
aggregationByValue
Int_t * fiData
Pointer to external integer field containing the subevent data.
void PrintEvent() override
Print event with default arguments.
void Set(Int_t dlen, Short_t type=10, Short_t subtype=1, Short_t procid=0, Char_t subcrate=0, Char_t ctrl=0)
virtual ~TGo4MbsSubEvent()
Short_t GetSubtype() const
Int_t GetAllocatedLength() const
Return length of allocated memory for data field.
Char_t GetSubcrate() const
Bool_t IsFilled() const
true if this subevent was filled since the last Clear()
void SetSubcrate(Char_t subcrate)
void SetSubtype(Short_t subtype)
void Clear(Option_t *opt="") override
Int_t GetIntLen() const
Return raw data length in int (4-bytes)
void SetDlen(Int_t dlen)
Int_t Fill() override
Method called by the event owner (analysis step) to fill the event element from the set event source.
void ReAllocate(Int_t newsize)
Allocate the data field with newsize.
Char_t GetControl() const
void SetFullId(Int_t fullid)
Short_t GetProcid() const
Bool_t fbIsDataOwner
True if subevent owns data field.
friend class TGo4MbsSource
void SetControl(Char_t control)
Int_t fiAllocLen
Length of the allocated data field.
Int_t GetFullId() const
Int_t GetDlen() const
void SetType(Short_t type)
void PrintMbsSubevent(Bool_t longw=kTRUE, Bool_t hexw=kTRUE, Bool_t dataw=kTRUE)
Print MBS subevent.
Int_t GetByteLen() const
Return raw data length in bytes.
Short_t GetType() const
Standard GSI subevent header implementation.