]>
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; | |
107 | GetRowCol(iddl, fMCM, fChannel, ium, fRow, fColumn); | |
108 | ||
109 | if (iddl < 4) | |
110 | { | |
111 | fModule = iddl*6 + ium; | |
112 | fDetector = 0; | |
113 | fSMN = iddl*6 + ium; | |
114 | } | |
115 | else if (iddl == 4) | |
116 | { | |
117 | if (ium < 6) | |
118 | { | |
119 | fModule = 24 + ium; | |
120 | fSMN = ium; | |
121 | } | |
122 | else if (ium >= 6) | |
123 | { | |
124 | fModule = 30 + ium; | |
125 | fSMN = 6 + ium; | |
126 | } | |
127 | fDetector = 1; | |
128 | } | |
129 | else if (iddl == 5) | |
130 | { | |
131 | ||
132 | if (ium < 6) | |
133 | { | |
134 | fModule = 30 + ium; | |
135 | fSMN = 6 + ium; | |
136 | } | |
137 | else if (ium >= 6) | |
138 | { | |
139 | fModule = 36 + ium; | |
140 | fSMN = 12 + ium; | |
141 | } | |
142 | fDetector = 1; | |
143 | } | |
144 | ||
145 | ||
146 | return kTRUE; | |
147 | } | |
148 | ||
149 | ||
150 | //_____________________________________________________________________________ | |
151 | void AliPMDRawStream::GetRowCol(Int_t ddlno, UInt_t mcmno, UInt_t chno, | |
152 | Int_t &um, Int_t &row, Int_t &col) const | |
153 | { | |
154 | // decode: ddlno, mcmno, chno -> um, row, col | |
155 | ||
156 | ||
157 | Int_t remmcm = 0; | |
158 | Int_t divmcm = 0; | |
159 | ||
160 | static const UInt_t kCh[64] = { 21, 25, 29, 28, 17, 24, 20, 16, | |
161 | 12, 13, 8, 4, 0, 1, 9, 5, | |
162 | 10, 6, 2, 3, 14, 7, 11, 15, | |
163 | 19, 18, 23, 27, 31, 30, 22, 26, | |
164 | 53, 57, 61, 60, 49, 56, 52, 48, | |
165 | 44, 45, 40, 36, 32, 33, 41, 37, | |
166 | 42, 38, 34, 35, 46, 39, 43, 47, | |
167 | 51, 50, 55, 59, 63, 62, 54, 58 }; | |
168 | ||
169 | if (ddlno == 0 || ddlno == 1) | |
170 | { | |
171 | um = mcmno/72; | |
172 | Int_t mcmnonew = mcmno - 72*um; | |
173 | Int_t rowcol = kCh[chno]; | |
174 | Int_t irownew = rowcol/4; | |
175 | Int_t icolnew = rowcol%4; | |
176 | ||
177 | remmcm = mcmnonew%12; | |
178 | divmcm = mcmnonew/12; | |
179 | ||
180 | row = 16*divmcm + irownew; | |
181 | col = 4*remmcm + icolnew; | |
182 | // This obtatined row and col (0,0) are the top left corner. | |
183 | // Needs transformation to get the Geant (0,0) | |
184 | ||
185 | } | |
186 | else if (ddlno == 2 || ddlno == 3) | |
187 | { | |
188 | um = mcmno/72; | |
189 | Int_t mcmnonew = mcmno - 72*um; | |
190 | Int_t rowcol = kCh[chno]; | |
191 | Int_t irownew = rowcol/4; | |
192 | Int_t icolnew = rowcol%4; | |
193 | ||
194 | remmcm = mcmnonew%24; | |
195 | divmcm = mcmnonew/24; | |
196 | ||
197 | row = 16*divmcm + irownew; | |
198 | col = 4*remmcm + icolnew; | |
199 | // This obtatined row and col (0,0) are the top left corner. | |
200 | // Needs transformation to get the Geant (0,0) | |
201 | ||
202 | } | |
203 | else if (ddlno == 4 || ddlno == 5) | |
204 | { | |
205 | um = mcmno/72; | |
206 | Int_t mcmnonew = mcmno - 72*um; | |
207 | Int_t rowcol = kCh[chno]; | |
208 | Int_t irownew = rowcol/4; | |
209 | Int_t icolnew = rowcol%4; | |
210 | ||
211 | if (um < 6) | |
212 | { | |
213 | remmcm = mcmnonew%12; | |
214 | divmcm = mcmnonew/12; | |
215 | } | |
216 | else if (um >= 6) | |
217 | { | |
218 | remmcm = mcmnonew%24; | |
219 | divmcm = mcmnonew/24; | |
220 | } | |
221 | ||
222 | row = 16*divmcm + irownew; | |
223 | col = 4*remmcm + icolnew; | |
224 | // This obtatined row and col (0,0) are the top left corner. | |
225 | // Needs transformation to get the Geant (0,0) | |
226 | ||
227 | } | |
228 | ||
229 | } |