]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDAltroMapping.h
Obsolete.
[u/mrichter/AliRoot.git] / FMD / AliFMDAltroMapping.h
index 138553f86da6e2203975a27d0430dee3d621c536..272f35c2678ba57b4026149af1ede311db5f1957 100644 (file)
@@ -56,6 +56,49 @@ public:
   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.  
@@ -66,7 +109,7 @@ public:
       @return @c true on success, false otherwise */
   Bool_t Hardware2Detector(UInt_t    ddl, UInt_t    hwaddr, 
                           UShort_t& det, Char_t&   ring, 
-                          UShort_t& sec, UShort_t& str) const;
+                          UShort_t& sec, Short_t& str) const;
   /** Map a hardware address into a detector index. 
       @param ddl     Hardware DDL number 
       @param board   FEC number
@@ -80,7 +123,82 @@ public:
   Bool_t Hardware2Detector(UInt_t    ddl,   UInt_t    board, 
                           UInt_t    altro, UInt_t    channel,
                           UShort_t& det,   Char_t&   ring, 
-                          UShort_t& sec,   UShort_t& str) const;
+                          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 timebin    Timebin 
+      @param preSamples # of pre samples 
+      @param sampleRate Over sampling rate 
+      @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 #
+      @param sam        On return, the sample number for this strip
+      @return @c true on success, false otherwise */
+  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 timebin    Timebin 
+      @param preSamples # of pre samples 
+      @param sampleRate Over sampling rate 
+      @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 #
+      @param sam        On return, the sample number for this strip
+      @return @c true on success, false otherwise */
+  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
@@ -93,8 +211,8 @@ public:
       @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
@@ -105,7 +223,60 @@ public:
       @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;
+                          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
+      @param sec         The sector #
+      @param str         The strip #
+      @param sam         The sample number 
+      @param preSamples  Number of pre-samples
+      @param sampleRate  The oversampling rate 
+      @param ddl         On return, hardware DDL number 
+      @param board       On return, the FEC board address (local to DDL)
+      @param altro       On return, the ALTRO number (local to FEC)
+      @param channel     On return, the channel number (local to ALTRO)
+      @param timebin     On return, the timebin number (local to ALTRO)
+      @return @c true on success, false otherwise */
+  Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
+                          UShort_t  sec,        UShort_t  str,
+                          UShort_t  sam, 
+                          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 sam         The sample number 
+      @param preSamples  Number of pre-samples
+      @param sampleRate  The oversampling rate 
+      @param ddl         On return, hardware DDL number 
+      @param hwaddr      On return, hardware address.  
+      @param timebin     On return, the timebin number (local to ALTRO)
+      @return @c true on success, false otherwise */
+  Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
+                          UShort_t  sec,        UShort_t  str,
+                          UShort_t  sam, 
+                          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