]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDStripIndex.h
Code to draw calibrations
[u/mrichter/AliRoot.git] / FMD / AliFMDStripIndex.h
CommitLineData
82fcb4e0 1#ifndef ALIFMDSTRIPINDEX_H
2#define ALIFMDSTRIPINDEX_H
a91c42d1 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
faf80567 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//
a91c42d1 25// Added by Hans H. Dalsgaard (hans.dalsgaard@cern.ch)
26
27
faf80567 28class AliFMDStripIndex
a91c42d1 29{
faf80567 30public:
31 /**
32 * Constructor
33 *
34 */
35 AliFMDStripIndex() {}
36 /**
37 * Destructor
38 *
39 */
40 virtual ~AliFMDStripIndex() {}
41 /**
42 * Pack an identifier from detector coordinates
43 *
44 * @param det Detector
45 * @param rng Ring
46 * @param sec Sector
47 * @param str Strip
48 *
49 * @return Packed identifier
50 */
a91c42d1 51 static UInt_t Pack(UShort_t det, Char_t rng, UShort_t sec, UShort_t str)
52 {
53 UInt_t irg = (rng == 'I' || rng == 'i' ? 0 : 1);
54 UInt_t id = (((str & 0x1FF) << 0) |
55 ((sec & 0x03F) << 9) |
56 ((irg & 0x001) << 16) |
57 ((det & 0x003) << 17));
58 return id;
59 }
faf80567 60 /**
61 * Unpack an identifier to detector coordinates
62 *
63 * @param id Identifier to unpack
64 * @param det On return, the detector
65 * @param rng On return, the ring
66 * @param sec On return, the sector
67 * @param str On return, the strip
68 */
a91c42d1 69 static void Unpack(UInt_t id,
faf80567 70 UShort_t& det, Char_t& rng, UShort_t& sec, UShort_t& str)
a91c42d1 71 {
72 str = ((id >> 0) & 0x1FF);
73 sec = ((id >> 9) & 0x03F);
74 rng = ((id >> 16) & 0x001) ? 'O' : 'I';
75 det = ((id >> 17) & 0x003);
76 }
77
faf80567 78 ClassDef(AliFMDStripIndex,1)
a91c42d1 79};
82fcb4e0 80#endif
faf80567 81//
82// Local Variables:
83// mode: C++
84// End:
85//