]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDEdepMap.cxx
Updated with modifications in AliMUONGeometryTransformer
[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//____________________________________________________________________
925e6570 25ClassImp(AliFMDEdepMap)
1a1fdef7 26#if 0
27 ; // This is here to keep Emacs for indenting the next line
28#endif
e802be3e 29
30//____________________________________________________________________
31AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
32 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
33 other.fMaxStrips),
34 fData(0)
35{
088f8e79 36 // Copy constructor
e802be3e 37 fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
38 fMaxSectors * fMaxStrips];
39 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
40 i++) fData[i] = other.fData[i];
41}
42
43
44
45//____________________________________________________________________
46AliFMDEdepMap::AliFMDEdepMap(size_t maxDet,
47 size_t maxRing,
48 size_t maxSec,
49 size_t maxStr)
50 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
51 fData(0)
52{
53 // Construct a map
54 //
55 // Parameters:
56 // maxDet Maximum # of detectors
57 // maxRinf Maximum # of rings
58 // maxSec Maximum # of sectors
59 // maxStr Maximum # of strips
60 fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
61 fMaxSectors * fMaxStrips];
62}
63
64//____________________________________________________________________
65AliFMDEdepMap&
66AliFMDEdepMap::operator=(const AliFMDEdepMap& other)
67{
088f8e79 68 // Assignment operator
e802be3e 69 fMaxDetectors = other.fMaxDetectors;
70 fMaxRings = other.fMaxRings;
71 fMaxSectors = other.fMaxSectors;
72 fMaxStrips = other.fMaxStrips;
73 if (fData) delete [] fData;
74 fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings *
75 fMaxSectors * fMaxStrips];
76 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
77 i++) fData[i] = other.fData[i];
78 return *this;
79}
80
088f8e79 81//____________________________________________________________________
82void
83AliFMDEdepMap::Reset()
84{
85 // Reset to zero
86 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
87 i++) { fData[i].fEdep = 0; fData[i].fN = 0; };
88}
89
e802be3e 90//____________________________________________________________________
91void
69b696b9 92AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val)
e802be3e 93{
088f8e79 94 // Reset to val
e802be3e 95 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
088f8e79 96 i++) { fData[i].fEdep = val.fEdep; fData[i].fN = val.fN; };
e802be3e 97}
98
99//____________________________________________________________________
100AliFMDEdepHitPair&
101AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
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//____________________________________________________________________
117const AliFMDEdepHitPair&
118AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
119{
120 // Get data
121 //
122 // Parameters:
123 // det Detector #
124 // ring Ring ID
125 // sec Sector #
126 // str Strip #
127 //
128 // Returns appropriate data
129 //
130 return fData[CalcIndex(det, ring, sec, str)];
131}
132
133
134//___________________________________________________________________
135//
136// EOF
137//