]>
Commit | Line | Data |
---|---|---|
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 | 34 | ClassImp(AliFMDEdepMap) |
1a1fdef7 | 35 | #if 0 |
36 | ; // This is here to keep Emacs for indenting the next line | |
37 | #endif | |
e802be3e | 38 | |
39 | //____________________________________________________________________ | |
40 | AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other) | |
41 | : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, | |
42 | other.fMaxStrips), | |
b5ee4425 | 43 | fTotal(0), |
e802be3e | 44 | fData(0) |
45 | { | |
088f8e79 | 46 | // Copy constructor |
bfdc7f5d | 47 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
48 | fData = new AliFMDEdepHitPair[fTotal]; | |
0ed9abeb | 49 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
e802be3e | 50 | } |
51 | ||
52 | ||
53 | ||
54 | //____________________________________________________________________ | |
6e79feeb | 55 | AliFMDEdepMap::AliFMDEdepMap(UShort_t maxDet, |
56 | UShort_t maxRing, | |
57 | UShort_t maxSec, | |
58 | UShort_t maxStr) | |
e802be3e | 59 | : AliFMDMap(maxDet, maxRing, maxSec, maxStr), |
b5ee4425 | 60 | fTotal(0), |
e802be3e | 61 | fData(0) |
62 | { | |
63 | // Construct a map | |
64 | // | |
65 | // Parameters: | |
66 | // maxDet Maximum # of detectors | |
67 | // maxRinf Maximum # of rings | |
68 | // maxSec Maximum # of sectors | |
69 | // maxStr Maximum # of strips | |
bfdc7f5d | 70 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
71 | fData = new AliFMDEdepHitPair[fTotal]; | |
e802be3e | 72 | } |
73 | ||
74 | //____________________________________________________________________ | |
75 | AliFMDEdepMap& | |
76 | AliFMDEdepMap::operator=(const AliFMDEdepMap& other) | |
77 | { | |
088f8e79 | 78 | // Assignment operator |
e802be3e | 79 | fMaxDetectors = other.fMaxDetectors; |
80 | fMaxRings = other.fMaxRings; | |
81 | fMaxSectors = other.fMaxSectors; | |
82 | fMaxStrips = other.fMaxStrips; | |
83 | if (fData) delete [] fData; | |
bfdc7f5d | 84 | fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; |
85 | fData = new AliFMDEdepHitPair[fTotal]; | |
0ed9abeb | 86 | for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; |
e802be3e | 87 | return *this; |
88 | } | |
89 | ||
088f8e79 | 90 | //____________________________________________________________________ |
91 | void | |
92 | AliFMDEdepMap::Reset() | |
93 | { | |
94 | // Reset to zero | |
0ed9abeb | 95 | for (Int_t i = 0; i < fTotal; i++) { |
83ad576a | 96 | fData[i].fEdep = 0; |
97 | fData[i].fN = 0; | |
98 | fData[i].fNPrim = 0; | |
bfdc7f5d | 99 | }; |
088f8e79 | 100 | } |
101 | ||
e802be3e | 102 | //____________________________________________________________________ |
103 | void | |
69b696b9 | 104 | AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val) |
e802be3e | 105 | { |
088f8e79 | 106 | // Reset to val |
0ed9abeb | 107 | for (Int_t i = 0; i < fTotal; i++) { |
83ad576a | 108 | fData[i].fEdep = val.fEdep; |
109 | fData[i].fN = val.fN; | |
110 | fData[i].fNPrim = val.fNPrim; | |
b2e6f0b0 | 111 | fData[i].fLabels.Set(0); |
bfdc7f5d | 112 | }; |
e802be3e | 113 | } |
114 | ||
115 | //____________________________________________________________________ | |
116 | AliFMDEdepHitPair& | |
83ad576a | 117 | AliFMDEdepMap::operator()(UShort_t det, Char_t ring, |
118 | UShort_t sec, UShort_t str) | |
e802be3e | 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 | const AliFMDEdepHitPair& | |
83ad576a | 135 | AliFMDEdepMap::operator()(UShort_t det, Char_t ring, |
136 | UShort_t sec, UShort_t str) const | |
e802be3e | 137 | { |
138 | // Get data | |
139 | // | |
140 | // Parameters: | |
141 | // det Detector # | |
142 | // ring Ring ID | |
143 | // sec Sector # | |
144 | // str Strip # | |
145 | // | |
146 | // Returns appropriate data | |
147 | // | |
148 | return fData[CalcIndex(det, ring, sec, str)]; | |
149 | } | |
150 | ||
151 | ||
152 | //___________________________________________________________________ | |
153 | // | |
154 | // EOF | |
155 | // |