1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //Struct to encode a strip address into one integer
17 //developed by Christian Holm Christensen (cholm@nbi.dk).
18 // The functions are static
19 // to ensure applicability from anywhere. This is needed to smoothly store
20 //strip addresses in track references.
21 // Added by Hans H. Dalsgaard (hans.dalsgaard@cern.ch)
24 struct AliFMDStripIndex
26 static UInt_t Pack(UShort_t det, Char_t rng, UShort_t sec, UShort_t str)
28 UInt_t irg = (rng == 'I' || rng == 'i' ? 0 : 1);
29 UInt_t id = (((str & 0x1FF) << 0) |
30 ((sec & 0x03F) << 9) |
31 ((irg & 0x001) << 16) |
32 ((det & 0x003) << 17));
35 static void Unpack(UInt_t id,
36 UShort_t& det, Char_t& rng, UShort_t& sec, UShort_t& str)
38 str = ((id >> 0) & 0x1FF);
39 sec = ((id >> 9) & 0x03F);
40 rng = ((id >> 16) & 0x001) ? 'O' : 'I';
41 det = ((id >> 17) & 0x003);
44 ClassDef(AliFMDStripIndex,0)