]>
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 | ||
32 | virtual void ResetCounters() | |
33 | { | |
34 | // reset the counters/iterators | |
35 | fPositionRow = 0; | |
36 | fPositionCol = fPositionRow + 1; | |
37 | fPositionTbin = 1; | |
38 | ||
39 | fLastRow = -1; | |
40 | fLastCol = -1; | |
41 | fLastTbin = -1; | |
42 | ||
43 | fResetCounters = kTRUE; | |
44 | } | |
45 | ||
46 | virtual void ResetTbinCounter() | |
47 | { | |
48 | // reset the time bin counter | |
49 | ||
50 | fPositionTbin = 1; | |
51 | } | |
52 | ||
53 | virtual void AddIndexTBin(Int_t row, Int_t col, Int_t tbin); | |
54 | ||
55 | Bool_t NextRCIndex(Int_t &row, Int_t &col); // get the next pad (row and column) and return kTRUE on success | |
56 | 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 | |
57 | Bool_t NextTbinIndex(Int_t &tbin); // get the next active timebin and return kTRUE on success | |
58 | ||
59 | Int_t GetCurrentRow() {return (*fIndex)[fPositionRow];} // current row | |
60 | Int_t GetCurrentCol() {return (*fIndex)[fPositionCol];} // current col | |
61 | Int_t GetCurtentTbin() {return (*fIndex)[fPositionCol + fPositionTbin];} //current tbin | |
62 | ||
63 | void ClearAll(); // clear the array, actually destroy and recreate w/o allocating | |
64 | ||
65 | //void Dump(); // printf content - one way of iterating demo | |
66 | //void Dump2(); // printf content - another way of iterating demo | |
67 | ||
68 | //Bool_t IsAllocated() const {if (fIndex) return kTRUE; else return kFALSE;} | |
69 | Bool_t IsAllocated() const | |
70 | { | |
71 | // return kTRUE if array allocated and there is no need to call allocate | |
72 | if (!fIndex) | |
73 | return kFALSE; | |
74 | if (fIndex->GetSize() <= 0) | |
75 | return kFALSE; | |
76 | else return kTRUE; | |
77 | } | |
78 | ||
79 | void SetSM(Int_t ix) | |
80 | { | |
81 | // Set which SM | |
82 | fSM = ix; | |
83 | }; | |
84 | ||
85 | void SetStack(Int_t ix) | |
86 | { | |
87 | // Set which stack | |
88 | fStack = ix; | |
89 | }; | |
90 | ||
91 | void SetChamber(Int_t ix) | |
92 | { | |
93 | // aka set stack | |
94 | SetStack(ix); | |
95 | } | |
96 | ||
97 | void SetLayer(Int_t ix) | |
98 | { | |
99 | // Set which layer | |
100 | fLayer = ix; | |
101 | }; | |
102 | ||
103 | void SetPlane(Int_t ix) | |
104 | { | |
105 | // aka set plane | |
106 | SetLayer(ix); | |
107 | } | |
108 | ||
109 | void SetDetNumber(Int_t ix) | |
110 | { | |
111 | // Set Det Number | |
112 | fDet = ix; | |
113 | } | |
114 | ||
115 | const Int_t GetDetNumber() {return fDet;} // Get Det number | |
116 | const Int_t GetLayer() {return fLayer;} // Layer = Plane = position of the chamber in TRD | |
117 | const Int_t GetPlane() {return fLayer;} // Layer = Plane = position of the chamber in TRD | |
118 | const Int_t GetStack() {return fStack;} // Stack = Chameber = position of the chamber in TRD | |
119 | const Int_t GetChamber() {return fStack;} // Stack = Chameber = position of the chamber in TRD | |
120 | const Int_t GetSM() {return fSM;} // Super module of the TRD | |
121 | ||
122 | const Bool_t HasEntry() {return fHasEntry;} // Return status if has an entry | |
123 | ||
124 | TArrayI *GetArray() {return fIndex;} // Get the tarrayi pointer for god knows what reason | |
125 | ||
126 | private: | |
127 | ||
128 | Int_t fDet; // det number | |
129 | Int_t fLayer; // aka plane - position in the full TRD | |
130 | Int_t fStack; // aka chamber - position in the full TRD | |
131 | Int_t fSM; // super module - position in the full TRD | |
132 | ||
133 | protected: | |
134 | ||
135 | TArrayI *fIndex; //! monitor active pads and tbins | |
136 | ||
137 | Int_t fPositionRow; // position in the index - jumps by 1 + 1 + fNtbins | |
138 | Int_t fPositionCol; // position in the index - jumps by 1 + 1 + fNtbins | |
139 | Int_t fPositionTbin; // position in the tbin - goes from 0 to fNtbins | |
140 | ||
141 | Int_t fLastRow; // to keep track what is the RC combination | |
142 | Int_t fLastCol; // to keep track what is the RC combination | |
143 | Int_t fLastTbin; // to keep track what is the Tbin - will catch if raw data bogus | |
144 | ||
145 | Int_t fNrows; // number of rows in the chamber | |
146 | Int_t fNcols; // number of cols in the chamber | |
147 | Int_t fNtbins; // number of tbins in the chamber | |
148 | ||
149 | Int_t fMaxLimit; // max number of things in the array = nrow * ncol * ntime + nrow * ncol * 2 | |
150 | ||
151 | Bool_t fResetCounters; // reset counter status | |
152 | ||
153 | Bool_t fHasEntry; // kTRUE flag if we have an entry | |
154 | ||
155 | ClassDef(AliTRDSignalIndex,1) // Data container for one TRD detector segment | |
156 | ||
157 | }; | |
158 | ||
159 | #endif |