HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hpiontrackertrb3lookup.h
Go to the documentation of this file.
1 #ifndef HPIONTRACKERTRB3LOOKUP_H
2 #define HPIONTRACKERTRB3LOOKUP_H
3 
4 #include "TObjArray.h"
5 #include "hparset.h"
6 #include "htrbnetdef.h"
7 
8 using namespace Trbnet;
9 using namespace std;
10 
11 class HPionTrackerTrb3LookupChan : public TObject {
12 protected:
13  Int_t module; // module number
14  Int_t cell; // cell number
15 public:
18 
19  Int_t getModule() {return module;}
20  Int_t getCell() {return cell;}
21 
22  void getAddress(Int_t& m, Int_t& c) {
23  m = module;
24  c = cell;
25  }
26 
27  void clear() {
28  module = -1;
29  cell = -1;
30  }
31 
32  void setModule(const Int_t n) {module = n;}
33  void setCell(const Int_t n) {cell = n;}
34 
35  void fill(Int_t m, Int_t c) {
36  module = m;
37  cell = c;
38  }
39 
41  module = r.getModule();
42  cell = r.getCell();
43  }
44 
45  ClassDef(HPionTrackerTrb3LookupChan, 1) // Channel level of the lookup table for the PionTracker TRB3 unpacker
46 };
47 
48 
49 class HPionTrackerTrb3LookupBoard: public TObject {
50  friend class HPionTrackerTrb3Lookup;
51 protected:
52  TObjArray* array; // pointer array containing HPionTrackerTrb3LookupChan objects
53 public:
56 
58  if (c >= 0 && c < 256) return &((*this)[c]);
59  else return 0;
60  }
61 
63  return *static_cast<HPionTrackerTrb3LookupChan*>((*array)[i]);
64  }
65 
66  Int_t getSize() {return 256;}
67  void clear();
68  ClassDef(HPionTrackerTrb3LookupBoard, 1) // Board level of the lookup table for the PionTracker TRB3 unpacker
69 };
70 
71 
73 protected:
74  TObjArray* array; // array of pointers of type HPionTrackerTrb3LookupBoard
75  Int_t arrayOffset; // offset to calculate the index
76 public:
77  HPionTrackerTrb3Lookup(const Char_t* name = "PionTrackerTrb3Lookup",
78  const Char_t* title = "Lookup table for the TRB3 unpacker of the PionTracker",
79  const Char_t* context = "PionTrackerTrb3LookupProduction",
80  Int_t minTrbnetAddress = Trbnet::kPionTrackerTrb3MinTrbnetAddress,
81  Int_t maxTrbnetAddress = Trbnet::kPionTrackerTrb3MaxTrbnetAddress);
83 
84  HPionTrackerTrb3LookupBoard* getBoard(Int_t trbnetAddress) {
85  return (HPionTrackerTrb3LookupBoard*)(array->At(trbnetAddress - arrayOffset));
86  }
88  return static_cast<HPionTrackerTrb3LookupBoard*>((*array)[i]);
89  }
90 
91  Int_t getSize() {return array->GetLast() + 1;}
92  Int_t getArrayOffset() {return arrayOffset;}
93 
94  Bool_t init(HParIo* input, Int_t* set);
95  Int_t write(HParIo* output);
96  void clear();
97  void printParams();
98  Bool_t fill(Int_t, Int_t, Int_t, Int_t);
99  Bool_t readline(const Char_t*);
100  void putAsciiHeader(TString&);
101  void write(fstream&);
102  ClassDef(HPionTrackerTrb3Lookup, 1) // Lookup table for the TRB3 unpacker of the PionTracker
103 };
104 
105 #endif /*!HPIONTRACKERTRB3LOOKUP_H*/
HPionTrackerTrb3LookupBoard * getBoard(Int_t trbnetAddress)
HPionTrackerTrb3LookupChan & operator[](Int_t i)
Int_t n
Definition: hpario.h:11
TString input
Definition: GarReader.C:5
void getAddress(Int_t &m, Int_t &c)
Definition: hparset.h:9
return output
void fill(HPionTrackerTrb3LookupChan &r)
HPionTrackerTrb3LookupChan * getChannel(Int_t c)
HPionTrackerTrb3LookupBoard * operator[](Int_t i)