161 if (!fItems || !cl || !ptr)
return;
163 TIter iter(cl->GetListOfDataMembers());
164 Int_t lastmemberid = -1;
165 if (fItems->GetLast() >= 0)
168 while (
auto obj = iter()) {
169 auto member =
dynamic_cast<TDataMember *
>(obj);
170 if (!member)
continue;
171 const char *memtypename = member->GetFullTypeName();
175 if(strcmp(memtypename,
"TClass*") == 0)
continue;
178 Int_t arraydim = member->GetArrayDim();
179 if (arraydim > 2)
continue;
181 Int_t maxindex1 = 1, maxindex2 = 1;
185 maxindex1 = member->GetMaxIndex(0);
188 maxindex1 = member->GetMaxIndex(0);
189 maxindex2 = member->GetMaxIndex(1);
193 TArrayI* arri =
nullptr;
194 TArrayD* arrd =
nullptr;
196 if (strcmp(memtypename,
"TString") == 0) {
199 if (strcmp(memtypename,
"TGo4Fitter*") == 0) {
202 if (strcmp(memtypename,
"TArrayI") == 0) {
204 memtypename =
"Int_t";
205 if ((maxindex1>1) || (maxindex2>1))
continue;
206 arri = (TArrayI*) (ptr + cloffset + member->GetOffset());
208 maxindex1 = arri->GetSize();
211 if (strcmp(memtypename,
"TArrayD") == 0) {
212 memtypeid = kDouble_t;
213 memtypename =
"Double_t";
214 if ((maxindex1>1) || (maxindex2>1))
continue;
215 arrd = (TArrayD*) (ptr + cloffset + member->GetOffset());
217 maxindex1 = arrd->GetSize();
220 if (!member->IsBasic())
continue;
221 memtypeid = member->GetDataType()->GetType();
240 for (Int_t ix1 = 0; ix1 < maxindex1; ix1++)
241 for (Int_t ix2 = 0; ix2 < maxindex2; ix2++) {
247 info->
SetType(memtypename, memtypeid);
253 char *addr = ptr + cloffset + member->GetOffset() + (ix1 * maxindex2 + ix2) * member->GetUnitSize();
255 addr = (
char *)(arri->GetArray() + ix1);
257 addr = (
char *)(arrd->GetArray() + ix1);
264 TIter cliter(cl->GetListOfBases());
265 while(
auto obj = cliter()) {
266 TBaseClass* baseclass =
dynamic_cast<TBaseClass*
>(obj);
267 if (!baseclass)
continue;
268 TClass *bclass = baseclass->GetClassPointer();
269 if(!bclass)
continue;
270 if(strcmp(bclass->GetName(),
"TGo4Parameter") == 0)
continue;
271 if(strcmp(bclass->GetName(),
"TNamed") == 0)
continue;
273 GetMemberValues(fItems, bclass, ptr, cloffset + baseclass->GetDelta());
290 if (!items || !cl || !ptr)
return kFALSE;
292 TIter iter(cl->GetListOfDataMembers());
294 while (
auto obj = iter()) {
295 auto member =
dynamic_cast<TDataMember *
>(obj);
296 if (!member)
continue;
297 const char *memtypename = member->GetFullTypeName();
301 if(strcmp(memtypename,
"TClass*") == 0)
continue;
304 Int_t arraydim = member->GetArrayDim();
305 if (arraydim>2)
continue;
307 Int_t maxindex1 = 1, maxindex2 = 1;
311 maxindex1 = member->GetMaxIndex(0);
314 maxindex1 = member->GetMaxIndex(0);
315 maxindex2 = member->GetMaxIndex(1);
319 TArrayI* arri =
nullptr;
320 TArrayD* arrd =
nullptr;
322 if (strcmp(memtypename,
"TString") == 0) {
325 if (strcmp(memtypename,
"TGo4Fitter*") == 0) {
328 if (strcmp(memtypename,
"TArrayI") == 0) {
330 memtypename =
"Int_t";
331 if ((maxindex1>1) || (maxindex2>1))
continue;
332 arri = (TArrayI*) (ptr + cloffset + member->GetOffset());
336 if (maxindex1<0)
return kFALSE;
337 if (arri->GetSize()!=maxindex1) arri->Set(maxindex1);
339 if (strcmp(memtypename,
"TArrayD") == 0) {
340 memtypeid = kDouble_t;
341 memtypename =
"Double_t";
342 if ((maxindex1>1) || (maxindex2>1))
continue;
343 arrd = (TArrayD*) (ptr + cloffset + member->GetOffset());
347 if (maxindex1<0)
return kFALSE;
348 if (arrd->GetSize()!=maxindex1) arrd->Set(maxindex1);
350 if (!member->IsBasic())
continue;
351 memtypeid = member->GetDataType()->GetType();
354 for (Int_t ix1 = 0; ix1 < maxindex1; ix1++)
355 for (Int_t ix2 = 0; ix2 < maxindex2; ix2++) {
356 if (itemsindx > items->GetLast())
362 if (strcmp(info->GetName(), member->GetName()) != 0)
364 if (strcmp(info->GetTitle(), member->GetTitle()) != 0)
375 char *addr = ptr + cloffset + member->GetOffset() + (ix1 * maxindex2 + ix2) * member->GetUnitSize();
377 addr = (
char *)(arri->GetArray() + ix1);
379 addr = (
char *)(arrd->GetArray() + ix1);
386 TIter cliter(cl->GetListOfBases());
387 while(
auto obj = cliter()) {
388 TBaseClass* baseclass =
dynamic_cast<TBaseClass*
>(obj);
389 if (!baseclass)
continue;
390 TClass *bclass = baseclass->GetClassPointer();
391 if(!bclass)
continue;
392 if(strcmp(bclass->GetName(),
"TGo4Parameter") == 0)
continue;
393 if(strcmp(bclass->GetName(),
"TNamed") == 0)
continue;
395 if (!
SetMemberValues(items, itemsindx, bclass, ptr, cloffset + baseclass->GetDelta()))
return kFALSE;
404 TString varname = TString::Format(
"param%d", cnt++);
405 Bool_t savemacro = opt && strstr(opt,
"savemacro");
408 out << TString::Format(
" %s* %s = (%s*) go4->GetParameter(\"%s\",\"%s\");",
409 ClassName(), varname.Data(), ClassName(), GetName(), ClassName()) << std::endl << std::endl;
410 out << TString::Format(
" if (!%s) {", varname.Data()) << std::endl;
411 out << TString::Format(
" TGo4Log::Error(\"Could not find parameter %s of class %s\");", GetName(), ClassName()) << std::endl;
412 out <<
" return;" << std::endl;
413 out <<
" }" << std::endl << std::endl;
414 out << TString::Format(
" TGo4Log::Info(\"Set parameter %s as saved at %s\");", GetName(), TDatime().AsString()) << std::endl << std::endl;
416 out << TString::Format(
" %s* %s = new %s;", ClassName(), varname.Data(), ClassName()) << std::endl;
417 out << TString::Format(
" %s->SetName(\"%s\");", varname.Data(), GetName()) << std::endl;
418 out << TString::Format(
" %s->SetTitle(\"%s\");", varname.Data(), GetTitle()) << std::endl;
429 info->GetFullName(membername);
431 switch (info->GetTypeId()) {
433 out << TString::Format(
" %s->%s = \"%s\";", varname.Data(), membername.Data(), info->GetStrValue()) << std::endl;
436 out << TString::Format(
" // fitter %s->%s ignored", varname.Data(), membername.Data()) << std::endl;
439 out << TString::Format(
" %s->%s.Set(%d);", varname.Data(), membername.Data(), info->GetIntValue()) << std::endl;
442 out << TString::Format(
" %s->%s = %s;", varname.Data(), membername.Data(), (info->GetIntValue() ?
"kTRUE" :
"kFALSE")) << std::endl;
445 out << TString::Format(
" %s->%s = %s;", varname.Data(), membername.Data(), info->GetStrValue()) << std::endl;