LCOV - code coverage report
Current view: top level - FMD/FMDbase - AliFMDStripIndex.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 6 100.0 %
Date: 2016-06-14 17:26:59 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #ifndef ALIFMDSTRIPINDEX_H
       2             : #define ALIFMDSTRIPINDEX_H
       3             : /**************************************************************************
       4             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       5             :  *                                                                        *
       6             :  * Author: The ALICE Off-line Project.                                    *
       7             :  * Contributors are mentioned in the code where appropriate.              *
       8             :  *                                                                        *
       9             :  * Permission to use, copy, modify and distribute this software and its   *
      10             :  * documentation strictly for non-commercial purposes is hereby granted   *
      11             :  * without fee, provided that the above copyright notice appears in all   *
      12             :  * copies and that both the copyright notice and this permission notice   *
      13             :  * appear in the supporting documentation. The authors make no claims     *
      14             :  * about the suitability of this software for any purpose. It is          *
      15             :  * provided "as is" without express or implied warranty.                  *
      16             :  **************************************************************************/
      17             : 
      18             : // Struct to encode a strip address into one integer
      19             : // developed by Christian Holm Christensen (cholm@nbi.dk).
      20             : // 
      21             : // The functions are static to ensure applicability from
      22             : // anywhere. This is needed to smoothly store strip addresses in track
      23             : // references. 
      24             : //
      25             : // Added by Hans H. Dalsgaard (hans.dalsgaard@cern.ch) 
      26             : 
      27             : 
      28             : class AliFMDStripIndex
      29             : {
      30             : public:
      31             :   enum { 
      32             :     // Mask of ID
      33             :     kIdMask = 0x0007FFFF,
      34             :     // Mask of energy 
      35             :     kEMask  = 0xFFF80000,
      36             :     // Offset of energy 
      37             :     kEOffset = 19
      38             :   };
      39             :   /** 
      40             :    * Constructor
      41             :    * 
      42             :    */  
      43             :   AliFMDStripIndex() {}
      44             :   /** 
      45             :    * Destructor 
      46             :    * 
      47             :    */
      48             :   virtual ~AliFMDStripIndex() {}
      49             :   /** 
      50             :    * Pack an identifier from detector coordinates
      51             :    * 
      52             :    * @param det  Detector
      53             :    * @param rng  Ring
      54             :    * @param sec  Sector
      55             :    * @param str  Strip
      56             :    * 
      57             :    * @return Packed identifier 
      58             :    */
      59             :   static UInt_t Pack(UShort_t det, Char_t rng, UShort_t sec, UShort_t str) 
      60             :   {
      61         354 :     UInt_t irg  = (rng == 'I' || rng == 'i' ? 0 : 1);
      62         220 :     UInt_t id   = (((str & 0x1FF) <<  0) | 
      63         220 :                    ((sec & 0x03F) <<  9) | 
      64         220 :                    ((irg & 0x001) << 16) | 
      65         110 :                    ((det & 0x003) << 17));
      66         110 :     return (id & kIdMask);
      67             :   }
      68             :   /** 
      69             :    * Unpack an identifier to detector coordinates
      70             :    * 
      71             :    * @param id   Identifier to unpack
      72             :    * @param det  On return, the detector
      73             :    * @param rng  On return, the ring
      74             :    * @param sec  On return, the sector
      75             :    * @param str  On return, the strip
      76             :    */  
      77             :   static void Unpack(UInt_t id, 
      78             :                      UShort_t& det, Char_t& rng, UShort_t& sec, UShort_t& str)
      79             :   {
      80             :     UInt_t tmp = (kIdMask & id);
      81             :     str = ((tmp >>  0) & 0x1FF);
      82             :     sec = ((tmp >>  9) & 0x03F);
      83             :     rng = ((tmp >> 16) & 0x001) ? 'O' : 'I';
      84             :     det = ((tmp >> 17) & 0x003);
      85             :   }
      86             :   ClassDef(AliFMDStripIndex,1)
      87             : };
      88             : #endif
      89             : //
      90             : // Local Variables:
      91             : //   mode: C++
      92             : // End:
      93             : //

Generated by: LCOV version 1.11