JeffersonLab / analyzer

HallA C++ Analyzer
BSD 3-Clause "New" or "Revised" License
7 stars 54 forks source link

Catch overflows in high rate scalers. #149

Closed sawjlab closed 6 years ago

sawjlab commented 6 years ago

Several changes in the OO decoder are made to deal with scalers that could overflow.

  1. Since the hardware scalers we use are 32 bits, the GetData(Int_t) method of GenScaler has been changed to return UInt_t instead of Int_t. Note though, the base definition of GetData(Int_t) is in Module.h, so that is where it is changed. This might impact classes for other hardware, but the only other classes that have GetData(Int_t) are Caen775Module and Caen792Module, so GetData(Int_t) was changed in Caen775Module.{Ch} too. It appears that nothing actually uses this method for the Caen modules, so perhaps it should be removed.
  2. In computing the time difference between successive scaler reads in GenScaler, a check is made overflow so that we won't get a huge negative time when the reference clock overflows.
  3. In computing rates, a check is made so that an overflow won't result in a huge negative rate.
sawjlab commented 6 years ago

I wonder if all the GetData methods in the decoder should be changed to UInt_t. Do any of the decoder modules provide data that could be negative?

hansenjo commented 6 years ago

I agree. I've been pretty busy changing Int_t to UInt_t in previous iterations, but the new OO decoder classes are using Int_t's again.

Let me take a look and see what can be changed.

Ole

On 11/21/2017 04:35 PM, Stephen Wood wrote:

I wonder if all the GetData methods in the decoder should be changed to UInt_t. Do any of the decoder modules provide data that could be negative?