CMON
CMON is CLAS Online Data Monitoring program. It does real time event reconstruction using old 'sda' program rewritten to C and modified for multithreaded environment.
Algoritms and Structure
Code location: $CLON/src/cmon. Following describes core libraries. Usually library 'xx' has xxinit() and xxlib() calls as an interface.
Pattern recognition library, located in prlib.s:
- ec_export.c - fills ECPI bank
- eclib.c - EC (Forward Calorimeter) calorimeter reconstruction library
- iclib.c - IC (Inner Calorimeter) reconstruction library
- pr_export.c - interface to offline packages, in particular makes DC1 bank
- prlib.c - Drift Chamber pattern recognition, in particular Road Finder
- sglib.c - Drift Chamber Segment Finder
Track reconstruction library, located in trlib.s.
- alu.c
- cmlib.c - main calls
- dcbrun.c - called from cmlib in the beginning of every run
- dcdcam.c - derives "dcam" for each hit of the candidate track (calls: scmatch, scbeta, scdtime, dcdocam, dclramb)
- dcdocam.c
- dcdsect.c
- dcerun.c
- dcfield.c
- dcfinde.c
- dcfit.c
- dcfitsl.c
- dchist.c
- dcicyl.c
- dcipln.c
- dclast.c
- dcpdst.c
- dcrkuta.c
- dcrotds.c
- dcstat.c
- dcswim.c
- dcswimvt.c
- dctodst.c
- dctrfit.c
- dctrmat.c
- sclib.c
- stlib.c
- tglib.c
- trbos.c
- trconfig.c
- trinit.c
- trlib.c
Road Maps
Road maps are used by Pattern Recognition. To generate road map following command must be used:
makefulldict
If ran without parameters it will show usage:
Usage: makefulldict IWmin IWmax Pmin Pmax Charge [THETAmin THETAmax] GeV/c Degree Output will go to the prlink.bos file in the current directory.
Go to $CLON_PARMS/cmon/prlib/DICT/ directory and adjust local cmon.config file. Then run makefullduct, for example:
makefulldict 1 130 0.5 1.0 -1.
It will generate roads scaning starting point from wire 1 to wire 130, momentum from 0.5GeV/c to 1.0GeV/c for negative particles.
Several dictionaries can be merged by running
mergedict
with following usage:
Usage: mergedict <dictfilename1> <dictfilename2> Output will go to the prlink.bos file in the current directory.
Calibration Constants
Calibration constants are stored in offline database. It can be accessed at this link.
Calibration constants must be extracted from offline database and stored in a form of map files to be used by CMON. To extract information from database to maps, db2clonmap.pl script must be used. It can be run with following parameters:
db2clonmap.pl runMin=<minimum run> runMax=<maximum run> \ [system=<system name>] \ [skip_run_control=<non-zero to skip RUN_CONTROL system>] \ [runIndexTable=<run index table name>] \ [time=<date/time of validity>] \ [hostname=<db server hostname>] \ [quiet=<non-zero to supress printout>] \ [help=<non-zero for usage message]
For example, to extract tagger calibration parameters goto $CLON_PARMS/Maps and run
db2clonmap.pl system=TAG_CALIB runMin=1 runMax=1000000
it will create subdirectory Maps_1-1000000, create TAG_CALIB.map inside and fill it up.
Default runIndexTable is RunIndex. For some run periods calibration constants are stored under different runIndexTable name, for example for g8b runIndexTable was calib_user.RunIndexg8b. In that case use command
db2clonmap.pl system=TAG_CALIB runIndexTable=calib_user.RunIndexg8b unMin=1 runMax=1000000 db2clonmap.pl system=SC_CALIBRATIONS_V2 runIndexTable=calib_user.RunIndexg9 runMin=1 runMax=1000000
To extract entire database run following command (it is important to use 'skip_run_control=1', otherwise it takes forever)
db2clonmap.pl skip_run_control=1 runMin=1 runMax=1000000
After it finished, move all *.map files to $CLON_PARMS/Maps.
Calibration databases can be dumped in a form of ascii file using following procedure:
$CLAS_TOOLS/caldb/caldb_show_constants_run.pl s=TAG_CALIB ss=tag_t i=ci r=40000 > /home/boiarino/z123
JUST FOR INFORMATION, DO NOT DO THAT: To write it back remove first two lines and type:
$CLAS_TOOLS/caldb/caldb_write_and_link.pl s=TAG_CALIB ss=tag_t i=ci min=40000 max=50000 ci="test1" f=/home/boiarino/z123