ROOT logo
#ifndef HTOFLOOKUP_H
#define HTOFLOOKUP_H

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

class HTofLookupChan : public TObject {
protected:
    Int_t sector;   // sector number (0..5)
    Int_t module;   // module number (0..21)
    Int_t cell;     // rod number (0..8)
    Char_t side;    // side of rod (L=left, R=right)
public:
    HTofLookupChan() { clear(); }
    ~HTofLookupChan() {;}
    Int_t getSector() { return sector; }
    Int_t getModule() { return module; }
    Int_t getCell()  { return cell; }
    Char_t getSide()  { return side; }
    void getAddress(Int_t& s,Int_t& m,Int_t& c,Char_t& p) {
      s=sector;
      m=module;
      c=cell;
      p=side;
    }
    void fill(const Int_t s,const Int_t m,const Int_t c,const Char_t p) {
      sector=s;
      module=m;
      cell=c;
      side=p;
    }
    void fill(HTofLookupChan& r) {
      sector=r.getSector();
      module=r.getModule();
      cell=r.getCell();
      side=r.getSide();
    }
    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(const Int_t n)  { side=n; }
    void clear() {
      sector=-1;
      module=-1;
      cell=-1;
      side='U';
    }
    ClassDef(HTofLookupChan,1) // Channel level of the lookup table for the TOF unpacker 
};

class HTofLookupSlot: public TObject {
protected:
  TObjArray* array; // pointer array containing HTofLookupChan objects
  Char_t modType;   // type of digital converter (A=ADC, T=TDC, U=undefined)
  Int_t maxChannel; // actual maximum index of channel
  Int_t nChannels;  // maximum number of channels in a slot
public:
  HTofLookupSlot(Int_t numChannels=1);
  ~HTofLookupSlot();
  HTofLookupChan& operator[](Int_t i) {
      return *static_cast<HTofLookupChan*>((*array)[i]);
  }
  HTofLookupChan* getChannel(Int_t c) {
    if (c>=0 && c<=maxChannel) return &((*this)[c]);
    else return 0;
  }
  Int_t getSize()  { return maxChannel+1; }
  Int_t getMaxSize() { return nChannels; }
  Char_t getType() { return modType; }
  void fill(Char_t,Int_t,Int_t,Int_t,Int_t,Char_t);
  void clear();
  ClassDef(HTofLookupSlot,1) // ADC/TDC level of  the lookup table for the TOF unpacker
};

class HTofLookupCrate: public TObject {
protected:
  TObjArray* array; // pointer array containing HTofLookupSlot objects
  Int_t maxSlot;    // actual maximum index of slots
  Int_t nSlots;     // maximum number of slots in a crate
public:
  HTofLookupCrate(Int_t numSlots=1);
  ~HTofLookupCrate();
  HTofLookupSlot& operator[](Int_t i) {
      return *static_cast<HTofLookupSlot*>((*array)[i]);
  }
  HTofLookupSlot* getSlot(Int_t s) {
    if (s>=0 && s<=maxSlot) return &((*this)[s]);
    else return 0;
  }
  Int_t getSize() { return maxSlot+1; }
  Int_t getMaxSize() { return nSlots; }
  void fill(Int_t,Char_t,Int_t,Int_t,Int_t,Int_t,Char_t);
  ClassDef(HTofLookupCrate,1) // Crate level of the lookup table for the TOF unpacker
};

class HTofLookup : public HParSet {
protected:
  TObjArray* array;  // array of pointers of type HTofLookupCrate
  Int_t maxCrate;    // actual maximum index of crates
public:
  HTofLookup(const Char_t* name="TofLookup",
             const Char_t* title="Lookup table for Tof unpacker",
             const Char_t* context="",
             Int_t nCrates=1, Int_t nSlots=1);
  ~HTofLookup();
  HTofLookupCrate& operator[](Int_t i) {
    return *static_cast<HTofLookupCrate*>((*array)[i]);
  }
  HTofLookupSlot* getSlot(Int_t c, Int_t s) {
    if (c>=0 && c<=maxCrate) return (*this)[c].getSlot(s);
    else return 0;
  }
  Int_t getSize() { return maxCrate+1; }
  Bool_t init(HParIo*,Int_t*);
  Int_t write(HParIo*);
  void clear();
  void printParam();
  void fill(Int_t,Int_t,Char_t,Int_t,Int_t,Int_t,Int_t,Char_t);
  void readline(const Char_t*, Int_t*);
  void putAsciiHeader(TString&);
  Bool_t writeline(Char_t*, Int_t, Int_t, Int_t);
  ClassDef(HTofLookup,1) // Lookup table for the TOF unpacker
};

#endif  /*!HTOFLOOKUP_H*/









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