Additiona TOF data members (S.Arcelli)
[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).
088f8e79 22// Used for various calib information, and the like,
23// as well as in reconstruction.
24// Can be used elsewhere too.
e802be3e 25//
26#include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H
27
28//____________________________________________________________________
925e6570 29ClassImp(AliFMDUShortMap)
1a1fdef7 30#if 0
31 ; // This is here to keep Emacs for indenting the next line
32#endif
e802be3e 33
34//____________________________________________________________________
35AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other)
36 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
37 other.fMaxStrips),
38 fData(0)
39{
088f8e79 40 // CTOR
bfdc7f5d 41 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
42 fData = new UShort_t[fTotal];
43 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 44}
45
46
47
48//____________________________________________________________________
49AliFMDUShortMap::AliFMDUShortMap(size_t maxDet,
50 size_t maxRing,
51 size_t maxSec,
52 size_t maxStr)
53 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
54 fData(0)
55{
56 // Construct a map
57 //
58 // Parameters:
59 // maxDet Maximum # of detectors
60 // maxRinf Maximum # of rings
61 // maxSec Maximum # of sectors
62 // maxStr Maximum # of strips
bfdc7f5d 63 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
64 fData = new UShort_t[fTotal];
e802be3e 65}
66
67//____________________________________________________________________
68AliFMDUShortMap&
69AliFMDUShortMap::operator=(const AliFMDUShortMap& other)
70{
088f8e79 71 // Assignment operator
e802be3e 72 fMaxDetectors = other.fMaxDetectors;
73 fMaxRings = other.fMaxRings;
74 fMaxSectors = other.fMaxSectors;
75 fMaxStrips = other.fMaxStrips;
76 if (fData) delete [] fData;
bfdc7f5d 77 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
78 fData = new UShort_t[fTotal];
79 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 80 return *this;
81}
82
83//____________________________________________________________________
84void
6e9e7c0a 85AliFMDUShortMap::Reset(const UShort_t& val)
e802be3e 86{
088f8e79 87 // Reset to val
bfdc7f5d 88 for (size_t i = 0; i < fTotal; i++) fData[i] = val;
e802be3e 89}
90
91//____________________________________________________________________
92UShort_t&
93AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
94{
95 // Get data
96 //
97 // Parameters:
98 // det Detector #
99 // ring Ring ID
100 // sec Sector #
101 // str Strip #
102 //
103 // Returns appropriate data
104 //
105 return fData[CalcIndex(det, ring, sec, str)];
106}
107
108//____________________________________________________________________
109const UShort_t&
110AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
111{
112 // Get data
113 //
114 // Parameters:
115 // det Detector #
116 // ring Ring ID
117 // sec Sector #
118 // str Strip #
119 //
120 // Returns appropriate data
121 //
122 return fData[CalcIndex(det, ring, sec, str)];
123}
124
125
126//___________________________________________________________________
127//
128// EOF
129//