Added some more checks to the GetEnergy method of lendafilter
There seemed to be a small bug in it as well the check to make
sure the energery value was positive had a ')' in the wrong place.

Now that is fixed and it is smarter about what to take as the background
when the max point is not in the first or last 20% of the trace
it uses the beginning 20 % as the background.  When the maxpoint is
within the first 20% of the trace it uses the last 20% as the background.
If the maxpoint appears in the last 20% it uses the first 20%.

Also it now checks to see if the window for the signal inegration
goes outside the trace.  For strange pulses triggering at the
beginning this was probably happening creating some undefined
behavoir.  If the window goes out of the trace it returns
BAD_NUM