00001
00005 #include <math.h>
00006
00007 #include <bpm/bpm_messages.h>
00008 #include <bpm/bpm_process.h>
00009
00010 int get_pedestal( doublewf_t *wf, int range, double *offset, double *rms ) {
00011
00012 wfstat_t s;
00013 int i;
00014
00015 if ( ! wf || ! offset ) {
00016 bpm_error( "Invalid pointer argument in get_pedestal(...)",
00017 __FILE__, __LINE__ );
00018 return BPM_FAILURE;
00019 }
00020
00021
00022 if ( doublewf_basic_stats( wf, 0, range, &s ) == BPM_FAILURE ) {
00023 bpm_error( "Error retreiving basic stats in get_pedestal()", __FILE__, __LINE__ );
00024 return BPM_FAILURE;
00025 }
00026
00027 *offset = s.mean;
00028 *rms = s.rms;
00029
00030 return BPM_SUCCESS;
00031 }