]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpEncodePair.cxx
Replacement of TVector2 object with two doubles
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpEncodePair.cxx
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 #include "AliMpEncodePair.h"
19
20 #include <Riostream.h>
21
22 //_______________________________________________________________________
23 MpPair_t AliMp::Pair(Int_t first, Int_t second)
24 {
25 /// See also AliMp::PairFirst(), AliMp::PairSecond()
26 /// \author L. Aphecetche, SUBATECH
27
28   return (( first << 16 ) | second);
29 }
30
31 //_______________________________________________________________________
32 Int_t AliMp::PairFirst(MpPair_t pair )
33 {
34 /// See also AliMp::Pair(), AliMp::PairSecond()
35 /// \author L. Aphecetche, SUBATECH
36
37   return ( pair & 0xFFFF0000 ) >> 16;
38 }
39
40 //_______________________________________________________________________
41 Int_t AliMp::PairSecond(MpPair_t pair)
42 {
43 /// See also AliMp::Pair(), AliMp::PairFirst()
44 /// \author L. Aphecetche, SUBATECH
45
46   return pair & 0xFFFF;
47 }
48
49 //_______________________________________________________________________
50 ostream& AliMp::PairPut(ostream& stream, MpPair_t pair)
51 {
52   if ( pair >= 0 ) {
53     stream << '(' << AliMp::PairFirst(pair) 
54            << ',' << AliMp::PairSecond(pair) << ')';
55     return stream;
56   }  
57   else { 
58     stream << "AliMpIntPair::Invalid";
59     return stream;
60   }
61 }