Hello, it’s very difficult to contextualize this problem, by the way this code snippet is inside a loop and it is executed hundreds of times and randomly, maybe depending on the inputs:
theclone = self.histo.Clone()
try:
return self.filler(self.iclass(theclone), data, self.binning)
except TypeError:
logging.error("self.iclass: %s\nself.histo: %s\ntype(self.histo): %s\ntype(self.histo.Clone()): %s",
self.iclass, self.histo, type(self.histo), type(theclone))
raise
and sometimes I get:
ERROR:root:self.iclass: <class 'ROOT.TH1F'>
self.histo: <ROOT.TH1F object ("h") at 0x2365bf00>
type(self.histo): <class 'ROOT.TH1F'>
type(self.histo.Clone()): <class 'ROOT.TGraphErrors'>
Traceback (most recent call last):
File "performance.py", line 405, in <module>
options.histo_binning, options.histo_line, options.reference)
File "performance.py", line 146, in __init__
worker = PerformanceWorker(binnedData, bins, estimators, theBinning, label, comb, histo_binning)
File "/cnfs/homes_fs/home/turra/MVACalib/egammaMVACalibUtils/trunk/python/worker.py", line 53, in __init__
binVarName, histoBinning)
File "/cnfs/homes_fs/home/turra/MVACalib/egammaMVACalibUtils/trunk/python/worker.py", line 63, in run
histograms = np.vectorize(self.histoGetter(histoBinning))(binnedData) # TODO: pass options to c-tor
File "/usr/local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 1862, in __call__
theout = self.thefunc(*newargs)
File "/cnfs/homes_fs/home/turra/MVACalib/egammaMVACalibUtils/trunk/python/RootTools.py", line 114, in __call__
return self.filler(self.iclass(theclone), data, self.binning)
TypeError: none of the 6 overloaded methods succeeded. Full details:
TH1F::TH1F() =>
takes at most 0 arguments (1 given)
TH1F::TH1F(const TVectorF& v) =>
could not convert argument 1
TH1F::TH1F(const TH1F& h1f) =>
could not convert argument 1
TH1F::TH1F(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup) =>
takes at least 5 arguments (1 given)
TH1F::TH1F(const char* name, const char* title, Int_t nbinsx, const Float_t* xbins) =>
takes at least 4 arguments (1 given)
TH1F::TH1F(const char* name, const char* title, Int_t nbinsx, const Double_t* xbins) =>
takes at least 4 arguments (1 given)
as you can see the type(self.histo.Clone()) is a TGraphErrors, but the type(self.histo) is a TH1F! It doesn’t make sense to me.