]>
Commit | Line | Data |
---|---|---|
56b1929b | 1 | /************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN. * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this * | |
9 | * software and its documentation strictly for non-commercial * | |
10 | * purposes is hereby granted without fee, provided that the * | |
11 | * above copyright notice appears in all copies and that both * | |
12 | * the copyright notice and this permission notice appear in * | |
13 | * the supporting documentation. The authors make no claims * | |
14 | * about the suitability of this software for any purpose. It * | |
15 | * is provided "as is" without express or implied warranty. * | |
16 | **************************************************************/ | |
17 | /* $Id$ */ | |
c2fc1258 | 18 | /** @file AliFMDBoolMap.cxx |
19 | @author Christian Holm Christensen <cholm@nbi.dk> | |
20 | @date Sun Mar 26 18:28:42 2006 | |
21 | @brief Per strip Boolean map | |
22 | */ | |
56b1929b | 23 | //__________________________________________________________ |
24 | // | |
088f8e79 | 25 | // Map of Bool_t for each FMD strip |
26 | // Used in calibration and the like classes. | |
27 | // Used amoung other things for dead-channel map | |
28 | // Can also be used for other stuff too | |
56b1929b | 29 | // Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen |
30 | // | |
31 | #include "AliFMDBoolMap.h" //ALIFMDBOOLMAP_H | |
32 | //__________________________________________________________ | |
925e6570 | 33 | ClassImp(AliFMDBoolMap) |
1a1fdef7 | 34 | #if 0 |
35 | ; // This is here to keep Emacs for indenting the next line | |
36 | #endif | |
56b1929b | 37 | //__________________________________________________________ |
38 | AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other) | |
39 | : AliFMDMap(other.fMaxDetectors, | |
40 | other.fMaxRings, | |
41 | other.fMaxSectors, | |
42 | other.fMaxStrips), | |
021f1396 | 43 | fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips), |
56b1929b | 44 | fData(0) |
45 | { | |
46 | // Copy constructor | |
021f1396 | 47 | if (fTotal == 0) fTotal = 51200; |
bfdc7f5d | 48 | fData = new Bool_t[fTotal]; |
0ed9abeb | 49 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
56b1929b | 50 | } |
51 | ||
021f1396 | 52 | //__________________________________________________________ |
53 | AliFMDBoolMap::AliFMDBoolMap() | |
54 | : AliFMDMap(), | |
55 | fTotal(0), | |
56 | fData(0) | |
57 | { | |
58 | // Constructor. | |
59 | // Parameters: | |
60 | // None | |
61 | } | |
62 | ||
56b1929b | 63 | //__________________________________________________________ |
6e79feeb | 64 | AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet, |
408bf2b4 | 65 | UShort_t maxRing, |
66 | UShort_t maxSec, | |
67 | UShort_t maxStr) | |
56b1929b | 68 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), |
021f1396 | 69 | fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips), |
56b1929b | 70 | fData(0) |
71 | { | |
72 | // Constructor. | |
73 | // Parameters: | |
74 | // maxDet Maximum number of detectors | |
75 | // maxRing Maximum number of rings per detector | |
76 | // maxSec Maximum number of sectors per ring | |
77 | // maxStr Maximum number of strips per sector | |
021f1396 | 78 | if (fTotal == 0) fTotal = 51200; |
bfdc7f5d | 79 | fData = new Bool_t[fTotal]; |
69b696b9 | 80 | Reset(); |
56b1929b | 81 | } |
82 | ||
83 | //__________________________________________________________ | |
84 | AliFMDBoolMap& | |
85 | AliFMDBoolMap::operator=(const AliFMDBoolMap& other) | |
86 | { | |
87 | // Assignment operator | |
88 | fMaxDetectors = other.fMaxDetectors; | |
89 | fMaxRings = other.fMaxRings; | |
90 | fMaxSectors = other.fMaxSectors; | |
91 | fMaxStrips = other.fMaxStrips; | |
92 | if (fData) delete [] fData; | |
bfdc7f5d | 93 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
021f1396 | 94 | if (fTotal == 0) fTotal = 51200; |
bfdc7f5d | 95 | fData = new Bool_t[fTotal]; |
0ed9abeb | 96 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
56b1929b | 97 | return *this; |
98 | } | |
99 | ||
100 | //__________________________________________________________ | |
101 | void | |
69b696b9 | 102 | AliFMDBoolMap::Reset(const Bool_t& val) |
56b1929b | 103 | { |
104 | // Reset map to val | |
0ed9abeb | 105 | for (Int_t i = 0; i < fTotal; i++) fData[i] = val; |
56b1929b | 106 | } |
107 | ||
108 | //__________________________________________________________ | |
109 | Bool_t& | |
110 | AliFMDBoolMap::operator()(UShort_t det, | |
111 | Char_t ring, | |
112 | UShort_t sec, | |
113 | UShort_t str) | |
114 | { | |
115 | // Get data | |
116 | // Parameters: | |
117 | // det Detector # | |
118 | // ring Ring ID | |
119 | // sec Sector # | |
120 | // str Strip # | |
121 | // Returns appropriate data | |
122 | return fData[CalcIndex(det, ring, sec, str)]; | |
123 | } | |
124 | ||
125 | //__________________________________________________________ | |
126 | const Bool_t& | |
127 | AliFMDBoolMap::operator()(UShort_t det, | |
128 | Char_t ring, | |
129 | UShort_t sec, | |
130 | UShort_t str) const | |
131 | { | |
132 | // Get data | |
133 | // Parameters: | |
134 | // det Detector # | |
135 | // ring Ring ID | |
136 | // sec Sector # | |
137 | // str Strip # | |
138 | // Returns appropriate data | |
139 | return fData[CalcIndex(det, ring, sec, str)]; | |
140 | } | |
141 | ||
142 | //__________________________________________________________ | |
143 | // | |
144 | // EOF | |
145 | // | |
146 |