Spin_QA

Thank you very much Kevin Adkins, for providing me all the necassary documents for spin QA and giving me nice clear explanatory answers for  all of my  questions!!!!!!!!!!!!!!!!!!!!!!

*********************************************************************************************************************************

This document outlines both the QA and database upload operations. From the spin QA we find out where on the physical RHIC ring the blue and yellow beams collide the first bunches (bunch zero). We then use code to decide which bunches are colliding at STAR. This is important because in analysis we want to know the orientation of the spin for each bunch that is colliding at STAR. This QA, coupled with the spin patterns from spin QA tell us precisely this. 

1) Spin QA
 This process is one in which we query the cdev database after a run and determine if the spin information  is correct, and if this pattern is maintained throughout an entire  We then take certain information and load it to a database. 

   a) SpinQA process:  https://drupal.star.bnl.gov/STAR/system/files/SpinQA_HowToFinal_0.pdf
   b) Uploading to database :  https://drupal.star.bnl.gov/STAR/system/files/dbUpload_HowTo.pdf


2) bXing QA
 To decide if the beams are offset from one another at the collision point. This is done AFTER production of the MuDst's and then  use to create the histograms necessary.

**********************************************************************************************************************************************************

SPIN QA - Run 13

Step ONE:   Produce the run list using the script  loopMainAll.tcl 

 Produce a run list as a First Priority run list with the similar requirement used for runQA , from March 15- June 10 :  FP1.csv

Step TWO:  Perform spin QA using spbitSeeker.tcl

spbitSeeker  qurry the CDEV data base to get the  spin info of each fill two times, at the begining and end of the fill.

below is the command use to get the spin info from the data base.

mysql -h dbbak.starp.bnl.gov --port 3412 Conditions_rhic -e "select dataS from kretDbBlobS where nodeID=9 and beginTime>'2013-03-24 04:09:35' order by beginTime limit 1" -s -E
mysql -h db04.star.bnl.gov --port 3412 Conditions_rhic -e "select dataS from kretDbBlobS where nodeID=9 and beginTime>'2013-03-24 04:09:35' order by beginTime limit 1" -s -E
 
spbitSeeket produce two output files called  v124 files  per fill which records the blue and yellow beam polarization for each 360 time bucket at the begining and end of the fill.

More Info about v124 files

spbitSeeker also produced a text file called spinTime.txt which contains some spin info such as number of filled bunches of Yellow and Blue beams, Polarization pattern of each beam which repeats after every 8 filled bunches and if any errors in the pattern, etc,, of each fill.

More info about spinTime.txt

 Problems encountered during step 2:

 a)  In the spinTime.txt for Fill 17232 to  Fill 17250 Polarization pattern was not as expected.
 b)  Code break and stop runnning at the Fill 17538.

-------------------------------------------------------------------------
To Solve a) Kevin contacted Elke,

She recall that the Spin patterns has changed for run 13 compared to run 12  and infact changed twice due to CAD error. 
Elke's slides presenting spin petterns of run 13:
 https://www.phenix.bnl.gov/WWW/publish/elke/STAR/TALKS/eca-spinpatterns2013.correction.pptx

Spin patterns has changed on March 21st.

So spin Pattern begining of run 13 to March 21st has modulo 14, means spin pattern repeats after every 14 bunches.

 Blue beam Pol. Patt   Yellow  beam Pol. Patt   Pol. Patt. Index  Pol. Patt Index
B1: ++--++--++--++ Y1: ++--++--++--++  B1XY3 = P1  B3XY1 = P5
B2: --++--++--++-- Y2: --++--++--++--  B1XY4 = P2  B3XY2 = P6
B3: ++++----++++-- Y3: ++++----++++--   B2XY3 = P3  B4XY1 = P7
B4: ----++++----++ Y4: ----++++----++  B2XY4 = P4  B4Xy2 = P8

Spin Pattern of run 13 starting from  March 21st 2013 has modulo 8

 Blue beam Pol. Patt  Yellow  beam Pol. Patt   Pol. Patt. Index Pol. Patt Index
B1: ++--++-- Y1: ++--++--  B1XY3 = P21  B3XY1 = P25
B2: --++--++ Y2: --++--++  B1XY4 = P22   B3XY2 = P26
B3: --++++-- Y3: --++++--  B2XY3 = P23  B4XY1 = P27
B4: ++----++ Y4: ++----++  B2XY4 = P24   B4Xy2 = P28

I  updated the spbitSeeker.tcl to account for the whole run 13 time period.
Thanks Elke, for provideg the information.

To show the difference sevaral lines from the spinTime.txt before and after March 21st 

 Fill #        1st run   Last run  #of runs   fill start       fill end        start dif  end dif   1st run time    #of filled bunches  pol. patt                 pol. patt index

F17248      14078037 14078055    13            1363712136   1363735857      227      187   2013-03-19 13:15:36   B109   Y109        B+cccccccc-++-- Ycc++cc--cc++cc    B?          
F17250      14079001 14079016    12            1363751073   1363779994      150       76    2013-03-20 00:04:33   B109   Y109        B-cccccccc+--++ Ycc--cc++cc--cc    B?          
F17253      14080009 14080045     9             1363849678   1363868890      178       77    2013-03-21 03:27:58   B109   Y109        B++--++-- Y--++++--   P21          
F17256      14081004 14081014     8             1363932118   1363947337      103       58   2013-03-22 02:21:58    B109   Y109        B++--++-- Y++----++   P22 

------------------------------------------------------------------

b) When The code stop at the fill 17538  (at the end of the fill) couldn't find the reason why.  But we  check the output of the cdev file of this fill and found out that it was broken.  Jan explains that  this could be caused by the  spin record corruption in CDEV data base. As the spin info is been recoreded in CDEV data base in every 5 minutes he implemented the idea that we need only one or two helthy spin recoreds in CDEV  per fill to determine the spin patterns . So   desided to move on by updating the code  to consider the spin pattern for the Fill 17538 only at the begining of the fill.  


Step THREE:  Check if the spin patterns are consistent through out the fill using begEndComp.tcl

This script will read the information in v124 files produced at the begining and end of the fill and compare to see if the patterns is consistent throughout the fill.

This scripts produce two out put text files called goodList.txt and badList.txt which has recoreds of good and Bad fills.

Step FOUR: Examing and Fixing Bad Fills

Fill 17600

Fill 17433

******************************************

Fill 17538:

badCdevout.eve
goodCdevout.eve

********************************************

 
Spin-QA updates_ W_meeting_11-25-2013
spin-QA _ spin_pwg