00001 // $Id: TGo4MbsSubEvent.h 896 2012-11-22 14:35:47Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGO4MBSSUBEVENT_H 00015 #define TGO4MBSSUBEVENT_H 00016 00017 #include "TGo4EventElement.h" 00018 00019 #include "TGo4SubEventHeader10.h" 00020 00021 class TGo4MbsEvent; 00022 00024 class TGo4MbsSubEvent : public TGo4EventElement { 00025 00026 friend class TGo4MbsSource; 00027 friend class TGo4MbsEvent; 00028 00029 public: 00030 00031 // only for streaming 00032 TGo4MbsSubEvent(); 00033 00034 TGo4MbsSubEvent(Int_t datasize); 00035 00036 virtual ~TGo4MbsSubEvent(); 00037 00038 virtual Int_t Fill() { return -1; } // method not used 00039 00040 virtual void Clear(Option_t *t=""); 00041 00043 virtual void PrintEvent(); 00044 00049 void PrintMbsSubevent(Bool_t longw = kTRUE, Bool_t hexw = kTRUE, Bool_t dataw = kTRUE); 00050 00051 void Set(Int_t dlen, Short_t type=10, Short_t subtype=1, 00052 Short_t procid=0, Char_t subcrate=0, Char_t ctrl=0); 00053 00054 void SetDlen(Int_t dlen) { fxHeader.fxGSIHeader.fiDlen = dlen; } 00055 Int_t GetDlen() const { return fxHeader.fxGSIHeader.fiDlen; } 00056 00058 Int_t GetByteLen() const { return (GetDlen()-2) * 2; } 00059 00061 Int_t GetIntLen() const { return GetByteLen() / 4; } 00062 00063 void SetType(Short_t type) { fxHeader.fxGSIHeader.fsType = type; } 00064 Short_t GetType() const { return fxHeader.fxGSIHeader.fsType; } 00065 00066 void SetSubtype(Short_t subtype) { fxHeader.fxGSIHeader.fsSubtype = subtype; } 00067 Short_t GetSubtype() const { return fxHeader.fxGSIHeader.fsSubtype; } 00068 00069 void SetProcid(Short_t procid) { fxHeader.fsProcid = procid; } 00070 Short_t GetProcid() const { return fxHeader.fsProcid; } 00071 00072 void SetSubcrate(Char_t subcrate) { fxHeader.fcSubcrate = subcrate; } 00073 Char_t GetSubcrate() const { return fxHeader.fcSubcrate; } 00074 00075 void SetControl(Char_t control) { fxHeader.fcControl = control; } 00076 Char_t GetControl() const { return fxHeader.fcControl; } 00077 00078 void SetFullId(Int_t fullid) { fxHeader.fiFullid = fullid; } 00079 Int_t GetFullId() const { return fxHeader.fiFullid; } 00080 00082 Int_t GetAllocatedLength() const { return fiAllocLen; } 00083 00086 Int_t* GetDataField() { return fiData; } 00087 00090 Int_t Data(Int_t i) const 00091 { return ((i<0) || (i>=GetAllocatedLength())) ? 0 : fiData[i]; } 00092 00094 Bool_t IsFilled() const { return fbIsFilled; } 00095 00096 private: 00097 00100 void ReAllocate(Int_t newsize); 00101 00104 Bool_t fbIsFilled; 00105 00108 Bool_t fbIsDataOwner; 00109 00111 TGo4SubEventHeader10 fxHeader; 00112 00121 Int_t fiAllocLen; 00122 00127 Int_t* fiData; //[fiAllocLen] 00128 00129 ClassDef(TGo4MbsSubEvent,2) 00130 }; 00131 00132 #endif //TGO4MBSSUBEVENT_H