]>
Commit | Line | Data |
---|---|---|
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 Float_t information | |
21 | // the floats are indexed by the coordinates | |
22 | // DETECTOR # (1-3) | |
23 | // RING ID ('I' or 'O', any case) | |
24 | // SECTOR # (0-39) | |
25 | // STRIP # (0-511) | |
26 | // | |
27 | // | |
28 | // Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen | |
29 | // | |
30 | #include "AliFMDFloatMap.h" //ALIFMDFLOATMAP_H | |
31 | //__________________________________________________________ | |
32 | ClassImp(AliFMDFloatMap) | |
33 | #if 0 | |
34 | ; // This is here to keep Emacs for indenting the next line | |
35 | #endif | |
36 | //__________________________________________________________ | |
37 | AliFMDFloatMap::AliFMDFloatMap(const AliFMDFloatMap& other) | |
38 | : AliFMDMap(other.fMaxDetectors, | |
39 | other.fMaxRings, | |
40 | other.fMaxSectors, | |
41 | other.fMaxStrips), | |
42 | fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips), | |
43 | fData(new Float_t[fTotal]) | |
44 | { | |
45 | // Copy constructor | |
46 | for (Int_t i = 0; i < fTotal; i++) | |
47 | fData[i] = other.fData[i]; | |
48 | } | |
49 | ||
50 | //__________________________________________________________ | |
51 | AliFMDFloatMap::AliFMDFloatMap(Int_t maxDet, | |
52 | Int_t maxRing, | |
53 | Int_t maxSec, | |
54 | Int_t maxStr) | |
55 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), | |
56 | fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips), | |
57 | fData(new Float_t[fTotal]) | |
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 | |
65 | Reset(0); | |
66 | } | |
67 | ||
68 | //__________________________________________________________ | |
69 | AliFMDFloatMap& | |
70 | AliFMDFloatMap::operator=(const AliFMDFloatMap& other) | |
71 | { | |
72 | // Assignment operator | |
73 | if(&other != this){ | |
74 | if(fMaxDetectors!= other.fMaxDetectors|| | |
75 | fMaxRings != other.fMaxRings|| | |
76 | fMaxSectors != other.fMaxSectors|| | |
77 | fMaxStrips != other.fMaxStrips){ | |
78 | // allocate new memory only if the array size is different.... | |
79 | fMaxDetectors = other.fMaxDetectors; | |
80 | fMaxRings = other.fMaxRings; | |
81 | fMaxSectors = other.fMaxSectors; | |
82 | fMaxStrips = other.fMaxStrips; | |
83 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; | |
84 | if (fData) delete [] fData; | |
85 | fData = new Float_t[fTotal]; | |
86 | } | |
87 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; | |
88 | } | |
89 | return *this; | |
90 | } | |
91 | ||
92 | //__________________________________________________________ | |
93 | void | |
94 | AliFMDFloatMap::Reset(const Float_t& val) | |
95 | { | |
96 | // Reset map to val | |
97 | for (Int_t i = 0; i < fTotal; i++) fData[i] = val; | |
98 | } | |
99 | ||
100 | //__________________________________________________________ | |
101 | Float_t& | |
102 | AliFMDFloatMap::operator()(UShort_t det, | |
103 | Char_t ring, | |
104 | UShort_t sec, | |
105 | UShort_t str) | |
106 | { | |
107 | // Get data | |
108 | // Parameters: | |
109 | // det Detector # | |
110 | // ring Ring ID | |
111 | // sec Sector # | |
112 | // str Strip # | |
113 | // Returns appropriate data | |
114 | return fData[CalcIndex(det, ring, sec, str)]; | |
115 | } | |
116 | ||
117 | //__________________________________________________________ | |
118 | const Float_t& | |
119 | AliFMDFloatMap::operator()(UShort_t det, | |
120 | Char_t ring, | |
121 | UShort_t sec, | |
122 | UShort_t str) const | |
123 | { | |
124 | // Get data | |
125 | // Parameters: | |
126 | // det Detector # | |
127 | // ring Ring ID | |
128 | // sec Sector # | |
129 | // str Strip # | |
130 | // Returns appropriate data | |
131 | return fData[CalcIndex(det, ring, sec, str)]; | |
132 | } | |
133 | ||
134 | //__________________________________________________________ | |
135 | // | |
136 | // EOF | |
137 | // | |
138 |