CbmRoot
Loading...
Searching...
No Matches
WalkMap.h
Go to the documentation of this file.
1/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer], Dominik Smith */
4
5#pragma once
6
7#include "Definitions.h"
8#include "yaml/Property.h"
9#include "yaml/Yaml.h"
10
11#include <map>
12#include <vector>
13
14namespace cbm::algo::sts
15{
16
17 class WalkMap {
18
19 public:
23 WalkMap() = default;
24 ~WalkMap() = default;
25
31 std::vector<double> Get(int32_t modAddress, uint16_t asic);
32
35
36 private:
37 // Move ADC into seperate class for easier YAML formatting
38 struct AdcMap {
39 // Map index: (ADC value), map value: (walk coefficient)
40 std::vector<double> walkCoefficients;
41
42 AdcMap() = default;
43 AdcMap(std::initializer_list<double> coeffs) : walkCoefficients(coeffs) {}
44
45 CBM_YAML_FORMAT(YAML::Flow);
47 CBM_YAML_PROPERTIES(yaml::Property(&AdcMap::walkCoefficients, "walkCoefficients", "Walk coefficients"));
48 };
49
50 // --- STS system time offset
52
53 // --- STS walk correction map
54 // --- Map index: (module address, ASIC number in module, ADC value), map value: (walk coefficient)
55 std::map<i32, std::vector<AdcMap>> fWalkMap;
56
58 CBM_YAML_PROPERTIES( yaml::Property(&WalkMap::timeOffset, "timeOffset", "Time offset for STS", YAML::Hex),
59 yaml::Property(&WalkMap::fWalkMap, "WalkMap", "Walk correction map", YAML::Hex, YAML::Flow));
60 };
61
62} // namespace cbm::algo::sts
63
#define CBM_YAML_EXTERN_DECL(type)
Declare the external instantiation of the Read and Dump functions for a type.
Definition Yaml.h:297
std::vector< double > Get(int32_t modAddress, uint16_t asic)
API: Mapping from module address and ASIC number to walk coefficients.
Definition WalkMap.cxx:11
WalkMap()=default
Construct emtpy mapping.
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))
std::map< i32, std::vector< AdcMap > > fWalkMap
Definition WalkMap.h:55
i32 GetSystemTimeOffset()
Get system time offset.
Definition WalkMap.h:34
std::int32_t i32
Definition Definitions.h:20
std::vector< double > walkCoefficients
Definition WalkMap.h:40
AdcMap(std::initializer_list< double > coeffs)
Definition WalkMap.h:43
CBM_YAML_PROPERTIES(yaml::Property(&AdcMap::walkCoefficients, "walkCoefficients", "Walk coefficients"))