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