]>
Commit | Line | Data |
---|---|---|
a09a2da4 | 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 | /// This class provides access to PMD digits in raw data. | |
21 | /// | |
22 | /// It loops over all PMD digits in the raw data given by the AliRawReader. | |
23 | /// The Next method goes to the next digit. If there are no digits left | |
24 | /// it returns kFALSE. | |
25 | /// Several getters provide information about the current digit. | |
26 | /// | |
27 | /////////////////////////////////////////////////////////////////////////////// | |
28 | ||
29 | #include "AliPMDRawStream.h" | |
30 | #include "AliRawReader.h" | |
31 | ||
32 | ClassImp(AliPMDRawStream) | |
33 | ||
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) : | |
37 | fRawReader(rawReader), | |
38 | fModule(-1), | |
39 | fPrevModule(-1), | |
40 | fMCM(-1), | |
41 | fChannel(-1), | |
42 | fRow(-1), | |
43 | fColumn(-1), | |
44 | fSignal(-1), | |
45 | fDetector(-1), | |
46 | fSMN(-1) | |
47 | { | |
48 | // create an object to read PMD raw digits | |
49 | ||
50 | fRawReader->Select(12); | |
51 | } | |
52 | ||
53 | //_____________________________________________________________________________ | |
54 | AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) : | |
55 | TObject(stream), | |
56 | fRawReader(NULL), | |
57 | fModule(-1), | |
58 | fPrevModule(-1), | |
59 | fMCM(-1), | |
60 | fChannel(-1), | |
61 | fRow(-1), | |
62 | fColumn(-1), | |
63 | fSignal(-1), | |
64 | fDetector(-1), | |
65 | fSMN(-1) | |
66 | { | |
67 | // copy constructor | |
68 | ||
69 | Fatal("AliPMDRawStream", "copy constructor not implemented"); | |
70 | } | |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliPMDRawStream& AliPMDRawStream::operator = (const AliPMDRawStream& | |
74 | /* stream */) | |
75 | { | |
76 | // assignment operator | |
77 | ||
78 | Fatal("operator =", "assignment operator not implemented"); | |
79 | return *this; | |
80 | } | |
81 | ||
82 | //_____________________________________________________________________________ | |
83 | AliPMDRawStream::~AliPMDRawStream() | |
84 | { | |
85 | // destructor | |
86 | ||
87 | } | |
88 | ||
89 | ||
90 | //_____________________________________________________________________________ | |
91 | Bool_t AliPMDRawStream::Next() | |
92 | { | |
93 | // read the next raw digit | |
94 | // returns kFALSE if there is no digit left | |
95 | ||
96 | fPrevModule = fModule; | |
97 | ||
98 | UInt_t data; | |
99 | if (!fRawReader->ReadNextInt(data)) return kFALSE; | |
100 | ||
101 | fSignal = data & 0x0FFF; | |
102 | fChannel = (data >> 12) & 0x003F; | |
103 | fMCM = (data >> 18) & 0x07FF; | |
104 | ||
105 | Int_t iddl = fRawReader->GetDDLID(); | |
106 | Int_t ium; | |
a09a2da4 | 107 | |
e54787da | 108 | GetRowCol(iddl, fMCM, fChannel, ium, fRow, fColumn); |
109 | ConvertDDL2SMN(iddl, ium, fSMN, fModule, fDetector); | |
110 | TransformH2S(fSMN, fRow, fColumn); | |
a09a2da4 | 111 | |
112 | return kTRUE; | |
113 | } | |
a09a2da4 | 114 | //_____________________________________________________________________________ |
115 | void AliPMDRawStream::GetRowCol(Int_t ddlno, UInt_t mcmno, UInt_t chno, | |
116 | Int_t &um, Int_t &row, Int_t &col) const | |
117 | { | |
118 | // decode: ddlno, mcmno, chno -> um, row, col | |
119 | ||
120 | ||
121 | Int_t remmcm = 0; | |
122 | Int_t divmcm = 0; | |
123 | ||
124 | static const UInt_t kCh[64] = { 21, 25, 29, 28, 17, 24, 20, 16, | |
125 | 12, 13, 8, 4, 0, 1, 9, 5, | |
126 | 10, 6, 2, 3, 14, 7, 11, 15, | |
127 | 19, 18, 23, 27, 31, 30, 22, 26, | |
128 | 53, 57, 61, 60, 49, 56, 52, 48, | |
129 | 44, 45, 40, 36, 32, 33, 41, 37, | |
130 | 42, 38, 34, 35, 46, 39, 43, 47, | |
131 | 51, 50, 55, 59, 63, 62, 54, 58 }; | |
132 | ||
133 | if (ddlno == 0 || ddlno == 1) | |
134 | { | |
135 | um = mcmno/72; | |
136 | Int_t mcmnonew = mcmno - 72*um; | |
137 | Int_t rowcol = kCh[chno]; | |
138 | Int_t irownew = rowcol/4; | |
139 | Int_t icolnew = rowcol%4; | |
140 | ||
141 | remmcm = mcmnonew%12; | |
142 | divmcm = mcmnonew/12; | |
143 | ||
144 | row = 16*divmcm + irownew; | |
145 | col = 4*remmcm + icolnew; | |
146 | // This obtatined row and col (0,0) are the top left corner. | |
147 | // Needs transformation to get the Geant (0,0) | |
148 | ||
149 | } | |
150 | else if (ddlno == 2 || ddlno == 3) | |
151 | { | |
152 | um = mcmno/72; | |
153 | Int_t mcmnonew = mcmno - 72*um; | |
154 | Int_t rowcol = kCh[chno]; | |
155 | Int_t irownew = rowcol/4; | |
156 | Int_t icolnew = rowcol%4; | |
157 | ||
158 | remmcm = mcmnonew%24; | |
159 | divmcm = mcmnonew/24; | |
160 | ||
161 | row = 16*divmcm + irownew; | |
162 | col = 4*remmcm + icolnew; | |
163 | // This obtatined row and col (0,0) are the top left corner. | |
164 | // Needs transformation to get the Geant (0,0) | |
165 | ||
166 | } | |
167 | else if (ddlno == 4 || ddlno == 5) | |
168 | { | |
169 | um = mcmno/72; | |
170 | Int_t mcmnonew = mcmno - 72*um; | |
171 | Int_t rowcol = kCh[chno]; | |
172 | Int_t irownew = rowcol/4; | |
173 | Int_t icolnew = rowcol%4; | |
174 | ||
175 | if (um < 6) | |
176 | { | |
177 | remmcm = mcmnonew%12; | |
178 | divmcm = mcmnonew/12; | |
179 | } | |
180 | else if (um >= 6) | |
181 | { | |
182 | remmcm = mcmnonew%24; | |
183 | divmcm = mcmnonew/24; | |
184 | } | |
185 | ||
186 | row = 16*divmcm + irownew; | |
187 | col = 4*remmcm + icolnew; | |
188 | // This obtatined row and col (0,0) are the top left corner. | |
189 | // Needs transformation to get the Geant (0,0) | |
190 | ||
191 | } | |
192 | ||
193 | } | |
e54787da | 194 | //_____________________________________________________________________________ |
195 | void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t ium, Int_t &smn, | |
196 | Int_t &module, Int_t &detector) const | |
197 | { | |
198 | // This converts the DDL number to Module Number which runs from 0-47 | |
199 | // Serial module number in one detector which runs from 0-23 | |
200 | // Also gives the detector number (0:PRE plane, 1:CPV plane) | |
201 | if (iddl < 4) | |
202 | { | |
203 | module = iddl*6 + ium; | |
204 | detector = 0; | |
205 | smn = iddl*6 + ium; | |
206 | } | |
207 | else if (iddl == 4) | |
208 | { | |
209 | if (ium < 6) | |
210 | { | |
211 | module = 24 + ium; | |
212 | smn = ium; | |
213 | } | |
214 | else if (ium >= 6) | |
215 | { | |
216 | module = 30 + ium; | |
217 | smn = 6 + ium; | |
218 | } | |
219 | detector = 1; | |
220 | } | |
221 | else if (iddl == 5) | |
222 | { | |
223 | ||
224 | if (ium < 6) | |
225 | { | |
226 | module = 30 + ium; | |
227 | smn = 6 + ium; | |
228 | } | |
229 | else if (ium >= 6) | |
230 | { | |
231 | module = 36 + ium; | |
232 | smn = 12 + ium; | |
233 | } | |
234 | detector = 1; | |
235 | } | |
236 | } | |
237 | //_____________________________________________________________________________ | |
238 | void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const | |
239 | { | |
240 | // Transform the Hardware (0,0) coordinate to Software (0,0) coordinate | |
241 | // and also writes in the digit form | |
242 | // i.e., For SuperModule 1 &2, instead of 96x48 it is 48x96 | |
243 | // For Supermodule 3 & 4, 48x96 | |
244 | ||
245 | Int_t irownew1 = 0; | |
246 | Int_t icolnew1 = 0; | |
247 | Int_t irownew = 0; | |
248 | Int_t icolnew = 0; | |
249 | // Transform all the (0,0) coordinates to the geant frame | |
250 | if(smn < 6) | |
251 | { | |
252 | irownew1 = 95 - row; | |
253 | icolnew1 = col; | |
254 | } | |
255 | else if(smn >= 6 && smn < 12) | |
256 | { | |
257 | irownew1 = row; | |
258 | icolnew1 = 47 - col; | |
259 | } | |
260 | else if(smn >= 12 && smn < 18) | |
261 | { | |
262 | irownew1 = 47 - row; | |
263 | icolnew1 = col; | |
264 | } | |
265 | else if(smn >= 18 && smn < 24) | |
266 | { | |
267 | irownew1 = row; | |
268 | icolnew1 = 95 - col; | |
269 | } | |
270 | ||
271 | // for smn < 12 : row = 96, column = 48 | |
272 | // for smn>= 12 and < 24 : row = 48, column = 96 | |
273 | // In order to make it uniform dimension, smn < 12 are inverted | |
274 | // i.e., row becomes column and column becomes row | |
275 | // for others it remains same | |
276 | // This is further inverted back while calculating eta and phi | |
277 | if(smn < 12) | |
278 | { | |
279 | // SupeModule 1 and 2 : Rows are inverted to columns and vice versa | |
280 | // and at the time of calculating the eta,phi it is again reverted | |
281 | // back | |
282 | irownew = icolnew1; | |
283 | icolnew = irownew1; | |
284 | } | |
285 | else if( smn >= 12 && smn < 24) | |
286 | { | |
287 | irownew = irownew1; | |
288 | icolnew = icolnew1; | |
289 | } | |
290 | ||
291 | row = irownew; | |
292 | col = icolnew; | |
293 | } | |
294 | //_____________________________________________________________________________ |