]>
Commit | Line | Data |
---|---|---|
ca21baaa | 1 | #ifndef AliTRDSIGNALINDEX_H |
2 | #define AliTRDSIGNALINDEX_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | #include "TObject.h" | |
10 | ||
11 | ///////////////////////////////////////////////////////////// | |
12 | // General container for data from TRD detector segments // | |
13 | // Adapted from AliDigits, origin M.Ivanov // | |
14 | ///////////////////////////////////////////////////////////// | |
15 | ||
16 | //class TArrayI; | |
17 | #include "TArrayI.h" | |
18 | ||
19 | class AliTRDSignalIndex : public TObject | |
20 | { | |
21 | public: | |
22 | ||
23 | AliTRDSignalIndex(); | |
24 | AliTRDSignalIndex(Int_t nrow, Int_t ncol,Int_t ntime); | |
25 | AliTRDSignalIndex(const AliTRDSignalIndex &d); | |
26 | virtual ~AliTRDSignalIndex(); // destructor | |
27 | AliTRDSignalIndex &operator=(const AliTRDSignalIndex &d); | |
28 | virtual void Copy(TObject &d) const; | |
29 | virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime); | |
30 | virtual void Reset(); | |
31 | ||
001be664 | 32 | virtual void ResetContentConditional(Int_t nrow, Int_t ncol,Int_t ntime); |
33 | virtual void ResetContent(); | |
34 | ||
ca21baaa | 35 | virtual void ResetCounters() |
36 | { | |
37 | // reset the counters/iterators | |
38 | fPositionRow = 0; | |
39 | fPositionCol = fPositionRow + 1; | |
40 | fPositionTbin = 1; | |
41 | ||
42 | fLastRow = -1; | |
43 | fLastCol = -1; | |
44 | fLastTbin = -1; | |
45 | ||
46 | fResetCounters = kTRUE; | |
47 | } | |
48 | ||
49 | virtual void ResetTbinCounter() | |
50 | { | |
51 | // reset the time bin counter | |
52 | ||
53 | fPositionTbin = 1; | |
54 | } | |
55 | ||
56 | virtual void AddIndexTBin(Int_t row, Int_t col, Int_t tbin); | |
57 | ||
58 | Bool_t NextRCIndex(Int_t &row, Int_t &col); // get the next pad (row and column) and return kTRUE on success | |
59 | Bool_t NextRCTbinIndex(Int_t &row, Int_t &col, Int_t &tbin); // get the next timebin of a pad (row and column) and return kTRUE on success | |
60 | Bool_t NextTbinIndex(Int_t &tbin); // get the next active timebin and return kTRUE on success | |
61 | ||
62 | Int_t GetCurrentRow() {return (*fIndex)[fPositionRow];} // current row | |
63 | Int_t GetCurrentCol() {return (*fIndex)[fPositionCol];} // current col | |
64 | Int_t GetCurtentTbin() {return (*fIndex)[fPositionCol + fPositionTbin];} //current tbin | |
65 | ||
66 | void ClearAll(); // clear the array, actually destroy and recreate w/o allocating | |
67 | ||
68 | //void Dump(); // printf content - one way of iterating demo | |
69 | //void Dump2(); // printf content - another way of iterating demo | |
70 | ||
71 | //Bool_t IsAllocated() const {if (fIndex) return kTRUE; else return kFALSE;} | |
72 | Bool_t IsAllocated() const | |
73 | { | |
74 | // return kTRUE if array allocated and there is no need to call allocate | |
75 | if (!fIndex) | |
76 | return kFALSE; | |
77 | if (fIndex->GetSize() <= 0) | |
78 | return kFALSE; | |
79 | else return kTRUE; | |
80 | } | |
81 | ||
82 | void SetSM(Int_t ix) | |
83 | { | |
84 | // Set which SM | |
85 | fSM = ix; | |
86 | }; | |
87 | ||
88 | void SetStack(Int_t ix) | |
89 | { | |
90 | // Set which stack | |
91 | fStack = ix; | |
92 | }; | |
93 | ||
94 | void SetChamber(Int_t ix) | |
95 | { | |
96 | // aka set stack | |
97 | SetStack(ix); | |
98 | } | |
99 | ||
100 | void SetLayer(Int_t ix) | |
101 | { | |
102 | // Set which layer | |
103 | fLayer = ix; | |
104 | }; | |
105 | ||
106 | void SetPlane(Int_t ix) | |
107 | { | |
108 | // aka set plane | |
109 | SetLayer(ix); | |
110 | } | |
111 | ||
112 | void SetDetNumber(Int_t ix) | |
113 | { | |
114 | // Set Det Number | |
115 | fDet = ix; | |
116 | } | |
117 | ||
001be664 | 118 | virtual Int_t GetDetNumber() const {return fDet;} // Get Det number |
119 | virtual Int_t GetLayer() const {return fLayer;} // Layer = Plane = position of the chamber in TRD | |
120 | virtual Int_t GetPlane() const {return fLayer;} // Layer = Plane = position of the chamber in TRD | |
121 | virtual Int_t GetStack() const {return fStack;} // Stack = Chameber = position of the chamber in TRD | |
122 | virtual Int_t GetChamber() const {return fStack;} // Stack = Chameber = position of the chamber in TRD | |
123 | virtual Int_t GetSM() const {return fSM;} // Super module of the TRD | |
ca21baaa | 124 | |
001be664 | 125 | virtual Bool_t HasEntry() const {return fHasEntry;} // Return status if has an entry |
126 | ||
127 | TArrayI *GetArray() const {return fIndex;} // Get the tarrayi pointer for god knows what reason | |
128 | ||
129 | virtual Int_t GetNrow() const {return fNrows;} // Get Nrows | |
130 | virtual Int_t GetNcol() const {return fNcols;} // Get Ncols | |
131 | virtual Int_t GetNtime() const {return fNtbins;} // Get Ntbins | |
132 | ||
133 | //enum { kMaxRows = 16, kMaxTbins = 24, kMaxCols = 144}; | |
ca21baaa | 134 | |
ca21baaa | 135 | private: |
136 | ||
137 | Int_t fDet; // det number | |
138 | Int_t fLayer; // aka plane - position in the full TRD | |
139 | Int_t fStack; // aka chamber - position in the full TRD | |
140 | Int_t fSM; // super module - position in the full TRD | |
141 | ||
142 | protected: | |
143 | ||
144 | TArrayI *fIndex; //! monitor active pads and tbins | |
145 | ||
146 | Int_t fPositionRow; // position in the index - jumps by 1 + 1 + fNtbins | |
147 | Int_t fPositionCol; // position in the index - jumps by 1 + 1 + fNtbins | |
148 | Int_t fPositionTbin; // position in the tbin - goes from 0 to fNtbins | |
149 | ||
150 | Int_t fLastRow; // to keep track what is the RC combination | |
151 | Int_t fLastCol; // to keep track what is the RC combination | |
152 | Int_t fLastTbin; // to keep track what is the Tbin - will catch if raw data bogus | |
153 | ||
154 | Int_t fNrows; // number of rows in the chamber | |
155 | Int_t fNcols; // number of cols in the chamber | |
156 | Int_t fNtbins; // number of tbins in the chamber | |
157 | ||
158 | Int_t fMaxLimit; // max number of things in the array = nrow * ncol * ntime + nrow * ncol * 2 | |
159 | ||
160 | Bool_t fResetCounters; // reset counter status | |
161 | ||
162 | Bool_t fHasEntry; // kTRUE flag if we have an entry | |
163 | ||
164 | ClassDef(AliTRDSignalIndex,1) // Data container for one TRD detector segment | |
165 | ||
166 | }; | |
167 | ||
168 | #endif |