X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSRawStreamSPD.cxx;h=402851e8f4d9fc718e265fa61cee7f41ab12666b;hb=6727e2db6c4c01a8fd22c2e8db31c532eaece212;hp=bcf52869d0902cd6a595626dfa6d50b71780fa2a;hpb=ba7cdd781e96aef517f7de9e22c01dd1ef54b8cb;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSRawStreamSPD.cxx b/ITS/AliITSRawStreamSPD.cxx index bcf52869d09..402851e8f4d 100644 --- a/ITS/AliITSRawStreamSPD.cxx +++ b/ITS/AliITSRawStreamSPD.cxx @@ -28,7 +28,6 @@ ClassImp(AliITSRawStreamSPD) - // this map has to change, waiting for the new geometry const Int_t AliITSRawStreamSPD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = { { 0, 1, 4, 5, 80, 81, 84, 85, 88, 89, 92, 93}, { 8, 9,12,13, 96, 97,100,101,104,105,108,109}, @@ -208,8 +207,7 @@ Bool_t AliITSRawStreamSPD::Next() fHalfStaveNr=5; } // translate ("online") ddl, hs, chip nr to ("offline") module id : - fModuleID = fgkDDLModuleMap[ddlID][fHalfStaveNr*2+fChipAddr/5]; - fOffset = 32 * (fChipAddr % 5); + fModuleID = GetOfflineModuleFromOnline(ddlID,fHalfStaveNr,fChipAddr); } else if ((fData & 0xC000) == 0x0000) { // trailer UShort_t hitCount = fData & 0x1FFF; @@ -223,15 +221,8 @@ Bool_t AliITSRawStreamSPD::Next() fCol = (fData & 0x001F); fRow = (fData >> 5) & 0x00FF; - // translate ("online") chipcol, chiprow to ("offline") col (coord1), row (coord2): - // This will change, waiting for new geometry!!! - fCoord1 = fCol; - // if (fModuleID < 80 && ddlID < 10) fCoord1=31-fCoord1; - // else if (fModuleID >=80 && ddlID >=10) fCoord1=31-fCoord1; - fCoord1 += fOffset; - // if (ddlID>=10) fCoord1=159-fCoord1; - fCoord2 = fRow; - // if (fModuleID<80) fCoord2=255-fCoord2; + fCoord1 = GetOfflineColFromOnline(ddlID,fHalfStaveNr,fChipAddr,fCol); + fCoord2 = GetOfflineRowFromOnline(ddlID,fHalfStaveNr,fChipAddr,fRow); return kTRUE; } @@ -294,3 +285,103 @@ Bool_t AliITSRawStreamSPD::GetHminTHchipPresent(UInt_t chip) const { if (chip<10) return ((( fCalHeadWord[7]>>(16+chip)) & 0x00000001) == 1); else return kFALSE; } + + + + +Int_t AliITSRawStreamSPD::GetModuleNumber(UInt_t iDDL, UInt_t iModule) { + if (iDDL<20 && iModule<12) return fgkDDLModuleMap[iDDL][iModule]; + else return 240; +} + + + + +Bool_t AliITSRawStreamSPD::OfflineToOnline(UInt_t module, UInt_t colM, UInt_t rowM, UInt_t& eq, UInt_t& hs, UInt_t& chip, UInt_t& col, UInt_t& row) { + // converts offline coordinates to online + eq = GetOnlineEqIdFromOffline(module); + hs = GetOnlineHSFromOffline(module); + chip = GetOnlineChipFromOffline(module,colM); + col = GetOnlineColFromOffline(module,colM); + row = GetOnlineRowFromOffline(module,rowM); + if (eq>=20 || hs>=6 || chip>=10 || col>=32 || row>=256) return kFALSE; + else return kTRUE; +} + + +Bool_t AliITSRawStreamSPD::OnlineToOffline(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row, UInt_t& module, UInt_t& colM, UInt_t& rowM) { + // converts online coordinates to offline + module = GetOfflineModuleFromOnline(eq,hs,chip); + colM = GetOfflineColFromOnline(eq,hs,chip,col); + rowM = GetOfflineRowFromOnline(eq,hs,chip,row); + if (module>=240 || colM>=160 || rowM>=256) return kFALSE; + else return kTRUE; +} + + +UInt_t AliITSRawStreamSPD::GetOnlineEqIdFromOffline(UInt_t module) { + // offline->online (eq) + for (UInt_t eqId=0; eqId<20; eqId++) { + for (UInt_t iModule=0; iModule<12; iModule++) { + if (GetModuleNumber(eqId,iModule)==(Int_t)module) return eqId; + } + } + return 20; // error +} + +UInt_t AliITSRawStreamSPD::GetOnlineHSFromOffline(UInt_t module) { + // offline->online (hs) + for (UInt_t eqId=0; eqId<20; eqId++) { + for (UInt_t iModule=0; iModule<12; iModule++) { + if (GetModuleNumber(eqId,iModule)==(Int_t)module) return iModule/2; + } + } + return 6; // error +} + +UInt_t AliITSRawStreamSPD::GetOnlineChipFromOffline(UInt_t module, UInt_t colM) { + // offline->online (chip) + for (UInt_t eq=0; eq<20; eq++) { + for (UInt_t iModule=0; iModule<12; iModule++) { + if (GetModuleNumber(eq,iModule)==(Int_t)module) { + return colM/32 + 5*(iModule%2); + } + } + } + return 10; // error +} + +UInt_t AliITSRawStreamSPD::GetOnlineColFromOffline(UInt_t module, UInt_t colM) { + // offline->online (col) + if (colM<160) return colM%32; + else return 32; // error +} + +UInt_t AliITSRawStreamSPD::GetOnlineRowFromOffline(UInt_t module, UInt_t rowM) { + // offline->online (row) + if (rowM<256) return rowM; + else return 256; // error +} + + + + + +UInt_t AliITSRawStreamSPD::GetOfflineModuleFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip) { + // online->offline (module) + if (eqId<20 && hs<6 && chip<10) return fgkDDLModuleMap[eqId][hs*2+chip/5]; + else return 240; +} + +UInt_t AliITSRawStreamSPD::GetOfflineColFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col) { + // online->offline (col) + if (eqId>=20 || hs>=6 || chip>=10 || col>=32) return 160; // error + UInt_t offset = 32 * (chip % 5); + return col+offset; +} + +UInt_t AliITSRawStreamSPD::GetOfflineRowFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t row) { + // online->offline (row) + if (eqId>=20 || hs>=6 || chip>=10 || row>=256) return 256; // error + return row; +}