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