EsaApp Code Documentation page

 

Code installation

How to setup the code locally if the repository is already there ? This entry described the setup of the Esa analysis package

Setting up your local copy of the code

If Yury's BaBar framework is already installed on your computing cluster your should have the $E158ROOT environment variable set somewhere. To install the entire framework, please see README.babar-install (yury). At UCL this code is installed in E158ROOT=/unix/lc/bino/e158

To get a local workcopy of the code use the following procedure
  • The scripts that set the enviroment have been written in csh. So if your default shell is not csh or tcsh, (e.g. you're using bash), then fire up a csh session.

    $ csh


  • If the e158setup.csh file is not yet sourced in your .cshrc file then sourcea it here

    $ source /unix/lc/bino/e158/bin/e158setup.csh


    alternatively put this line in your .cshrc file so it will be done automatically
  • Even though the release of the software is installed locally in $E158ROOT, you will need to get the packaged from the SLAC CVS server, therefore you will need an AFS token for the slac cell:

    $ klog -principal 'slac-username' -cell slac.stanford.edu


  • Now make sure you have the correct environment set, the e158setup.csh script doesn't set correctly your E158ARCH environment variable, so do this by issuing

    $ srtpath


    The releasenumber should be either "newest" or "9.0.0", newest is a link to release 9.0.0. Normally you just have to enter twice.
  • Bootstrap the local copy using

    $ newrel -t 9.0.0 'dirname'


    This will create a directory with the new release
  • Go to this directory, add the packages EsaIlc and workdir and compile them...

    $ cd 'dirname'
    $ addpkg EsaIlc
    $ addpkg workdir
    $ gmake workdir.setup
    $ gmake EsaIlc.bin


    This should put the binary in bin/$E158ARCH/EsaApp
  • Copy the $E158CON calibration files for Esa to the local workdir :

    $ cd workdir
    $ cp -r $E158CON/Esa .


  • Copy the runBPM.csh script to the workdir as well

    $ cp ../EsaIlc/runBPM.csh .


  • All set :-), to run the code see the next section

Running the Esa Processing code

After having installed the code in your local path, say esa, your working directory is esa/workdir. If you have followed the instruction above correctly, there should be a subdirectory called esa/workdir/Esa which contains the calibration files.

Their is one master calibration file called BpmConstDDC.index which defines for which runrange a certain calibration file is valid. It has the format

# E158RUNS from : till FILE: Esa/CalibrationConstantsfileForThisPeriod
E158RUNS 1044 : 1050 FILE: Esa/BpmConstDDC.r1044
E158RUNS 1051 : 1053 FILE: Esa/BpmConstDDC.r1028
E158RUNS 1057 : 1060 FILE: Esa/BpmConstDDC.r1057


In a similar fashion, there is a general definition file for the Waveform definition files, called WaveformInfo.index which has the same format and defines the setup of the BPMs and some general properties, like sampling frequency, number of samples for each waveform. The most up to date version of these calibration files is stored in the online production account on the esaanal machines. This means it's best to copy all those files over from
esaanal3:~esaexp/ilcOnline/workdir/Esa
to your local calibration directory.

To process a file, you have to run the runBPM.csh script, which you should have copied to the workdir. This script takes an argument, being the runnumber. It might be that you have to edit the default script to point to the path where the ascii data is stored on your computers, look for the line

setenv ESADATFILE `echo /nfs/slac/g/esa/ilc/data/${MYINPUT}`


and edit accordingly. The script will put it's produced root files in the ESAOUTPUTPLACE, if you want to change that look for

setenv ESAOUTPUTPLACE root
in the script and adjust accordinly. The outputplace is relative to the workdir.

Finally it is also possible to control dynamically which ntuples will be produced in the final root file. Look for the following piece of code in esa/EsaIlc/file.tcl :

module input EsaInputFile
mod talk EsaInputFile
  writeMCC set true
  writeADC set true
  writeSIS set true
  writeSAM set true
  writeINT set true
  writeMAG set true
  writeNMR set true
exit
This will swith on/off the respective ntuple in the produced root file.

Performing the calibration

 

Contents of rootfiles

 

ntp1

Obsolete, was meant for position data from fitting. This method is not used in ESA.
 

ntp2

This tree contains the results of the digital downconversion analysis of the raw BPM signals, information included here is amplitude, phase, position, tilt etc... of the BPMs used. Here is a variable list, note that the dots between the brackets are supposed to be replaced by the BPM designation, eg. x9 or q24 etc...
  • run : runnumber
  • event : event number
  • counter : same
  • t0 : time in samples at which the beam arrives in the cavity
  • t0Error : error on that in samples
  • (...)Amp : amplitude of the downconverted waveform at a fixed t0Ref
  • (...)Phase : phase of he downconverted waveform at a fixed t0Ref
  • (...)Freq : frequency used in the DDC algoritm, basically the frequency picked up from the calibration file, converted into MHz (note that in fact this is the reflected frequency from the 2nd nyquist band since we undersample).
  • (...)Gamma : width used in the DDC algoritm, note that this quantity is still in the strange units used in the calibration file. (see previous section)
  • (...)decTime : decaytime in microseconds, as calculated from the (...)Gamma, by simply inverting and multipliying with something like 8.40336 ns for external and 10 ns for internal clock to convert the value in samples to physical units
  • (...)Pos : the calibrated position in millimeters for the current pulse
  • (...)Tilt : tilt
  • (...)deltaT : difference between t0 and the time (in samples) where the downconverted waveform is samples (t0Ref), value given in samples
  • (...)Chi2_NDF : obsolete (=1)
  •  

    ntp3

    This tree contains the SCP MCC data. Here is a variable list :
  • runNumber : the current run number
  • evtNumber : the current event number
  • LI00_KLYS_2_PHAS :
  • LI00_PHAS_96_VACT :
  • LI00_PHAS_6_VACT :
  • LI29_LI29FBCK_XPOSE- :
  • LI29_LI29FBCK_XANGE- :
  • LI29_LI29FBCK_YPOSE- :
  • LI29_LI29FBCK_YANGE- :
  • FB31_FB31ESA_EGAIN1E- :
  • FB31_FB31ESA_EGAIN4E- :
  • FB31_FB31ESA_PHAS0271 : subbooster phases that controls the phase of the klystrons in sector 27
  • FB31_FB31ESA_PHAS0281 : subbooster phases that controls the phase of the klystrons in sector 28, used together with previous phase for energy feedback, should be opposite in sign.
  • FB31_FB31ESA_PHAS0274 :
  • AB01_AB01STER_AB01X :
  • AB01_AB01STER_AB01Y :
  • AB01_AB01STER_AB01XANG :
  • AB01_AB01STER_AB01YANG :
  • AB01_TORO_2995_DATA :
  • AB01_TORO_4140_DATA :
  • AB01_Bend_1650_IACT :
  • AB01_Bend_1650_BACT :
  • AB01_LGPS_140_IACT :
  • AB01_LGPS_1100_IACT :
  • AB01_LGPS_1100_BACT :
  • AB01_BTRM_1112_BACT :
  • AB01_BTRM_1314_BACT :
  • AB01_BTRM_1516_BACT :
  • AB01_BTRM_2122_BACT :
  • AB01_BTRM_2324_BACT :
  • AB01_BTRM_2526_BACT :
  • AB01_LGPS_1010_BACT :
  • AB01_LGPS_1090_BACT :
  • AB01_LGPS_1950_BACT :
  • AB01_LGPS_2050_BACT :
  • AB01_LGPS_2750_BACT :
  • AB01_LGPS_2780_BACT :
  • AB01_LGPS_2850_BACT :
  • AB01_LGPS_3050_BACT :
  • AB01_LGPS_3850_BACT :
  • AB01_XCOR_2890_BACT :
  • AB01_XCOR_2892_BACT :
  • AB01_YCOR_2911_BACT :
  • AB01_YCOR_2913_BACT :
  • AB01_XCOR_3212_BACT :
  • AB01_XCOR_3214_BACT :
  • AB01_YCOR_3313_BACT :
  • AB01_YCOR_3315_BACT :
  • AB01_STEP_2010_VACT :
  • AB01_STEP_2011_VACT :
  • AB01_ASTS_BPM12RET :
  • AB01_ASTS_BPM24RET :
  • AB01_ASTS_BPM31RET :
  • AB01_ASTS_BPM32RET :
  • mv01_xmov_5111_vdes :
  • mv01_ymov_5112_vdes :
  • mv01_xmov_5113_vdes :
  • mv01_xmov_5111_vact :
  • mv01_ymov_5112_vact :
  • mv01_xmov_5113_vact :
  • ab01_step_4210_vdes :
  • ab01_step_4210_vact :
  • ab01_step_4410_vdes :
  • ab01_step_4410_vact :
  • ab01_step_4411_vdes :
  • ab01_step_4411_vact :
  • ab01_step_4300_vdes :
  • ab01_step_4300_vact :
  • ab01_step_4500_vdes :
  • ab01_step_4500_vact :
  • dr13_ampl_13_vdes :
  • li02_sbst_1_phas :
  • li12_sbst_1_phas :
  • ab01_xmov_4211_vdes :
  • ab01_xmov_4211_vact :
  • ab01_xmov_4212_vdes :
  • ab01_xmov_4212_vact :
  • ab01_xmov_4213_vdes :
  • ab01_xmov_4213_vact :
  • ab01_asts_3bpm1 : thermocouple temperature on BPM 41 (in fahrenheit)
  • ab01_asts_3bpm2 : thermocouple temperature on BPM 42 (in fahrenheit)
  • ab01_asts_3bpm3 : thermocouple temperature on BPM 3 (in fahrenheit)
  • ab01_asts_3bpm4 : thermocouple temperature on BPM 4 (in fahrenheit)
  • ab01_asts_3bpm5 : thermocouple temperature on BPM 5 (in fahrenheit)
  • ab01_asts_3bpm6 :
  • ab01_asts_3bpm7 :
  • ab01_asts_3bpm8 :
  • ab01_asts_3bpm9 : thermocouple temperature on BPM 9 (in fahrenheit)
  • ab01_asts_3bpm10 : thermocouple temperature on BPM 10 (in fahrenheit)
  • ab01_asts_3bpm11 : thermocouple temperature on BPM 11 (in fahrenheit)
  • ab01_asts_3wake1_1 :
  • ab01_asts_3wake1_2 :
  • ab01_asts_rb061_01 : temperature of sensor 1 on electronics rack 61 in ESA (in fahrenheit)
  • ab01_asts_rb061_02 : temperature of sensor 2 on electronics rack 61 in ESA (in fahrenheit)
  • ab01_ampl_1_vact :
  • ab01_ampl_2_vact :
  • ab01_ampl_3_vact :
  • ab01_ampl_4_vact :
  • ab01_ampl_5_vact :
  • ab01_ampl_6_vact :
  • ab01_ampl_7_vact :
  • ab01_ampl_8_vact :
  • ab01_ampl_9_vact :
  • ab01_ampl_10_vact :
  • ab01_ampl_11_vact :
  • ab01_ampl_12_vact :
  • ab01_ampl_13_vact :
  • ab01_ampl_14_vact :
  • ab01_ampl_15_vact :
  • ab01_ampl_16_vact :
  • ab01_ampl_17_vact :
  • ca11_TORO_34_DATA :
  • AB01_TORO_2460_DATA :
  •  

    ntp4

    This tree contains the ADC data:
  • runNumber : the current run number
  • evtNumber : the current event number
  • nAdc :
  • adc[nAdc] :
  •  

    ntp5

    This tree contains the raw waveforms from the SIS modules :
  • runNumber : the current run number
  • evtNumber : the current event number
  • nSamples :
  • sample[nSamples] :
  • sis0wf0_x9[nSamples] :
  • ...
  •  

    ntp6

    Interferometer data ntuple :
  • runNumber : the current run number
  • evtNumber : the current event number
  • seqN :
  • stat0_0 :
  • stat1_0 :
  • err0_0 :
  • err1_0 :
  • ssi0 :
  • pos0 :
  • vel0 :
  • time0 :
  • ...
  •  

    ntp7

    VSAM data, for mapping see Zen's notes
  • runNumber : the current run number
  • evtNumber : the current event number
  • vsam0[0] : Z1 fluxgate on girder before 3B4 (strayfields, Y direction)
  • vsam0[1] : Z2 fluxgate on the beampipe before 3B4 ( strayfields, Y direction )
  • vsam0[2] : Y2 fluxgate on the beampipe before 3B4 ( strayfields, X direction )
  • vsam1[] : array with values from the second VSAM module
  • ...
  •  

    ntp8

    Magnet control data, the index 0 as in mag0Time corresponds to the magnet circuit.
  • runNumber : run number
  • evtNumber : event number
  • mag0TransductIdx : transductor used, 0: cage transductor, 1: PS transductor
  • mag0UseNMRread : use nmr read value from this magnet
  • mag0Time : unix time of this read
  • mag0Status : read status bits
  • mag0Polarity : magnet polarity (+/- 1 )
  • mag0FieldSetPoint : magnet setpoint in kGauss
  • mag0Field : magnet field calculated from transductor reading
  • mag0CurrSetPoint : magnet circuit current (A) setpoint
  • mag0Curr : magnet circuit current (A)
  • mag0MomentumSetPoint : magnet momentum setpoint calculated from current setpoint
  •  

    ntp9

  • runNumber : run number
  • evtNumber : event number
  • nmr1IsFeedback : is 1 if this probe is used for field feedback to magnet control
  • nmr1Polarity : NMR probe polarity ( +/- 1 )
  • nmr1Status : NMR probe status bits
  • nmr1Quality : NMR data quality, combination of status bits (=1 if good data)
  • nmr1Unit : 0 is MHz, 1 is Tesla
  • nmr1Time : unix time of this read
  • nmr1Field : measure field value
  • nmr1SeqN : measurement sequence number
  •  

    ntp10

    Ntuple with measured frequencies and widths from fourier spectrum for each waveform :
  • run : the current run number
  • event : the current event number
  • counter : same
  • nSamples :
  • sis0wf0_x9MaxFD :
  • sis0wf0_x9MaxFDbin :
  • sis0wf0_x9MaxFWHM :
  • ...
  •  
    back to main