Difference between revisions of "Old MolPol DAQ Analysis"

From Hall A Wiki
Jump to: navigation, search
Line 26: Line 26:
 
=== run.kumac ===
 
=== run.kumac ===
 
'''run.kumac''' is located in the ~/paw/moller/ directory.
 
'''run.kumac''' is located in the ~/paw/moller/ directory.
 +
* Initializes the run number to be used by '''getrun.kumac''' (which feeds the current run number into asym11.kumac or asym15.kumac, the analysis script of interest)
 +
* Command line arguments and defaults:
 +
** MACRO run ''run''=0 ''reload''=0 ''clear''=0 ''name''=moller_data ''dirg''=XX ''rawext''=dat
 +
* And the only thing that changes from the defaults is the run number when run from the command line as "paw> exec run run=NUMBER" (as shown in the section above)
 
* Reads ''nact'' (number of actions?) as $VDIM(''lrun'') and ''nfil'' (number of files) as $VLEN(''lrun'') (and these should be the same since ''dim'' was omitted and is assumed to be 1 for the $VDIM command).
 
* Reads ''nact'' (number of actions?) as $VDIM(''lrun'') and ''nfil'' (number of files) as $VLEN(''lrun'') (and these should be the same since ''dim'' was omitted and is assumed to be 1 for the $VDIM command).
 
* Sets ''dirg'' (data directory?) to /adaq1/data1/moller or /work/halla/moller/disk1/exp depending on the computer you log in from.
 
* Sets ''dirg'' (data directory?) to /adaq1/data1/moller or /work/halla/moller/disk1/exp depending on the computer you log in from.

Revision as of 17:58, 22 September 2018

Making Polarization measurements

Overview

  1. Start dbedit on adaq1, select "mollerpol_l" database and set in "beam_pol" configuration table in row "code" parameter "adcevents" from 9 to 2: " ... adcevents=2"
  2. Make at least two CODA runs in order to use both coil polarities.
  3. Data analysis:
    • old DAQ: adaq1:~/paw/moller/
      > paw
      paw> exec run run=15625
      paw> exec lg_spectra run=15625
      paw> exec time run=15625
      paw> lcd mag_optim
      paw> exec anpow_set e0=7.37 (E0 - beam energy in GeV)
      paw> exec asym11 anpow=0.7735 gate=0.033 run=15625 (gate=0.033 for 30Hz helicity frequency and gate=0.0008 for 1kHz)
    
    • It is possible to read these files from the ~moller home directory using any account defined in the adaqfs computer system

Kumacs

pawlogon.kumac

pawlogon.kumac is located in the ~/paw/moller/ directory, containing Moller Polarimeter analysis specific aliases and initialization.

  • The pawlogon.kumac is run automatically at PAW startup, so it should not be neglected.
  • It sets graphing option settings, defines .ps file saving and printing aliases, and initializes.

run.kumac

run.kumac is located in the ~/paw/moller/ directory.

  • Initializes the run number to be used by getrun.kumac (which feeds the current run number into asym11.kumac or asym15.kumac, the analysis script of interest)
  • Command line arguments and defaults:
    • MACRO run run=0 reload=0 clear=0 name=moller_data dirg=XX rawext=dat
  • And the only thing that changes from the defaults is the run number when run from the command line as "paw> exec run run=NUMBER" (as shown in the section above)
  • Reads nact (number of actions?) as $VDIM(lrun) and nfil (number of files) as $VLEN(lrun) (and these should be the same since dim was omitted and is assumed to be 1 for the $VDIM command).
  • Sets dirg (data directory?) to /adaq1/data1/moller or /work/halla/moller/disk1/exp depending on the computer you log in from.
  • Reads through the file list and throws away all empties and grabs an available LUN to run with (and uses goto's to skip around in the kumac, instead of function definitions as one would do in C++).
  • "mfind file:" tries to read the actual files into PAW's memory.
  • nf variable reads the number of lines in the NTuple file list's files = [fnamntu].
  • If it finds a file then it runs it through rawrd.com and keeps reading the files.

rawrd.com

rawrd.com is located in the ~/bin/ directory (with the base version located in ~/analysis/raw-ntup/) and is a BASH "command" file (not a PAW KUMAC) which converts a raw CODA data file into a PAW NTuple.

  • cd's and runs from the ~/analysis/raw-ntup/ folder.
  • Ultimately will run a rawrd_Linux.exe executable (in the same ~/analysis/raw-ntup/ folder) on the raw CODA data it finds.
  • Searches for and symlinks to a raw data file found in diraw=/adaqs3/data4/ folder (default, but in the run.kumac file it is adaq1/data1/moller/).
  • Defines the raw file to be read as filer=$diraw/"*_"$run."$dext" (where $dext is a user input variable, defaulting to "dat", and $run is also user input from the run.kumac place where it is run).
    • Basically this means it searches in the user defined place (defaults to /adaqs3/data4/) for files with the name structure anything_RunNumber.dat and executes the rawread_Linux.exe executable on them (which I assume is compiled from the rawread.f fortran code).
  • Resulting output files have suffix .nt (for NTuple).
  • Most of the script is moving symlinks around and checking for non-trivial file size and permissions.

rawread.f/rawread_Linux.exe

rawread.f is a Fortran code located in the ~/analysis/raw-ntup/ folder that is compiled (and renamed) into rawread_Linux.exe and serves as a decoder for raw CODA data from the Moller Polarimeter DAQ.

  • Reads a raw CODA file and turns it into an NTuple.
  • Reads all of the CODA Moller Polarimeter DAQ specific data file header words and crawls through the CODA data file's initialization words until it gets to the raw data itself
  • Reads out event data and banked data into arrays
  • Stores data into relevant NTuple branches
  • It knows what lengths the different data types should be and robustly diagnoses errors, but this means any deviation from the standard expected data types, header words, or bank structures will fail to be decoded correctly, and the reasoning for most of the decoding is not clear or commented in the code. So making any changes would require expert knowledge or a lot of digging for information.



Terminology

PAW

  • PAW = "Physics Analysis Workstation", is an interpreted Fortran based language used in High Energy and Nuclear Physics data analysis.
  • PAW (CERN User's Guide) is "PAW is an interactive utility for visualizing experimental data on a computer graphics display. It may be run in batch mode if desired for very large and time consuming data analyses; typically, however, the user will decide on an analysis procedure interactively before running a batch job." - which basically means it does the same kind of interpreted analysis work that ROOT does, except in Fortran instead of C++.
  • PAW was designed and used with Fortran and systems that had some hardware limitations, which is where a number of the anachronistic things like pre-reserved memory slots, postscript printing, and finite line-widths originated, and is why PAW has been largely replaced by ROOT in modern nuclear and particle physics applications.

KUIP

  • KUIP = "Kit for a User Interface Package", is the user interface designed to work with PAW. It is analogous to ROOT, and includes a command line interface (CLI) and GUI interfaces similar to ROOT's TBrowser and assorted histogram and canvas interfaces, and they operate similarly.
  • CERN user guide here.
  • KUMACs are "KUIP Macros" and are interpreted PAW macro scripts that can be run in batch mode.

LUN/lun

  • LUN = "Logical Unit Number" - a lun is a METAFILE descriptor number ranging from 1 to 100.
  • From Brad Sawatsky's PAW FAQ: "Some PAW commands ( HISTOGRAM/FILE, FORTRAN/FILE etc ...) have a parameter named lun. This parameter is a "logical unit number" on which are attached files. Some of these "logical unit number" are reserved by PAW and associated packages. The following table gives the list of the reserved units."
    • The table says 5-19 are reserved, and so are most of 81-91 and 97 - therefore most of the KUMACs discussed here start with lun 21.
  • To print a file do
    • fort/file lun {filename.ps} - opens the file lun
    • meta lun - makes it into a .ps file
    • close lun - closes

Command Descriptions

  • ve/cr = Vector/Create
  • $VDIM(name,dim) = returns the size of vector "name" along the "dim" dimension (default = 1 if not explicitly set)
  • $VLEN(name) = returns the location of the last non-zero element of a vector (acts like $VDIM but for 1 dimensional arrays)
  • $SHELL(command,n) = returns the nth line of output from the given shell command
  • [macro variable] = gets interpreted as a number if possible (macro variables are all initially strings, but PAW does a lot of gymnastics to convert strings into numbers intelligently, and there are ways to force interpretations to happen or not to happen in ways you want - see section 3.5 of the PAW guide for lots of detail)