17#include <TDataMember.h>
20#include <TEnumConstant.h>
25#include <boost/property_tree/ptree.hpp>
34 return strcmp(dm.GetTrueTypeName(),
"string") == 0;
40 std::function<
void(TDataMember*,
int,
int)>&& callback)
42 auto* memberlist = cl->GetListOfDataMembers();
43 for (
int i = 0;
i < memberlist->GetEntries(); ++
i) {
44 auto* dm = (TDataMember*)memberlist->At(
i);
46 auto isValidComplex = [dm]() {
48 return isString(*dm) || dm->IsEnum() || dm->IsSTLContainer() ||
55 if (dm->Property() & kIsStatic) {
59 if (dm->IsaPointer()) {
62 if (!dm->IsBasic() && !isValidComplex()) {
66 const auto dim = dm->GetArrayDim();
72 const auto size = (dim == 1) ? dm->GetMaxIndex(dim - 1) : 1;
82 std::stringstream namestream;
83 namestream << dm->GetName();
85 namestream <<
"[" <<
index <<
"]";
87 return namestream.str();
90void ptreeToMember(boost::property_tree::ptree
const&
value,
96 if (dm->IsSTLContainer()) {
114 throw std::runtime_error(
"Not an int/float/double/bool vector");
129 auto* dt = dm->GetDataType();
131 switch (dt->GetType()) {
133 *(
char*)
ptr =
value.get_value<
char>();
137 *(
unsigned char*)
ptr =
value.get_value<
unsigned char>();
141 *(
short*)
ptr =
value.get_value<
short>();
145 *(
unsigned short*)
ptr =
value.get_value<
unsigned short>();
149 *(
int*)
ptr =
value.get_value<
int>();
153 *(
unsigned int*)
ptr =
value.get_value<
unsigned int>();
157 *(
long*)
ptr =
value.get_value<
long>();
161 *(
unsigned long*)
ptr =
value.get_value<
unsigned long>();
165 *(
float*)
ptr =
value.get_value<
float>();
170 *(
double*)
ptr =
value.get_value<
double>();
174 *(
bool*)
ptr =
value.get_value<
bool>();
191 if (strcmp(tname,
"string") == 0 || strcmp(tname,
"std::string") == 0) {
192 *(std::string*)
ptr =
value.get_value<std::string>();
194 throw std::runtime_error(
"Unable to override value");
201 if (dm->IsSTLContainer()) {
216 throw std::runtime_error(
"Not an int/float/double/bool vector");
228 auto* dt = dm->GetDataType();
230 switch (dt->GetType()) {
241 return ConfigParamSpec{tname, VariantType::UInt16, *(
unsigned short*)
ptr, {
"No help"}};
253 return ConfigParamSpec{tname, VariantType::UInt64, *(
unsigned long*)
ptr, {
"No help"}};
277 if (strcmp(tname,
"string") == 0 || strcmp(tname,
"std::string") == 0) {
280 throw std::runtime_error(
"Cannot use " + std::string(tname));
287std::vector<ConfigParamSpec>
290 std::vector<ConfigParamSpec> specs;
292 auto toDataMember = [&mainKey, &specs, obj](TDataMember* dm,
int index,
int size) {
293 auto* dt = dm->GetDataType();
294 auto TS = dt !=
nullptr ? dt->Size() : 0;
295 char*
ptr = ((
char*)obj) + dm->GetOffset() +
index * TS;
298 specs.push_back(memberToConfigParamSpec(
name.c_str(), dm,
ptr));
309 auto toDataMember = [obj, &pt](TDataMember* dm,
int index,
int size) {
310 auto* dt = dm->GetDataType();
311 auto TS = dt !=
nullptr ? dt->Size() : 0;
312 char*
ptr = ((
char*)obj) + dm->GetOffset() +
index * TS;
314 auto it = pt.get_child_optional(
name);
318 ptreeToMember(*it, dm->GetTrueTypeName(), dm,
ptr);
void loopOverMembers(TClass *cl, void *obj, std::function< void(const TDataMember *, int, int)> &&callback)
std::string getName(const TDataMember *dm, int index, int size)
bool isString(TDataMember const &dm)
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
configStandalone Reconstruction rec_tpc float
constexpr uint32_t runtime_hash(char const *str)
consteval uint32_t compile_time_hash(Ts... Vs)
GLsizei const GLchar *const * string
GLuint const GLchar * name
GLsizei const GLfloat * value
uint8_t int statusCode int
return(kp2 - aa - bb) *kp1/aa
Defining ITS Vertex explicitly as messageable.
RuntimeErrorRef runtime_error(const char *)
Array2D< T > array2DFromBranch(boost::property_tree::ptree const &ptree)
std::vector< T > vectorFromBranch(boost::property_tree::ptree const &branch)
std::vector< T, fair::mq::pmr::polymorphic_allocator< T > > vector
static std::vector< ConfigParamSpec > asConfigParamSpecsImpl(std::string const &mainkey, TClass *cl, void *obj)
static void fillFromPtree(TClass *cl, void *obj, boost::property_tree::ptree const &pt)