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

Moved STS system time offset parameter from sts::ReadoutConfig to sts::WalkMap.

parent fa388282
No related branches found
No related tags found
1 merge request!1855Moved STS system time offset parameter from sts::ReadoutConfig to sts::WalkMap.
......@@ -86,8 +86,6 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config, const ChannelMaskSet&
const uint16_t numChanPerAsic = 128; ///< Number of channels per ASIC
const uint16_t numElinksPerComp = numCrobPerComp * numElinksPerCrob;
fTimeOffset = config.timeOffset;
// Constructing the map (equipmentId, eLink) -> (module, ASIC within module)
int32_t febBaseIdx = 0;
for (uint16_t compIdx = 0; compIdx < numComp; compIdx++) {
......@@ -102,7 +100,7 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config, const ChannelMaskSet&
uint16_t asicInModule = 0;
bool isPulser = false;
uint16_t elinkId = numElinksPerCrob * crobIdx + elinkIdx; // elink within component
uint16_t elinkId = numElinksPerCrob * crobIdx + elinkIdx; // elink within component
const auto& elinks = config.GetElinks(component.GetFEBType());
const auto& elink = elinks.at(elinkId);
......@@ -132,8 +130,8 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config, const ChannelMaskSet&
asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb);
// Init channel mask
const int32_t febId = feb + febBaseIdx;
auto mapIt = chanMaskSet.values.find(febId);
const int32_t febId = feb + febBaseIdx;
auto mapIt = chanMaskSet.values.find(febId);
if (mapIt != chanMaskSet.values.end()) {
const auto& mask = mapIt->second;
......@@ -151,10 +149,10 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config, const ChannelMaskSet&
fReadoutConfig[equipment][elinkIdx] = {moduleAddress, asicInModule, isPulser};
} //# elink
} //# CROB
} //# elink
} //# CROB
febBaseIdx += numCrobPerComp * numFebsPerCrob; // Add the proper offset for the current CROB
} //# component
} //# component
}
sts::ReadoutConfig::Entry sts::ReadoutConfig::Map(uint16_t equipmentId, uint16_t elinkId)
......
......@@ -70,7 +70,6 @@ namespace cbm::algo::sts
yaml::Property(&Elink::toAsicFebB, "toAsicFebB", "Mapping of eLink to ASIC for FEB Type B", YAML::Hex));
};
i32 timeOffset;
u16 numAsicsPerFeb;
std::vector<Module> modules;
std::vector<Component> components;
......@@ -79,8 +78,7 @@ namespace cbm::algo::sts
const std::vector<Elink>& GetElinks(FEBType type) const;
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::timeOffset, "timeOffset", "Time offset for STS", YAML::Hex),
yaml::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"),
CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"),
yaml::Property(&ReadoutSetup::modules, "modules", "Modules", {}, YAML::Flow),
yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow),
yaml::Property(&ReadoutSetup::elinksFeb8_1, "elinksFeb8_1",
......@@ -114,8 +112,6 @@ namespace cbm::algo::sts
/** @brief Constructor **/
ReadoutConfig(const ReadoutSetup&, const ChannelMaskSet&);
i64 TimeOffset() const { return fTimeOffset; }
/** @brief Equipment in the configuration
** @return Vector of equipment IDs
**/
......@@ -158,8 +154,6 @@ namespace cbm::algo::sts
std::string PrintReadoutMap();
private:
i32 fTimeOffset = 0; // Time offset for STS
// --- STS readout map
// --- Map index: (equipment, elink)
std::map<u16, std::vector<Entry>> fReadoutConfig = {}; //!
......
......@@ -28,7 +28,7 @@ Unpack::Unpack(const Config& config) : fConfig(config)
auto mapEntry = fConfig.readout.Map(equip, elink);
elinkPar.fAddress = mapEntry.moduleAddress; // Module address for this elink
elinkPar.fAsicNr = mapEntry.asicNumber; // ASIC number within module
elinkPar.fTimeOffset = fConfig.readout.TimeOffset();
elinkPar.fTimeOffset = fConfig.walkMap.TimeOffset();
elinkPar.fAdcMinCut = fConfig.readout.AdcCutMap(equip, elink);
elinkPar.fAdcOffset = 1.;
elinkPar.fAdcGain = 1.;
......
......@@ -30,6 +30,9 @@ namespace cbm::algo::sts
*/
std::vector<double> Get(int32_t modAddress, uint16_t asic);
/** @brief Get system time offset. **/
i32 TimeOffset() { return timeOffset; }
private:
// Move ADC into seperate class for easier YAML formatting
struct AdcMap {
......@@ -44,12 +47,16 @@ namespace cbm::algo::sts
CBM_YAML_PROPERTIES(yaml::Property(&AdcMap::walkCoefficients, "walkCoefficients", "Walk coefficients"));
};
// --- STS system time offset
i32 timeOffset;
// --- STS walk correction map
// --- Map index: (module address, ASIC number in module, ADC value), map value: (walk coefficient)
std::map<i32, std::vector<AdcMap>> fWalkMap;
CBM_YAML_MERGE_PROPERTY();
CBM_YAML_PROPERTIES(yaml::Property(&WalkMap::fWalkMap, "WalkMap", "Walk correction map", YAML::Hex, YAML::Flow));
CBM_YAML_PROPERTIES( yaml::Property(&WalkMap::timeOffset, "timeOffset", "Time offset for STS", YAML::Hex),
yaml::Property(&WalkMap::fWalkMap, "WalkMap", "Walk correction map", YAML::Hex, YAML::Flow));
};
} // namespace cbm::algo::sts
......
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