]>
Commit | Line | Data |
---|---|---|
bb18c002 | 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 | //------------------------------------------------------------------------- | |
bdf99a93 | 17 | // |
18 | // AliTPCmapper | |
19 | // Authors: Christian.Lippmann@cern.ch, J.Wiechula@gsi.de | |
accfa4d9 | 20 | // Class to map detector coordinates (row, pad, sector, ...) to |
21 | // hardware coordinates (RCU, Branch, FEC, Altro, channel, Equipment ID, ...) | |
bdf99a93 | 22 | // |
23 | // There are two different ways to number padrows: | |
24 | // 1) local padrow: for each ROC, 0 ... 62 for an IROC, 0 ... 95 for an OROC, | |
25 | // 2) global padrow: for each sector, from 0 ... 158. | |
26 | // If the global numbering is used, it is denoted by the variable name | |
27 | // globalpadrow in this class. | |
bb18c002 | 28 | // |
bdf99a93 | 29 | // There are two different ways to number sectors: |
accfa4d9 | 30 | // 1) Sectors contain one IROC and one OROC and are counted from 0 to 17 on |
31 | // each of the two sides (A=0 and C=1), | |
32 | // 2) ROCs are numbered from 0 to 71 where the ROCs 0 ... 35 are IROCS and | |
33 | // ROCs 36 ... 71 are OROCs. A ROC is often named "sector" in aliroot, | |
34 | // which can be very confusing! | |
bdf99a93 | 35 | // |
accfa4d9 | 36 | //------------------------------------------------------------------------- |
bb18c002 | 37 | |
bb18c002 | 38 | #include <TMath.h> |
39 | #include <TSystem.h> | |
accfa4d9 | 40 | #include <TString.h> |
bb18c002 | 41 | |
42 | #include "AliTPCmapper.h" | |
accfa4d9 | 43 | #include "AliTPCAltroMapping.h" |
44 | #include "AliTPCROC.h" | |
45 | #include "AliLog.h" | |
bdf99a93 | 46 | #include "AliDAQ.h" |
bb18c002 | 47 | |
48 | ClassImp(AliTPCmapper) | |
49 | ||
accfa4d9 | 50 | //______________________________________________________________ |
0e46ed2e | 51 | AliTPCmapper::AliTPCmapper(const char * dirname) : |
accfa4d9 | 52 | fNside(0), |
53 | fNsector(0), | |
54 | fNrcu(0), | |
55 | fNbranch(0), | |
56 | fNaltro(0), | |
57 | fNchannel(0), | |
58 | fNpadrow(0), | |
59 | fNpadrowIROC(0), | |
60 | fNpadrowOROC(0), | |
bdf99a93 | 61 | fTpcDdlOffset(0), |
accfa4d9 | 62 | fROC(NULL) |
63 | { | |
0e46ed2e | 64 | // |
accfa4d9 | 65 | // Constructor |
0e46ed2e | 66 | // |
67 | // dirname - specify the directory with the ascii Altro mapping files | |
68 | // | |
69 | Init(dirname); | |
accfa4d9 | 70 | } |
bb18c002 | 71 | |
72 | //______________________________________________________________ | |
accfa4d9 | 73 | AliTPCmapper::~AliTPCmapper() |
74 | { | |
75 | // Destructor | |
76 | ||
77 | delete fROC; | |
78 | ||
79 | for ( Int_t i = 0; i < fNrcu; i++ ) { | |
80 | delete fMapping[i]; | |
81 | fMapping[i] = 0; | |
82 | } | |
83 | } | |
84 | ||
85 | ||
86 | //_____________________________________________________________________________ | |
87 | AliTPCmapper::AliTPCmapper(const AliTPCmapper& mapper) : | |
88 | TObject(mapper), | |
89 | fNside(mapper.fNside), | |
90 | fNsector(mapper.fNsector), | |
91 | fNrcu(mapper.fNrcu), | |
92 | fNbranch(mapper.fNbranch), | |
93 | fNaltro(mapper.fNaltro), | |
94 | fNchannel(mapper.fNchannel), | |
95 | fNpadrow(mapper.fNpadrow), | |
96 | fNpadrowIROC(mapper.fNpadrowIROC), | |
97 | fNpadrowOROC(mapper.fNpadrowOROC), | |
bdf99a93 | 98 | fTpcDdlOffset(mapper.fTpcDdlOffset), |
accfa4d9 | 99 | fROC(mapper.fROC) |
100 | { | |
101 | // Copy Constructor | |
102 | for ( Int_t i = 0; i < fNrcu; i++ ) fMapping[i] = mapper.fMapping[i]; | |
103 | } | |
104 | ||
105 | //_____________________________________________________________________________ | |
106 | AliTPCmapper& AliTPCmapper::operator = (const AliTPCmapper& mapper) | |
bb18c002 | 107 | { |
accfa4d9 | 108 | // Assignment operator |
109 | ||
110 | if(&mapper == this) return *this; | |
111 | ((TObject *)this)->operator=(mapper); | |
112 | ||
113 | for ( Int_t i = 0; i < fNrcu; i++ ) fMapping[i] = mapper.fMapping[i]; | |
114 | fROC = mapper.fROC; | |
115 | ||
116 | fNside = mapper.fNside; | |
117 | fNsector = mapper.fNsector; | |
118 | fNrcu = mapper.fNrcu; | |
119 | fNbranch = mapper.fNbranch; | |
120 | fNaltro = mapper.fNaltro; | |
121 | fNchannel = mapper.fNchannel; | |
122 | fNpadrow = mapper.fNpadrow; | |
123 | fNpadrowIROC = mapper.fNpadrowIROC; | |
124 | fNpadrowOROC = mapper.fNpadrowOROC; | |
bdf99a93 | 125 | fTpcDdlOffset = mapper.fTpcDdlOffset; |
accfa4d9 | 126 | |
127 | return *this; | |
bb18c002 | 128 | } |
129 | ||
130 | //______________________________________________________________ | |
0e46ed2e | 131 | void AliTPCmapper::Init(const char *dirname) |
bb18c002 | 132 | { |
accfa4d9 | 133 | // Initialize all |
bdf99a93 | 134 | fNside = 2; |
135 | fNsector = 18; | |
136 | fNrcu = 6; | |
137 | fNbranch = 2; | |
138 | fNaltro = 8; | |
accfa4d9 | 139 | fNchannel = 15; |
140 | ||
141 | // Load and read mapping files. AliTPCAltroMapping contains the mapping for | |
142 | // each patch (rcu). | |
0e46ed2e | 143 | TString path; |
144 | if (dirname==0){ | |
145 | path =gSystem->Getenv("ALICE_ROOT"); | |
146 | path += "/TPC/mapping/Patch"; | |
147 | }else{ | |
148 | path = dirname; | |
149 | path +="Patch"; | |
150 | } | |
151 | ||
accfa4d9 | 152 | TString path2; |
153 | for(Int_t i = 0; i < fNrcu; i++) { | |
154 | path2 = path; | |
155 | path2 += i; | |
156 | path2 += ".data"; | |
157 | fMapping[i] = new AliTPCAltroMapping(path2.Data()); | |
158 | } | |
159 | ||
160 | // Create instance of AliTPCROC object | |
161 | fROC = AliTPCROC::Instance(); | |
162 | ||
163 | fNpadrowIROC = fROC->GetNRows(0); | |
164 | fNpadrowOROC = fROC->GetNRows(36); | |
165 | fNpadrow = fNpadrowIROC+fNpadrowOROC; | |
bb18c002 | 166 | |
bdf99a93 | 167 | AliDAQ daq; |
168 | fTpcDdlOffset = daq.DdlIDOffset("TPC"); | |
169 | ||
accfa4d9 | 170 | } |
bb18c002 | 171 | |
bb18c002 | 172 | |
accfa4d9 | 173 | //_____________________________________________________________________________ |
174 | Int_t AliTPCmapper::GetHWAddress(Int_t roc, Int_t padrow, Int_t pad) const | |
175 | { | |
176 | // Get the hardware address from pad coordinates for a given ROC | |
177 | Int_t patch = GetPatch(roc, padrow, pad); | |
bdf99a93 | 178 | if ( (patch >= fNrcu) || (patch < 0) ) return -1; |
accfa4d9 | 179 | return fMapping[patch]->GetHWAddress(padrow, pad, roc); |
180 | } | |
181 | ||
182 | ||
183 | //_____________________________________________________________________________ | |
bdf99a93 | 184 | Int_t AliTPCmapper::GetHWAddressSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 185 | { |
186 | // Get the hardware address from pad coordinates | |
187 | Int_t patch = 0; | |
bdf99a93 | 188 | if ( globalpadrow < fNpadrowIROC ) { |
189 | patch = GetPatch(0, globalpadrow, pad); | |
190 | return fMapping[patch]->GetHWAddress(globalpadrow, pad, 0); | |
191 | } else if ( globalpadrow < fNpadrow ) { | |
192 | patch = GetPatch(36, globalpadrow - fNpadrowIROC, pad); | |
193 | return fMapping[patch]->GetHWAddress(globalpadrow - fNpadrowIROC, | |
accfa4d9 | 194 | pad, 36); |
195 | } else { | |
bdf99a93 | 196 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); |
accfa4d9 | 197 | return -1; |
198 | } | |
199 | } | |
200 | ||
201 | ||
202 | //_____________________________________________________________________________ | |
203 | Int_t AliTPCmapper::GetRcu(Int_t roc, Int_t padrow, Int_t pad) const | |
204 | { | |
205 | // Get the patch (rcu) index from the pad coordinates. The Roc index is | |
206 | // needed as well to determine if it is IROC or OROC. | |
207 | return GetPatch(roc, padrow, pad); | |
208 | } | |
209 | ||
210 | ||
211 | //_____________________________________________________________________________ | |
212 | Int_t AliTPCmapper::GetPatch(Int_t roc, Int_t padrow, Int_t pad) const | |
213 | { | |
214 | // Get the patch (rcu) index from the pad coordinates. The Roc index is | |
215 | // needed as well to determine if it is IROC or OROC. | |
216 | ||
217 | if ( (padrow < 0) || (pad < 0) || (roc < 0) ) { | |
218 | AliWarning(Form("Pad coordinates outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc)); | |
219 | return -1; | |
220 | } | |
221 | ||
222 | if ( roc < 36 ) { | |
223 | // IROC (0 ... 35) | |
224 | Int_t padsInRow = GetNpads(padrow); | |
225 | if ( (padsInRow < 0) || (pad >= padsInRow) ) { | |
226 | AliWarning(Form("Pad index outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc)); | |
227 | return -1; | |
228 | } | |
229 | if ( padrow < 30 ) { return 0; | |
230 | } else if ( padrow == 30 ) { // padrow 30 is shared between rcus 0 and 1 | |
231 | if ( (pad < 37) || (pad > 48) ) return 1; | |
232 | else return 0; | |
233 | } else if ( padrow < fNpadrowIROC ) { return 1; | |
234 | } else { | |
235 | AliWarning(Form("Padrow outside range (padrow %d, roc %d) !", padrow, roc)); | |
236 | return -1; | |
237 | } | |
238 | } else if ( roc < 72 ) { | |
239 | // OROC (36 ... 71) | |
240 | Int_t padsInRow = GetNpads(fNpadrowIROC+padrow); | |
241 | if ( (padsInRow < 0) || (pad >= padsInRow) ) { | |
242 | AliWarning(Form("Pad index outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc)); | |
243 | return -1; | |
bb18c002 | 244 | } |
accfa4d9 | 245 | if ( padrow < 27 ) { return 2; |
246 | } else if ( padrow == 27 ) { // padrow 27 is shared between rcus 2 and 3 | |
247 | if ( (pad >= 43) && (pad <= 46) ) return 3; | |
248 | else return 2; | |
249 | } else if ( padrow < 54 ) { return 3; | |
250 | } else if ( padrow < 76 ) { return 4; | |
251 | } else if ( padrow == 76) { // padrow 76 is shared between rcus 4 and 5 | |
252 | if ( (pad >= 33) && (pad <= 88) ) return 5; | |
253 | else return 4; | |
254 | } else if ( padrow < fNpadrowOROC ) { return 5; | |
255 | } else { | |
256 | AliWarning(Form("Padrow outside range (padrow %d, roc %d) !", padrow, roc)); | |
257 | return -1; | |
258 | } | |
259 | } | |
260 | return -1; | |
261 | } | |
bb18c002 | 262 | |
bb18c002 | 263 | |
accfa4d9 | 264 | //_____________________________________________________________________________ |
bdf99a93 | 265 | Int_t AliTPCmapper::GetRcuSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 266 | { |
267 | // Get the patch (rcu) index from the pad coordinates for a sector | |
bdf99a93 | 268 | return GetPatchSector(globalpadrow, pad); |
bb18c002 | 269 | } |
270 | ||
accfa4d9 | 271 | |
272 | //_____________________________________________________________________________ | |
bdf99a93 | 273 | Int_t AliTPCmapper::GetPatchSector(Int_t globalpadrow, Int_t pad) const |
bb18c002 | 274 | { |
accfa4d9 | 275 | // Get the patch (rcu) index from the pad coordinates for a sector |
bdf99a93 | 276 | if ( globalpadrow >= fNpadrow ) { |
277 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 278 | return -1; |
279 | } | |
bdf99a93 | 280 | if ( globalpadrow < fNpadrowIROC ) return GetPatch(0, globalpadrow, pad); |
281 | else return GetPatch(36, globalpadrow-fNpadrowIROC, pad); | |
accfa4d9 | 282 | } |
bb18c002 | 283 | |
bb18c002 | 284 | |
accfa4d9 | 285 | //_____________________________________________________________________________ |
286 | Int_t AliTPCmapper::GetPadRow(Int_t patch, Int_t hwAddress) const | |
287 | { | |
288 | // Get Pad Row (for a ROC) from the hardware address | |
bdf99a93 | 289 | if ( (patch >= fNrcu) || (patch < 0) ) { |
290 | AliWarning(Form("Patch index outside range (patch %d) !", patch)); | |
291 | return -1; | |
292 | } | |
accfa4d9 | 293 | return fMapping[patch]->GetPadRow(hwAddress); |
294 | } | |
bb18c002 | 295 | |
bb18c002 | 296 | |
accfa4d9 | 297 | //_____________________________________________________________________________ |
bdf99a93 | 298 | Int_t AliTPCmapper::GetGlobalPadRow(Int_t patch, Int_t hwAddress) const |
accfa4d9 | 299 | { |
300 | // Get Pad Row (for full sector) from the hardware address | |
301 | if ( patch < 2 ) return GetPadRow(patch, hwAddress); | |
302 | else return GetPadRow(patch, hwAddress) + fNpadrowIROC; | |
303 | } | |
bb18c002 | 304 | |
bb18c002 | 305 | |
accfa4d9 | 306 | //_____________________________________________________________________________ |
307 | Int_t AliTPCmapper::GetPad(Int_t patch, Int_t hwAddress) const | |
308 | { | |
309 | // Get Pad index from the hardware address | |
bdf99a93 | 310 | if ( (patch >= fNrcu) || (patch < 0) ) { |
311 | AliWarning(Form("Patch index outside range (patch %d) !", patch)); | |
312 | return -1; | |
313 | } | |
accfa4d9 | 314 | return fMapping[patch]->GetPad(hwAddress); |
315 | } | |
bb18c002 | 316 | |
bb18c002 | 317 | |
accfa4d9 | 318 | //_____________________________________________________________________________ |
319 | Int_t AliTPCmapper::GetPadRow(Int_t patch, Int_t branch, Int_t fec, Int_t chip, | |
320 | Int_t channel) const | |
321 | { | |
322 | // Get pad row (for a ROC) from hardware coordinates | |
323 | if ( (patch >= fNrcu) || (branch >= fNbranch) || (chip >= fNaltro) || (channel >= fNchannel) | |
324 | || (patch < 0) || (branch < 0) || (chip < 0) || (channel < 0) ) { | |
325 | AliWarning(Form("Coordinates outside range (patch %d, branch %d, fec %d, chip %d, channel %d)) !", | |
326 | patch, branch, fec, chip, channel)); | |
327 | return -1; | |
328 | } | |
329 | return GetPadRow(patch, CodeHWAddress(branch, fec, chip, channel)); | |
330 | } | |
bb18c002 | 331 | |
332 | ||
accfa4d9 | 333 | //_____________________________________________________________________________ |
bdf99a93 | 334 | Int_t AliTPCmapper::GetGlobalPadRow(Int_t patch, Int_t branch, Int_t fec, Int_t chip, |
accfa4d9 | 335 | Int_t channel) const |
336 | { | |
337 | // Get Pad Row (for full sector) from the hardware address | |
338 | if ( (patch >= fNrcu) || (branch >= fNbranch) || (chip >= fNaltro) || (channel >= fNchannel) | |
339 | || (patch < 0) || (branch < 0) || (chip < 0) || (channel < 0) ) { | |
340 | AliWarning(Form("Coordinates outside range (patch %d, branch %d, fec %d, chip %d, channel %d)) !", | |
341 | patch, branch, fec, chip, channel)); | |
342 | return -1; | |
343 | } | |
344 | if ( patch < 2 ) return GetPadRow(patch, branch, fec, chip, channel); | |
345 | else return GetPadRow(patch, branch, fec, chip, channel) + fNpadrowIROC; | |
346 | } | |
bb18c002 | 347 | |
bb18c002 | 348 | |
accfa4d9 | 349 | //_____________________________________________________________________________ |
350 | Int_t AliTPCmapper::GetPad(Int_t patch, Int_t branch, Int_t fec, Int_t chip, Int_t channel) const | |
351 | { | |
352 | // Get pad from hardware coordinates | |
353 | if ( (patch >= fNrcu) || (branch >= fNbranch) || (chip >= fNaltro) || (channel >= fNchannel) | |
354 | || (patch < 0) || (branch < 0) || (chip < 0) || (channel < 0) ) { | |
355 | AliWarning(Form("Coordinates outside range (patch %d, branch %d, fec %d, chip %d, channel %d)) !", | |
356 | patch, branch, fec, chip, channel)); | |
357 | return -1; | |
358 | } | |
359 | return GetPad(patch, CodeHWAddress(branch, fec, chip, channel)); | |
bb18c002 | 360 | } |
361 | ||
accfa4d9 | 362 | |
363 | //_____________________________________________________________________________ | |
364 | Int_t AliTPCmapper::GetBranch(Int_t roc, Int_t padrow, Int_t pad) const | |
bb18c002 | 365 | { |
accfa4d9 | 366 | // Get the branch to which this pad is connected. The FECs connected to |
367 | // one RCU are divided into two branches: A(=0) and B(=1). This information | |
368 | // can be extracted from the hardware address. | |
369 | return DecodedHWAddressBranch(GetHWAddress(roc, padrow, pad)); | |
370 | } | |
bb18c002 | 371 | |
accfa4d9 | 372 | |
373 | //_____________________________________________________________________________ | |
bdf99a93 | 374 | Int_t AliTPCmapper::GetBranchSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 375 | { |
bdf99a93 | 376 | // Get Branch from pad coordinates, where globalpadrow is counted |
accfa4d9 | 377 | // for a full sector (0 ... 158) |
bdf99a93 | 378 | return DecodedHWAddressBranch(GetHWAddressSector(globalpadrow, pad)); |
bb18c002 | 379 | } |
380 | ||
bb18c002 | 381 | |
accfa4d9 | 382 | //_____________________________________________________________________________ |
383 | Int_t AliTPCmapper::GetFEChw(Int_t roc, Int_t padrow, Int_t pad) const | |
384 | { | |
385 | // Get the FEC number in hardware numbering. The FECs are numbered from 0 (in the | |
386 | // center of the partition) to 8 (partition 3, 4, 5), 9 (partition 0, 2), 11 | |
387 | // (partition 1, branch A) or 12 (partition 1, branch B). This information | |
388 | // can be extracted from the hardware address. | |
389 | return DecodedHWAddressFECaddr(GetHWAddress(roc, padrow, pad)); | |
390 | } | |
391 | ||
bb18c002 | 392 | |
accfa4d9 | 393 | //_____________________________________________________________________________ |
bdf99a93 | 394 | Int_t AliTPCmapper::GetFEChwSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 395 | { |
396 | // Get the FEC number in hardware numbering from pad coordinates, where | |
bdf99a93 | 397 | // globalpadrow is counted for a full sector (0 ... 158) |
398 | return DecodedHWAddressFECaddr(GetHWAddressSector(globalpadrow, pad)); | |
accfa4d9 | 399 | } |
bb18c002 | 400 | |
bb18c002 | 401 | |
accfa4d9 | 402 | //_____________________________________________________________________________ |
403 | Int_t AliTPCmapper::GetFEC(Int_t roc, Int_t padrow, Int_t pad) const | |
404 | { | |
405 | // Get the FEC number in offline-oriented numbering. The FECs are numbered from 0 | |
406 | // 17 (partition 3, 4, 5), 19 (partition 0, 2) or 24 (partition 1). | |
407 | Int_t patch = GetPatch(roc, padrow, pad); | |
408 | Int_t fec = DecodedHWAddressFECaddr(GetHWAddress(roc, padrow, pad)); | |
409 | Int_t branch = DecodedHWAddressBranch(GetHWAddress(roc, padrow, pad)); | |
410 | if ( (fec < 0) || (branch < 0) || (patch < 0) ) return -1; | |
411 | return HwToOffline(patch, branch, fec); | |
bb18c002 | 412 | } |
413 | ||
bb18c002 | 414 | |
accfa4d9 | 415 | //_____________________________________________________________________________ |
bdf99a93 | 416 | Int_t AliTPCmapper::GetFECSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 417 | { |
bdf99a93 | 418 | // Get the FEC number in offline-oriented numbering. globalpadrow is |
accfa4d9 | 419 | // counted for a full sector (0 ... 158) |
bdf99a93 | 420 | Int_t patch = GetPatchSector(globalpadrow, pad); |
421 | Int_t fec = DecodedHWAddressFECaddr(GetHWAddressSector(globalpadrow, pad)); | |
422 | Int_t branch = DecodedHWAddressBranch(GetHWAddressSector(globalpadrow, pad)); | |
accfa4d9 | 423 | if ( (fec < 0) || (branch < 0) || (patch < 0) ) return -1; |
424 | return HwToOffline(patch, branch, fec); | |
425 | } | |
426 | ||
bb18c002 | 427 | |
accfa4d9 | 428 | //_____________________________________________________________________________ |
429 | Int_t AliTPCmapper::GetChip(Int_t roc, Int_t padrow, Int_t pad) const | |
430 | { | |
431 | // Get Chip (ALTRO) index (0 ... 7) from pad coordinates | |
432 | return DecodedHWAddressChipaddr(GetHWAddress(roc, padrow, pad)); | |
433 | } | |
bb18c002 | 434 | |
435 | ||
accfa4d9 | 436 | //_____________________________________________________________________________ |
bdf99a93 | 437 | Int_t AliTPCmapper::GetChipSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 438 | { |
439 | // Get Chip (ALTRO) index (0 ... 7) from pad coordinates, where | |
bdf99a93 | 440 | // globalpadrow is counted for a full sector (0 ... 158) |
441 | return DecodedHWAddressChipaddr(GetHWAddressSector(globalpadrow, pad)); | |
bb18c002 | 442 | } |
443 | ||
accfa4d9 | 444 | |
445 | //_____________________________________________________________________________ | |
446 | Int_t AliTPCmapper::GetChannel(Int_t roc, Int_t padrow, Int_t pad) const | |
447 | { | |
448 | // Get Channel index (0 ... 15) from pad coordinates | |
449 | return DecodedHWAddressChanneladdr(GetHWAddress(roc, padrow, pad)); | |
bb18c002 | 450 | } |
451 | ||
bb18c002 | 452 | |
accfa4d9 | 453 | //_____________________________________________________________________________ |
bdf99a93 | 454 | Int_t AliTPCmapper::GetChannelSector(Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 455 | { |
456 | // Get Channel index (0 ... 15) from pad coordinates, where | |
bdf99a93 | 457 | // globalpadrow is counted for a full sector (0 ... 158) |
458 | return DecodedHWAddressChanneladdr(GetHWAddressSector(globalpadrow, pad)); | |
accfa4d9 | 459 | } |
460 | ||
bb18c002 | 461 | |
accfa4d9 | 462 | //_____________________________________________________________________________ |
463 | Int_t AliTPCmapper::CodeHWAddress(Int_t branch, Int_t fec, Int_t chip, Int_t channel) const | |
464 | { | |
465 | // Get Hardware address from channel, altro, fec and branch coordinates | |
466 | return ((branch&1)<<11) + ((fec&0xf)<<7) + ((chip&0x7)<<4) + (channel&0xf); | |
bb18c002 | 467 | } |
468 | ||
accfa4d9 | 469 | |
470 | //_____________________________________________________________________________ | |
471 | Int_t AliTPCmapper::DecodedHWAddressBranch(Int_t hwAddress) const | |
472 | { | |
473 | // Get branch index (0, 1) from hardware address | |
474 | if ( hwAddress < 0 ) return -1; | |
475 | return ((hwAddress>>11)&1); | |
476 | } | |
477 | ||
478 | ||
479 | //_____________________________________________________________________________ | |
480 | Int_t AliTPCmapper::DecodedHWAddressFECaddr(Int_t hwAddress) const | |
481 | { | |
482 | // Get FEC index (0 ... 12) from hardware address | |
483 | if ( hwAddress < 0 ) return -1; | |
484 | return ((hwAddress>>7)&0xf); | |
485 | } | |
486 | ||
487 | ||
488 | //_____________________________________________________________________________ | |
489 | Int_t AliTPCmapper::DecodedHWAddressChipaddr(Int_t hwAddress) const | |
490 | { | |
491 | // Get ALTRO index (0 ... 7) from hardware address | |
492 | if ( hwAddress < 0 ) return -1; | |
493 | return ((hwAddress>>4)&0x7); | |
494 | } | |
495 | ||
496 | ||
497 | //_____________________________________________________________________________ | |
498 | Int_t AliTPCmapper::DecodedHWAddressChanneladdr(Int_t hwAddress) const | |
499 | { | |
500 | // Get channel index (0 ... 15) from hardware address | |
501 | if ( hwAddress < 0 ) return -1; | |
502 | return ((hwAddress&0xf)); | |
bb18c002 | 503 | } |
504 | ||
accfa4d9 | 505 | |
bb18c002 | 506 | //______________________________________________________________ |
accfa4d9 | 507 | Int_t AliTPCmapper::GetNpads(Int_t roc, Int_t padrow) const{ |
508 | // Get number of pads in padrow for this ROC. | |
509 | return fROC->GetNPads((UInt_t)roc, (UInt_t)padrow); | |
bb18c002 | 510 | } |
511 | ||
accfa4d9 | 512 | |
bb18c002 | 513 | //______________________________________________________________ |
bdf99a93 | 514 | Int_t AliTPCmapper::GetNpads(Int_t globalpadrow) const{ |
515 | // Get number of pads in padrow, where globalpadrow is counted for a full sector (0 ... 158) | |
accfa4d9 | 516 | |
bdf99a93 | 517 | if ( globalpadrow >= fNpadrow ) { |
518 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 519 | return -1; |
520 | } | |
bdf99a93 | 521 | if ( globalpadrow < fNpadrowIROC ) return GetNpads(0, globalpadrow); // IROC |
522 | else return GetNpads(36, globalpadrow - fNpadrowIROC); // OROC | |
accfa4d9 | 523 | |
524 | return -1; | |
bb18c002 | 525 | } |
526 | ||
accfa4d9 | 527 | |
bb18c002 | 528 | //______________________________________________________________ |
accfa4d9 | 529 | Int_t AliTPCmapper::GetNpadrows(Int_t roc) const |
bb18c002 | 530 | { |
accfa4d9 | 531 | // Get number of padrows |
532 | return fROC->GetNRows(roc); | |
bb18c002 | 533 | } |
534 | ||
accfa4d9 | 535 | |
bb18c002 | 536 | //______________________________________________________________ |
accfa4d9 | 537 | /* |
bdf99a93 | 538 | Double_t AliTPCmapper::GetPadXlocal(Int_t globalpadrow) const |
bb18c002 | 539 | { |
bdf99a93 | 540 | // Get local x coordinate of pad, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 541 | |
bdf99a93 | 542 | if ( globalpadrow >= fNpadrow ) { |
543 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 544 | return -1.0; |
545 | } | |
546 | ||
547 | //IROC | |
bdf99a93 | 548 | if ( globalpadrow < fNpadrowIROC ) |
549 | return (852.25 + 7.5*(Double_t)globalpadrow)/10.; //divide by 10 to get cm | |
0e75e410 | 550 | |
bdf99a93 | 551 | globalpadrow -= fNpadrowIROC; |
accfa4d9 | 552 | |
bdf99a93 | 553 | if ( globalpadrow < 64 ) //OROC inner part |
554 | return (10.* globalpadrow + 1351.)/10.; //divide by 10 to get cm | |
accfa4d9 | 555 | |
556 | //OROC outer part | |
bdf99a93 | 557 | return (15.*(globalpadrow - 64) + 1993.5)/10.; //divide by 10 to get cm |
bb18c002 | 558 | } |
accfa4d9 | 559 | */ |
bb18c002 | 560 | |
561 | //______________________________________________________________ | |
accfa4d9 | 562 | /* |
bdf99a93 | 563 | Double_t AliTPCmapper::GetPadYlocal(Int_t globalpadrow, Int_t pad) const |
bb18c002 | 564 | { |
bdf99a93 | 565 | // Get local y coordinate of pad, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 566 | |
bdf99a93 | 567 | if ( globalpadrow >= fNpadrow ) { |
568 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 569 | return -1.0; |
570 | } | |
571 | ||
bdf99a93 | 572 | Int_t padsInRow = GetNpads(globalpadrow); |
accfa4d9 | 573 | if ( (padsInRow < 0) || (pad >= padsInRow) ) { |
574 | AliWarning(Form("Pad index outside range (pad %d) !", pad)); | |
575 | return -1.0; | |
576 | } | |
577 | ||
578 | //IROC | |
bdf99a93 | 579 | if ( globalpadrow < fNpadrowIROC ) |
accfa4d9 | 580 | return (2.* padsInRow - 4.*pad - 2.)*1.e-1; //divide by 10 to get cm |
581 | ||
582 | //OROC | |
583 | return (3.* padsInRow -6.*pad - 3.)*1.e-1; //divide by 10 to get cm | |
bb18c002 | 584 | } |
accfa4d9 | 585 | */ |
bb18c002 | 586 | |
587 | //______________________________________________________________ | |
accfa4d9 | 588 | /* |
bdf99a93 | 589 | Double_t AliTPCmapper::GetPadXglobal(Int_t globalpadrow, Int_t pad, Int_t sector) const |
bb18c002 | 590 | { |
bdf99a93 | 591 | // Get global x coordinate of pad, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 592 | |
bdf99a93 | 593 | if ( globalpadrow >= fNpadrow ) { |
594 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 595 | return -1.0; |
596 | } | |
597 | ||
bdf99a93 | 598 | Int_t padsInRow = GetNpads(globalpadrow); |
accfa4d9 | 599 | if ( (padsInRow < 0) || (pad >= padsInRow) ) { |
600 | AliWarning(Form("Pad index outside range (pad %d) !", pad)); | |
601 | return -1.0; | |
602 | } | |
603 | ||
604 | Double_t angle = (Double_t)(( sector * 20. ) + 10. ) * TMath::DegToRad(); | |
bdf99a93 | 605 | return GetPadXlocal(globalpadrow) * TMath::Cos(angle) - |
606 | GetPadYlocal(globalpadrow, pad) * TMath::Sin(angle); | |
bb18c002 | 607 | } |
accfa4d9 | 608 | */ |
bb18c002 | 609 | |
610 | //______________________________________________________________ | |
accfa4d9 | 611 | /* |
bdf99a93 | 612 | Double_t AliTPCmapper::GetPadYglobal(Int_t globalpadrow, Int_t pad,Int_t sector) const |
bb18c002 | 613 | { |
bdf99a93 | 614 | // Get global y coordinate of pad, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 615 | |
bdf99a93 | 616 | if ( globalpadrow >= fNpadrow ) { |
617 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 618 | return -1.0; |
619 | } | |
620 | ||
bdf99a93 | 621 | Int_t padsInRow = GetNpads(globalpadrow); |
accfa4d9 | 622 | if ( (padsInRow < 0) || (pad >= padsInRow) ) { |
623 | AliWarning(Form("Pad index outside range (pad %d) !", pad)); | |
624 | return -1.0; | |
625 | } | |
626 | ||
627 | Double_t angle = (Double_t)(( sector * 20. ) + 10. ) * TMath::DegToRad(); | |
bdf99a93 | 628 | return GetPadXlocal(globalpadrow) * TMath::Sin(angle) + |
629 | GetPadYlocal(globalpadrow, pad) * TMath::Cos(angle); | |
bb18c002 | 630 | } |
accfa4d9 | 631 | */ |
bb18c002 | 632 | |
633 | //______________________________________________________________ | |
accfa4d9 | 634 | /* |
bdf99a93 | 635 | Double_t AliTPCmapper::GetPadWidth(Int_t globalpadrow) const |
bb18c002 | 636 | { |
bdf99a93 | 637 | // Get pad width, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 638 | |
bdf99a93 | 639 | if ( globalpadrow >= fNpadrow ) { |
640 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 641 | return -1.0; |
642 | } | |
643 | ||
bdf99a93 | 644 | if (globalpadrow < fNpadrowIROC ) // IROC |
accfa4d9 | 645 | return 0.4; |
646 | return 0.6; | |
bb18c002 | 647 | } |
accfa4d9 | 648 | */ |
bb18c002 | 649 | |
650 | //______________________________________________________________ | |
accfa4d9 | 651 | /* |
bdf99a93 | 652 | Double_t AliTPCmapper::GetPadLength(Int_t globalpadrow) const |
accfa4d9 | 653 | { |
bdf99a93 | 654 | // Get pad length, where globalpadrow is counted for a full sector (0 ... 158) |
accfa4d9 | 655 | |
bdf99a93 | 656 | if ( globalpadrow >= fNpadrow ) { |
657 | AliWarning(Form("Padrow outside range (globalpadrow %d) !", globalpadrow)); | |
accfa4d9 | 658 | return -1.0; |
659 | } | |
660 | ||
bdf99a93 | 661 | if ( globalpadrow < fNpadrowIROC ) return 0.75; |
662 | if ( globalpadrow < 127 ) return 1.0; | |
accfa4d9 | 663 | return 1.5; |
664 | } | |
665 | */ | |
666 | ||
667 | //_____________________________________________________________________________ | |
668 | Int_t AliTPCmapper::GetNfec(Int_t patch) const | |
bb18c002 | 669 | { |
accfa4d9 | 670 | // Get size of readout partition (number of FECs) for this rcu (patch) index (0 ... 5) |
671 | Int_t retval = 0; | |
672 | switch(patch){ | |
673 | case(0): | |
674 | retval = 18; | |
675 | break; | |
676 | case(1): | |
677 | retval = 25; | |
678 | break; | |
679 | case(2): | |
680 | retval = 18; | |
681 | break; | |
682 | case(3): | |
683 | retval = 20; | |
684 | break; | |
685 | case(4): | |
686 | retval = 20; | |
687 | break; | |
688 | case(5): | |
689 | retval = 20; | |
690 | break; | |
691 | }; | |
692 | return retval; | |
693 | } | |
bb18c002 | 694 | |
bb18c002 | 695 | |
accfa4d9 | 696 | //_____________________________________________________________________________ |
697 | Int_t AliTPCmapper::GetNfec(Int_t patch, Int_t branch) const | |
698 | { | |
699 | // Get size of readout partition (number of FECs) for this branch | |
700 | Int_t retval = 0; | |
701 | switch(patch){ | |
702 | case(0): | |
703 | retval = 9; | |
704 | break; | |
705 | case(1): | |
706 | retval = 13; | |
707 | break; | |
708 | case(2): | |
709 | retval = 9; | |
710 | break; | |
711 | case(3): | |
712 | retval = 10; | |
713 | break; | |
714 | case(4): | |
715 | retval = 10; | |
716 | break; | |
717 | case(5): | |
718 | retval = 10; | |
719 | break; | |
720 | }; | |
721 | ||
722 | if( (branch == 1) && (patch == 1) ){ | |
723 | retval = 12; | |
724 | } | |
725 | return retval; | |
726 | } | |
bb18c002 | 727 | |
bb18c002 | 728 | |
accfa4d9 | 729 | //_____________________________________________________________________________ |
730 | Int_t AliTPCmapper::OfflineToHwFec(Int_t patch, Int_t fec) const | |
731 | { | |
732 | // Convert FEC position in offline-like numbering to hardware numbering (fec). | |
733 | ||
734 | if ( (patch < 0) || (fec < 0) ) { | |
735 | AliWarning(Form("Patch (%d) or Fec number (%d) outside range !", patch, fec)); | |
736 | return -1; | |
737 | } | |
738 | if ( (patch > 5) || (fec >= GetNfec(patch)) ) { | |
739 | AliWarning(Form("Patch (%d) or Fec number (%d) outside range !", patch, fec)); | |
740 | return -1; | |
741 | } | |
742 | ||
743 | Int_t fecsInBranchA = GetNfec(patch, 0); | |
744 | if ( fec < fecsInBranchA ) // branch A | |
745 | return (fecsInBranchA - 1 - fec); | |
746 | else // branch B | |
747 | return (fec - fecsInBranchA); | |
748 | ||
749 | return -1; | |
bb18c002 | 750 | } |
751 | ||
accfa4d9 | 752 | |
753 | //_____________________________________________________________________________ | |
754 | Int_t AliTPCmapper::OfflineToHwBranch(Int_t patch, Int_t fec) const | |
755 | { | |
756 | // Convert fec position in offline-like numbering to hardware numbering (branch). | |
757 | ||
758 | if ( (patch < 0) || (fec < 0) ) { | |
759 | AliWarning(Form("Patch (%d) or Fec number (%d) outside range !", patch, fec)); | |
760 | return -1; | |
761 | } | |
762 | if ( (patch > 5) || (fec >= GetNfec(patch)) ) { | |
763 | AliWarning(Form("Patch (%d) or Fec number (%d) outside range !", patch, fec)); | |
764 | return -1; | |
765 | } | |
766 | if ( fec < GetNfec(patch, 0) ) return 0; // branch A | |
767 | else return 1; // branch B | |
768 | ||
769 | return -1; | |
770 | } | |
771 | ||
772 | ||
773 | //_____________________________________________________________________________ | |
774 | Int_t AliTPCmapper::HwToOffline(Int_t patch, Int_t branch, Int_t fec) const | |
775 | { | |
776 | // Convert hardware FEC position (branch, fec) to the offline-oriented numbering | |
777 | ||
778 | if ( (patch < 0) || (fec < 0) || (branch < 0) ) { | |
779 | AliWarning(Form("Patch (%d), branch (%d) or Fec number (%d) outside range !", patch, branch, fec)); | |
780 | return -1; | |
781 | } | |
782 | if ( (patch > 5) || (branch > 1) || (fec >= GetNfec(patch, branch)) ) { | |
783 | AliWarning(Form("Patch (%d), branch (%d) or Fec number (%d) outside range !", patch, branch, fec)); | |
784 | return -1; | |
785 | } | |
786 | Int_t fecsInBranchA = GetNfec(patch, 0); | |
787 | if ( branch == 0 ) // branch A | |
788 | return (fecsInBranchA - 1 - fec); | |
789 | else // branch B | |
790 | return (fec + fecsInBranchA); | |
791 | ||
792 | return -1; | |
793 | } | |
794 | ||
795 | ||
796 | //_____________________________________________________________________________ | |
797 | Int_t AliTPCmapper::GetEquipmentID(Int_t roc, Int_t padrow, Int_t pad) const | |
bb18c002 | 798 | { |
accfa4d9 | 799 | // Get EqID from pad coordinate. The Roc index is |
800 | // needed as well to determine if it is IROC or OROC. | |
801 | ||
802 | Int_t side = GetSideFromRoc(roc); | |
803 | if ( side < 0 ) return -1; | |
804 | Int_t sector = GetSectorFromRoc(roc); | |
805 | if ( sector < 0 ) return -1; | |
806 | Int_t patch = GetPatch(roc, padrow, pad); | |
807 | if ( patch < 0 ) return -1; | |
808 | return GetEquipmentIDfromPatch(side, sector, patch); | |
809 | } | |
810 | ||
bb18c002 | 811 | |
accfa4d9 | 812 | //_____________________________________________________________________________ |
bdf99a93 | 813 | Int_t AliTPCmapper::GetEquipmentIDsector(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 814 | { |
815 | // Get EqID from pad coordinate, where padrow is counted for a full sector (0 ... 158) | |
bdf99a93 | 816 | Int_t patch = GetPatchSector(globalpadrow, pad); |
accfa4d9 | 817 | if ( patch < 0 ) return -1; |
818 | Int_t roc = GetRocFromPatch(side, sector, patch); | |
819 | if ( roc < 0 ) return -1; | |
820 | ||
bdf99a93 | 821 | if ( globalpadrow < fNpadrowIROC ) |
822 | return GetEquipmentID(roc, globalpadrow, pad); | |
accfa4d9 | 823 | else |
bdf99a93 | 824 | return GetEquipmentID(roc, globalpadrow-fNpadrowIROC, pad); |
bb18c002 | 825 | } |
accfa4d9 | 826 | |
827 | ||
828 | //_____________________________________________________________________________ | |
829 | Int_t AliTPCmapper::GetEquipmentIDfromPatch(Int_t side, Int_t sector, Int_t patch) const | |
830 | { | |
831 | // Get EqID from patch (rcu). | |
832 | ||
833 | Int_t roc = GetRocFromPatch(side, sector, patch); | |
834 | Int_t ddl = 0; | |
835 | if (patch < 2) // IROC | |
836 | ddl = roc*2 + patch; | |
837 | else // OROC | |
838 | ddl = (roc-36)*4 + 36*2 + (patch-2); | |
839 | // Add offset. TPC has detectorID = 3 | |
bdf99a93 | 840 | return ddl+fTpcDdlOffset; |
accfa4d9 | 841 | } |
842 | ||
843 | ||
844 | //_____________________________________________________________________________ | |
845 | Int_t AliTPCmapper::GetPatchFromEquipmentID(Int_t equipmentID) const | |
846 | { | |
847 | // Get rcu (patch) index (0 ... 5) from equipment ID | |
848 | Int_t retval = 0; | |
849 | ||
bdf99a93 | 850 | if ( (equipmentID < fTpcDdlOffset) || (equipmentID > 983) ) { |
accfa4d9 | 851 | AliWarning(Form("Equipment ID (%d) outside range !", equipmentID)); |
852 | return -1; | |
853 | } | |
854 | if ( ( (int)equipmentID - 840 ) < 0) retval = (equipmentID-768)%2; | |
855 | else retval = (equipmentID-840)%4 + 2; | |
856 | return retval; | |
857 | } | |
858 | ||
859 | ||
860 | //_____________________________________________________________________________ | |
861 | Int_t AliTPCmapper::GetSideFromEquipmentID(Int_t equipmentID) const | |
862 | { | |
863 | // Get side from Eq ID | |
bdf99a93 | 864 | if ( equipmentID < fTpcDdlOffset ) { |
accfa4d9 | 865 | AliWarning(Form("Equipment ID (%d) outside range !", equipmentID)); |
866 | return -1; | |
867 | } | |
868 | if ( equipmentID < 804 ) return 0; | |
869 | else if ( equipmentID < 840 ) return 1; | |
870 | else if ( equipmentID < 912 ) return 0; | |
871 | else if ( equipmentID < 984 ) return 1; | |
872 | else { | |
873 | AliWarning(Form("Equipment ID (%d) outside range !", equipmentID)); | |
874 | return -1; | |
875 | } | |
876 | } | |
877 | ||
878 | ||
879 | //_____________________________________________________________________________ | |
880 | Int_t AliTPCmapper::GetSectorFromEquipmentID(Int_t equipmentID) const | |
881 | { | |
882 | // Get sector index (0 ... 17) from equipment ID | |
883 | Int_t retval = 0; | |
884 | ||
bdf99a93 | 885 | if ( (equipmentID < fTpcDdlOffset) || (equipmentID > 983) ) { |
accfa4d9 | 886 | AliWarning(Form("Equipment ID (%d) outside range !", equipmentID)); |
887 | return -1; | |
888 | } | |
889 | if ( (equipmentID - 840) < 0 ) retval = (equipmentID-768)/2; | |
890 | else retval = (equipmentID-840)/4; | |
891 | return retval; | |
892 | } | |
893 | ||
894 | ||
895 | //_____________________________________________________________________________ | |
896 | Int_t AliTPCmapper::GetRocFromEquipmentID(Int_t equipmentID) const | |
897 | { | |
898 | // Get ROC index (0 ... 71) from equipment ID | |
899 | Int_t side = GetSideFromEquipmentID(equipmentID); | |
900 | if ( side < 0 ) return -1; | |
901 | Int_t sector = GetSectorFromEquipmentID(equipmentID); | |
902 | if ( sector < 0 ) return -1; | |
903 | Int_t patch = GetPatchFromEquipmentID(equipmentID); | |
904 | if ( patch < 0 ) return -1; | |
905 | ||
906 | return GetRocFromPatch(side, sector, patch); | |
907 | } | |
908 | ||
909 | ||
910 | //_____________________________________________________________________________ | |
911 | Int_t AliTPCmapper::GetSectorFromRoc(Int_t roc) const | |
912 | { | |
913 | // get the sector number (0 ... 17) from the roc number (0 ... 71) | |
914 | ||
915 | if ( roc < 0 ) { | |
916 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
917 | return -1; | |
918 | } else if ( roc < 18 ) { // inner sector, A side | |
919 | return roc; | |
920 | } else if ( roc < 36 ) { // inner sector, C side | |
921 | return (roc-18); | |
922 | } else if ( roc < 54 ) { // outer sector, A side | |
923 | return (roc-36); | |
924 | } else if ( roc < 72 ) { // outer sector, C side | |
925 | return (roc-54); | |
926 | } else { | |
927 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
928 | return -1; | |
929 | } | |
930 | } | |
931 | ||
932 | ||
933 | //_____________________________________________________________________________ | |
934 | Int_t AliTPCmapper::GetSideFromRoc(Int_t roc) const | |
935 | { | |
936 | // get the side (0, 1) from the roc number (0 ... 71) | |
937 | ||
938 | if ( roc < 0 ) { | |
939 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
940 | return -1; | |
941 | } else if ( roc < 18 ) { // inner sector, A side | |
942 | return 0; | |
943 | } else if ( roc < 36 ) { // inner sector, C side | |
944 | return 1; | |
945 | } else if ( roc < 54 ) { // outer sector, A side | |
946 | return 0; | |
947 | } else if ( roc < 72 ) { // outer sector, C side | |
948 | return 1; | |
949 | } else { | |
950 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
951 | return -1; | |
952 | } | |
953 | } | |
954 | ||
955 | ||
956 | //_____________________________________________________________________________ | |
957 | Int_t AliTPCmapper::GetRocFromPatch(Int_t side, Int_t sector, Int_t patch) const | |
958 | { | |
959 | // Get Roc (0 ... 71) from side (0, 1), sector (0 ... 17) and patch (0 ... 5) | |
960 | ||
961 | if ( (side < 0) || (side >= fNside) ) { | |
962 | AliWarning(Form("Side outside range (side %d) !", side)); | |
963 | return -1; | |
964 | } | |
965 | if ( (sector < 0) || (sector >= fNsector) ) { | |
966 | AliWarning(Form("Sector outside range (sector %d) !", sector)); | |
967 | return -1; | |
968 | } | |
969 | if ( (patch < 0) || (patch >= fNrcu) ) { | |
970 | AliWarning(Form("Patch (rcu) outside range (patch %d) !", patch)); | |
971 | return -1; | |
972 | } | |
973 | ||
974 | if ( side == 0 ) { // A side | |
975 | if ( patch < 2 ) return sector; // IROC | |
976 | else return 36+sector; // OROC | |
977 | } else { // C side | |
978 | if ( patch < 2 ) return 18+(17-sector); // IROC | |
979 | else return 54+(17-sector); // OROC | |
980 | } | |
981 | } | |
982 | ||
983 | ||
984 | //_____________________________________________________________________________ | |
bdf99a93 | 985 | Int_t AliTPCmapper::GetRoc(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const |
accfa4d9 | 986 | { |
987 | // Get Roc (0 ... 71) from side (0, 1), sector (0 ... 17) and pad coordinates | |
988 | ||
bdf99a93 | 989 | Int_t patch = GetPatchSector(globalpadrow, pad); |
accfa4d9 | 990 | if ( patch < 0 ) return -1; |
991 | return GetRocFromPatch(side, sector, patch); | |
992 | } | |
993 | ||
994 | ||
995 | //_____________________________________________________________________________ | |
996 | Bool_t AliTPCmapper::IsIROC(Int_t roc) const | |
997 | { | |
998 | // Is this ROC an IROC? | |
999 | if ( roc < 0 ) { | |
1000 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
1001 | return -1; | |
1002 | } else if ( roc < 36 ) { // inner sector | |
1003 | return true; | |
1004 | } else if ( roc < 72 ) { // outer sector, C side | |
1005 | return false; | |
1006 | } else { | |
1007 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
1008 | return -1; | |
1009 | } | |
1010 | } | |
1011 | ||
1012 | ||
1013 | //_____________________________________________________________________________ | |
1014 | Bool_t AliTPCmapper::IsOROC(Int_t roc) const | |
1015 | { | |
1016 | // Is this ROC an OROC? | |
1017 | if ( roc < 0 ) { | |
1018 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
1019 | return -1; | |
1020 | } else if ( roc < 36 ) { // inner sector | |
1021 | return false; | |
1022 | } else if ( roc < 72 ) { // outer sector, C side | |
1023 | return true; | |
1024 | } else { | |
1025 | AliWarning(Form("Roc outside range (roc %d) !", roc)); | |
1026 | return -1; | |
1027 | } | |
1028 | } | |
1029 | ||
1030 | // EOF |