Skip to content
Snippets Groups Projects
Commit 6bd1700e authored by Pascal Raisig's avatar Pascal Raisig Committed by Pascal Raisig
Browse files

Fix spadic 2.2 channel mapping in asic coordinates

parent 862a44d6
No related branches found
No related tags found
1 merge request!88Fix spadic ch mapping
......@@ -278,15 +278,24 @@ void CbmTrdParManager::CreateModuleParameters(const TString& path) {
chAddressesVec.clear();
chAddressesVec.resize(nAsicChannels);
Int_t iAsicChannel(0);
Int_t iAsicChannel =
0; // This is the nth asic channel as it is written to the raw messages
for (auto channelAddress : chAddressesVec) {
// Each row of asic channels for one spadic has its own eLink. The numbering of the channels is stored in the GetElinkChannel() function
channelAddress = asic->GetElinkChannel(iAsicChannel);
if ((iAsicChannel % 2 != 0))
channelAddress +=
nModuleColumns; // one asic is split over two rows with odd channels in the top row, thus there address is placed in the next column
// Now apply the asic specific mapping
channelAddress = asic->GetAsicChAddress(
iAsicChannel); // returns the channeladdress in the scope of one asic
// Get the channel addressed to the top or bottom row of the single asic
if ((channelAddress / (nAsicChannels / 2)) > 0) {
// if the address corresponds to the second 16 channels 16..31 it goes into the next row
channelAddress -= (nAsicChannels / 2);
// since we have only 16 channels per row we have to subtract 16 from channels 16..31
channelAddress += nModuleColumns;
}
// move channel address to the correct column according to the asic column position
channelAddress +=
nThAsicColumn * nAsicChannels / 2; // one asic is split over two rows
// move channel address to the correct row according to the asic row position
channelAddress +=
nThAsicRow * nModuleColumns * 2; // one asic is split over two rows
......
......@@ -183,13 +183,21 @@ Int_t CbmTrdParSpadic::GetNasicsPerCrob(Int_t moduleType) {
return nAsicsPerCrob;
}
// ---- GetElinkChannel ----------------------------------------------------
Int_t CbmTrdParSpadic::GetElinkChannel(Int_t channelNumber) {
///< Returns the asic channel number from 00..15 (2 eLinks) in asic coordinates. Spadic channels are not mapped from 00 to 31 in padplane coordinates, this function returns the asic channel in padplane coordinates in the system of one asic (not in the channel map of a full module!)
std::vector<Int_t> spadicChannelMap = {
15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8,
7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0};
return spadicChannelMap.at(channelNumber);
// ---- GetAsicChAddress ----
Int_t CbmTrdParSpadic::GetAsicChAddress(const Int_t asicChannel) {
Int_t address = -1;
///< Returns the nth asic Channel in asic coordinates in single asic padplane coordinates. Spadic channels are not mapped from 00 to 31 in padplane coordinates, this function returns the padplane channelnumber in the system of one asic(not in the channel map of a full module !)
auto elinkCh = asicChannel;
if (asicChannel > 15)
elinkCh -= NSPADICCH / 2; // The mapping is symmetric for the elinks
std::vector<Int_t> chvec = {
15, 7, 14, 6, 13, 11, 5, 12, 10, 4, 3, 9, 8, 2, 1, 0};
address = chvec.at(elinkCh);
if (asicChannel > 15)
address +=
NSPADICCH
/ 2; // Get the correct value for the channels in the second elink
return address;
}
ClassImp(CbmTrdParSpadic)
......@@ -69,9 +69,8 @@ public:
UInt_t GetAddressOnModule() const {
return fAddress % 1000;
} ///< Returns the number of the asic on the module counted from top left
Int_t GetElinkChannel(
Int_t
channelNumber); ///< Returns the asic channel number from 00..15 (2 eLinks) in asic coordinates. Spadic channels are not mapped from 00 to 31 in padplane coordinates, this function returns the asic channel in padplane coordinates in the system of one asic (not in the channel map of a full module!)
Int_t GetAsicChAddress(const Int_t asicChannel);
///< Returns the nth asic Channel in asic coordinates in single asic padplane coordinates. Spadic channels are not mapped from 00 to 31 in padplane coordinates, this function returns the padplane channelnumber in the system of one asic(not in the channel map of a full module !)
private:
......
......@@ -884,10 +884,11 @@ CbmMcbm2018UnpackerAlgoTrdR::MakeDigi(CbmTrdRawMessageSpadic raw) {
Int_t uniqueModuleId = asicAddress / 1000;
// Int_t layerId(CbmTrdAddress::GetLayerId(uniqueModuleId));
// Int_t moduleId(CbmTrdAddress::GetModuleId(uniqueModuleId));
Int_t asicChannelId(0);
asicChannelId = (raw.GetElinkId() % 2) == fIsFirstChannelsElinkEven
? raw.GetChannelId()
: raw.GetChannelId() + NSPADICCH / 2;
auto asicChannelId = (raw.GetElinkId() % 2) == fIsFirstChannelsElinkEven
? raw.GetChannelId()
: raw.GetChannelId() + NSPADICCH / 2;
digiAddress = (fAsicChannelMap.find(asicAddress))->second.at(asicChannelId);
std::shared_ptr<CbmTrdDigi> digi =
......
......@@ -73,8 +73,8 @@ ELSE (SSE_FOUND)
"-O3")
ENDIF (SSE_FOUND)
set(LINKDEF CbmTrdRecLinkDef.h)
Set(LIBRARY_NAME CbmTrdRec)
set(LINKDEF CbmTrdRecoLinkDef.h)
Set(LIBRARY_NAME CbmTrdReco)
Set(DEPENDENCIES
CbmRecoBase CbmBase CbmData Base CbmTrdBase TMVA
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment