]>
Commit | Line | Data |
---|---|---|
57c3c593 | 1 | #ifndef ALIFMDALTROMAPPING_H |
2 | #define ALIFMDALTROMAPPING_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights | |
4 | * reserved. | |
5 | * | |
6 | * Latest changes by Christian Holm Christensen <cholm@nbi.dk> | |
7 | * | |
8 | * See cxx source for full Copyright notice | |
9 | */ | |
c2fc1258 | 10 | /** @file AliFMDAltroMapping.h |
11 | @author Christian Holm Christensen <cholm@nbi.dk> | |
12 | @date Sun Mar 26 18:28:11 2006 | |
13 | @brief Map HW address to detector coordinates and back again. | |
14 | */ | |
57c3c593 | 15 | #ifndef ALIALTROMAPPING_H |
16 | # include <AliAltroMapping.h> | |
17 | #endif | |
18 | #ifndef ALIFMDUSHORTMAP_H | |
19 | # include "AliFMDUShortMap.h" | |
20 | #endif | |
21 | #ifndef ROOT_TArrayI | |
22 | # include <TArrayI.h> | |
23 | #endif | |
02a27b50 | 24 | // |
25 | // Map hardware address to detector coordinates. | |
26 | // | |
27 | // The hardware address consist of a DDL number and 12bits of ALTRO | |
28 | // addresses. The ALTRO address are formatted as follows. | |
29 | // | |
30 | // 12 7 4 0 | |
31 | // |---------------|---------|------------| | |
32 | // | Board # | ALTRO # | Channel # | | |
33 | // +---------------+---------+------------+ | |
34 | // | |
35 | // | |
9f662337 | 36 | //____________________________________________________________________ |
37 | /** @class AliFMDAltroMapping | |
38 | @brief Class that encodes a map to/from ALTRO hardware address to | |
39 | FMD detector coordinates. | |
40 | ||
41 | The hardware address consist of a DDL number and 12bits of ALTRO | |
42 | addresses. The ALTRO address are formatted as follows. | |
43 | @verbatim | |
44 | 12 7 4 0 | |
45 | |---------------|---------|------------| | |
46 | | Board # | ALTRO # | Channel # | | |
47 | +---------------+---------+------------+ | |
48 | @endverbatim | |
49 | ||
50 | @ingroup FMD_base | |
51 | */ | |
57c3c593 | 52 | class AliFMDAltroMapping : public AliAltroMapping |
53 | { | |
54 | public: | |
9f662337 | 55 | /** Constructor */ |
57c3c593 | 56 | AliFMDAltroMapping(); |
02a27b50 | 57 | /** Destructor */ |
58 | virtual ~AliFMDAltroMapping() {} | |
b995fc28 | 59 | /** Return detector number corresponding to given DDL number |
60 | @param ddl DDL number | |
61 | @return Detector number */ | |
7af3df7f | 62 | Short_t DDL2Detector(UInt_t ddl) const |
63 | { | |
64 | return (ddl<=2 ? Short_t(ddl + 1) : -1); | |
65 | } | |
b995fc28 | 66 | /** Return the ring identifier corresponding to a board number |
67 | @param board Board number | |
68 | @return Ring identifier */ | |
69 | Char_t Board2Ring(UShort_t board) const { return (board%2)?'O':'I'; } | |
70 | ||
71 | /** Return the strip base number corresponding to a channel address | |
72 | @param board Board number | |
73 | @param altro Altro number | |
74 | @param channel Channel number | |
75 | @param ring On return, the ring ID | |
76 | @param sec On return, the sector number | |
77 | @param strip On return, the strip base offset | |
78 | @return @c true on success */ | |
79 | Bool_t Channel2StripBase(UShort_t board, UShort_t altro, | |
80 | UShort_t chan, Char_t& ring, | |
81 | UShort_t& sec, Short_t& str) const; | |
82 | /** Return the strip, sample corresponding to a timebin | |
83 | @param sec Sector | |
84 | @param timebin Time bin | |
85 | @param preSamples Number of pre-samples | |
86 | @param sampleRate Oversampling rate | |
87 | @param strip On return, the strip number in this channel | |
88 | @param sam On return, the sample number */ | |
89 | void Timebin2Strip(UShort_t sec, UShort_t timebin, | |
90 | UShort_t preSamples, UShort_t sampleRate, | |
91 | Short_t& strip, UShort_t& sample) const; | |
92 | ||
93 | #if 0 | |
94 | /** Map a hardware address into a detector index. | |
95 | @param hwaddr Hardware address. | |
96 | @param ring On return, the ring ID | |
97 | @param sec On return, the sector # | |
98 | @param str On return, the base of strip # | |
99 | @return @c true on success, false otherwise */ | |
100 | Bool_t Hardware2Detector(UInt_t hwaddr, | |
101 | Char_t& ring, UShort_t& sec, Short_t& str) const; | |
9f662337 | 102 | /** Map a hardware address into a detector index. |
103 | @param ddl Hardware DDL number | |
104 | @param hwaddr Hardware address. | |
105 | @param det On return, the detector # | |
106 | @param ring On return, the ring ID | |
107 | @param sec On return, the sector # | |
f6449cc0 | 108 | @param str On return, the base of strip # |
9f662337 | 109 | @return @c true on success, false otherwise */ |
57c3c593 | 110 | Bool_t Hardware2Detector(UInt_t ddl, UInt_t hwaddr, |
111 | UShort_t& det, Char_t& ring, | |
f38b1653 | 112 | UShort_t& sec, Short_t& str) const; |
b995fc28 | 113 | /** Map a hardware address into a detector index. |
114 | @param ddl Hardware DDL number | |
115 | @param board FEC number | |
116 | @param altro ALTRO number | |
117 | @param channel Channel number | |
118 | @param det On return, the detector # | |
119 | @param ring On return, the ring ID | |
120 | @param sec On return, the sector # | |
121 | @param str On return, the base of strip # | |
122 | @return @c true on success, false otherwise */ | |
123 | Bool_t Hardware2Detector(UInt_t ddl, UInt_t board, | |
124 | UInt_t altro, UInt_t channel, | |
125 | UShort_t& det, Char_t& ring, | |
126 | UShort_t& sec, Short_t& str) const; | |
127 | #endif | |
f38b1653 | 128 | /** Map a hardware address into a detector index. |
129 | @param ddl Hardware DDL number | |
130 | @param hwaddr Hardware address. | |
131 | @param timebin Timebin | |
132 | @param preSamples # of pre samples | |
133 | @param sampleRate Over sampling rate | |
134 | @param det On return, the detector # | |
135 | @param ring On return, the ring ID | |
136 | @param sec On return, the sector # | |
137 | @param str On return, the base of strip # | |
138 | @param sam On return, the sample number for this strip | |
139 | @return @c true on success, false otherwise */ | |
b995fc28 | 140 | Bool_t Hardware2Detector(UShort_t ddl, UShort_t hwaddr, |
f38b1653 | 141 | UShort_t timebin, UShort_t preSamples, |
142 | UShort_t sampleRate, | |
143 | UShort_t& det, Char_t& ring, | |
144 | UShort_t& sec, Short_t& str, | |
145 | UShort_t& sam) const; | |
f38b1653 | 146 | /** Map a hardware address into a detector index. |
147 | @param ddl Hardware DDL number | |
148 | @param board FEC number | |
149 | @param altro ALTRO number | |
150 | @param channel Channel number | |
151 | @param timebin Timebin | |
152 | @param preSamples # of pre samples | |
153 | @param sampleRate Over sampling rate | |
154 | @param det On return, the detector # | |
155 | @param ring On return, the ring ID | |
156 | @param sec On return, the sector # | |
157 | @param str On return, the base of strip # | |
158 | @param sam On return, the sample number for this strip | |
159 | @return @c true on success, false otherwise */ | |
b995fc28 | 160 | Bool_t Hardware2Detector(UShort_t ddl, UShort_t board, |
161 | UShort_t altro, UShort_t chan, | |
162 | UShort_t timebin, UShort_t preSamples, | |
163 | UShort_t sampleRate, | |
f38b1653 | 164 | UShort_t& det, Char_t& ring, |
165 | UShort_t& sec, Short_t& str, | |
166 | UShort_t& sam) const; | |
b995fc28 | 167 | |
168 | ||
169 | ||
170 | /** Return DDL number corresponding to given detector number | |
171 | @param det Detector number | |
172 | @return DDL number */ | |
173 | UShort_t Detector2DDL(UShort_t det) const { return det - 1; } | |
174 | /** Return board address corresponding to a sector | |
175 | @param ring Ring identifier | |
176 | @param sec Sector number | |
177 | @return The board number, or negative number in case of failure */ | |
178 | Short_t Sector2Board(Char_t ring, UShort_t sec) const; | |
179 | /** Convert strip address to a channel address. | |
180 | @param ring Ring identifier | |
181 | @param sec Sector number | |
182 | @param str Strip number | |
183 | @param board On return, contains the board number | |
184 | @param altro On return, contains the altro number | |
185 | @param chan On return, contains the channel number | |
186 | @return @c true on success. */ | |
187 | Bool_t Strip2Channel(Char_t ring, UShort_t sec, | |
188 | UShort_t str, UShort_t& board, | |
189 | UShort_t& altro, UShort_t& chan) const; | |
190 | /** Get the timebin correspoding to a strip and sample | |
191 | @param sec Sector number | |
192 | @param str Strip number | |
193 | @param sam Sample number | |
194 | @param preSamples Number of pre-samples. | |
195 | @param sampleRate The over-sampling rate | |
196 | @return the timebin corresponding to the passed strip */ | |
197 | UShort_t Strip2Timebin(UShort_t sec, UShort_t strip, | |
198 | UShort_t sam, UShort_t preSamples, | |
199 | UShort_t sampleRate) const; | |
200 | ||
201 | #if 0 | |
f6449cc0 | 202 | /** Map a detector index into a hardware address. |
203 | @param det The detector # | |
204 | @param ring The ring ID | |
205 | @param sec The sector # | |
206 | @param str The strip # | |
207 | @param ddl On return, hardware DDL number | |
208 | @param board On return, the FEC board address (local to DDL) | |
209 | @param altro On return, the ALTRO number (local to FEC) | |
210 | @param channel On return, the channel number (local to ALTRO) | |
211 | @return @c true on success, false otherwise */ | |
212 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, | |
213 | UShort_t sec, UShort_t str, | |
b995fc28 | 214 | UShort_t& ddl, UShort_t& board, |
215 | UShort_t& altro, UShort_t& channel) const; | |
216 | /** Map a detector index into a hardware address. | |
217 | @param det The detector # | |
218 | @param ring The ring ID | |
219 | @param sec The sector # | |
220 | @param str The strip # | |
221 | @param ddl On return, hardware DDL number | |
222 | @param hwaddr On return, hardware address. | |
223 | @return @c true on success, false otherwise */ | |
224 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, | |
225 | UShort_t sec, UShort_t str, | |
226 | UShort_t& ddl, UShort_t& hwaddr) const; | |
227 | #endif | |
f38b1653 | 228 | /** Map a detector index into a hardware address. |
229 | @param det The detector # | |
230 | @param ring The ring ID | |
231 | @param sec The sector # | |
232 | @param str The strip # | |
233 | @param sam The sample number | |
234 | @param preSamples Number of pre-samples | |
235 | @param sampleRate The oversampling rate | |
236 | @param ddl On return, hardware DDL number | |
237 | @param board On return, the FEC board address (local to DDL) | |
238 | @param altro On return, the ALTRO number (local to FEC) | |
239 | @param channel On return, the channel number (local to ALTRO) | |
240 | @param timebin On return, the timebin number (local to ALTRO) | |
241 | @return @c true on success, false otherwise */ | |
242 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, | |
243 | UShort_t sec, UShort_t str, | |
244 | UShort_t sam, | |
b995fc28 | 245 | UShort_t preSamples, UShort_t sampleRate, |
246 | UShort_t& ddl, UShort_t& board, | |
247 | UShort_t& altro, UShort_t& channel, | |
f38b1653 | 248 | UShort_t& timebin) const; |
f38b1653 | 249 | /** Map a detector index into a hardware address. |
250 | @param det The detector # | |
251 | @param ring The ring ID | |
252 | @param sec The sector # | |
253 | @param str The strip # | |
254 | @param sam The sample number | |
255 | @param preSamples Number of pre-samples | |
256 | @param sampleRate The oversampling rate | |
257 | @param ddl On return, hardware DDL number | |
258 | @param hwaddr On return, hardware address. | |
259 | @param timebin On return, the timebin number (local to ALTRO) | |
260 | @return @c true on success, false otherwise */ | |
261 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, | |
262 | UShort_t sec, UShort_t str, | |
263 | UShort_t sam, | |
b995fc28 | 264 | UShort_t preSamples, UShort_t sampleRate, |
265 | UShort_t& ddl, UShort_t& hwaddr, | |
f38b1653 | 266 | UShort_t& timebin) const; |
b995fc28 | 267 | /** Convert board, chip, channel to a hardware address |
268 | @param board Board number | |
269 | @param altro Altro number | |
270 | @param channel Channel number | |
271 | @return hardware address of a channel */ | |
272 | UInt_t ChannelAddress(UShort_t board, UShort_t altro, UShort_t channel) const; | |
273 | /** Convert a channel address to board, altro, channel fields | |
274 | @param hwaddr Channel address | |
275 | @param board On return, the Board number | |
276 | @param altro On return, the Altro number | |
277 | @param channel On return, the Channel number */ | |
278 | void ChannelAddress(UShort_t hwaddr, UShort_t& board, UShort_t& altro, | |
279 | UShort_t& channel) const; | |
9f662337 | 280 | /** convert a partial detector index into a hardware address |
281 | @param sector Sector number | |
282 | @param str Strip number | |
283 | @param ring Ring ID as an integer | |
284 | @return Hardware address */ | |
573322da | 285 | Int_t GetHWAddress(Int_t sector, Int_t str, Int_t ring); |
9f662337 | 286 | /** Get the pad-row (or sector) corresponding to hardware address |
287 | @param hwaddr hardware address | |
288 | @return Sector number */ | |
57c3c593 | 289 | Int_t GetPadRow(Int_t hwaddr) const; |
9f662337 | 290 | /** Get the pad (or strip) corresponding to hardware address |
291 | @param hwaddr hardware address | |
292 | @return Strip number */ | |
57c3c593 | 293 | Int_t GetPad(Int_t hwaddr) const; |
9f662337 | 294 | /** Get the sector (or ring) corresponding to hardware address |
295 | @param hwaddr hardware address | |
296 | @return Ring ID as an integer */ | |
57c3c593 | 297 | Int_t GetSector(Int_t hwaddr) const; |
f6449cc0 | 298 | /** Print map to standard out |
299 | @param option Option string (hw, or det) */ | |
300 | void Print(Option_t* option="hw") const; | |
57c3c593 | 301 | protected: |
9f662337 | 302 | /** Read map from file - not used |
303 | @return @c true on success */ | |
57c3c593 | 304 | virtual Bool_t ReadMapping(); |
573322da | 305 | /** Create the inverse mapping arrays */ |
306 | virtual Bool_t CreateInvMapping(); | |
57c3c593 | 307 | |
573322da | 308 | ClassDef(AliFMDAltroMapping, 2) // Read raw FMD Altro data |
57c3c593 | 309 | }; |
310 | ||
311 | #endif | |
312 | //____________________________________________________________________ | |
313 | // | |
314 | // Local Variables: | |
315 | // mode: C++ | |
316 | // End: | |
317 | // | |
318 | // EOF | |
319 | // |