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