]>
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), | |
43 | fData(0) | |
44 | { | |
45 | // Copy constructor | |
bfdc7f5d | 46 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
47 | fData = new Bool_t[fTotal]; | |
48 | for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; | |
56b1929b | 49 | } |
50 | ||
51 | //__________________________________________________________ | |
52 | AliFMDBoolMap::AliFMDBoolMap(size_t maxDet, | |
53 | size_t maxRing, | |
54 | size_t maxSec, | |
55 | size_t maxStr) | |
56 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), | |
57 | fData(0) | |
58 | { | |
59 | // Constructor. | |
60 | // Parameters: | |
61 | // maxDet Maximum number of detectors | |
62 | // maxRing Maximum number of rings per detector | |
63 | // maxSec Maximum number of sectors per ring | |
64 | // maxStr Maximum number of strips per sector | |
bfdc7f5d | 65 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
66 | fData = new Bool_t[fTotal]; | |
69b696b9 | 67 | Reset(); |
56b1929b | 68 | } |
69 | ||
70 | //__________________________________________________________ | |
71 | AliFMDBoolMap& | |
72 | AliFMDBoolMap::operator=(const AliFMDBoolMap& other) | |
73 | { | |
74 | // Assignment operator | |
75 | fMaxDetectors = other.fMaxDetectors; | |
76 | fMaxRings = other.fMaxRings; | |
77 | fMaxSectors = other.fMaxSectors; | |
78 | fMaxStrips = other.fMaxStrips; | |
79 | if (fData) delete [] fData; | |
bfdc7f5d | 80 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
81 | fData = new Bool_t[fTotal]; | |
82 | for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; | |
56b1929b | 83 | return *this; |
84 | } | |
85 | ||
86 | //__________________________________________________________ | |
87 | void | |
69b696b9 | 88 | AliFMDBoolMap::Reset(const Bool_t& val) |
56b1929b | 89 | { |
90 | // Reset map to val | |
bfdc7f5d | 91 | for (size_t i = 0; i < fTotal; i++) fData[i] = val; |
56b1929b | 92 | } |
93 | ||
94 | //__________________________________________________________ | |
95 | Bool_t& | |
96 | AliFMDBoolMap::operator()(UShort_t det, | |
97 | Char_t ring, | |
98 | UShort_t sec, | |
99 | UShort_t str) | |
100 | { | |
101 | // Get data | |
102 | // Parameters: | |
103 | // det Detector # | |
104 | // ring Ring ID | |
105 | // sec Sector # | |
106 | // str Strip # | |
107 | // Returns appropriate data | |
108 | return fData[CalcIndex(det, ring, sec, str)]; | |
109 | } | |
110 | ||
111 | //__________________________________________________________ | |
112 | const Bool_t& | |
113 | AliFMDBoolMap::operator()(UShort_t det, | |
114 | Char_t ring, | |
115 | UShort_t sec, | |
116 | UShort_t str) const | |
117 | { | |
118 | // Get data | |
119 | // Parameters: | |
120 | // det Detector # | |
121 | // ring Ring ID | |
122 | // sec Sector # | |
123 | // str Strip # | |
124 | // Returns appropriate data | |
125 | return fData[CalcIndex(det, ring, sec, str)]; | |
126 | } | |
127 | ||
128 | //__________________________________________________________ | |
129 | // | |
130 | // EOF | |
131 | // | |
132 |