##PlotFE55wMultiChannelAvg
##
##PURPOSE:
##  To plot FE55 histograms for the various number of channels being averaged.
##  These files are contained in 
##        /nfs/slac/g/ki/ki03/lances/H1RG-022/ASIC/08Jun29/
##
##SETUP:
execfile('/afs/slac/u/ki/lances/python/python_HxRG/HxRG_Setup.py')
execfile('/afs/slac/u/ki/lances/python/ThesisPlotSettings.py')
from FE55_Extract_Database import *
import FE55_Extract_Database; reload(FE55_Extract_Database); from FE55_Extract_Database import *

QueryStr = 'WHERE X > 10 and Y > 10 and X < 90 and Y < 90 and ReadNum > 20 and NumPix<2 and MAXQ> 200 and NEGPIX=0'

TotQs4, MaxQs4 =FE55_Extract_Database('H2RG-32-147','ASIC','08Jun29','1000', \
 QueryString=QueryStr ,Gain=4, NumADCs=4, WindowM=1, Mode=2, UseRef=0)

BinsIn  = arange(70)*12
Bins, N = histOutline.histOutline(TotQs4, binsIn=BinsIn)

mplot.figure(1)
mplot.clf()
mplot.plot(Bins, N, 'r-', label='4 Ch')
mplot.title(r'\textbf{Fe$^{55}$ with Gain = 1 and 2x2 bins}')

