#ifndef HSTSTRB3LOOKUP_H #define HSTSTRB3LOOKUP_H #include "hparset.h" #include "htrbnetdef.h" #include #define STS_TRB3_LOOKUP_SIZE 49 using namespace Trbnet; using namespace std; class HStsTrb3LookupChan : public TObject { protected: Char_t module; // module number Char_t layer; // layer number Int_t cell; // cell number Char_t subcell; // sub-cell number public: HStsTrb3LookupChan() { clear(); } Char_t getModule() { return module; } Char_t getLayer() { return layer; } Int_t getCell() { return cell; } Char_t getSubCell() { return subcell; } void getAddress(Char_t &m, Char_t &l, Int_t &c, Char_t &s) const { m = module; l = layer; c = cell; s = subcell; } void clear() { module = -1; layer = -1; cell = -1; subcell = 0; } void setModule(Char_t m) { module = m; } void setLayer(Char_t l) { layer = l; } void setCell(Int_t c) { cell = c; } void setSubCell(Char_t s) { subcell = s; } void fill(Char_t m, Char_t l, Int_t c, Char_t s) { module = m; layer = l; cell = c; subcell = s; } void fill(HStsTrb3LookupChan &r) { module = r.getModule(); layer = r.getLayer(); cell = r.getCell(); subcell = r.getSubCell(); } ClassDef(HStsTrb3LookupChan, 1) // Channel level of the lookup table for the Sts TRB3 unpacker }; class HStsTrb3LookupTdc : public TObject { friend class HStsTrb3Lookup; protected: TObjArray *array; // pointer array containing HStsTrb3LookupChan objects public: HStsTrb3LookupTdc(); ~HStsTrb3LookupTdc(); HStsTrb3LookupChan *getChannel(Int_t c) { if (c >= 0 && c < STS_TRB3_LOOKUP_SIZE) return &((*this)[c]); else return 0; } HStsTrb3LookupChan &operator[](Int_t i) { return *static_cast((*array)[i]); } Int_t getSize() { return STS_TRB3_LOOKUP_SIZE; } void clear(); ClassDef(HStsTrb3LookupTdc, 1) // Board level of the lookup table for the Sts TRB3 unpacker }; class HStsTrb3Lookup : public HParSet { protected: TObjArray *array; // array of pointers of type HStsTrb3LookupTdc Int_t arrayOffset; // offset to calculate the index public: HStsTrb3Lookup(const Char_t *name = "StsTrb3Lookup", const Char_t *title = "Lookup table for the TRB3 unpacker of the Sts", const Char_t *context = "StsTrb3LookupProduction", Int_t minTrbnetAddress = Trbnet::kStsTrb3MinTrbnetAddress, Int_t maxTrbnetAddress = Trbnet::kStsTrb3MaxTrbnetAddress); ~HStsTrb3Lookup(); HStsTrb3LookupTdc *getTdc(Int_t trbnetAddress) { if ((arrayOffset <= trbnetAddress) && (trbnetAddress <= (array->GetSize() + arrayOffset))) return (HStsTrb3LookupTdc *)(array->At(trbnetAddress - arrayOffset)); return 0; } HStsTrb3LookupTdc *operator[](Int_t i) { return static_cast((*array)[i]); } Int_t getSize() { return array->GetLast() + 1; } Int_t getArrayOffset() { return arrayOffset; } Bool_t init(HParIo *input, Int_t *set); Int_t write(HParIo *output); void clear(); void printParams(); Bool_t fill(Int_t, Int_t, Char_t, Char_t, Int_t, Char_t); Bool_t readline(const Char_t *); void putAsciiHeader(TString &); void write(fstream &); ClassDef(HStsTrb3Lookup, 1) // Lookup table for the TRB3 unpacker of the Sts }; #endif /*!HSTSTRB3LOOKUP_H*/