Skip to content

Fix TF1::DrawCopy issue #19627

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

Merged
merged 4 commits into from
Aug 15, 2025
Merged

Fix TF1::DrawCopy issue #19627

merged 4 commits into from
Aug 15, 2025

Conversation

couet
Copy link
Member

@couet couet commented Aug 13, 2025

TF1::Copy didn't copy fHistogram if it exited.
It fixes this issue: #13122

@dpiparo
Copy link
Member

dpiparo commented Aug 13, 2025

BP to 636 when all tests are passing?

@couet
Copy link
Member Author

couet commented Aug 13, 2025

It needs more checks. It does not work yet.

@ferdymercury
Copy link
Collaborator

It needs more checks. It does not work yet.

Interesting. I thought that copy-pasting

   if (fHistogram) {
      obj->fHistogram = (TH1*)fHistogram->Clone();
      obj->fHistogram->SetDirectory(nullptr);
   }

as done in TF1::Clone should do the job.

Copy link
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Could you add this gtest?

TEST(TF1, DrawCopy)
{
   auto f = new TF1("fa1","x*x",-3,3);
   f->GetXaxis()->SetTitle("xtitle");
   auto fcopy = f->DrawCopy();
   EXPECT_EQ(fcopy->GetXaxis()->GetTitle(), "xtitle");
}

@couet
Copy link
Member Author

couet commented Aug 13, 2025

indeed I am on it

Copy link

github-actions bot commented Aug 13, 2025

Test Results

    21 files      21 suites   3d 6h 6m 57s ⏱️
 3 377 tests  3 375 ✅ 0 💤 2 ❌
69 188 runs  69 182 ✅ 0 💤 6 ❌

For more details on these failures, see this check.

Results for commit 6a4bf66.

♻️ This comment has been updated with latest results.

@couet couet requested a review from bellenot as a code owner August 14, 2025 12:44
Copy link
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

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

Thanks a lot! LGTM

@couet couet changed the title Implement and use TF1::SetHistogram Fix TF1::DrawCopy issue Aug 14, 2025
@couet couet requested a review from ferdymercury August 14, 2025 13:48
@couet couet requested a review from ferdymercury August 15, 2025 09:35
@couet
Copy link
Member Author

couet commented Aug 15, 2025

It looks like the failures are not related to this PR

Copy link
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

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

Looks ready to merge, thanks!!

@couet couet merged commit d5fe25f into root-project:master Aug 15, 2025
72 of 92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants