]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDMap.cxx
Bugfix.
[u/mrichter/AliRoot.git] / FMD / AliFMDMap.cxx
CommitLineData
e802be3e 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//____________________________________________________________________
19//
20//
21//
22#include "AliFMDMap.h" // ALIFMDMAP_H
23
24//____________________________________________________________________
25ClassImp(AliFMDMap);
26
27//____________________________________________________________________
28AliFMDMap::AliFMDMap(size_t maxDet,
29 size_t maxRing,
30 size_t maxSec,
31 size_t maxStr)
32 : fMaxDetectors(maxDet),
33 fMaxRings(maxRing),
34 fMaxSectors(maxSec),
35 fMaxStrips(maxStr)
36{
37 // Construct a map
38 //
39 // Parameters:
40 // maxDet Maximum # of detectors
41 // maxRinf Maximum # of rings
42 // maxSec Maximum # of sectors
43 // maxStr Maximum # of strips
44}
45
46
47//____________________________________________________________________
48size_t
49AliFMDMap::CalcIndex(size_t det, Char_t ring, size_t sec, size_t str) const
50{
51 // Calculate index into storage from arguments.
52 //
53 // Parameters:
54 // det Detector #
55 // ring Ring ID
56 // sec Sector #
57 // str Strip #
58 //
59 // Returns appropriate index into storage
60 //
61 size_t ringi = (ring == 'I' || ring == 'i' ? 0 : 1);
62 size_t idx =
63 (det + fMaxDetectors * (ringi + fMaxRings * (sec + fMaxSectors * str)));
64 if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) {
65 Fatal("CalcIndex", "Index (%d,'%c',%d,%d) out of bounds, "
66 "in particular the %s index",
67 det, ring, sec, str,
68 (det >= fMaxDetectors ? "Detector" :
69 (ringi >= fMaxRings ? "Ring" :
70 (sec >= fMaxSectors ? "Sector" : "Strip"))));
71 return 0;
72 }
73 return idx;
74}
75
76
77//___________________________________________________________________
78//
79// EOF
80//