14#ifndef COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
15#define COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
25#include <TDataMember.h>
37 const std::size_t
n =
a.size();
38 const std::size_t
m =
b.size();
45 std::vector<std::size_t> prev(
m + 1), curr(
m + 1), prev2(
m + 1);
46 std::iota(prev.begin(), prev.end(), 0);
47 for (std::size_t
i = 1;
i <=
n; ++
i) {
49 for (std::size_t
j = 1;
j <=
m; ++
j) {
50 std::size_t cost = (
a[
i - 1] ==
b[
j - 1]) ? 0 : 1;
51 curr[
j] = std::min({prev[
j] + 1,
54 if (
i > 1 &&
j > 1 &&
a[
i - 1] ==
b[
j - 2] &&
55 a[
i - 2] ==
b[
j - 1]) {
56 curr[
j] = std::min(curr[
j], prev2[
j - 2] + 1);
59 prev2 = std::move(prev);
60 prev = std::move(curr);
61 curr.assign(
m + 1, 0);
75 std::string
toString(std::string
const& prefix,
bool showProv,
size_t padding = 0)
const;
85 static std::vector<ParamDataMember>* getDataMembersImpl(std::string
const& mainkey, TClass* cl,
void*,
86 std::map<std::string, ConfigurableParam::EParamProvenance>
const* provmap,
size_t virtualoffset);
88 static void fillKeyValuesImpl(std::string
const& mainkey, TClass* cl,
void*, boost::property_tree::ptree*,
89 std::map<std::string, std::pair<std::type_info const&, void*>>*,
92 static void printWarning(std::type_info
const&);
94 static void assignmentImpl(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
95 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
96 static void syncCCDBandRegistry(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
97 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
99 static void outputMembersImpl(std::ostream& out, std::string
const& mainkey, std::vector<ParamDataMember>
const*
members,
bool showProv,
bool useLogger,
bool withPadding =
false,
bool showHash =
false);
100 static void printMembersImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const*
members,
bool showProv,
bool useLogger,
bool withPadding,
bool showHash);
102 static size_t getHashImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const*
members);
104 template <
typename P>
107 template <
typename Base,
typename P>
141 void printKeyValues(
bool showProv =
true,
bool useLogger =
false,
bool withPadding =
true,
bool showHash =
true) const final
147 _ParamHelper::printMembersImpl(
getName(),
members.get(), showProv, useLogger, withPadding, showHash);
159 void output(std::ostream& out)
const final
162 _ParamHelper::outputMembersImpl(out,
getName(),
members.get(),
true,
false);
175 static_assert(std::is_same<
decltype(P::sInstance),
P>
::value,
176 "static instance must of same type as class");
179 auto cl = TClass::GetClass(
typeid(
P));
181 _ParamHelper::printWarning(
typeid(
P));
193 auto cl = TClass::GetClass(
typeid(
P));
195 _ParamHelper::printWarning(
typeid(
P));
208 P* readback =
nullptr;
210 if (readback !=
nullptr) {
211 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(
P)), (
void*)
this, (
void*)readback,
229 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(
P)), (
void*)
this, (
void*)externalobj,
238 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(
P)),
getName().c_str());
245template <
typename P,
typename Base>
259 static_assert(std::copyable<Base>,
"Base type must be copyable.");
260 return static_cast<Base>(*this);
279 void printKeyValues(
bool showProv =
true,
bool useLogger =
false,
bool withPadding =
true,
bool showHash =
true) const final
285 _ParamHelper::printMembersImpl(
getName(),
members.get(), showProv, useLogger, withPadding, showHash);
297 void output(std::ostream& out)
const final
300 _ParamHelper::outputMembersImpl(out,
getName(),
members.get(),
true,
false);
313 static_assert(std::is_same<
decltype(P::sInstance),
P>
::value,
314 "static instance must of same type as class");
317 auto cl = TClass::GetClass(
typeid(
Base));
319 _ParamHelper::printWarning(
typeid(
Base));
333 auto cl = TClass::GetClass(
typeid(
Base));
335 _ParamHelper::printWarning(
typeid(
Base));
348 P* readback =
nullptr;
350 if (readback !=
nullptr) {
351 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)readback,
369 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)externalobj,
378 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(
P)),
getName().c_str());
389 if (
auto* cl = dm.GetClass(); cl &&
isContainer(cl->GetName())) {
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
bounded_vector< int > members
EParamProvenance getMemberProvenance(const std::string &key) const final
void printKeyValues(bool showProv=true, bool useLogger=false, bool withPadding=true, bool showHash=true) const final
void syncCCDBandRegistry(void *externalobj) final
void serializeTo(TFile *file) const final
static const P & Instance()
void putKeyValues(boost::property_tree::ptree *tree) final
std::vector< ParamDataMember > * getDataMembers() const
void initFrom(TFile *file) final
void output(std::ostream &out) const final
size_t getHash() const final
std::string getName() const final
static std::map< std::string, std::pair< std::type_info const &, void * > > * sKeyToStorageMap
void setRegisterMode(bool b)
bool isInitialized() const
static bool isRegisteredContainerType(const std::string &typeName)
static std::map< std::string, ConfigurableParam::EParamProvenance > * sValueProvenanceMap
static EParamProvenance getProvenance(const std::string &key)
static EnumRegistry * sEnumRegistry
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * value
GLboolean GLboolean GLboolean GLboolean a
bool isContainer(const std::string &typeName)
std::size_t damerauLevenshteinDistance(std::string_view a, std::string_view b)
std::string toString(std::string const &prefix, bool showProv, size_t padding=0) const
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))