Beam crossing analysis of Period 1

I got start based on the help of Kevin's documents 

So far, run13 P14ia production have produced the MuDst files of 1011 "successful" runs of period 1, day 76- day 126. 
Here is the runlist queried by 

get_file_list.pl -cond "filetype=daq_reco_MuDst,filename~st_W,production=P14ia,trgsetupname=pp500_production_2013,storage=nfs"
-keys "orda(runnumber)" -distinct -limit 0
Method to finding the offset, Minimum chi2. 

a) plot the bX7 & bX48 spectrums run by run

b) make the ideal histogram based on the spin DB information.

c) loop the offset from 1 to 120, to calculated the chi2 between the bX7  & bX 48 and the ideal histogram. 

d) find out the offset value where the chi2 is minimum. 

Result. 

1) Run 14084063 have status "sanity=0" and have not MuDet file on disk. Lidia has confirmed that this runs have something wrong during production. 

2) Run 14117001 and 14118062 have very few events, 9 and 1 repectively. From the shift log and online plots, these two runs have no value to use. we can just remove them. In our run list, these runs didn't pass our >3mins cuts. 

This is the runlist with good bunch crossing spectrum, which contains 1008 runs.  All of them have 0 bX7 offset as expected. The bX48 offset values randomly distributed in the interval [0,119]. 

After a cross-checking, the bX offset should be shortly uploaded to the database. Then we can have the spin 4-bit information of each event. 

3)Several bad bunches should be masked. 
Runs of fill 17416 have empty buncn 79 unexpectedly.
Runs of fill 17384 have empty buncn 28, 29 unexpectedly