]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDEdepMap.cxx
Additiona TOF data members (S.Arcelli)
[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
bfdc7f5d 37 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
38 fData = new AliFMDEdepHitPair[fTotal];
39 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 40}
41
42
43
44//____________________________________________________________________
45AliFMDEdepMap::AliFMDEdepMap(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
bfdc7f5d 59 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
60 fData = new AliFMDEdepHitPair[fTotal];
e802be3e 61}
62
63//____________________________________________________________________
64AliFMDEdepMap&
65AliFMDEdepMap::operator=(const AliFMDEdepMap& other)
66{
088f8e79 67 // Assignment operator
e802be3e 68 fMaxDetectors = other.fMaxDetectors;
69 fMaxRings = other.fMaxRings;
70 fMaxSectors = other.fMaxSectors;
71 fMaxStrips = other.fMaxStrips;
72 if (fData) delete [] fData;
bfdc7f5d 73 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
74 fData = new AliFMDEdepHitPair[fTotal];
75 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 76 return *this;
77}
78
088f8e79 79//____________________________________________________________________
80void
81AliFMDEdepMap::Reset()
82{
83 // Reset to zero
bfdc7f5d 84 for (size_t i = 0; i < fTotal; i++) {
85 fData[i].fEdep = 0;
86 fData[i].fN = 0;
87 };
088f8e79 88}
89
e802be3e 90//____________________________________________________________________
91void
69b696b9 92AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val)
e802be3e 93{
088f8e79 94 // Reset to val
bfdc7f5d 95 for (size_t i = 0; i < fTotal; i++) {
96 fData[i].fEdep = val.fEdep;
97 fData[i].fN = val.fN;
98 };
e802be3e 99}
100
101//____________________________________________________________________
102AliFMDEdepHitPair&
103AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
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//____________________________________________________________________
119const AliFMDEdepHitPair&
120AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
121{
122 // Get data
123 //
124 // Parameters:
125 // det Detector #
126 // ring Ring ID
127 // sec Sector #
128 // str Strip #
129 //
130 // Returns appropriate data
131 //
132 return fData[CalcIndex(det, ring, sec, str)];
133}
134
135
136//___________________________________________________________________
137//
138// EOF
139//