]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDUShortMap.cxx
Initialization of data members
[u/mrichter/AliRoot.git] / FMD / AliFMDUShortMap.cxx
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 //                                                                          
20 // A map of per strip UShort_t information (for example ADC values,
21 // number of hits and so on). 
22 //
23 #include "AliFMDUShortMap.h"            // ALIFMDUSHORTMAP_H
24
25 //____________________________________________________________________
26 ClassImp(AliFMDUShortMap)
27 #if 0
28   ; // This is here to keep Emacs for indenting the next line
29 #endif
30
31 //____________________________________________________________________
32 AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other)
33   : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, 
34               other.fMaxStrips), 
35     fData(0)
36 {
37   fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
38   for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
39        i++) fData[i] = other.fData[i];
40 }
41
42   
43
44 //____________________________________________________________________
45 AliFMDUShortMap::AliFMDUShortMap(size_t maxDet, 
46                                  size_t maxRing, 
47                                  size_t maxSec, 
48                                  size_t maxStr)
49   : AliFMDMap(maxDet, maxRing, maxSec, maxStr), 
50     fData(0)
51 {
52   // Construct a map
53   //
54   // Parameters:
55   //     maxDet       Maximum # of detectors
56   //     maxRinf      Maximum # of rings
57   //     maxSec       Maximum # of sectors
58   //     maxStr       Maximum # of strips
59   fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
60 }
61
62 //____________________________________________________________________
63 AliFMDUShortMap&
64 AliFMDUShortMap::operator=(const AliFMDUShortMap& other) 
65 {
66   fMaxDetectors = other.fMaxDetectors;
67   fMaxRings     = other.fMaxRings;
68   fMaxSectors   = other.fMaxSectors;
69   fMaxStrips    = other.fMaxStrips;
70   if (fData) delete [] fData;
71   fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
72   for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
73        i++) fData[i] = other.fData[i];
74   return *this;
75 }
76
77 //____________________________________________________________________
78 void
79 AliFMDUShortMap::Clear(const UShort_t& val) 
80 {
81   for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
82        i++) fData[i] = val;
83 }
84
85 //____________________________________________________________________
86 UShort_t& 
87 AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) 
88 {
89   // Get data 
90   // 
91   // Parameters: 
92   //     det       Detector #
93   //     ring      Ring ID
94   //     sec       Sector # 
95   //     str       Strip # 
96   //
97   // Returns appropriate data
98   //
99   return fData[CalcIndex(det, ring, sec, str)];
100 }
101
102 //____________________________________________________________________
103 const UShort_t& 
104 AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
105 {
106   // Get data 
107   // 
108   // Parameters: 
109   //     det       Detector #
110   //     ring      Ring ID
111   //     sec       Sector # 
112   //     str       Strip # 
113   //
114   // Returns appropriate data
115   //
116   return fData[CalcIndex(det, ring, sec, str)];
117 }
118
119
120 //___________________________________________________________________
121 //
122 // EOF
123 //