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