LCOV - code coverage report
Current view: top level - MUON/MUONmapping - AliMpEncodePair.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 10 30.0 %
Date: 2016-06-14 17:26:59 Functions: 3 4 75.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             : *                                                                        *
       4             : * Author: The ALICE Off-line Project.                                    *
       5             : * Contributors are mentioned in the code where appropriate.              *
       6             : *                                                                        *
       7             : * Permission to use, copy, modify and distribute this software and its   *
       8             : * documentation strictly for non-commercial purposes is hereby granted   *
       9             : * without fee, provided that the above copyright notice appears in all   *
      10             : * copies and that both the copyright notice and this permission notice   *
      11             : * appear in the supporting documentation. The authors make no claims     *
      12             : * about the suitability of this software for any purpose. It is          *
      13             : * provided "as is" without express or implied warranty.                  *
      14             : **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : // AliMp::Pair functions: 
      19             : // The functions for encoding the pair of integers to another integer,
      20             : // defined withing a namespace AliMp.
      21             : // The encoded pairs can be added and subtracted.
      22             : // Author Laurent Aphecetche
      23             : 
      24             : #include "AliMpEncodePair.h"
      25             : 
      26             : #include <Riostream.h>
      27             : 
      28             : //_______________________________________________________________________
      29             : MpPair_t AliMp::Pair(Int_t first, Int_t second)
      30             : {
      31             : /// See also AliMp::PairFirst(), AliMp::PairSecond()
      32             : /// \author L. Aphecetche, SUBATECH
      33             : 
      34    24580198 :   return (( first << 16 ) | second);
      35             : }
      36             : 
      37             : //_______________________________________________________________________
      38             : Int_t AliMp::PairFirst(MpPair_t pair )
      39             : {
      40             : /// See also AliMp::Pair(), AliMp::PairSecond()
      41             : /// \author L. Aphecetche, SUBATECH
      42             : 
      43    39275960 :   return ( pair & 0xFFFF0000 ) >> 16;
      44             : }
      45             : 
      46             : //_______________________________________________________________________
      47             : Int_t AliMp::PairSecond(MpPair_t pair)
      48             : {
      49             : /// See also AliMp::Pair(), AliMp::PairFirst()
      50             : /// \author L. Aphecetche, SUBATECH
      51             : 
      52    38916214 :   return pair & 0xFFFF;
      53             : }
      54             : 
      55             : //_______________________________________________________________________
      56             : ostream& AliMp::PairPut(ostream& stream, MpPair_t pair)
      57             : {
      58             : /// A special printing for encoded pair.
      59             : 
      60           0 :   if ( pair >= 0 ) {
      61           0 :     stream << '(' << AliMp::PairFirst(pair) 
      62           0 :            << ',' << AliMp::PairSecond(pair) << ')';
      63           0 :     return stream;
      64             :   }  
      65             :   else { 
      66           0 :     stream << "AliMpIntPair::Invalid";
      67           0 :     return stream;
      68             :   }
      69           0 : }    

Generated by: LCOV version 1.11