Added docs and fixed a bug
[u/mrichter/AliRoot.git] / FMD / AliFMDUShortMap.cxx
CommitLineData
e802be3e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//____________________________________________________________________
19//
7684b53c 20// A map of per strip UShort_t information (for example ADC values,
21// number of hits and so on).
e802be3e 22//
23#include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H
24
25//____________________________________________________________________
26ClassImp(AliFMDUShortMap);
27
28//____________________________________________________________________
29AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other)
30 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
31 other.fMaxStrips),
32 fData(0)
33{
34 fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
35 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
36 i++) fData[i] = other.fData[i];
37}
38
39
40
41//____________________________________________________________________
42AliFMDUShortMap::AliFMDUShortMap(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 // Construct a map
50 //
51 // Parameters:
52 // maxDet Maximum # of detectors
53 // maxRinf Maximum # of rings
54 // maxSec Maximum # of sectors
55 // maxStr Maximum # of strips
56 fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
57}
58
59//____________________________________________________________________
60AliFMDUShortMap&
61AliFMDUShortMap::operator=(const AliFMDUShortMap& other)
62{
63 fMaxDetectors = other.fMaxDetectors;
64 fMaxRings = other.fMaxRings;
65 fMaxSectors = other.fMaxSectors;
66 fMaxStrips = other.fMaxStrips;
67 if (fData) delete [] fData;
68 fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
69 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
70 i++) fData[i] = other.fData[i];
71 return *this;
72}
73
74//____________________________________________________________________
75void
76AliFMDUShortMap::Clear(const UShort_t& val)
77{
78 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
79 i++) fData[i] = val;
80}
81
82//____________________________________________________________________
83UShort_t&
84AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
85{
86 // Get data
87 //
88 // Parameters:
89 // det Detector #
90 // ring Ring ID
91 // sec Sector #
92 // str Strip #
93 //
94 // Returns appropriate data
95 //
96 return fData[CalcIndex(det, ring, sec, str)];
97}
98
99//____________________________________________________________________
100const UShort_t&
101AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
102{
103 // Get data
104 //
105 // Parameters:
106 // det Detector #
107 // ring Ring ID
108 // sec Sector #
109 // str Strip #
110 //
111 // Returns appropriate data
112 //
113 return fData[CalcIndex(det, ring, sec, str)];
114}
115
116
117//___________________________________________________________________
118//
119// EOF
120//