]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDEdepMap.cxx
Alignment fixes
[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 **************************************************************************/
e802be3e 15/* $Id$ */
c2fc1258 16/** @file AliFMDEdepMap.cxx
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Mon Mar 27 12:39:50 2006
19 @brief Per strip map of energy deposited and number of hits
02a27b50 20 @ingroup FMD_sim
c2fc1258 21*/
e802be3e 22//____________________________________________________________________
23//
02a27b50 24// Contains a pair of energy deposited fEdep and number of hits
25// fN, fEdep is the summed energy deposition, and fN is the
26// number of hits. The map contains one such object or each strip.
27// It is used to cache the data in the digitization classes
28// AliFMDBaseDigitizer and so on.
e802be3e 29//
30//
31#include "AliFMDEdepMap.h" // ALIFMDEDEPMAP_H
32
33//____________________________________________________________________
925e6570 34ClassImp(AliFMDEdepMap)
1a1fdef7 35#if 0
36 ; // This is here to keep Emacs for indenting the next line
37#endif
e802be3e 38
39//____________________________________________________________________
40AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
41 : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
42 other.fMaxStrips),
43 fData(0)
44{
088f8e79 45 // Copy constructor
bfdc7f5d 46 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
47 fData = new AliFMDEdepHitPair[fTotal];
48 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 49}
50
51
52
53//____________________________________________________________________
54AliFMDEdepMap::AliFMDEdepMap(size_t maxDet,
55 size_t maxRing,
56 size_t maxSec,
57 size_t maxStr)
58 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
59 fData(0)
60{
61 // Construct a map
62 //
63 // Parameters:
64 // maxDet Maximum # of detectors
65 // maxRinf Maximum # of rings
66 // maxSec Maximum # of sectors
67 // maxStr Maximum # of strips
bfdc7f5d 68 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
69 fData = new AliFMDEdepHitPair[fTotal];
e802be3e 70}
71
72//____________________________________________________________________
73AliFMDEdepMap&
74AliFMDEdepMap::operator=(const AliFMDEdepMap& other)
75{
088f8e79 76 // Assignment operator
e802be3e 77 fMaxDetectors = other.fMaxDetectors;
78 fMaxRings = other.fMaxRings;
79 fMaxSectors = other.fMaxSectors;
80 fMaxStrips = other.fMaxStrips;
81 if (fData) delete [] fData;
bfdc7f5d 82 fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
83 fData = new AliFMDEdepHitPair[fTotal];
84 for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
e802be3e 85 return *this;
86}
87
088f8e79 88//____________________________________________________________________
89void
90AliFMDEdepMap::Reset()
91{
92 // Reset to zero
bfdc7f5d 93 for (size_t i = 0; i < fTotal; i++) {
94 fData[i].fEdep = 0;
95 fData[i].fN = 0;
96 };
088f8e79 97}
98
e802be3e 99//____________________________________________________________________
100void
69b696b9 101AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val)
e802be3e 102{
088f8e79 103 // Reset to val
bfdc7f5d 104 for (size_t i = 0; i < fTotal; i++) {
105 fData[i].fEdep = val.fEdep;
106 fData[i].fN = val.fN;
107 };
e802be3e 108}
109
110//____________________________________________________________________
111AliFMDEdepHitPair&
112AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
113{
114 // Get data
115 //
116 // Parameters:
117 // det Detector #
118 // ring Ring ID
119 // sec Sector #
120 // str Strip #
121 //
122 // Returns appropriate data
123 //
124 return fData[CalcIndex(det, ring, sec, str)];
125}
126
127//____________________________________________________________________
128const AliFMDEdepHitPair&
129AliFMDEdepMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
130{
131 // Get data
132 //
133 // Parameters:
134 // det Detector #
135 // ring Ring ID
136 // sec Sector #
137 // str Strip #
138 //
139 // Returns appropriate data
140 //
141 return fData[CalcIndex(det, ring, sec, str)];
142}
143
144
145//___________________________________________________________________
146//
147// EOF
148//