cdev instances --> .xml data blocks -------------- ---------------- irSpec.star star ringSpe.blue blue-ring ringSpe.yellow yell-ring bo2-wcm3 blue-wcm yi2-wcm3 yell-wcm polarimeter.blu blue-rhic_pol polarimeter.yel yell-rhic_pol next comes ZOO of names: BPM's: rbpm.bi9-bh7.1 as is ... ... rbmp.y05-bh1 as is ... snakes ... as is ... rotators ... as is ...
There is a C++ program askCdev executed every 4 minutes on sc3.starp
asking cdev for variables marked with (+) in this list .
The cdev data record (in .xml format) is sent to eemc-sc.starp machine via ssh and is recorded in STAR online DB by the eemcDB (C++) program.
No QA on a data is made. If only some variables are accessible in cdev only those will be recorded.
An instruction how to restart this programs will be added soon ...
On a rcas6nnn machine of choice a DB request is made every 4 minutes for the last entry from cdev. A Tcl script is executed, the plots and web-page are updated. http://www.star.bnl.gov/~balewski/cdev/
* to fetch an ASCII/jpg file posted on a web page one can use a popular program lynx . Execute from any computer connected to the Internet:
lynx http://www.star.bnl.gov/~balewski/cdev/data/blue-wcm-wcmbeamm.dat -dump or lynx http://www.star.bnl.gov/~balewski/cdevB/jpg/blue-ring-polarizationfillpatterns.jpg -dump >myFig.jpg
* copy the latest file from the web-page area:
cp ~balewski/WWW/cdev/data/outCdev.eve .
* use mySql command to fetch a record from DB.
mysql -h onlsun1.star.bnl.gov --port 3310 Conditions_rhic -e "SELECT data FROM kretDbBlobS WHERE nodeID=3 AND beginTime>'2003-04-09 11:39:14' LIMIT 1 " -t > outCdev.tmp grep -v "\-\-\-\-" outCdev.tmp | grep -v "| data" | sed -e 's/|<cdev >/<cdev>/' | sed -e 's/ |//' >outCdev.eve head outCdev.eveNote, the first line is very long! It does the DB request.
On Tue Apr 15 15:06:45 EDT 2003 data are written to the official online DB,
querry records from:
mysql -h onlsun1.star.bnl.gov --port 3502 Conditions_rhic -e "SELECT dataS FROM kretDbBlobS WHERE nodeID=9 ORDER BY beginTime DESC LIMIT 1 " -t > $myPath/outCdev.tmp
The second line cleans the text file so only the data body remains.
The third one is just printing the first 10 lines of the cdev record.
Below is the result:
rcas6014:~/cdevMon2/0bb>head outCdev.eve
<cdev>
<content N="1" TYPE="S"> ver=2.0 compiled on Apr 7 2003 18:26:10 </content>
<unixTime N="1" TYPE="I" > 1049888401 </unixTime>
<bnlTime N="1" TYPE="S"> Wed Apr 09 07:40:01 2003 </bnlTime>
<Yell>
<ring>
<ionSpeciesS N="1" TYPE="S" > Proton </ionSpeciesS>
<ringStateS N="1" TYPE="S" > store </ringStateS>
......
* to get one value , e.g. WCM one may use a single line processor:
grep "wcmBeamM" outCdev.eve | sed -e 's/<wcmBeamM N="1" TYPE="F" >//' | sed -e 's/<\/wcmBeamM>//'
2610.770264
1567.649902
Note however, there is no check which value is for which ring, since this info is contained in other lines of the input file.* I'd recommend to use a more intelligent text processing tool. Below is an example of the Tcl script. Download this example . Modify the xml2ascii.tcl as instructed. For example, to print out RHIC polarization the following lines are enough:
foreach item [array names eve ] {
if { [string first "avgasym" $item ] <0 } { continue }
if { [string first "45" $item ] >=0 } { continue }
if { [string first "90" $item ] >=0 } { continue }
puts "$eve($item) <-- $item "
}
A similar few lines of the Tcl code is needed to print out the fill pattern and WCM charge for every time bucket.
The output of the example is below:
rcas6014:~/cdevMon2/0bb>tclsh xml2ascii.tcl
processing file outCdev.eve ...sorter result=0
Your input file='outCdev.eve' conforms with .xml syntax
DB entry unixTime =1049839090 --> string: Tue Apr 08 17:58:10 EDT 2003
or day=98.7070601852 in starting from January 1 2003
Lets print all average RHIC polarizations & errors for any beam
0.000673597 <-- yell-rhic_pol-avgasymys
0.00524403 <-- blue-rhic_pol-avgasymxs
0.000278973 <-- yell-rhic_pol-avgasymerrorxs
0.000266193 <-- blue-rhic_pol-avgasymerrorxs
0.000237613 <-- blue-rhic_pol-avgasymys
0.000367573 <-- yell-rhic_pol-avgasymerrorys
0.000414938 <-- blue-rhic_pol-avgasymerrorys
0.000319186 <-- yell-rhic_pol-avgasymxs
Lets save the FillPattern & WCM vs. time bucket
to the output file='wcm.dat'
User1() processing blue-ring-measuredfillpatternm , blue-wcm-filldatam
results saved to file ='wcm.dat'
rcas6012:~/0x>head wcm.dat
1 1 41.3313
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 1 43.3433
8 0 0
9 0 0
10 0 0