diff --git a/hist/hist/inc/TF1.h b/hist/hist/inc/TF1.h index 322862f389700..4901a5039b38d 100644 --- a/hist/hist/inc/TF1.h +++ b/hist/hist/inc/TF1.h @@ -413,6 +413,7 @@ class TF1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker { static Bool_t DefaultAddToGlobalList(Bool_t on = kTRUE); virtual void Browse(TBrowser *b); virtual void Copy(TObject &f1) const; + TObject* Clone(const char* newname=0) const; virtual Double_t Derivative(Double_t x, Double_t *params = 0, Double_t epsilon = 0.001) const; virtual Double_t Derivative2(Double_t x, Double_t *params = 0, Double_t epsilon = 0.001) const; virtual Double_t Derivative3(Double_t x, Double_t *params = 0, Double_t epsilon = 0.001) const; @@ -774,7 +775,7 @@ T TF1::EvalPar(const T *x, const Double_t *params) //////////////////////////////////////////////////////////////////////////////// /// Eval for vectorized functions // template -// T TF1::Eval(T x, T y, T z, T t) const +// T TF1::Eval(T x, T y, T z, T t) const // { // if (fType == EFType::kFormula) // return fFormula->Eval(x, y, z, t); diff --git a/hist/hist/src/TAxis.cxx b/hist/hist/src/TAxis.cxx index e5a306db04354..29092f2e455b5 100644 --- a/hist/hist/src/TAxis.cxx +++ b/hist/hist/src/TAxis.cxx @@ -243,6 +243,18 @@ void TAxis::Copy(TObject &obj) const delete axis.fModLabs; axis.fModLabs = 0; } + if (fModLabs) { + TIter next(fModLabs); + TAxisModLab *modlabel; + if(! axis.fModLabs) { + axis.fModLabs = new TList(); + } + while( (modlabel=(TAxisModLab*)next()) ) { + TAxisModLab *copyModLabel = new TAxisModLab(*modlabel); + axis.fModLabs->Add(copyModLabel); + copyModLabel->SetUniqueID(modlabel->GetUniqueID()); + } + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/hist/hist/src/TF1.cxx b/hist/hist/src/TF1.cxx index 53f2471f2394a..69e125a04d331 100644 --- a/hist/hist/src/TF1.cxx +++ b/hist/hist/src/TF1.cxx @@ -951,7 +951,7 @@ TF1::~TF1() if (fFormula) delete fFormula; if (fParams) delete fParams; - if (fFunctor) delete fFunctor; + if (fFunctor) delete fFunctor; } @@ -1059,6 +1059,24 @@ void TF1::Copy(TObject &obj) const } +//////////////////////////////////////////////////////////////////////////////// +/// Make a complete copy of the underlying object. If 'newname' is set, +/// the copy's name will be set to that name. + +TObject* TF1::Clone(const char*) const +{ + + TF1* obj = (TF1*) TNamed::Clone(); + + if (fHistogram) { + obj->fHistogram = (TH1*)fHistogram->Clone(); + obj->fHistogram->SetDirectory(0); + } + + return obj; +} + + //////////////////////////////////////////////////////////////////////////////// /// Returns the first derivative of the function at point x, /// computed by Richardson's extrapolation method (use 2 derivative estimates