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