G2p Beampackage
Feature
g2p beampackage is a python package developed for position calculation, it contains the package for:
- Harp data analysis from raw harp data
- BPM calibration
- Raster calibration and reconstruction
- Decode bpm information from rootfile
- Calculate position and dump to pickle file
- Insert position to rootfile
- Read run information, including:
- BPM calibration constant
- BCM calibration constant
- Any run information saved in sqlite database which synced with Ryan's Mysql database plus some additional BPM information
Download and install
There have two parts for the beampackage, source code and database. You can copy them from the g2p work disk:/w/halla-sfs62/g2p/centos62/g2ppylib Once you copied it, you need to set the environments below:
- REPLAY_OUT_PATH used to find your rootfile
- BEAMPACPATH location for beampackage source code directory
- BEAMDBPATH location for beampackage database directory
- BEAMPKLPATH The position to save your pickle file, if there is corresponding pkl file exists beampackage will read it directly and skip decode or calculate
- BEAMPKLBAK The position to save your pickle files which you don't want to redecode or recalculate and you want stay it as stable version, beampackage will check BEAMPKLPATH first then check BEAMPKLBAK
- BEAMDEBUG debug bit, used to set 0
- BEAMUPDATE automatically update beampackage, you can set to 0 to close it
- BEAMUPDATECHECK check beampackage updated, you can set to 0 to close it
- PYTHONPATH you need to add your BEAMPACPATH to PYTHONPATH
To use the beampackage, you need to make sure the package following is installed:
- python 2.7
- root with python module compiled from cern
- scipy,numpy and matplotlib
The following modules should be came with python and you don't need to install any more: "sys","os","urllib","urllib2","socket","re","threading","math","pickle","shutil","glob","array","time","linecache","zipfile","ctypes","xml.etree.ElementTree","select","bisect","gc","multiprocessing"
Database
There are several type of databases you can find in BEAMDBPATH directory, ascii txt database, ods file, c code, pkl file and sqlite database
- sqlite database
- g2p.db is converted from Ryan's mysql database, and added some additional BPM information
- c code
- bpm_$1_$2.c are pure c code, they are fitted function used to transport the positions from two BPMs to target(x_a,y_a,x_b,y_b -> x_tgt,y_tgt,theta_tgt,phi_tgt) when there is target magnet field exists. The Makefile is also exists in the database directory used to compile them. Those functions are fitted by using BdL method and mudifi fit program, you can find them in g2p work disk: /w/halla-sfs62/g2p/pzhu/work/beamDrift, you need to install root and clhep and gcc,fortran before using it. $1 is the beam orbit which you can find from sqlite database and $2 is the integered target z position.
- ascii file the normal ascii txt file, you can edit it by any txt editor
- bpma/b_$run$.dat are the bpm calibration constants files. a/b shows which bpm it used, run number in filename is just a tag came from one of the bpm calibration run, it used to check which arm is available. The constant file contains the available run period info, available target z position info, bpm calibration constant information
- raster_$run$.dat are the raster calibration constants files. The avail run period info, avail target z info, raster calibration constant are included in the file. run number in filename is just a tag same as bpm calibration constant file. They used to transfer the raster magnet current information to position offset caused by raster, which used to get the event by event position at target.
- beampackage.conf defined several beampackage settings.
- bpmerr.conf contains the bpm and harp survey information
- bpmcalib.conf contains several special calibration settings for each calibration period
- ods file the OpenDocument Spreadsheet file, you can open it by using openoffice or libreoffice
- bcm calibration.ods the bcm