66 for ( Int_t i = 0; i < 6; i++ )
fMapping[i]=0;
94 for ( Int_t i = 0; i <
fNrcu; i++ ) {
117 for ( Int_t i = 0; i < 6; i++ )
fMapping[i]=0;
126 if(&mapper ==
this)
return *
this;
127 ((TObject *)
this)->operator=(mapper);
133 fNrcu = mapper.
fNrcu;
161 path =gSystem->Getenv(
"ALICE_ROOT");
162 path +=
"/TPC/mapping/Patch";
169 for(Int_t i = 0; i <
fNrcu; i++) {
193 Int_t patch =
GetPatch(roc, padrow, pad);
194 if ( (patch >=
fNrcu) || (patch < 0) )
return -1;
207 patch =
GetPatch(0, globalpadrow, pad);
210 }
else if ( globalpadrow <
fNpadrow ) {
215 AliWarning(Form(
"Padrow outside range (globalpadrow %d) !", globalpadrow));
238 if ( (padrow < 0) || (pad < 0) || (roc < 0) ) {
239 AliWarning(Form(
"Pad coordinates outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc));
246 if ( (padsInRow < 0) || (pad >= padsInRow) ) {
247 AliWarning(Form(
"Pad index outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc));
250 if ( padrow < 30 ) {
return 0;
251 }
else if ( padrow == 30 ) {
252 if ( (pad < 37) || (pad > 48) )
return 1;
256 AliWarning(Form(
"Padrow outside range (padrow %d, roc %d) !", padrow, roc));
259 }
else if ( roc < 72 ) {
262 if ( (padsInRow < 0) || (pad >= padsInRow) ) {
263 AliWarning(Form(
"Pad index outside range (padrow %d, pad %d, roc %d) !", padrow, pad, roc));
266 if ( padrow < 27 ) {
return 2;
267 }
else if ( padrow == 27 ) {
268 if ( (pad >= 43) && (pad <= 46) )
return 3;
270 }
else if ( padrow < 54 ) {
return 3;
271 }
else if ( padrow < 76 ) {
return 4;
272 }
else if ( padrow == 76) {
273 if ( (pad >= 33) && (pad <= 88) )
return 5;
277 AliWarning(Form(
"Padrow outside range (padrow %d, roc %d) !", padrow, roc));
300 AliWarning(Form(
"Padrow outside range (globalpadrow %d) !", globalpadrow));
313 if ( (patch >=
fNrcu) || (patch < 0) ) {
314 AliWarning(Form(
"Patch index outside range (patch %d) !", patch));
326 if ( patch < 2 )
return GetPadRow(patch, hwAddress);
336 if ( (patch >=
fNrcu) || (patch < 0) ) {
337 AliWarning(Form(
"Patch index outside range (patch %d) !", patch));
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));
367 || (patch < 0) || (branch < 0) || (chip < 0) || (channel < 0) ) {
368 AliWarning(Form(
"Coordinates outside range (patch %d, branch %d, fec %d, chip %d, channel %d)) !",
369 patch, branch, fec, chip, channel));
372 if ( patch < 2 )
return GetPadRow(patch, branch, fec, chip, channel);
383 || (patch < 0) || (branch < 0) || (chip < 0) || (channel < 0) ) {
384 AliWarning(Form(
"Coordinates outside range (patch %d, branch %d, fec %d, chip %d, channel %d)) !",
385 patch, branch, fec, chip, channel));
441 Int_t patch =
GetPatch(roc, padrow, pad);
444 if ( (fec < 0) || (branch < 0) || (patch < 0) )
return -1;
458 if ( (fec < 0) || (branch < 0) || (patch < 0) )
return -1;
506 return ((branch&1)<<11) + ((fec&0xf)<<7) + ((chip&0x7)<<4) + (channel&0xf);
515 if ( hwAddress < 0 )
return -1;
516 return ((hwAddress>>11)&1);
525 if ( hwAddress < 0 )
return -1;
526 return ((hwAddress>>7)&0xf);
535 if ( hwAddress < 0 )
return -1;
536 return ((hwAddress>>4)&0x7);
545 if ( hwAddress < 0 )
return -1;
546 return ((hwAddress&0xf));
555 Int_t retval = fROC->
GetNPads((UInt_t)roc, (UInt_t)padrow);
565 AliWarning(Form(
"Padrow outside range (globalpadrow %d) !", globalpadrow));
774 if( (branch == 1) && (patch == 1) ){
787 if ( (patch < 0) || (fec < 0) ) {
788 AliWarning(Form(
"Patch (%d) or Fec number (%d) outside range !", patch, fec));
791 if ( (patch > 5) || (fec >=
GetNfec(patch)) ) {
792 AliWarning(Form(
"Patch (%d) or Fec number (%d) outside range !", patch, fec));
796 Int_t fecsInBranchA =
GetNfec(patch, 0);
797 if ( fec < fecsInBranchA )
798 return (fecsInBranchA - 1 - fec);
800 return (fec - fecsInBranchA);
811 if ( (patch < 0) || (fec < 0) ) {
812 AliWarning(Form(
"Patch (%d) or Fec number (%d) outside range !", patch, fec));
815 if ( (patch > 5) || (fec >=
GetNfec(patch)) ) {
816 AliWarning(Form(
"Patch (%d) or Fec number (%d) outside range !", patch, fec));
819 if ( fec <
GetNfec(patch, 0) )
return 0;
831 if ( (patch < 0) || (fec < 0) || (branch < 0) ) {
832 AliWarning(Form(
"Patch (%d), branch (%d) or Fec number (%d) outside range !", patch, branch, fec));
835 if ( (patch > 5) || (branch > 1) || (fec >=
GetNfec(patch, branch)) ) {
836 AliWarning(Form(
"Patch (%d), branch (%d) or Fec number (%d) outside range !", patch, branch, fec));
839 Int_t fecsInBranchA =
GetNfec(patch, 0);
841 return (fecsInBranchA - 1 - fec);
843 return (fec + fecsInBranchA);
856 if ( side < 0 )
return -1;
858 if ( sector < 0 )
return -1;
859 Int_t patch =
GetPatch(roc, padrow, pad);
860 if ( patch < 0 )
return -1;
871 if ( patch < 0 )
return -1;
873 if ( roc < 0 )
return -1;
892 ddl = (roc-36)*4 + 36*2 + (patch-2);
905 if ( (equipmentID <
fTpcDdlOffset) || (equipmentID > 983) ) {
906 AliWarning(Form(
"Equipment ID (%d) outside range !", equipmentID));
909 if ( ( (
int)equipmentID - 840 ) < 0) retval = (equipmentID-768)%2;
910 else retval = (equipmentID-840)%4 + 2;
921 AliWarning(Form(
"Equipment ID (%d) outside range !", equipmentID));
924 if ( equipmentID < 804 )
return 0;
925 else if ( equipmentID < 840 )
return 1;
926 else if ( equipmentID < 912 )
return 0;
927 else if ( equipmentID < 984 )
return 1;
929 AliWarning(Form(
"Equipment ID (%d) outside range !", equipmentID));
942 AliWarning(Form(
"Equipment ID (%d) outside range !", equipmentID));
946 if ( side < 0 )
return -1;
948 if ( (equipmentID - 840) < 0 ) {
952 if ( side == 0 ) retval = (equipmentID-840)/4;
953 else retval = (equipmentID-840-18*4)/4;
965 if ( side < 0 )
return -1;
967 if ( sector < 0 )
return -1;
969 if ( patch < 0 )
return -1;
981 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
983 }
else if ( roc < 18 ) {
985 }
else if ( roc < 36 ) {
987 }
else if ( roc < 54 ) {
989 }
else if ( roc < 72 ) {
992 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1004 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1006 }
else if ( roc < 18 ) {
1008 }
else if ( roc < 36 ) {
1010 }
else if ( roc < 54 ) {
1012 }
else if ( roc < 72 ) {
1015 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1026 if ( (side < 0) || (side >=
fNside) ) {
1027 AliWarning(Form(
"Side outside range (side %d) !", side));
1030 if ( (sector < 0) || (sector >=
fNsector) ) {
1031 AliWarning(Form(
"Sector outside range (sector %d) !", sector));
1034 if ( (patch < 0) || (patch >=
fNrcu) ) {
1035 AliWarning(Form(
"Patch (rcu) outside range (patch %d) !", patch));
1040 if ( patch < 2 )
return sector;
1041 else return 36+sector;
1043 if ( patch < 2 )
return 18+sector;
1044 else return 54+sector;
1055 if ( patch < 0 )
return -1;
1066 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1068 }
else if ( roc < 36 ) {
1070 }
else if ( roc < 72 ) {
1073 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1085 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
1087 }
else if ( roc < 36 ) {
1089 }
else if ( roc < 72 ) {
1092 AliWarning(Form(
"Roc outside range (roc %d) !", roc));
UInt_t GetNPads(UInt_t sector, UInt_t row) const
Int_t GetChipSector(Int_t globalpadrow, Int_t pad) const
Int_t DecodedHWAddressChipaddr(Int_t hwAddress) const
Bool_t IsIROC(Int_t roc) const
Int_t GetGlobalPadRow(Int_t patch, Int_t hwAddress) const
Int_t GetNpads(Int_t roc, Int_t padrow) const
Int_t GetFECSector(Int_t globalpadrow, Int_t pad) const
Int_t GetRcu(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetHWAddressSector(Int_t globalpadrow, Int_t pad) const
Int_t DecodedHWAddressChanneladdr(Int_t hwAddress) const
Int_t GetRoc(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const
Int_t GetPad(Int_t patch, Int_t hwAddress) const
Int_t GetEquipmentIDsector(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const
AliTPCAltroMapping * fMapping[6]
The ALTRO mapping for each patch (rcu)
Int_t GetFEChwSector(Int_t globalpadrow, Int_t pad) const
Int_t GetNfec(Int_t patch, Int_t branch) const
Int_t OfflineToHwBranch(Int_t patch, Int_t fec) const
Int_t GetFEC(Int_t roc, Int_t padrow, Int_t pad) const
Int_t CodeHWAddress(Int_t branch, Int_t fec, Int_t chip, Int_t channel) const
#define AliWarning(message)
Int_t GetPatch(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetEquipmentID(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetFEChw(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetSideFromEquipmentID(Int_t equipmentID) const
Int_t GetChannel(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetRocFromPatch(Int_t side, Int_t sector, Int_t patch) const
Int_t GetBranchSector(Int_t globalpadrow, Int_t pad) const
Int_t DecodedHWAddressBranch(Int_t hwAddress) const
Geometry class for a single ROC.
AliTPCmapper & operator=(const AliTPCmapper &mapper)
Int_t GetPadRow(Int_t patch, Int_t hwAddress) const
Int_t OfflineToHwFec(Int_t patch, Int_t fec) const
Int_t fNrcu
Sector has 6 RCUs (patches)
Int_t fNpadrowIROC
IROC has 63 padrows.
Int_t GetChip(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetPatchFromEquipmentID(Int_t equipmentID) const
Int_t DecodedHWAddressFECaddr(Int_t hwAddress) const
static Int_t DdlIDOffset(const char *detectorName)
AliCaloAltroMapping * fMapping[4]
Int_t fNpadrow
Sector has 159 padrows.
Int_t fNside
TPC has 2 sides.
Int_t GetSectorFromRoc(Int_t roc) const
Int_t fNaltro
FEC has 8 ALTROs.
Int_t fTpcDdlOffset
DDL offset for TPC.
Int_t fNsector
TPC side has 18 sectors.
Int_t GetRcuSector(Int_t globalpadrow, Int_t pad) const
virtual Int_t GetPadRow(Int_t hwAddress) const
Int_t fNpadrowOROC
OROC has 96 padrows.
Int_t GetEquipmentIDfromPatch(Int_t side, Int_t sector, Int_t patch) const
Int_t GetRocFromEquipmentID(Int_t equipmentID) const
virtual Int_t GetPad(Int_t hwAddress) const
Int_t GetChannelSector(Int_t globalpadrow, Int_t pad) const
Int_t fNbranch
RCU has 2 branches.
static AliTPCROC * Instance()
Int_t GetSideFromRoc(Int_t roc) const
Int_t GetHWAddress(Int_t roc, Int_t padrow, Int_t pad) const
Int_t fNchannel
ALTRO has 16 channels.
Bool_t IsOROC(Int_t roc) const
Int_t HwToOffline(Int_t patch, Int_t branch, Int_t fec) const
Int_t GetSectorFromEquipmentID(Int_t equipmentID) const
Int_t GetBranch(Int_t roc, Int_t padrow, Int_t pad) const
Int_t GetNpadrows(Int_t roc) const
virtual Int_t GetHWAddress(Int_t padrow, Int_t pad, Int_t sector)
void Init(const char *dirname)
Int_t GetPatchSector(Int_t globalpadrow, Int_t pad) const