1) Plot both OLO2 current and one of the bcm scaler vs. time; 2) Check by eye if they "line-up", note the OLO2 is from epics slow control so there is a time lag between the two; 3) Select by hand the region where there is no big difference between the two caused by the time lag. ROOT might have some fancy tools to select regions from a graph; 4) Define these regions as "stable", then use OLO2 vs. bcm-scaler within these regions for calibration. Try both pol1 and pol2 and export the results and their errors to a data file or write them down, for all scalers (u1,d1,u3,d3,u10,d10); It will help for the record to make a pretty plot of scaler/OLO2 vs. OLO2, which should be a horizontal line if the bcms are completely linear. (you may need two macros for the above procedure, one works for current vs. rate, the other for charge vs. counts as Alexandre suggested. You can start from the rate version). 5) The p0 from the fits should in principle be the scaler offsets. But as VInce pointed out, the offset may cahnge over time and can be checked with data where beam was off. Try this method instead and see if you can get the same offsets. In a seperate macro, 6) Calibrate OLO2 vs. faraday cup using appropriate BCM logger files. Now there is no "good" region to select, so you can fit the two directly. Again, try both pol1 and pol2 and record all results. *) At the end, combine all results and find a relation between the true current (from either faraday cup or OLO2) and all six scalers. This would likely be a 2nd polynomial. The three parameters would be the offset, the slope, and the non-linearity. Determine all three along with their error bars. Also, use error propagation, find out what is the error on the current (or charge) from the calibration results. If the macro can be somewhat automized with little inputs by hand, it will become valuable for the whole Hall A collaboration because all later experiments will use the same macro. This is something to keep in mind while working on the macro.