ROOT logo
#ifndef HTRBLOOKUP_H
#define HTRBLOOKUP_H

#include "TObject.h"
#include "TObjArray.h"
#include "hparset.h"

using namespace std;
#include <fstream>

class HTrbLookupChan : public TObject {
protected:
  Char_t detector;  // identifier for detector
  Int_t  sector;    // sector number
  Int_t  module;    // module number
  Int_t  cell;      // cell number
  Char_t side;      // side of cell
  Int_t  feAddress; // front end address
public:
  HTrbLookupChan()     { clear(); }
  ~HTrbLookupChan()    {;}
  Char_t getDetector() { return detector; }
  Int_t getSector()    { return sector; }
  Int_t getModule()    { return module; }
  Int_t getCell()      { return cell;  }
  Char_t getSide()     { return side;  }
  Int_t getFeAddress() { return feAddress;  }
  void getAddress(Char_t& d,Int_t& s,Int_t& m,Int_t& c,Char_t& t,Int_t& f) {
    d=detector;
    s=sector;
    m=module;
    c=cell;
    t=side;
    f=feAddress;
  }
  void fill(Char_t d,Int_t s,Int_t m,Int_t c,Char_t t,Int_t f) {
    detector=d;
    sector=s;
    module=m;
    cell=c;
    side=t;
    feAddress=f;
  }
  void fill(HTrbLookupChan& r) {
    detector=r.getDetector();
    sector=r.getSector();
    module=r.getModule();
    cell=r.getCell();
    side=r.getSide();
    feAddress=r.getFeAddress();
  }
  void setDetector(Char_t c)       { detector=c; }
  void setSector(const Int_t n)    { sector=n; }
  void setModule(const Int_t n)    { module=n; }
  void setCell(const Int_t n)      { cell=n; }
  void setSide(Char_t c)           { side=c; }
  void setFeAddress(const Int_t n) { feAddress=n; }
  void clear() {
    detector='\0';
    sector=-1;
    module=-1;
    cell=-1;
    side='\0';
    feAddress=-1;
  }
  ClassDef(HTrbLookupChan,2) // Channel level of the lookup table for the TRB unpacker
};


class HTrbLookupBoard: public TObject {
  friend class HTrbLookup;
protected:
  TObjArray* array;     // pointer array containing HTrbLookupChan objects
public:
  HTrbLookupBoard();
  ~HTrbLookupBoard();
  HTrbLookupChan* getChannel(Int_t c) {
    if (c>=0 && c<128) return &((*this)[c]);
    else return 0;
  }
  HTrbLookupChan& operator[](Int_t i) {
      return *static_cast<HTrbLookupChan*>((*array)[i]);
  }
  Int_t getSize()  { return 128; }
  void clear();
  ClassDef(HTrbLookupBoard,1) // Board level of  the lookup table for the TRB unpacker
};


class HTrbLookup : public HParSet {
protected:
  TObjArray* array;  // array of pointers of type HTrbLookupBoard
  Int_t arrayOffset; // offset to calculate the index
public:
  HTrbLookup(const Char_t* name="TrbLookup",
             const Char_t* title="Lookup table for TRB unpacker",
             const Char_t* context="TrbLookupProduction",
             Int_t minSubeventId=800, Int_t nBoards=100);
  ~HTrbLookup();
  HTrbLookupBoard* getBoard(Int_t subeventId) {
    return (HTrbLookupBoard*)(array->At(subeventId-arrayOffset));
  }
  HTrbLookupBoard* operator[](Int_t i) {
    return static_cast<HTrbLookupBoard*>((*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,Char_t,Int_t,Int_t,Int_t,Char_t,Int_t);
  Bool_t readline(const Char_t*);
  void putAsciiHeader(TString&);
  void write(fstream&);
  ClassDef(HTrbLookup,1) // Lookup table for the TRB unpacker
};

#endif  /*!HTRBLOOKUP_H*/
 htrblookup.h:1
 htrblookup.h:2
 htrblookup.h:3
 htrblookup.h:4
 htrblookup.h:5
 htrblookup.h:6
 htrblookup.h:7
 htrblookup.h:8
 htrblookup.h:9
 htrblookup.h:10
 htrblookup.h:11
 htrblookup.h:12
 htrblookup.h:13
 htrblookup.h:14
 htrblookup.h:15
 htrblookup.h:16
 htrblookup.h:17
 htrblookup.h:18
 htrblookup.h:19
 htrblookup.h:20
 htrblookup.h:21
 htrblookup.h:22
 htrblookup.h:23
 htrblookup.h:24
 htrblookup.h:25
 htrblookup.h:26
 htrblookup.h:27
 htrblookup.h:28
 htrblookup.h:29
 htrblookup.h:30
 htrblookup.h:31
 htrblookup.h:32
 htrblookup.h:33
 htrblookup.h:34
 htrblookup.h:35
 htrblookup.h:36
 htrblookup.h:37
 htrblookup.h:38
 htrblookup.h:39
 htrblookup.h:40
 htrblookup.h:41
 htrblookup.h:42
 htrblookup.h:43
 htrblookup.h:44
 htrblookup.h:45
 htrblookup.h:46
 htrblookup.h:47
 htrblookup.h:48
 htrblookup.h:49
 htrblookup.h:50
 htrblookup.h:51
 htrblookup.h:52
 htrblookup.h:53
 htrblookup.h:54
 htrblookup.h:55
 htrblookup.h:56
 htrblookup.h:57
 htrblookup.h:58
 htrblookup.h:59
 htrblookup.h:60
 htrblookup.h:61
 htrblookup.h:62
 htrblookup.h:63
 htrblookup.h:64
 htrblookup.h:65
 htrblookup.h:66
 htrblookup.h:67
 htrblookup.h:68
 htrblookup.h:69
 htrblookup.h:70
 htrblookup.h:71
 htrblookup.h:72
 htrblookup.h:73
 htrblookup.h:74
 htrblookup.h:75
 htrblookup.h:76
 htrblookup.h:77
 htrblookup.h:78
 htrblookup.h:79
 htrblookup.h:80
 htrblookup.h:81
 htrblookup.h:82
 htrblookup.h:83
 htrblookup.h:84
 htrblookup.h:85
 htrblookup.h:86
 htrblookup.h:87
 htrblookup.h:88
 htrblookup.h:89
 htrblookup.h:90
 htrblookup.h:91
 htrblookup.h:92
 htrblookup.h:93
 htrblookup.h:94
 htrblookup.h:95
 htrblookup.h:96
 htrblookup.h:97
 htrblookup.h:98
 htrblookup.h:99
 htrblookup.h:100
 htrblookup.h:101
 htrblookup.h:102
 htrblookup.h:103
 htrblookup.h:104
 htrblookup.h:105
 htrblookup.h:106
 htrblookup.h:107
 htrblookup.h:108
 htrblookup.h:109
 htrblookup.h:110
 htrblookup.h:111
 htrblookup.h:112
 htrblookup.h:113
 htrblookup.h:114
 htrblookup.h:115
 htrblookup.h:116
 htrblookup.h:117
 htrblookup.h:118
 htrblookup.h:119