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