]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDStripIndex.h
Fixes for pA indenfication of events
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDStripIndex.h
CommitLineData
142c5859 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 **************************************************************************/
ffca499d 17/**
18 * @file AliFMDStripIndex.h
19 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
20 * @date Wed Mar 23 14:04:10 2011
21 *
22 * @brief
23 *
24 *
bd6f5206 25 * @ingroup pwglf_forward_mc
ffca499d 26 */
142c5859 27
28// Struct to encode a strip address into one integer
29// developed by Christian Holm Christensen (cholm@nbi.dk).
30//
31// The functions are static to ensure applicability from
32// anywhere. This is needed to smoothly store strip addresses in track
33// references.
34//
35// Added by Hans H. Dalsgaard (hans.dalsgaard@cern.ch)
36
37
ffca499d 38/**
39 * Functions to encode/decode strip address from User ID in a
40 * track-reference
41 *
bd6f5206 42 * @ingroup pwglf_forward_mc
ffca499d 43 */
142c5859 44class AliFMDStripIndex
45{
46public:
47 /**
48 * Constructor
49 *
50 */
51 AliFMDStripIndex() {}
52 /**
53 * Destructor
54 *
55 */
56 virtual ~AliFMDStripIndex() {}
57 /**
58 * Pack an identifier from detector coordinates
59 *
60 * @param det Detector
61 * @param rng Ring
62 * @param sec Sector
63 * @param str Strip
64 *
65 * @return Packed identifier
66 */
67 static UInt_t Pack(UShort_t det, Char_t rng, UShort_t sec, UShort_t str)
68 {
69 UInt_t irg = (rng == 'I' || rng == 'i' ? 0 : 1);
70 UInt_t id = (((str & 0x1FF) << 0) |
71 ((sec & 0x03F) << 9) |
72 ((irg & 0x001) << 16) |
73 ((det & 0x003) << 17));
74 return id;
75 }
76 /**
77 * Unpack an identifier to detector coordinates
78 *
79 * @param id Identifier to unpack
80 * @param det On return, the detector
81 * @param rng On return, the ring
82 * @param sec On return, the sector
83 * @param str On return, the strip
84 */
85 static void Unpack(UInt_t id,
86 UShort_t& det, Char_t& rng, UShort_t& sec, UShort_t& str)
87 {
88 str = ((id >> 0) & 0x1FF);
89 sec = ((id >> 9) & 0x03F);
90 rng = ((id >> 16) & 0x001) ? 'O' : 'I';
91 det = ((id >> 17) & 0x003);
92 }
93
94 ClassDef(AliFMDStripIndex,1)
95};
96#endif
97//
98// Local Variables:
99// mode: C++
100// End:
101//