]>
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$ */ | |
18 | //__________________________________________________________ | |
19 | // | |
20 | // Map of per strip Bool_t information | |
21 | // | |
22 | // Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen | |
23 | // | |
24 | #include "AliFMDBoolMap.h" //ALIFMDBOOLMAP_H | |
25 | //__________________________________________________________ | |
26 | ClassImp(AliFMDBoolMap); | |
27 | //__________________________________________________________ | |
28 | AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other) | |
29 | : AliFMDMap(other.fMaxDetectors, | |
30 | other.fMaxRings, | |
31 | other.fMaxSectors, | |
32 | other.fMaxStrips), | |
33 | fData(0) | |
34 | { | |
35 | // Copy constructor | |
36 | fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
37 | for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; i++) | |
38 | fData[i] = other.fData[i]; | |
39 | } | |
40 | ||
41 | //__________________________________________________________ | |
42 | AliFMDBoolMap::AliFMDBoolMap(size_t maxDet, | |
43 | size_t maxRing, | |
44 | size_t maxSec, | |
45 | size_t maxStr) | |
46 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), | |
47 | fData(0) | |
48 | { | |
49 | // Constructor. | |
50 | // Parameters: | |
51 | // maxDet Maximum number of detectors | |
52 | // maxRing Maximum number of rings per detector | |
53 | // maxSec Maximum number of sectors per ring | |
54 | // maxStr Maximum number of strips per sector | |
55 | fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
56 | Clear(); | |
57 | } | |
58 | ||
59 | //__________________________________________________________ | |
60 | AliFMDBoolMap& | |
61 | AliFMDBoolMap::operator=(const AliFMDBoolMap& other) | |
62 | { | |
63 | // Assignment operator | |
64 | fMaxDetectors = other.fMaxDetectors; | |
65 | fMaxRings = other.fMaxRings; | |
66 | fMaxSectors = other.fMaxSectors; | |
67 | fMaxStrips = other.fMaxStrips; | |
68 | if (fData) delete [] fData; | |
69 | fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; | |
70 | for (size_t i = 0; i < fMaxDetectors * fMaxRings | |
71 | * fMaxSectors * fMaxStrips; i++) | |
72 | fData[i] = other.fData[i]; | |
73 | return *this; | |
74 | } | |
75 | ||
76 | //__________________________________________________________ | |
77 | void | |
78 | AliFMDBoolMap::Clear(const Bool_t& val) | |
79 | { | |
80 | // Reset map to val | |
81 | for (size_t i = 0; i < fMaxDetectors * fMaxRings | |
82 | * fMaxSectors * fMaxStrips; i++) | |
83 | fData[i] = val; | |
84 | } | |
85 | ||
86 | //__________________________________________________________ | |
87 | Bool_t& | |
88 | AliFMDBoolMap::operator()(UShort_t det, | |
89 | Char_t ring, | |
90 | UShort_t sec, | |
91 | UShort_t str) | |
92 | { | |
93 | // Get data | |
94 | // Parameters: | |
95 | // det Detector # | |
96 | // ring Ring ID | |
97 | // sec Sector # | |
98 | // str Strip # | |
99 | // Returns appropriate data | |
100 | return fData[CalcIndex(det, ring, sec, str)]; | |
101 | } | |
102 | ||
103 | //__________________________________________________________ | |
104 | const Bool_t& | |
105 | AliFMDBoolMap::operator()(UShort_t det, | |
106 | Char_t ring, | |
107 | UShort_t sec, | |
108 | UShort_t str) const | |
109 | { | |
110 | // Get data | |
111 | // Parameters: | |
112 | // det Detector # | |
113 | // ring Ring ID | |
114 | // sec Sector # | |
115 | // str Strip # | |
116 | // Returns appropriate data | |
117 | return fData[CalcIndex(det, ring, sec, str)]; | |
118 | } | |
119 | ||
120 | //__________________________________________________________ | |
121 | // | |
122 | // EOF | |
123 | // | |
124 |