]>
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 | **************************************************************************/ | |
e802be3e | 15 | /* $Id$ */ |
c2fc1258 | 16 | /** @file AliFMDUShortMap.cxx |
17 | @author Christian Holm Christensen <cholm@nbi.dk> | |
18 | @date Mon Mar 27 12:48:18 2006 | |
19 | @brief Per strip of unisgned shorts (16 bit) data | |
20 | */ | |
e802be3e | 21 | //____________________________________________________________________ |
22 | // | |
7684b53c | 23 | // A map of per strip UShort_t information (for example ADC values, |
24 | // number of hits and so on). | |
088f8e79 | 25 | // Used for various calib information, and the like, |
26 | // as well as in reconstruction. | |
27 | // Can be used elsewhere too. | |
e802be3e | 28 | // |
29 | #include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H | |
30 | ||
31 | //____________________________________________________________________ | |
925e6570 | 32 | ClassImp(AliFMDUShortMap) |
1a1fdef7 | 33 | #if 0 |
34 | ; // This is here to keep Emacs for indenting the next line | |
35 | #endif | |
e802be3e | 36 | |
37 | //____________________________________________________________________ | |
38 | AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other) | |
39 | : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, | |
40 | other.fMaxStrips), | |
b5ee4425 | 41 | fTotal(0), |
e802be3e | 42 | fData(0) |
43 | { | |
088f8e79 | 44 | // CTOR |
bfdc7f5d | 45 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
46 | fData = new UShort_t[fTotal]; | |
0ed9abeb | 47 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
e802be3e | 48 | } |
49 | ||
50 | ||
51 | ||
52 | //____________________________________________________________________ | |
6e79feeb | 53 | AliFMDUShortMap::AliFMDUShortMap(UShort_t maxDet, |
54 | UShort_t maxRing, | |
55 | UShort_t maxSec, | |
56 | UShort_t maxStr) | |
e802be3e | 57 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), |
b5ee4425 | 58 | fTotal(0), |
e802be3e | 59 | fData(0) |
60 | { | |
61 | // Construct a map | |
62 | // | |
63 | // Parameters: | |
64 | // maxDet Maximum # of detectors | |
65 | // maxRinf Maximum # of rings | |
66 | // maxSec Maximum # of sectors | |
67 | // maxStr Maximum # of strips | |
bfdc7f5d | 68 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
69 | fData = new UShort_t[fTotal]; | |
e802be3e | 70 | } |
71 | ||
72 | //____________________________________________________________________ | |
73 | AliFMDUShortMap& | |
74 | AliFMDUShortMap::operator=(const AliFMDUShortMap& other) | |
75 | { | |
088f8e79 | 76 | // Assignment operator |
e802be3e | 77 | fMaxDetectors = other.fMaxDetectors; |
78 | fMaxRings = other.fMaxRings; | |
79 | fMaxSectors = other.fMaxSectors; | |
80 | fMaxStrips = other.fMaxStrips; | |
81 | if (fData) delete [] fData; | |
bfdc7f5d | 82 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
83 | fData = new UShort_t[fTotal]; | |
0ed9abeb | 84 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
e802be3e | 85 | return *this; |
86 | } | |
87 | ||
88 | //____________________________________________________________________ | |
89 | void | |
6e9e7c0a | 90 | AliFMDUShortMap::Reset(const UShort_t& val) |
e802be3e | 91 | { |
088f8e79 | 92 | // Reset to val |
0ed9abeb | 93 | for (Int_t i = 0; i < fTotal; i++) fData[i] = val; |
e802be3e | 94 | } |
95 | ||
96 | //____________________________________________________________________ | |
97 | UShort_t& | |
98 | AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) | |
99 | { | |
100 | // Get data | |
101 | // | |
102 | // Parameters: | |
103 | // det Detector # | |
104 | // ring Ring ID | |
105 | // sec Sector # | |
106 | // str Strip # | |
107 | // | |
108 | // Returns appropriate data | |
109 | // | |
110 | return fData[CalcIndex(det, ring, sec, str)]; | |
111 | } | |
112 | ||
113 | //____________________________________________________________________ | |
114 | const UShort_t& | |
115 | AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const | |
116 | { | |
117 | // Get data | |
118 | // | |
119 | // Parameters: | |
120 | // det Detector # | |
121 | // ring Ring ID | |
122 | // sec Sector # | |
123 | // str Strip # | |
124 | // | |
125 | // Returns appropriate data | |
126 | // | |
127 | return fData[CalcIndex(det, ring, sec, str)]; | |
128 | } | |
129 | ||
130 | ||
131 | //___________________________________________________________________ | |
132 | // | |
133 | // EOF | |
134 | // |