CMON: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
 
(17 intermediate revisions by 3 users not shown)
Line 3: Line 3:
== Algoritms and Structure ==
== Algoritms and Structure ==


Code location: ''$CLON/src/cmon''. Following describes core components.
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'':
'''Pattern recognition''' library, located in ''prlib.s'':
Line 14: Line 14:


'''Track reconstruction''' library, located in ''trlib.s''.
'''Track reconstruction''' library, located in ''trlib.s''.
-r--r--r-- 1 boiarino clas  1350 Feb 25  2005 alu.c
* alu.c
-r--r--r-- 1 boiarino clas  9612 Nov  3  2007 cmlib.c
* cmlib.c - main calls
-r--r--r-- 1 boiarino clas  1128 Feb 25  2005 dcbrun.c
* dcbrun.c - called from cmlib in the beginning of every run
-r--r--r-- 1 boiarino clas 13009 Nov  3  2007 dcdcam.c
* dcdcam.c - derives "dcam" for each hit of the candidate track (calls: scmatch, scbeta, scdtime, dcdocam, dclramb)
-r--r--r-- 1 boiarino clas  2709 Feb 25  2005 dcdocam.c
* dcdocam.c -  calculates distance to the hit wire (calls: none)
-r--r--r-- 1 boiarino clas 22517 Nov 3  2007 dcdsect.c
* dcdsect.c - draw sector geometry, tracks and hits
-r--r--r-- 1 boiarino clas  1872 Feb 25  2005 dcerun.c
* dcerun.c
-r--r--r-- 1 boiarino clas 15654 Feb 25  2005 dcfield.c
* dcfield.c - Performs 3-dim 2-nd order interpolation for each component of the magnetic field using Taylor series
-rw-r--r-- 1 boiarino clas 10303 Mar 14  2010 dcfinde.c
* dcfinde.c - Identify electron for electroproduction, or other particle for photoproduction
-r--r--r-- 1 boiarino clas 24888 Nov  3  2007 dcfit.c
* dcfit.c - Level = 2: Performs track fitting using the stored wire positions and momentum from the pattern recognition templates; Level = 4: Final fitting with corrected drift times
-r--r--r-- 1 boiarino clas  8977 Feb 25  2005 dcfitsl.c
* dcfitsl.c - fit one track segment in a SuperLayer
-rw-r--r-- 1 boiarino clas 43991 Dec  7  2010 dchist.c
* dchist.c
-r--r--r-- 1 boiarino clas 6816 Feb 25 2005 dcicyl.c
* dcicyl.c - Intersection of a Track with a Cylinder. Calculates intersection of track  with cylindrical surface of radius R. The track is approximated by a cubic in the track length. To improve stability, the coordinate system is shifted. First the Newton method (by P.D.) is used to find the intersection. Derivatives are calculated analytically using the parameters of cubic approximation. For input parameters given correctly and for the track not too steep to the surface the Newton method converges in 1-2 iterations and gives ultimate accuracy. For the reasons of safety of the procedure the old Half-Interval Division method is used if the first method is failed.
-r--r--r-- 1 boiarino clas 7246 Feb 25 2005 dcipln.c
* dcipln.c - Intersection of a Track with a Plane. Calculates intersection of track with a plane situated at the distance 'd' from the center of coordinates. The vector 'ortvec' is the unit length vector directed from the center of coordinates to the direction of the plane and orthogonal to it. The track is approximated by a cubic in the track length.    To improve stability, the coordinate system is shifted. Normally the Newton method is used to find the intersection. Derivatives are calculated analytically using the parameters of cubic approximation. For input parameters given correctly and for the track not too steep to the surface the Newton method converges in 1-2 iterations and gives ultimate accuracy. For the reasons of safety of the procedure the old Half-Interval Division method is used if the first method is failed.
-rw-r--r-- 1 boiarino clas  1473 Oct 30  2007 dclast.c
* dclast.c - finishing the program
-rw-r--r-- 1 fklein  clas  2130 Nov  2  2007 dcpdst.c
* dcpdst.c - gives access to a event bank 'EVTB' for Level = 2 or 4
-r--r--r-- 1 boiarino clas 13628 Feb 25  2005 dcrkuta.c
* dcrkuta.c - one-step tracking a particle through a magnetic field using Runge-Kutta method
-r--r--r-- 1 boiarino clas  2279 Feb 25  2005 dcrotds.c
* dcrotds.c - vector transformation from Detector to Sector Coordinate System and reverse { DCS <--> SCS }
-r--r--r-- 1 boiarino clas  6060 Feb 25  2005 dcstat.c
* dcstat.c -  keep tallies on different types of analysis cuts; for multithreaded applications: allocate TRstat structure locally for every thread and use 'dcstatadd(TRstat *stat)' to accumulate all statistic together
-r--r--r-- 1 boiarino clas 8480 Feb 25  2005 dcswim.c
* dcswim.c - track swimming (traj. propagation) in magnetic field. Calculates track points on detector planes
-r--r--r-- 1 boiarino clas  6419 Feb 25  2005 dcswimvt.c
* dcswimvt.c - back swimming in the PT magnetic field; calculates track points on the target plane#1
-r--r--r-- 1 fklein  clas  1837 Nov  2  2007 dctodst.c
* dctodst.c - writes the reconstructed event into DST
-r--r--r-- 1 boiarino clas 13565 Feb 25  2005 dctrfit.c
* dctrfit.c - perform a fit of the track candidate
-r--r--r-- 1 boiarino clas  4765 Feb 25  2005 dctrmat.c
* dctrmat.c - calculates transport matrix for one step; records matrix at point of layer penetration
-r--r--r-- 1 boiarino clas 25659 Nov  4  2007 sclib.c
* sclib.c - find SC slab "idsc" in data the track points to
-rw-r--r-- 1 boiarino clas  6001 Jan 29  2009 stlib.c
* stlib.c - start counter library
-rw-r--r-- 1 boiarino clas 42033 Mar 14  2010 tglib.c
* tglib.c - tagger library (rewritten a la offline version)
-r--r--r-- 1 boiarino clas  550 Feb 25  2005 trbos.c
* trbos.c
-r--r--r-- 1 boiarino clas 14272 Feb 25  2005 trconfig.c
* trconfig.c
-r--r--r-- 1 boiarino clas  2248 Feb 25  2005 trinit.c
* trinit.c
-rw-r--r-- 1 boiarino clas  3835 Mar 14  2010 trlib.c
* trlib.c


== Road Maps ==
== Road Maps ==
Line 96: Line 96:
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
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=TAG_CALIB runIndexTable=calib_user.RunIndexg8b runMin=1 runMax=1000000
  db2clonmap.pl system=SC_CALIBRATIONS_V2 runIndexTable=calib_user.RunIndexg9 runMin=1 runMax=1000000
  db2clonmap.pl system=SC_CALIBRATIONS_V2 runIndexTable=calib_user.RunIndexg9 runMin=1 runMax=1000000



Latest revision as of 19:16, 1 June 2012

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 - calculates distance to the hit wire (calls: none)
  • dcdsect.c - draw sector geometry, tracks and hits
  • dcerun.c
  • dcfield.c - Performs 3-dim 2-nd order interpolation for each component of the magnetic field using Taylor series
  • dcfinde.c - Identify electron for electroproduction, or other particle for photoproduction
  • dcfit.c - Level = 2: Performs track fitting using the stored wire positions and momentum from the pattern recognition templates; Level = 4: Final fitting with corrected drift times
  • dcfitsl.c - fit one track segment in a SuperLayer
  • dchist.c
  • dcicyl.c - Intersection of a Track with a Cylinder. Calculates intersection of track with cylindrical surface of radius R. The track is approximated by a cubic in the track length. To improve stability, the coordinate system is shifted. First the Newton method (by P.D.) is used to find the intersection. Derivatives are calculated analytically using the parameters of cubic approximation. For input parameters given correctly and for the track not too steep to the surface the Newton method converges in 1-2 iterations and gives ultimate accuracy. For the reasons of safety of the procedure the old Half-Interval Division method is used if the first method is failed.
  • dcipln.c - Intersection of a Track with a Plane. Calculates intersection of track with a plane situated at the distance 'd' from the center of coordinates. The vector 'ortvec' is the unit length vector directed from the center of coordinates to the direction of the plane and orthogonal to it. The track is approximated by a cubic in the track length. To improve stability, the coordinate system is shifted. Normally the Newton method is used to find the intersection. Derivatives are calculated analytically using the parameters of cubic approximation. For input parameters given correctly and for the track not too steep to the surface the Newton method converges in 1-2 iterations and gives ultimate accuracy. For the reasons of safety of the procedure the old Half-Interval Division method is used if the first method is failed.
  • dclast.c - finishing the program
  • dcpdst.c - gives access to a event bank 'EVTB' for Level = 2 or 4
  • dcrkuta.c - one-step tracking a particle through a magnetic field using Runge-Kutta method
  • dcrotds.c - vector transformation from Detector to Sector Coordinate System and reverse { DCS <--> SCS }
  • dcstat.c - keep tallies on different types of analysis cuts; for multithreaded applications: allocate TRstat structure locally for every thread and use 'dcstatadd(TRstat *stat)' to accumulate all statistic together
  • dcswim.c - track swimming (traj. propagation) in magnetic field. Calculates track points on detector planes
  • dcswimvt.c - back swimming in the PT magnetic field; calculates track points on the target plane#1
  • dctodst.c - writes the reconstructed event into DST
  • dctrfit.c - perform a fit of the track candidate
  • dctrmat.c - calculates transport matrix for one step; records matrix at point of layer penetration
  • sclib.c - find SC slab "idsc" in data the track points to
  • stlib.c - start counter library
  • tglib.c - tagger library (rewritten a la offline version)
  • 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 runMin=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