Skip to content
Snippets Groups Projects
Commit 06942549 authored by Dominik Smith's avatar Dominik Smith
Browse files

cbm::algo::UnpackSts and related classes: Changed asic enumeration to account...

cbm::algo::UnpackSts and related classes: Changed asic enumeration to account for downward counting on module backside.
parent a9fb81bc
No related branches found
No related tags found
1 merge request!1206cbm::algo::UnpackSts: Implemented walk correction. Improved asic enumeration.
Pipeline #22823 passed
...@@ -61,6 +61,7 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config) ...@@ -61,6 +61,7 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config)
const uint16_t numCrobPerComp = config.components.at(0).feb2module.size(); // Number of CROBs per component const uint16_t numCrobPerComp = config.components.at(0).feb2module.size(); // Number of CROBs per component
// const uint16_t numFebsPerCrob = config.components.at(0).feb2module.at(0).size(); // Number of FEBs per CROB // const uint16_t numFebsPerCrob = config.components.at(0).feb2module.at(0).size(); // Number of FEBs per CROB
const uint16_t numAsicsPerFeb = config.numAsicsPerFeb; // Number of ASICs per FEB const uint16_t numAsicsPerFeb = config.numAsicsPerFeb; // Number of ASICs per FEB
const uint16_t numAsicsPerMod = 2 * numAsicsPerFeb; // Number of ASICs per module
const uint16_t numElinksPerCrob = config.elinks.size(); // Number of elinks per CROB const uint16_t numElinksPerCrob = config.elinks.size(); // Number of elinks per CROB
// Constructing the map (equipmentId, eLink) -> (module, ASIC within module) // Constructing the map (equipmentId, eLink) -> (module, ASIC within module)
...@@ -93,8 +94,8 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config) ...@@ -93,8 +94,8 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config)
int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B
uint32_t asicIndex = (febType == 0 ? elink.toAsicFebA : elink.toAsicFebB); uint32_t asicIndex = (febType == 0 ? elink.toAsicFebA : elink.toAsicFebB);
uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB
// Asic number is counted downward from numAsicsPerMod - 1 for p side
asicInModule = (moduleSide == 1 ? asicInFeb : asicInFeb + numAsicsPerFeb); asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb);
} }
} }
fReadoutConfig[equipment][elinkIdx] = {moduleAddress, asicInModule, isPulser}; fReadoutConfig[equipment][elinkIdx] = {moduleAddress, asicInModule, isPulser};
......
...@@ -79,6 +79,7 @@ namespace cbm::algo ...@@ -79,6 +79,7 @@ namespace cbm::algo
const uint16_t numCrobPerComp = 1; // Number of CROBs per component const uint16_t numCrobPerComp = 1; // Number of CROBs per component
const uint16_t numFebsPerCrob = 5; // Number of FEBs per CROB const uint16_t numFebsPerCrob = 5; // Number of FEBs per CROB
const uint16_t numAsicsPerFeb = 8; // Number of ASICs per FEB const uint16_t numAsicsPerFeb = 8; // Number of ASICs per FEB
const uint16_t numAsicsPerMod = 16; // Number of ASICs per module
const uint16_t numElinksPerCrob = 42; // Number of elinks per CROB const uint16_t numElinksPerCrob = 42; // Number of elinks per CROB
// Equipment IDs for each component // Equipment IDs for each component
...@@ -169,8 +170,8 @@ namespace cbm::algo ...@@ -169,8 +170,8 @@ namespace cbm::algo
int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B
uint32_t asicIndex = (febType == 0 ? elink2AsicFebA[elinkId] : elink2AsicFebB[elinkId]); uint32_t asicIndex = (febType == 0 ? elink2AsicFebA[elinkId] : elink2AsicFebB[elinkId]);
uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB
// Asic number is counted downward from numAsicsPerMod - 1 for p side
asicInModule = (moduleSide == 1 ? asicInFeb : asicInFeb + numAsicsPerFeb); asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb);
} }
} }
fReadoutMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule); fReadoutMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule);
......
...@@ -105,15 +105,12 @@ namespace cbm::algo ...@@ -105,15 +105,12 @@ namespace cbm::algo
uint32_t asicNr = elinkPar.fAsicNr; uint32_t asicNr = elinkPar.fAsicNr;
// --- Hardware-to-software address // --- Hardware-to-software address
uint32_t numChansPerModule = fParams.fNumAsicsPerModule * fParams.fNumChansPerAsic; uint32_t channel = 0;
uint32_t address = elinkPar.fAddress; if (asicNr < fParams.fNumAsicsPerModule / 2) { // front side (n side); channels counted upward
uint32_t channel = 0;
if (asicNr < fParams.fNumAsicsPerModule / 2) { // front side (n side)
channel = message.GetHitChannel() + fParams.fNumChansPerAsic * asicNr; channel = message.GetHitChannel() + fParams.fNumChansPerAsic * asicNr;
} }
else { // back side (p side) else { // back side (p side); channels counted downward
channel = numChansPerModule - message.GetHitChannel() channel = fParams.fNumChansPerAsic * (asicNr + 1) - message.GetHitChannel() - 1;
- fParams.fNumChansPerAsic * (asicNr - fParams.fNumAsicsPerModule / 2) - 1;
} }
// --- Expand time stamp to time within timeslice (in clock cycle) // --- Expand time stamp to time within timeslice (in clock cycle)
...@@ -132,7 +129,7 @@ namespace cbm::algo ...@@ -132,7 +129,7 @@ namespace cbm::algo
double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain; double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain;
// --- Create output digi // --- Create output digi
digiVec.emplace_back(address, channel, messageTime, charge); digiVec.emplace_back(elinkPar.fAddress, channel, messageTime, charge);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
......
...@@ -214,15 +214,12 @@ namespace cbm::algo ...@@ -214,15 +214,12 @@ namespace cbm::algo
uint32_t asicNr = elinkPar.fAsicNr; uint32_t asicNr = elinkPar.fAsicNr;
// --- Hardware-to-software address // --- Hardware-to-software address
uint32_t numChansPerModule = unpackPar.fNumAsicsPerModule * unpackPar.fNumChansPerAsic; uint32_t channel = 0;
uint32_t address = elinkPar.fAddress; if (asicNr < unpackPar.fNumAsicsPerModule / 2) { // front side (n side); channels counted upward
uint32_t channel = 0;
if (asicNr < unpackPar.fNumAsicsPerModule / 2) { // front side (n side)
channel = message.GetHitChannel() + unpackPar.fNumChansPerAsic * asicNr; channel = message.GetHitChannel() + unpackPar.fNumChansPerAsic * asicNr;
} }
else { // back side (p side) else { // back side (p side); channels counted downward
channel = numChansPerModule - message.GetHitChannel() channel = unpackPar.fNumChansPerAsic * (asicNr + 1) - message.GetHitChannel() - 1;
- unpackPar.fNumChansPerAsic * (asicNr - unpackPar.fNumAsicsPerModule / 2) - 1;
} }
// --- Expand time stamp to time within timeslice (in clock cycle) // --- Expand time stamp to time within timeslice (in clock cycle)
...@@ -239,7 +236,7 @@ namespace cbm::algo ...@@ -239,7 +236,7 @@ namespace cbm::algo
double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain; double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain;
// --- Create output digi // --- Create output digi
digis[numDigis] = CbmStsDigi(address, channel, messageTime, charge); digis[numDigis] = CbmStsDigi(elinkPar.fAddress, channel, messageTime, charge);
numDigis++; numDigis++;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
......
...@@ -168,13 +168,7 @@ namespace cbm::algo ...@@ -168,13 +168,7 @@ namespace cbm::algo
elinkPar.fTimeOffset = 0.; elinkPar.fTimeOffset = 0.;
elinkPar.fAdcOffset = 1.; elinkPar.fAdcOffset = 1.;
elinkPar.fAdcGain = 1.; elinkPar.fAdcGain = 1.;
if (elinkPar.fAsicNr < numAsicsPerModuleSts / 2) { elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr);
elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr);
}
else {
elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress,
numAsicsPerModuleSts - (elinkPar.fAsicNr - numAsicsPerModuleSts / 2) - 1);
}
// TODO: Add parameters for time and ADC calibration // TODO: Add parameters for time and ADC calibration
par->fElinkParams.push_back(elinkPar); par->fElinkParams.push_back(elinkPar);
} }
......
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