AliFMDAltroMapping();
/** Destructor */
virtual ~AliFMDAltroMapping() {}
+ /** Return detector number corresponding to given DDL number
+ @param ddl DDL number
+ @return Detector number */
+ Short_t DDL2Detector(UInt_t ddl) const
+ {
+ return (ddl<=2 ? Short_t(ddl + 1) : -1);
+ }
+ /** Return the ring identifier corresponding to a board number
+ @param board Board number
+ @return Ring identifier */
+ Char_t Board2Ring(UShort_t board) const { return (board%2)?'O':'I'; }
+
+ /** Return the strip base number corresponding to a channel address
+ @param board Board number
+ @param altro Altro number
+ @param channel Channel number
+ @param ring On return, the ring ID
+ @param sec On return, the sector number
+ @param strip On return, the strip base offset
+ @return @c true on success */
+ Bool_t Channel2StripBase(UShort_t board, UShort_t altro,
+ UShort_t chan, Char_t& ring,
+ UShort_t& sec, Short_t& str) const;
+ /** Return the strip, sample corresponding to a timebin
+ @param sec Sector
+ @param timebin Time bin
+ @param preSamples Number of pre-samples
+ @param sampleRate Oversampling rate
+ @param strip On return, the strip number in this channel
+ @param sam On return, the sample number */
+ void Timebin2Strip(UShort_t sec, UShort_t timebin,
+ UShort_t preSamples, UShort_t sampleRate,
+ Short_t& strip, UShort_t& sample) const;
+
+#if 0
+ /** Map a hardware address into a detector index.
+ @param hwaddr Hardware address.
+ @param ring On return, the ring ID
+ @param sec On return, the sector #
+ @param str On return, the base of strip #
+ @return @c true on success, false otherwise */
+ Bool_t Hardware2Detector(UInt_t hwaddr,
+ Char_t& ring, UShort_t& sec, Short_t& str) const;
/** Map a hardware address into a detector index.
@param ddl Hardware DDL number
@param hwaddr Hardware address.
Bool_t Hardware2Detector(UInt_t ddl, UInt_t hwaddr,
UShort_t& det, Char_t& ring,
UShort_t& sec, Short_t& str) const;
+ /** Map a hardware address into a detector index.
+ @param ddl Hardware DDL number
+ @param board FEC number
+ @param altro ALTRO number
+ @param channel Channel number
+ @param det On return, the detector #
+ @param ring On return, the ring ID
+ @param sec On return, the sector #
+ @param str On return, the base of strip #
+ @return @c true on success, false otherwise */
+ Bool_t Hardware2Detector(UInt_t ddl, UInt_t board,
+ UInt_t altro, UInt_t channel,
+ UShort_t& det, Char_t& ring,
+ UShort_t& sec, Short_t& str) const;
+#endif
/** Map a hardware address into a detector index.
@param ddl Hardware DDL number
@param hwaddr Hardware address.
@param str On return, the base of strip #
@param sam On return, the sample number for this strip
@return @c true on success, false otherwise */
- Bool_t Hardware2Detector(UInt_t ddl, UInt_t hwaddr,
+ Bool_t Hardware2Detector(UShort_t ddl, UShort_t hwaddr,
UShort_t timebin, UShort_t preSamples,
UShort_t sampleRate,
UShort_t& det, Char_t& ring,
UShort_t& sec, Short_t& str,
UShort_t& sam) const;
- /** Map a hardware address into a detector index.
- @param ddl Hardware DDL number
- @param board FEC number
- @param altro ALTRO number
- @param channel Channel number
- @param det On return, the detector #
- @param ring On return, the ring ID
- @param sec On return, the sector #
- @param str On return, the base of strip #
- @return @c true on success, false otherwise */
- Bool_t Hardware2Detector(UInt_t ddl, UInt_t board,
- UInt_t altro, UInt_t channel,
- UShort_t& det, Char_t& ring,
- UShort_t& sec, Short_t& str) const;
/** Map a hardware address into a detector index.
@param ddl Hardware DDL number
@param board FEC number
@param str On return, the base of strip #
@param sam On return, the sample number for this strip
@return @c true on success, false otherwise */
- Bool_t Hardware2Detector(UInt_t ddl, UInt_t board,
- UInt_t altro, UInt_t chan,
- UInt_t timebin, UInt_t preSamples,
- UInt_t sampleRate,
+ Bool_t Hardware2Detector(UShort_t ddl, UShort_t board,
+ UShort_t altro, UShort_t chan,
+ UShort_t timebin, UShort_t preSamples,
+ UShort_t sampleRate,
UShort_t& det, Char_t& ring,
UShort_t& sec, Short_t& str,
UShort_t& sam) const;
+
+
+
+ /** Return DDL number corresponding to given detector number
+ @param det Detector number
+ @return DDL number */
+ UShort_t Detector2DDL(UShort_t det) const { return det - 1; }
+ /** Return board address corresponding to a sector
+ @param ring Ring identifier
+ @param sec Sector number
+ @return The board number, or negative number in case of failure */
+ Short_t Sector2Board(Char_t ring, UShort_t sec) const;
+ /** Convert strip address to a channel address.
+ @param ring Ring identifier
+ @param sec Sector number
+ @param str Strip number
+ @param board On return, contains the board number
+ @param altro On return, contains the altro number
+ @param chan On return, contains the channel number
+ @return @c true on success. */
+ Bool_t Strip2Channel(Char_t ring, UShort_t sec,
+ UShort_t str, UShort_t& board,
+ UShort_t& altro, UShort_t& chan) const;
+ /** Get the timebin correspoding to a strip and sample
+ @param sec Sector number
+ @param str Strip number
+ @param sam Sample number
+ @param preSamples Number of pre-samples.
+ @param sampleRate The over-sampling rate
+ @return the timebin corresponding to the passed strip */
+ UShort_t Strip2Timebin(UShort_t sec, UShort_t strip,
+ UShort_t sam, UShort_t preSamples,
+ UShort_t sampleRate) const;
+
+#if 0
/** Map a detector index into a hardware address.
@param det The detector #
@param ring The ring ID
@return @c true on success, false otherwise */
Bool_t Detector2Hardware(UShort_t det, Char_t ring,
UShort_t sec, UShort_t str,
- UInt_t& ddl, UInt_t& board,
- UInt_t& altro, UInt_t& channel) const;
+ UShort_t& ddl, UShort_t& board,
+ UShort_t& altro, UShort_t& channel) const;
+ /** Map a detector index into a hardware address.
+ @param det The detector #
+ @param ring The ring ID
+ @param sec The sector #
+ @param str The strip #
+ @param ddl On return, hardware DDL number
+ @param hwaddr On return, hardware address.
+ @return @c true on success, false otherwise */
+ Bool_t Detector2Hardware(UShort_t det, Char_t ring,
+ UShort_t sec, UShort_t str,
+ UShort_t& ddl, UShort_t& hwaddr) const;
+#endif
/** Map a detector index into a hardware address.
@param det The detector #
@param ring The ring ID
Bool_t Detector2Hardware(UShort_t det, Char_t ring,
UShort_t sec, UShort_t str,
UShort_t sam,
- UShort_t preSamples, UShort_t sampleRate,
- UInt_t& ddl, UInt_t& board,
- UInt_t& altro, UInt_t& channel,
+ UShort_t preSamples, UShort_t sampleRate,
+ UShort_t& ddl, UShort_t& board,
+ UShort_t& altro, UShort_t& channel,
UShort_t& timebin) const;
- /** Map a detector index into a hardware address.
- @param det The detector #
- @param ring The ring ID
- @param sec The sector #
- @param str The strip #
- @param ddl On return, hardware DDL number
- @param hwaddr On return, hardware address.
- @return @c true on success, false otherwise */
- Bool_t Detector2Hardware(UShort_t det, Char_t ring,
- UShort_t sec, UShort_t str,
- UInt_t& ddl, UInt_t& hwaddr) const;
/** Map a detector index into a hardware address.
@param det The detector #
@param ring The ring ID
Bool_t Detector2Hardware(UShort_t det, Char_t ring,
UShort_t sec, UShort_t str,
UShort_t sam,
- UShort_t preSamples, UShort_t sampleRate,
- UInt_t& ddl, UInt_t& hwaddr,
+ UShort_t preSamples, UShort_t sampleRate,
+ UShort_t& ddl, UShort_t& hwaddr,
UShort_t& timebin) const;
+ /** Convert board, chip, channel to a hardware address
+ @param board Board number
+ @param altro Altro number
+ @param channel Channel number
+ @return hardware address of a channel */
+ UInt_t ChannelAddress(UShort_t board, UShort_t altro, UShort_t channel) const;
+ /** Convert a channel address to board, altro, channel fields
+ @param hwaddr Channel address
+ @param board On return, the Board number
+ @param altro On return, the Altro number
+ @param channel On return, the Channel number */
+ void ChannelAddress(UShort_t hwaddr, UShort_t& board, UShort_t& altro,
+ UShort_t& channel) const;
/** convert a partial detector index into a hardware address
@param sector Sector number
@param str Strip number