Number of entries - Problem with overflows

Hi,

I have a histogram that seems to be empty, however it has 192 entries. I understand that some of them might be over/underflows. However, when setting the statistics option to see under/overflows, it shows that I have NO underflows and only 10 overflows. Could this be a problem with ROOT, or is it a problem with my data. I do know that those entries might be very large (compared to the range of my histogram)… is there a limit in the value of the entry to be considered an overflow? I also noticed that the skewness is ‘nan’, not sure it that’s related.

I appreciate any insight you might have on this.

Thanks!!

Arely Cortes

Hi,
There is no max limit value for an entry to be considered overflow.
Are you filling the histogram with weights ?
In that case the underflow/overflow number is the total sum of the weights for the underflow/overflow events which can be different than the total number of underflow/overflow entries.

Having nan in skewness is normal if you have all in-range bins with zero content.

Regards

Lorenzo

Hi Lorenzo.

Thanks for you prompt reply. I’m not filling this histograms with weights. This is a pT (transverse momentum) histogram. As you mentioned, I have no entries inside the range of the histogram, but still, I would expect all of them to be overflows. Any other idea why this is happening?

thanks.

Arely

Hi,

how did you create and fill the histogram ? Is it coming from a projection of a multi-dimensional histogram ?
Can you send me the minimal program reproducing this, or otherwise the histogram object (not the figure) in a ROOT file so I can have a look at it
Thanks

Lorenzo

Hi Lorenzo,

Here I attach the histogram (in a root file.)

At some point, I thought the values I’m filling the histogram with might not be well defined (I have a given value for P, but not sure if pT is well defined.) However, I can not tell now, since I seem to have values for the angles (which, along with P, define pT.)

Thanks for taking time to look into this.

Arely
OverflowProblem.root (3.75 KB)

Hi ,

I would need also your code filling the histogram to understand your problem. If you are filling with Nan’s you should get them as overflow’s entries.
Regards

Lorenzo

Hi,

Here’s the code I use to fill the histogram. I can not include the whole code that reproduces the problem, because the problem might be related to the data I’m using (from CASTOR) or other predeclaration, and the whole thing is not so simple (I’m running MuonTrackMonitoring package on cosmic data.)

const Trk::MeasuredPerigee *measPerigee = dynamic_cast< const Trk::MeasuredPerigee *>(track->perigeeParameters());

if ((measPerigee->pT()/1000.) < 300.0) {
//“Low pT” muons
m_recomuon_pT[h_index]->Fill(measPerigee->pT()/1000.);
} else {
// “High pT” muons
m_recomuon_HighpT[h_index]->Fill(measPerigee->pT()/1000.);
}

I understand if you can not spot the problem from this information. But, since I’m running in AthenaFramework, reproducing the problem might be overwhelming. Any suggestions of what I could try when running my code to spot possible problems?

Thanks you.

Arely

Hi,

there are a couple of thinks you can do. First you can set the statistics to include underflow/overflow by calling (before filling the histogram):

TH1::StatOverflows(true);

then you could also check the bin value number returned by the Fill() method. For example you could print or make an histogram with these returned bin values.

Regards

Lorenzo

You can also see what’s going on by printing out the value you are filling in the histogram:

const Trk::MeasuredPerigee *measPerigee = dynamic_cast< const Trk::MeasuredPerigee *>(track->perigeeParameters());
double pt = measPerigee->pT()/1000.

if ( pt < 300.0) 
{
   //"Low pT" muons
   m_recomuon_pT[h_index]->Fill(pt);
   cout << "low " << pt << endl;
} else {
  // "High pT" muons
  m_recomuon_HighpT[h_index]->Fill(pt);
   cout << "low " << pt << endl;
} 

You can add more if statements if you want to check:

  • is this a number (not a nan)
  • is this in the range of the histogram

Cheers,
Charles

Hi Lorenzo, Charles.
Thanks for your replies.

I believe I understand the problem now, and actually it was sort of related to what Lorenzo mentioned on weights.

I forgot to consider one detail. I created 10 pT histograms (so I don’t need to run all the statistics at once), each one normalized (to 1.) At the end, this final histogram is the addition of the 10 initial histograms. Then, for each histogram, having all entries outside the range, implies an overflow of “1” (the entries have been normalized.) Then, for the final histogram, the overflow is 10.

Thanks you so much for your help. And I’m sorry, I should have considered this before, but forgot to mention/think about it.

Arely