]>
Commit | Line | Data |
---|---|---|
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 "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H | |
23 | ||
24 | //____________________________________________________________________ | |
25 | ClassImp(AliFMDUShortMap); | |
26 | ||
27 | //____________________________________________________________________ | |
28 | AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other) | |
29 | : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, | |
30 | other.fMaxStrips), | |
31 | fData(0) | |
32 | { | |
33 | fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
34 | for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; | |
35 | i++) fData[i] = other.fData[i]; | |
36 | } | |
37 | ||
38 | ||
39 | ||
40 | //____________________________________________________________________ | |
41 | AliFMDUShortMap::AliFMDUShortMap(size_t maxDet, | |
42 | size_t maxRing, | |
43 | size_t maxSec, | |
44 | size_t maxStr) | |
45 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), | |
46 | fData(0) | |
47 | { | |
48 | // Construct a map | |
49 | // | |
50 | // Parameters: | |
51 | // maxDet Maximum # of detectors | |
52 | // maxRinf Maximum # of rings | |
53 | // maxSec Maximum # of sectors | |
54 | // maxStr Maximum # of strips | |
55 | fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
56 | } | |
57 | ||
58 | //____________________________________________________________________ | |
59 | AliFMDUShortMap& | |
60 | AliFMDUShortMap::operator=(const AliFMDUShortMap& other) | |
61 | { | |
62 | fMaxDetectors = other.fMaxDetectors; | |
63 | fMaxRings = other.fMaxRings; | |
64 | fMaxSectors = other.fMaxSectors; | |
65 | fMaxStrips = other.fMaxStrips; | |
66 | if (fData) delete [] fData; | |
67 | fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
68 | for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; | |
69 | i++) fData[i] = other.fData[i]; | |
70 | return *this; | |
71 | } | |
72 | ||
73 | //____________________________________________________________________ | |
74 | void | |
75 | AliFMDUShortMap::Clear(const UShort_t& val) | |
76 | { | |
77 | for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; | |
78 | i++) fData[i] = val; | |
79 | } | |
80 | ||
81 | //____________________________________________________________________ | |
82 | UShort_t& | |
83 | AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) | |
84 | { | |
85 | // Get data | |
86 | // | |
87 | // Parameters: | |
88 | // det Detector # | |
89 | // ring Ring ID | |
90 | // sec Sector # | |
91 | // str Strip # | |
92 | // | |
93 | // Returns appropriate data | |
94 | // | |
95 | return fData[CalcIndex(det, ring, sec, str)]; | |
96 | } | |
97 | ||
98 | //____________________________________________________________________ | |
99 | const UShort_t& | |
100 | AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const | |
101 | { | |
102 | // Get data | |
103 | // | |
104 | // Parameters: | |
105 | // det Detector # | |
106 | // ring Ring ID | |
107 | // sec Sector # | |
108 | // str Strip # | |
109 | // | |
110 | // Returns appropriate data | |
111 | // | |
112 | return fData[CalcIndex(det, ring, sec, str)]; | |
113 | } | |
114 | ||
115 | ||
116 | //___________________________________________________________________ | |
117 | // | |
118 | // EOF | |
119 | // |