Got rid of class template AliFMD<Type> on request of Federico, who
[u/mrichter/AliRoot.git] / FMD / AliFMDEdepMap.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//
20//
21//
22#include "AliFMDEdepMap.h" // ALIFMDEDEPMAP_H
23
24//____________________________________________________________________
25ClassImp(AliFMDEdepMap);
26
27//____________________________________________________________________
28AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
29 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
30 other.fMaxStrips),
31 fData(0)
32{
33 fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
34 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//____________________________________________________________________
42AliFMDEdepMap::AliFMDEdepMap(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 AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
57 fMaxSectors * fMaxStrips];
58}
59
60//____________________________________________________________________
61AliFMDEdepMap&
62AliFMDEdepMap::operator=(const AliFMDEdepMap& other)
63{
64 fMaxDetectors = other.fMaxDetectors;
65 fMaxRings = other.fMaxRings;
66 fMaxSectors = other.fMaxSectors;
67 fMaxStrips = other.fMaxStrips;
68 if (fData) delete [] fData;
69 fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
70 fMaxSectors * fMaxStrips];
71 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
72 i++) fData[i] = other.fData[i];
73 return *this;
74}
75
76//____________________________________________________________________
77void
78AliFMDEdepMap::Clear(const AliFMDEdepHitPair& val)
79{
80 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
81 i++) fData[i] = val;
82}
83
84//____________________________________________________________________
85AliFMDEdepHitPair&
86AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
87{
88 // Get data
89 //
90 // Parameters:
91 // det Detector #
92 // ring Ring ID
93 // sec Sector #
94 // str Strip #
95 //
96 // Returns appropriate data
97 //
98 return fData[CalcIndex(det, ring, sec, str)];
99}
100
101//____________________________________________________________________
102const AliFMDEdepHitPair&
103AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
104{
105 // Get data
106 //
107 // Parameters:
108 // det Detector #
109 // ring Ring ID
110 // sec Sector #
111 // str Strip #
112 //
113 // Returns appropriate data
114 //
115 return fData[CalcIndex(det, ring, sec, str)];
116}
117
118
119//___________________________________________________________________
120//
121// EOF
122//