Fix effc++ warnings and most blatant coding-convention violations.
[u/mrichter/AliRoot.git] / STEER / AliFMDFloatMap.cxx
CommitLineData
9da38871 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
6169f936 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//
9da38871 27//
28// Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen
29//
30#include "AliFMDFloatMap.h" //ALIFMDFLOATMAP_H
31//__________________________________________________________
32ClassImp(AliFMDFloatMap)
33#if 0
34 ; // This is here to keep Emacs for indenting the next line
35#endif
36//__________________________________________________________
37AliFMDFloatMap::AliFMDFloatMap(const AliFMDFloatMap& other)
38 : AliFMDMap(other.fMaxDetectors,
39 other.fMaxRings,
40 other.fMaxSectors,
41 other.fMaxStrips),
42 fData(0)
43{
44 // Copy constructor
ac07a8f5 45 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
46 fData = new Float_t[fTotal];
9da38871 47 for (size_t i = 0; i < fMaxDetectors * fMaxRings
48 * fMaxSectors * fMaxStrips; i++)
49 fData[i] = other.fData[i];
50}
51
52//__________________________________________________________
53AliFMDFloatMap::AliFMDFloatMap(size_t maxDet,
54 size_t maxRing,
55 size_t maxSec,
56 size_t maxStr)
57 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
58 fData(0)
59{
60 // Constructor.
61 // Parameters:
62 // maxDet Maximum number of detectors
63 // maxRing Maximum number of rings per detector
64 // maxSec Maximum number of sectors per ring
65 // maxStr Maximum number of strips per sector
ac07a8f5 66 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
67 fData = new Float_t[fTotal];
9da38871 68 Reset();
69}
70
71//__________________________________________________________
72AliFMDFloatMap&
73AliFMDFloatMap::operator=(const AliFMDFloatMap& other)
74{
75 // Assignment operator
76 fMaxDetectors = other.fMaxDetectors;
77 fMaxRings = other.fMaxRings;
78 fMaxSectors = other.fMaxSectors;
79 fMaxStrips = other.fMaxStrips;
ac07a8f5 80 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
9da38871 81 if (fData) delete [] fData;
ac07a8f5 82 fData = new Float_t[fTotal];
83 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
9da38871 84 return *this;
85}
86
87//__________________________________________________________
88void
89AliFMDFloatMap::Reset(const Float_t& val)
90{
91 // Reset map to val
ac07a8f5 92 for (size_t i = 0; i < fTotal; i++) fData[i] = val;
9da38871 93}
94
95//__________________________________________________________
96Float_t&
97AliFMDFloatMap::operator()(UShort_t det,
98 Char_t ring,
99 UShort_t sec,
100 UShort_t str)
101{
102 // Get data
103 // Parameters:
104 // det Detector #
105 // ring Ring ID
106 // sec Sector #
107 // str Strip #
108 // Returns appropriate data
109 return fData[CalcIndex(det, ring, sec, str)];
110}
111
112//__________________________________________________________
113const Float_t&
114AliFMDFloatMap::operator()(UShort_t det,
115 Char_t ring,
116 UShort_t sec,
117 UShort_t str) const
118{
119 // Get data
120 // Parameters:
121 // det Detector #
122 // ring Ring ID
123 // sec Sector #
124 // str Strip #
125 // Returns appropriate data
126 return fData[CalcIndex(det, ring, sec, str)];
127}
128
129//__________________________________________________________
130//
131// EOF
132//
133