Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure changed labels are kept after a clone (fix ROOT-10580) #5041

Merged
merged 4 commits into from Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion hist/hist/inc/TF1.h
Expand Up @@ -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;
Expand Down Expand Up @@ -774,7 +775,7 @@ T TF1::EvalPar(const T *x, const Double_t *params)
////////////////////////////////////////////////////////////////////////////////
/// Eval for vectorized functions
// template <class T>
// 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);
Expand Down
12 changes: 12 additions & 0 deletions hist/hist/src/TAxis.cxx
Expand Up @@ -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());
}
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
20 changes: 19 additions & 1 deletion hist/hist/src/TF1.cxx
Expand Up @@ -951,7 +951,7 @@ TF1::~TF1()

if (fFormula) delete fFormula;
if (fParams) delete fParams;
if (fFunctor) delete fFunctor;
if (fFunctor) delete fFunctor;
}


Expand Down Expand Up @@ -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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you pass the new name/argument to 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
Expand Down