Skip to content

Merging compatible TProfile2D does not preserve bin entries #18658

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

Open
1 task
will-cern opened this issue May 8, 2025 · 1 comment · May be fixed by #18661
Open
1 task

Merging compatible TProfile2D does not preserve bin entries #18658

will-cern opened this issue May 8, 2025 · 1 comment · May be fixed by #18661
Assignees
Labels

Comments

@will-cern
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

Description

When merging two TProfile2D that have a different number of bins but are none-the-less compatible to be merged (bin boundaries align), I have noticed that the bin entries are not being preserved. Please see the reproducer below. Reproduced in ROOT master.

Reproducer

{
  TProfile2D h("h","h",1,0,1,1,0,1);
  h.SetCanExtend(TH1::kAllAxes);
  auto h2 = dynamic_cast<TProfile2D*>(h.Clone());
  h.Fill(0.5,0.5,0);
  h2->Fill(1.5,0.5,0);  

  TList l;
  l.Add(h2);
  h.Merge(&l);

  assert( h.GetEntries() == 2 ); // this is fine

  double s=0;
  for(int i=0;i<h.GetNumberOfBins();i++) s += h.GetBinEntries(i);

  assert( s == 2 ); // this fails
} 

ROOT version

all

Installation method

any

Operating system

any

Additional context

No response

@ferdymercury
Copy link
Collaborator

See #18661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants