function [totcharge] = IntegrateCharge(signal,time,lowb,highb,ampfact)

    sigsum=0;
    
    deltT = (time(highb)-time(highb-1));
    
    for k= lowb:highb;
        sigsum = (sigsum + (signal(k)*deltT));
    end
   
    gaincorr = 10^(ampfact/20);
    
    totcharge = (sigsum)/(50.0*gaincorr);
%    totcharge = (sigsum);            
    
end
