Line data Source code
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 : /* $Id$ */
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
20 : @ingroup FMD_sim
21 : */
22 : //____________________________________________________________________
23 : //
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.
29 : //
30 : //
31 : #include "AliFMDEdepMap.h" // ALIFMDEDEPMAP_H
32 :
33 : //____________________________________________________________________
34 12 : ClassImp(AliFMDEdepMap)
35 : #if 0
36 : ; // This is here to keep Emacs for indenting the next line
37 : #endif
38 :
39 : //____________________________________________________________________
40 : AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other)
41 0 : : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
42 0 : other.fMaxStrips),
43 0 : fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
44 0 : fData(0)
45 0 : {
46 : // Copy constructor
47 0 : if (fTotal == 0) fTotal = 51200;
48 0 : fData = new AliFMDEdepHitPair[fTotal];
49 0 : for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
50 0 : }
51 :
52 :
53 : //____________________________________________________________________
54 : AliFMDEdepMap::AliFMDEdepMap()
55 0 : : AliFMDMap(),
56 0 : fTotal(0),
57 0 : fData(0)
58 0 : {
59 : // Construct a map
60 : //
61 : // Parameters:
62 : // None
63 0 : }
64 :
65 : //____________________________________________________________________
66 : AliFMDEdepMap::AliFMDEdepMap(UShort_t maxDet,
67 : UShort_t maxRing,
68 : UShort_t maxSec,
69 : UShort_t maxStr)
70 2 : : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
71 2 : fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
72 2 : fData(0)
73 10 : {
74 : // Construct a map
75 : //
76 : // Parameters:
77 : // maxDet Maximum # of detectors
78 : // maxRinf Maximum # of rings
79 : // maxSec Maximum # of sectors
80 : // maxStr Maximum # of strips
81 4 : if (fTotal == 0) fTotal = 51200;
82 204808 : fData = new AliFMDEdepHitPair[fTotal];
83 4 : }
84 :
85 : //____________________________________________________________________
86 : AliFMDEdepMap&
87 : AliFMDEdepMap::operator=(const AliFMDEdepMap& other)
88 : {
89 : // Assignment operator
90 0 : if (&other == this) return *this;
91 0 : fMaxDetectors = other.fMaxDetectors;
92 0 : fMaxRings = other.fMaxRings;
93 0 : fMaxSectors = other.fMaxSectors;
94 0 : fMaxStrips = other.fMaxStrips;
95 0 : if (fData) delete [] fData;
96 0 : fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
97 0 : if (fTotal == 0) fTotal = 51200;
98 0 : fData = new AliFMDEdepHitPair[fTotal];
99 0 : for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
100 0 : return *this;
101 0 : }
102 :
103 : //____________________________________________________________________
104 : void
105 : AliFMDEdepMap::Reset()
106 : {
107 : // Reset to zero
108 819224 : for (Int_t i = 0; i < fTotal; i++) {
109 409600 : fData[i].fEdep = 0;
110 409600 : fData[i].fN = 0;
111 409600 : fData[i].fNPrim = 0;
112 409600 : fData[i].fLabels.Reset();
113 : };
114 8 : }
115 :
116 : //____________________________________________________________________
117 : void
118 : AliFMDEdepMap::Reset(const AliFMDEdepHitPair& val)
119 : {
120 : // Reset to val
121 0 : for (Int_t i = 0; i < fTotal; i++) {
122 0 : fData[i].fEdep = val.fEdep;
123 0 : fData[i].fN = val.fN;
124 0 : fData[i].fNPrim = val.fNPrim;
125 0 : fData[i].fLabels = val.fLabels;
126 : };
127 0 : }
128 :
129 : //____________________________________________________________________
130 : AliFMDEdepHitPair&
131 : AliFMDEdepMap::operator()(UShort_t det, Char_t ring,
132 : UShort_t sec, UShort_t str)
133 : {
134 : // Get data
135 : //
136 : // Parameters:
137 : // det Detector #
138 : // ring Ring ID
139 : // sec Sector #
140 : // str Strip #
141 : //
142 : // Returns appropriate data
143 : //
144 432 : return fData[CalcIndex(det, ring, sec, str)];
145 : }
146 :
147 : //____________________________________________________________________
148 : const AliFMDEdepHitPair&
149 : AliFMDEdepMap::operator()(UShort_t det, Char_t ring,
150 : UShort_t sec, UShort_t str) const
151 : {
152 : // Get data
153 : //
154 : // Parameters:
155 : // det Detector #
156 : // ring Ring ID
157 : // sec Sector #
158 : // str Strip #
159 : //
160 : // Returns appropriate data
161 : //
162 819200 : return fData[CalcIndex(det, ring, sec, str)];
163 : }
164 :
165 :
166 : //___________________________________________________________________
167 : //
168 : // EOF
169 : //
|