]>
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 | ||
c8ab4518 | 11 | //////////////////////////////////////////////////////////////////////////// |
12 | // // | |
13 | // General container for data from TRD detector segments // | |
14 | // Adapted from AliDigits, origin M.Ivanov // | |
15 | // // | |
16 | // Author: // | |
17 | // Mateusz Ploskon (ploskon@ikf.uni-frankfurt.de) // | |
18 | // // | |
19 | //////////////////////////////////////////////////////////////////////////// | |
ca21baaa | 20 | |
ca21baaa | 21 | class AliTRDSignalIndex : public TObject |
22 | { | |
c8ab4518 | 23 | |
ca21baaa | 24 | public: |
25 | ||
26 | AliTRDSignalIndex(); | |
27 | AliTRDSignalIndex(Int_t nrow, Int_t ncol,Int_t ntime); | |
28 | AliTRDSignalIndex(const AliTRDSignalIndex &d); | |
c8ab4518 | 29 | virtual ~AliTRDSignalIndex(); |
ca21baaa | 30 | AliTRDSignalIndex &operator=(const AliTRDSignalIndex &d); |
ca21baaa | 31 | |
064d808d | 32 | virtual void Copy(TObject &d) const; |
33 | virtual void Allocate(const Int_t nrow, const Int_t ncol, const Int_t ntime); | |
001be664 | 34 | |
c8ab4518 | 35 | virtual void Reset(); |
064d808d | 36 | virtual void ResetContentConditional(const Int_t nrow, const Int_t ncol, const Int_t ntime); |
c8ab4518 | 37 | virtual void ResetContent(); |
38 | virtual void ResetCounters(); | |
064d808d | 39 | virtual void ResetTbinCounter() { } |
40 | ||
41 | void ResetArrays(); | |
001be664 | 42 | |
c8ab4518 | 43 | virtual void AddIndexTBin(Int_t row, Int_t col, Int_t tbin); |
064d808d | 44 | void AddIndexRC(const Int_t row, const Int_t col); |
001be664 | 45 | |
c8ab4518 | 46 | // Get the next pad (row and column) and return kTRUE on success |
47 | Bool_t NextRCIndex(Int_t &row, Int_t &col); | |
48 | // Get the next timebin of a pad (row and column) and return kTRUE on success | |
49 | Bool_t NextRCTbinIndex(Int_t &row, Int_t &col, Int_t &tbin); | |
50 | // Get the next active timebin and return kTRUE on success | |
51 | Bool_t NextTbinIndex(Int_t &tbin); | |
ca21baaa | 52 | |
064d808d | 53 | Int_t GetCurrentRow() const { return fCurrRow; } |
54 | Int_t GetCurrentCol() const { return fCurrCol; } | |
55 | Int_t GetCurrentTbin() const { return fCurrTbin; } | |
56 | ||
57 | Bool_t IsBoolIndex(Int_t row, Int_t col) const {return fBoolIndex[row*fNcols+col];}; | |
58 | void InitSortedIndex(); | |
59 | ||
60 | // Clear the array, actually destroy and recreate w/o allocating | |
c8ab4518 | 61 | void ClearAll(); |
62 | // Return kTRUE if array allocated and there is no need to call allocate | |
064d808d | 63 | Bool_t IsAllocated() const { if (!fBoolIndex) return kFALSE; |
64 | if (fMaxLimit <= 0) return kFALSE; | |
65 | else return kTRUE;} | |
66 | ||
67 | void SetSM(const Int_t ix) { fSM = ix; } | |
68 | void SetStack(const Int_t ix) { fStack = ix; } | |
69 | void SetLayer(const Int_t ix) { fLayer = ix; } | |
70 | void SetDetNumber(const Int_t ix) { fDet = ix; } | |
c8ab4518 | 71 | |
72 | virtual Int_t GetDetNumber() const { return fDet; } // Get Det number | |
053767a4 | 73 | virtual Int_t GetLayer() const { return fLayer; } // Layer position of the chamber in TRD |
74 | virtual Int_t GetStack() const { return fStack; } // Stack position of the chamber in TRD | |
c8ab4518 | 75 | virtual Int_t GetSM() const { return fSM; } // Super module of the TRD |
064d808d | 76 | Short_t *GetArray() const { return fSortedIndex; } // Get the array pointer for god knows what reason |
ca21baaa | 77 | |
c8ab4518 | 78 | virtual Bool_t HasEntry() const { return fHasEntry; } // Return status if has an entry |
ca21baaa | 79 | |
c8ab4518 | 80 | virtual Int_t GetNrow() const { return fNrows; } // Get Nrows |
81 | virtual Int_t GetNcol() const { return fNcols; } // Get Ncols | |
82 | virtual Int_t GetNtime() const { return fNtbins; } // Get Ntbins | |
ca21baaa | 83 | |
c8ab4518 | 84 | private: |
ca21baaa | 85 | |
c8ab4518 | 86 | Int_t fDet; // Detector number |
053767a4 | 87 | Int_t fLayer; // Layer position in the full TRD |
88 | Int_t fStack; // Stack position in the full TRD | |
c8ab4518 | 89 | Int_t fSM; // Super module - position in the full TRD |
ca21baaa | 90 | |
064d808d | 91 | Bool_t *fBoolIndex; // |
92 | Short_t *fSortedIndex; // | |
93 | Int_t fMaxLimit; // Max number of things in the array | |
94 | Int_t fPositionRC; // Position in the SortedIndex | |
95 | Bool_t fSortedWasInit; // Was SortedIndex initialized? | |
ca21baaa | 96 | |
064d808d | 97 | Int_t fCurrRow; // Last Row read out of SortedIndex |
98 | Int_t fCurrCol; // Last Col read out of SortedIndex | |
99 | Int_t fCurrTbin; // Last outgiven Tbin | |
100 | ||
c8ab4518 | 101 | Int_t fNrows; // Number of rows in the chamber |
102 | Int_t fNcols; // Number of cols in the chamber | |
103 | Int_t fNtbins; // Number of tbins in the chamber | |
ca21baaa | 104 | |
c8ab4518 | 105 | Bool_t fHasEntry; // kTRUE flag if we have an entry |
ca21baaa | 106 | |
c8ab4518 | 107 | ClassDef(AliTRDSignalIndex,2) // Data container for one TRD detector segment |
ca21baaa | 108 | |
109 | }; | |
ca21baaa | 110 | #endif |
064d808d | 111 | |
112 | /* | |
113 | Comment from 22 Dec 2008 | |
114 | ||
115 | The structure of the Index was changed. Now no Tbin is saved anymore, | |
116 | only RC combination are saved! (reasons see below) | |
117 | ||
118 | For the readout, all tbins for a RC combination must be read out to find | |
119 | the time bin of signal > 0. | |
120 | ||
121 | THE WRITING PROCEDURE: | |
122 | AddIndexTBin is now obsolate, use AddIndexRC instead as AddIndexTBin will | |
123 | be deleted in future. | |
124 | ||
125 | example that gives exactely the same output as before: | |
126 | as it was: | |
127 | AliTRDSignalIndexes *indexes; | |
128 | AliTRDarrayADC *Signal; //or AliTRDarraySignal *Signal; | |
129 | if(Signal->GetDataB(row, col, time)>0) | |
130 | indexes->AddIndexTBin(row, col, time); | |
131 | ||
132 | as it should be from no on: | |
133 | AliTRDSignalIndexes *indexes; | |
134 | AliTRDarrayADC *Signal; //or AliTRDarraySignal *Signal; | |
135 | if(Signal->GetDataB(row, col, time)>0) | |
136 | indexes->AddIndexRC(row, col); | |
137 | ||
138 | ||
139 | ||
140 | THE READING PROCEDURE: | |
141 | In most cases you can leave anything as it is. | |
142 | See more in the example. | |
143 | ||
144 | example: | |
145 | as it was: | |
146 | AliTRDSignalIndexes *indexes; | |
147 | AliTRDarraySignal *Signal; | |
148 | while(indexes->NextRCTbinIndex(row, col, time)) | |
149 | {...} | |
150 | ||
151 | as it should be from no on to get the exactely the same output as before: | |
152 | AliTRDSignalIndexes *indexes; | |
153 | AliTRDarraySignal *Signal; | |
154 | while(indexes->NextRCTbinIndex(row, col, time)) | |
155 | if(Signal->GetData(row, col, time)>0) | |
156 | {...} | |
157 | ||
158 | as it should be idealy: | |
159 | AliTRDSignalIndexes *indexes; | |
160 | AliTRDarraySignal *Signal; | |
161 | for(time = 0; time < Ntime; time++) | |
162 | while(indexes->NextRCIndex(row, col, time)) | |
163 | if(Signal->GetData(row, col, time)>0) | |
164 | {...} | |
165 | ||
166 | ||
167 | REASON OF THE CHANGES: | |
168 | ||
169 | The array saved the information nicely, but it turned out that sorting | |
170 | the array by column would have many benefits. | |
171 | I.e. it is crucial for fivePadClusters and it if much faster to allocate. | |
172 | But the sorting is not fast if the tbin is also saved. | |
173 | Moreover the tbin information was alsmost useless because, | |
174 | whenever an RC index existed, many of the possible tbins where used. | |
175 | ||
176 | Theodor Rascanu | |
177 | ||
178 | */ |