Possibility to not write syswatch info to file (default)
[u/mrichter/AliRoot.git] / STEER / ESD / 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
021f1396 36
37//__________________________________________________________
38AliFMDFloatMap::AliFMDFloatMap(const AliFMDMap& other)
39 : AliFMDMap(other),
40 fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
41 fData(0)
42{
43 if (fTotal == 0) fTotal = 51200;
44 fData = new Float_t[fTotal];
45 // Copy constructor
46 if (!other.IsFloat()) return;
47 for (Int_t i = 0; i < fTotal; i++) fData[i] = other.AtAsFloat(i);
48}
49
9da38871 50//__________________________________________________________
51AliFMDFloatMap::AliFMDFloatMap(const AliFMDFloatMap& other)
52 : AliFMDMap(other.fMaxDetectors,
53 other.fMaxRings,
54 other.fMaxSectors,
55 other.fMaxStrips),
fe12e09c 56 fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
021f1396 57 fData(0)
9da38871 58{
021f1396 59 if (fTotal == 0) fTotal = 51200;
60 fData = new Float_t[fTotal];
9da38871 61 // Copy constructor
fe12e09c 62 for (Int_t i = 0; i < fTotal; i++)
9da38871 63 fData[i] = other.fData[i];
64}
65
66//__________________________________________________________
021f1396 67AliFMDFloatMap::AliFMDFloatMap()
68 : AliFMDMap(),
69 fTotal(0),
70 fData(0)
71{
72 // Constructor.
73 // Parameters:
74 // None
75}
76
77//__________________________________________________________
fe12e09c 78AliFMDFloatMap::AliFMDFloatMap(Int_t maxDet,
79 Int_t maxRing,
80 Int_t maxSec,
81 Int_t maxStr)
9da38871 82 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
fe12e09c 83 fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
021f1396 84 fData(0)
9da38871 85{
86 // Constructor.
87 // Parameters:
88 // maxDet Maximum number of detectors
89 // maxRing Maximum number of rings per detector
90 // maxSec Maximum number of sectors per ring
91 // maxStr Maximum number of strips per sector
021f1396 92 if (fTotal == 0) fTotal = 51200;
93 fData = new Float_t[fTotal];
cd888a89 94 Reset(0);
9da38871 95}
96
97//__________________________________________________________
98AliFMDFloatMap&
99AliFMDFloatMap::operator=(const AliFMDFloatMap& other)
100{
101 // Assignment operator
cd888a89 102 if(&other != this){
a2fbb067 103 if(fMaxDetectors!= other.fMaxDetectors||
104 fMaxRings != other.fMaxRings||
105 fMaxSectors != other.fMaxSectors||
106 fMaxStrips != other.fMaxStrips){
107 // allocate new memory only if the array size is different....
108 fMaxDetectors = other.fMaxDetectors;
109 fMaxRings = other.fMaxRings;
110 fMaxSectors = other.fMaxSectors;
111 fMaxStrips = other.fMaxStrips;
112 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
021f1396 113 if (fTotal == 0) fTotal = 51200;
a2fbb067 114 if (fData) delete [] fData;
115 fData = new Float_t[fTotal];
116 }
cd888a89 117 for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
118 }
9da38871 119 return *this;
120}
121
021f1396 122
9da38871 123//__________________________________________________________
124void
125AliFMDFloatMap::Reset(const Float_t& val)
126{
127 // Reset map to val
fe12e09c 128 for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
9da38871 129}
130
131//__________________________________________________________
132Float_t&
133AliFMDFloatMap::operator()(UShort_t det,
134 Char_t ring,
135 UShort_t sec,
136 UShort_t str)
137{
138 // Get data
139 // Parameters:
140 // det Detector #
141 // ring Ring ID
142 // sec Sector #
143 // str Strip #
144 // Returns appropriate data
145 return fData[CalcIndex(det, ring, sec, str)];
146}
147
148//__________________________________________________________
149const Float_t&
150AliFMDFloatMap::operator()(UShort_t det,
151 Char_t ring,
152 UShort_t sec,
153 UShort_t str) const
154{
155 // Get data
156 // Parameters:
157 // det Detector #
158 // ring Ring ID
159 // sec Sector #
160 // str Strip #
161 // Returns appropriate data
162 return fData[CalcIndex(det, ring, sec, str)];
163}
164
165//__________________________________________________________
166//
167// EOF
168//
169