]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDUShortMap.cxx
Possibility to compile with Root v5-11-04/06
[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 **************************************************************************/
e802be3e 15/* $Id$ */
c2fc1258 16/** @file AliFMDUShortMap.cxx
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Mon Mar 27 12:48:18 2006
19 @brief Per strip of unisgned shorts (16 bit) data
20*/
e802be3e 21//____________________________________________________________________
22//
7684b53c 23// A map of per strip UShort_t information (for example ADC values,
24// number of hits and so on).
088f8e79 25// Used for various calib information, and the like,
26// as well as in reconstruction.
27// Can be used elsewhere too.
e802be3e 28//
29#include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H
30
31//____________________________________________________________________
925e6570 32ClassImp(AliFMDUShortMap)
1a1fdef7 33#if 0
34 ; // This is here to keep Emacs for indenting the next line
35#endif
e802be3e 36
37//____________________________________________________________________
38AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other)
39 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
40 other.fMaxStrips),
41 fData(0)
42{
088f8e79 43 // CTOR
bfdc7f5d 44 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
45 fData = new UShort_t[fTotal];
46 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 47}
48
49
50
51//____________________________________________________________________
52AliFMDUShortMap::AliFMDUShortMap(size_t maxDet,
53 size_t maxRing,
54 size_t maxSec,
55 size_t maxStr)
56 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
57 fData(0)
58{
59 // Construct a map
60 //
61 // Parameters:
62 // maxDet Maximum # of detectors
63 // maxRinf Maximum # of rings
64 // maxSec Maximum # of sectors
65 // maxStr Maximum # of strips
bfdc7f5d 66 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
67 fData = new UShort_t[fTotal];
e802be3e 68}
69
70//____________________________________________________________________
71AliFMDUShortMap&
72AliFMDUShortMap::operator=(const AliFMDUShortMap& other)
73{
088f8e79 74 // Assignment operator
e802be3e 75 fMaxDetectors = other.fMaxDetectors;
76 fMaxRings = other.fMaxRings;
77 fMaxSectors = other.fMaxSectors;
78 fMaxStrips = other.fMaxStrips;
79 if (fData) delete [] fData;
bfdc7f5d 80 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
81 fData = new UShort_t[fTotal];
82 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 83 return *this;
84}
85
86//____________________________________________________________________
87void
6e9e7c0a 88AliFMDUShortMap::Reset(const UShort_t& val)
e802be3e 89{
088f8e79 90 // Reset to val
bfdc7f5d 91 for (size_t i = 0; i < fTotal; i++) fData[i] = val;
e802be3e 92}
93
94//____________________________________________________________________
95UShort_t&
96AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
97{
98 // Get data
99 //
100 // Parameters:
101 // det Detector #
102 // ring Ring ID
103 // sec Sector #
104 // str Strip #
105 //
106 // Returns appropriate data
107 //
108 return fData[CalcIndex(det, ring, sec, str)];
109}
110
111//____________________________________________________________________
112const UShort_t&
113AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
114{
115 // Get data
116 //
117 // Parameters:
118 // det Detector #
119 // ring Ring ID
120 // sec Sector #
121 // str Strip #
122 //
123 // Returns appropriate data
124 //
125 return fData[CalcIndex(det, ring, sec, str)];
126}
127
128
129//___________________________________________________________________
130//
131// EOF
132//