I have been trying to save a set of trained sampler pointer objects to TTree. The point of saving them is to bypass the training time of these sampler. So I have got 10k such trained samplers for different scattering processes, background temperature and leading parton energies.

I have made a class and have generated a dictionary for this class

#pragma once

#include “Math/DistSampler.h”class SamplerData{

public:

double ENERGY;

double TEMPERATURE;

int PROCESSID;

ROOT::Math::DistSampler* SAMPLER;

double INTEGRATEDVALUE;SamplerData()

: ENERGY(0.0), TEMPERATURE(0.0), PROCESSID(0), SAMPLER(nullptr), INTEGRATEDVALUE(0.0) {}

SamplerData(double e, double t, int pid, ROOT::Math::DistSampler* s, double value)

: ENERGY(e), TEMPERATURE(t), PROCESSID(pid), SAMPLER(s), INTEGRATEDVALUE(value) {}`void printer();`

};

The execution:

`for(int i=0;i<3;i++){ for (int i0=1;i0<=tapmaan[i];i0++){ for (int i1=0;i1<9;i1++){ p_proc=Integrator_(i0*0.5,temp_ar[i],Proc[i1]); s_proc=i0*0.5; t_proc=temp_ar[i]; r_proc=i1; ROOT::Math::DistSampler * sampler = ROOT::Math::Factory::CreateDistSampler("Foam"); JSINFO<<"i "<<i<<" i0 "<<i0<<" i1 "<<i1; double xmin[]={0.0, 0.0, 0.0, 0.0}; double xmax[]={M_PI, M_PI, 2*M_PI, i0*0.5+temp_ar[i]}; double par0[]={i0*0.5,temp_ar[i],Proc[i1]}; f1->SetParameters(par0); sampler->SetFunction(*f1,4); sampler->SetRange(xmin,xmax); ret=sampler->Init(); samplerdata.ENERGY=s_proc; samplerdata.TEMPERATURE=t_proc; samplerdata.PROCESSID=r_proc; JSINFO<<"LUSSSSSSh"; samplerdata.SAMPLER=sampler; JSINFO<<"LUUUUUUS TWO"; samplerdata.INTEGRATEDVALUE=p_proc; JSINFO<<"LUSH FIVVVVE"; //file->WriteObjectAny(&samplerdata, "SamplerData", "samplerdata"); tree->Fill(); JSINFO<<"LUSH FOOOOUR"; } } } tree->Write(); //file->Close(); auto stop = std::chrono::high_resolution_clock::now(); auto duration = duration_cast<std::chrono::microseconds>(stop - start); JSINFO<<"time for rates "<<duration.count();`

After doing so, I am getting this error:

Warning in TBufferFile::WriteObjectAny: since ROOT::Math::WrappedMultiFunction<TF1&> has no public constructor

which can be called without argument, objects of this class

can not be read with the current library. You will need to

add a default constructor before attempting to read it.

Is there a way to circumvent this problem?

_ROOT Version: 6.26/06

*Platform:* Ventura 13.4 (22F66)

_Compiler: Apple clang version 14.0.0