run13 spinQA -- updated

I. Spin pattern before March 21 ( according to Elke's slide )

a) The spin pattern is not continuous through the empty bucheds 30/31 and the 70/71.
b) For the pattern 3&4 we have a huge asymmetry between number of the bunches with positive and negative helicity.
 
Good fill list of this part. the spin pattern is not periodically changed as ususal.  

=================================================================

II. Procedure 

1. loopMainAll.tcl
Generate the run list by fill
pp500_production_2013 & pp500_production_2013_noendcap , Successful & Questionable, >180s , at least tpc & emc
163 fills, 2379 runs

2. spbitSeeker.tcl
Collect spin info from data base
produce spinTime.csv table
produce V124 files of the begin and end of each fill

3. begEndComp.tcl
Compare the V124 files of the begin run and the end run
produce goodList.txt and badList.txt

4. Fix bad fills

=================================================================

III. Examining and fixing bad fills

F17434
Problem:
Huge difference between the recoded start time from STAR Runlog and the recoded start time from Conditions_rhic , >> 310s
Examining & result:
Check the start time manually.
Found that the recoded CDEV time at the beginning of the fill is not changed for the past several hours until the 6th runs of this fill in the run list.
Solution:
Remove the first 5 runs, and fixed
-----------------------------------------------------------------------------------------
F17520
Appear in Devika’s badList.txt but doesn’t in mine.
Checked the difference: two more runs from second /third priority in end of this fill in my run list. The time difference is reasonable for the last run , but is too large( >310s) for the run second to the last(last in Devika’s runlist).
?? Do we need to pay attention at this point that there maybe errors in the middle of the fills ?
-----------------------------------------------------------------------------------------
F17538
Problem:
In script spbitSeeker.tcl, mysql didn’t return full CDEV output.
The interactive fill outCdev.eve fill is not integral format except the first 3 runs.
Examining & result:
Check the outCdev.eve manually.
Found that the returned CDEV information stopped in the middle. But the block “polarizationFillPatternS” block which contains the spin information of both beams looks well output.
Solution:
Tried to comment the lines in the code jan_source/sxml.tcl which adjust the format of the outCdev.eve file . The script spbitSeeker.tcl run through with successfully collecting the spin information.
Not sure if the problem can be fixed in the Cdev database. ??
-----------------------------------------------------------------------------------------
F17600
Problem:
The spin patterns aren’t consistent between the begin and the end.
Examining & result:
1. Run the script spinBitCrawler.tcl and crawlerComp.tcl to check the fill every 10 mins. Found that the spin pattern changed in the middle of the fill.
2. As Hal suggested, Checked the shift log. Found F17600 should be two fills, but the later fill was named incorrectly.
3. Manually separated this fill into two fills according to the shift log. Both fills have stable spin pattern. Here is the spin information of separated fills. 
Solution:
Contact with CAD to fixed it in the database ???
=================================================================
IV. Result
Good List and Bad list