#ifndef HWALLTRB3LOOKUP_H #define HWALLTRB3LOOKUP_H #include "TObjArray.h" #include "TObject.h" #include "hparset.h" #include "htrbnetdef.h" using namespace Trbnet; using namespace std; class HWallTrb3LookupChan : public TObject { protected: Int_t cell; // cell number public: HWallTrb3LookupChan() { clear(); } ~HWallTrb3LookupChan() { ; } Int_t getCell() { return cell; } void getAddress(Int_t& c) { c = cell; } void fill(Int_t c) { cell = c; } void fill(HWallTrb3LookupChan& r) { cell = r.getCell(); } void setCell (const Int_t n) { cell = n; } void clear() { cell = -1; } ClassDef(HWallTrb3LookupChan, 1) // Channel level of the lookup table for the Wall TRB3 unpacker }; class HWallTrb3LookupTdc: public TObject { friend class HWallTrb3Lookup; protected: TObjArray* array; // pointer array containing HWallTrb3LookupChan objects public: HWallTrb3LookupTdc(); ~HWallTrb3LookupTdc(); Int_t getSize() { return array ? array->GetLast()+1 : 0; } HWallTrb3LookupChan* getChannel(Int_t c) { if (c >= 0 && c < getSize()) return &((*this)[c]); else return 0; } HWallTrb3LookupChan& operator[](Int_t i) { return *static_cast((*array)[i]); } void clear(); ClassDef(HWallTrb3LookupTdc, 1) // Tdc level of the lookup table for the iTOF TRB3 unpacker }; class HWallTrb3Lookup : public HParSet { protected: TObjArray* array; // array of pointers of type HWallTrb2LookupTdc Int_t arrayOffset; // offset to calculate the index Int_t lookup[303][2]; //! reverse lookup void fillLookup(); void initLookup(); public: HWallTrb3Lookup(const Char_t* name = "WallTrb3Lookup", const Char_t* title = "Lookup table for the TRB3 unpacker of the Wall detector", const Char_t* context = "WallTrb3LookupProduction", Int_t minTrbnetAddress = Trbnet::kWallTrb3MinTrbnetAddress, Int_t maxTrbnetAddress = Trbnet::kWallTrb3MaxTrbnetAddress); ~HWallTrb3Lookup(); HWallTrb3LookupTdc* getTdc(Int_t trbnetAddress) { if ((arrayOffset <= trbnetAddress) && (trbnetAddress <= (array->GetSize() + arrayOffset))) return (HWallTrb3LookupTdc*)(array->At(trbnetAddress - arrayOffset)); return 0; } HWallTrb3LookupTdc* 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 printParam(); Bool_t fill(Int_t, Int_t, Int_t); Bool_t find(Int_t c, Int_t& tdc,Int_t& chan); Bool_t readline(const Char_t*); void putAsciiHeader(TString&); void write(fstream&); ClassDef(HWallTrb3Lookup, 1) // Lookup table for the TRB2 unpacker of the iTOF detector }; #endif /*!HWALLTRB3LOOKUP_H*/