Difference between revisions of "Analyzer/Comparisons"

From HallCWiki
Jump to navigationJump to search
 
(29 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
== Setting up Fortran Analyzer (ENGINE) and Replay ==
 
== Setting up Fortran Analyzer (ENGINE) and Replay ==
 
=== Get copy of Analyzer and Replay directories ===
 
=== Get copy of Analyzer and Replay directories ===
* The ENGINE code has been put in a [https://github.com/JeffersonLab/engine github repository]. To get the code follow the same [https://hallcweb.jlab.org/wiki/index.php/ROOT_Analyzer/Git#Retrieving_the_Hall_C_analyzer_with_git directions] used to get hcana, but replace "hcana" with "engine"
+
* The ENGINE code has been put in a [https://github.com/JeffersonLab/engine github repository].  
* Create an "analysis" directory for doing the ENGINE replay. When setting up the "upstream" remote, leave off the "--track develop" argument.  
+
** To checkout and contribute using github:
* In the "analysis" directory extract the ENGINE code: "git clone git@github.com:GitHub-Username/engine.git" . This creates the subdirectory engine.
+
*** Create an account on [https://github.com github.com] and following the directions for storing your public ssh key on the site.
 +
**** NOTE: The github instructions ask you to install a program called "xclip" to help upload your public key. This is unnecessary - you can just "click and paste".
 +
*** Once you have signed into github then go to [https://github.com/JeffersonLab/engine https://github.com/JeffersonLab/engine].
 +
**** Select '''Watch''' to be notified of changes to engine repo and the click on the '''Fork''' button to create your own Github copy of the repo.
 +
*** On the computer that you want to run the code
 +
**** Create an "analysis" directory for doing the ENGINE replay.  
 +
**** In the "analysis" directory type: '''git clone git@github.com:''Githib-Username''/engine.git''' where ''Githib-Username'' is your github username.
 +
**** This creates the subdirectory engine.
 +
**** Now "origin" remote is to your personal Github repository. After cloning you will be in the "master" branch. You need to use the "mkj" branch.
 +
*** Always work in the "mkj" branch or in a new branch that uses "mkj" branch as starting point. Make your local changes and commit them to your local copy.  You can update the github repository by command: '''git push origin mkj''' . If you want to have these changes incorporated into the JeffersonLab repository then go to your github account ''' ''Githib-Username''/engine''' and go to branch "mkj". Click on the '''pull request''' button. This will notify the person monitoring the JeffersonLab repository and your changes can be pulled in.
 +
*** To have access to the changes in the JeffersonLab GitHub repository, in your newly created engine directory
 +
**** One time need to execute the command: '''git remote add upstream --track mkj git@github.com:JeffersonLab/engine'''
 +
**** The command '''git fetch upstream/mkj''' will fetch changes
 +
**** The command '''git merge upstream/mkj''' will merge any changes fetched into your working files
 
* Use the ENGINE code:
 
* Use the ENGINE code:
 
** go to engine subdirectory
 
** go to engine subdirectory
Line 13: Line 26:
  
 
=== Get the ENGINE replay files directory ===
 
=== Get the ENGINE replay files directory ===
*The ENGINE replay files have been put in a [https://github.com/JeffersonLab/replay github repository]. To get the code follow the same [https://hallcweb.jlab.org/wiki/index.php/ROOT_Analyzer/Git#Retrieving_the_Hall_C_analyzer_with_git directions] used to get hcana, but replace "hcana" with "replay". When setting up the "upstream" remote, leave off the "--track develop" argument.
+
*The ENGINE replay files have been put in a [https://github.com/JeffersonLab/replay github repository].  
*In the "analysis" directory extract the replay files: "git clone git@github.com:GitHub-Username/replay.git" . This creates the subdirectory replay.
+
** To checkout and contribute using github ( assume you have account):
 +
*** Once you have signed into github then go to [https://github.com/JeffersonLab/replay https://github.com/JeffersonLab/replay].
 +
**** Select '''Watch''' to be notified of changes to the repo and the click on the '''Fork''' button to create your own Github copy of the repo.
 +
*** On the computer that you want to do the replay
 +
**** In the "analysis" directory type: '''git clone git@github.com:''Githib-Username''/replay.git''' where ''Githib-Username'' is your github username.
 +
**** This creates the subdirectory replay.
 +
**** Now "origin" remote is to your personal Github repository. After cloning you will be in the "master" branch.
 +
***  Make your local changes and commit them to your local copy.  You can update the github repository by command: '''git push origin master''' . If you want to have these changes incorporated into the JeffersonLab repository then go to your github account ''' ''Githib-Username''/replay'''. Click on the '''pull request''' button. This will notify the person monitoring the JeffersonLab repository and your changes can be pulled in.
 +
*** To have access to the changes in the JeffersonLab GitHub repository, in your newly created engine directory
 +
**** One time need to execute the command: '''git remote add upstream git@github.com:JeffersonLab/replay'''
 +
**** The command '''git fetch upstream''' will fetch changes
 +
**** The command '''git merge upstream''' will merge any changes fetched into your working files
  
 
=== Updates to the "mkj" branch of ENGINE ===
 
=== Updates to the "mkj" branch of ENGINE ===
Line 49: Line 73:
 
== Getting data from the MSS ==  
 
== Getting data from the MSS ==  
 
*Most of examples are for run 52949 which might already be on the cache disk since people are using the file.
 
*Most of examples are for run 52949 which might already be on the cache disk since people are using the file.
*For detailed instructions see new [https://wiki.jlab.org/cc/external/wiki/index.php/New_jcache jcache commands])
+
*For detailed instructions see new [https://scicomp.jlab.org/docs/%20 jcache commands])
*An example is : jcache submit default /mss/hallc/daq04/raw/daq04_52949.log.0
+
*An example is : jcache get /mss/hallc/daq04/raw/daq04_52949.log.0
  
 
== Replaying a run with the ENGINE ==
 
== Replaying a run with the ENGINE ==
Line 73: Line 97:
 
** Create symbolic link: " ln -sf ../replay/MAPS ."
 
** Create symbolic link: " ln -sf ../replay/MAPS ."
 
** Create symbolic link: " ln -sf ../replay/PARAM ."
 
** Create symbolic link: " ln -sf ../replay/PARAM ."
 +
**For raster decoding, we had to modify the ENGINE type map files by adding a new detector ID and a plane ID.
 +
*** For replaying jan05 data, a new map file "july04_hcana.map" and new database file "jan05.database" have been created and the hcana macros call "jan05.database"
 +
*** In general to replay with other "replay" directories
 +
**** Use the script "/Macros/mapedit_rasterbcm.pl" to convert ENGINE type map files to this modified type.
 +
**** So as to not interfere in the engine replay directory, create a new  map as e.g. "cp MAPS/july04.map july04_hcana.map"
 +
**** Copy the database file that you use for the engine replay and edit it to use the new map file.
 
* Replay a run  
 
* Replay a run  
 
**cd to the hcana_replay.  
 
**cd to the hcana_replay.  
Line 93: Line 123:
 
*For hodoscope comparing focal plane times and start time on per event basis: ".x Macros/comp_hms_hodo_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")"
 
*For hodoscope comparing focal plane times and start time on per event basis: ".x Macros/comp_hms_hodo_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")"
 
**[https://hallcweb.jlab.org/wiki/images/3/39/Fptimes-52949.png plot of focal plane times] for all HMS triggers.
 
**[https://hallcweb.jlab.org/wiki/images/3/39/Fptimes-52949.png plot of focal plane times] for all HMS triggers.
**[https://hallcweb.jlab.org/wiki/images/8/84/Fptimes-diff-52949.png plot of difference between ENGINE and HCANA focal plane times. All within 1x10-5.
+
**[https://hallcweb.jlab.org/wiki/images/8/84/Fptimes-diff-52949.png plot] of difference between ENGINE and HCANA focal plane times. All within 1x10-5.
**[https://hallcweb.jlab.org/wiki/images/3/34/Start-times.png plots of start time (top plot) and difference (bottom)  between ENGINE and HCANA start times. All within 1x10-5.
+
**[https://hallcweb.jlab.org/wiki/images/3/34/Start-times.png plots] of start time (top plot) and difference (bottom)  between ENGINE and HCANA start times. All within 1x10-5.
 
*For calorimeter ADC hit map:".x Macros/plot_shower_adc.C(52949)".  
 
*For calorimeter ADC hit map:".x Macros/plot_shower_adc.C(52949)".  
 
**[https://hallcweb.jlab.org/wiki/index.php/Image:Calo_adcmap_52949.png Adc hit map]
 
**[https://hallcweb.jlab.org/wiki/index.php/Image:Calo_adcmap_52949.png Adc hit map]
Line 120: Line 150:
 
***.L Macros/analyze_hcana_tree.C
 
***.L Macros/analyze_hcana_tree.C
 
***.L Macros/analyze_engine_tree.C
 
***.L Macros/analyze_engine_tree.C
***.x Macros/comp_hms_hcana_engine.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")
+
***.x Macros/comp_hms_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")
 
***  You will get the comparison plots shown below.
 
***  You will get the comparison plots shown below.
**You can modify comp_hms_hcana_engine.C to print out track information.  For example:
+
**You can modify comp_hms_engine_hcana.C to print out track information.  For example:
 
  hcana event number = 1038 event type = 1
 
  hcana event number = 1038 event type = 1
 
  Number of Total hits  = 22
 
  Number of Total hits  = 22
Line 153: Line 183:
 
** Table of number of events passing the difference cut for each track number with the ratio to the total number of events in last 4 columns.
 
** Table of number of events passing the difference cut for each track number with the ratio to the total number of events in last 4 columns.
 
  Track      cut        XP        YP          X          Y
 
  Track      cut        XP        YP          X          Y
   1  1.0000e-02       79741       79741       79650       79716 1.0000 1.0000 0.9989 0.9997
+
   1  1.0000e-04       79726       79736       79722       79718 0.9998 0.9999 0.9998 0.9997
  1  1.0000e-03      79679      79728      78612      79349 0.9992 0.9998 0.9858 0.9951
+
   1  1.0000e-05      79704       79719       22415       21652 0.9995 0.9997 0.2811 0.2715
  1  1.0000e-04      79605      79690      71009      73462 0.9983 0.9994 0.8905 0.9213
+
   1  1.0000e-06      71066       71935       2293       2312 0.8912 0.9021 0.0288 0.0290
   1  1.0000e-05      74300       77640       15871       16228 0.9318 0.9737 0.1990 0.2035
+
   1  1.0000e-07        9519       9917         240         210 0.1194 0.1244 0.0030 0.0026
   1  1.0000e-06      51821       55081       1644       1745 0.6499 0.6907 0.0206 0.0219
+
   2  1.0000e-04       7653       7655        7652       7651 0.9997 1.0000 0.9996 0.9995
   1  1.0000e-07        6777       7246         179         165 0.0850 0.0909 0.0022 0.0021
+
   2  1.0000e-05        7650       7651       2168       1967 0.9993 0.9995 0.2832 0.2570
   2  1.0000e-02       7655       7655        7648       7649 1.0000 1.0000 0.9991 0.9992
+
   2  1.0000e-06        6896       6818         254         192 0.9008 0.8907 0.0332 0.0251
  2  1.0000e-03        7648        7654        7533        7609 0.9991 0.9999 0.9841 0.9940
+
   2  1.0000e-07        898         895         29         20 0.1173 0.1169 0.0038 0.0026
  2  1.0000e-04        7641        7649        6752        6932 0.9982 0.9992 0.8820 0.9056
+
   3  1.0000e-04         328        328        328        328 1.0000 1.0000 1.0000 1.0000
   2  1.0000e-05        7089       7417       1479       1416 0.9261 0.9689 0.1932 0.1850
+
   3  1.0000e-05         328        328         95          87 1.0000 1.0000 0.2896 0.2652
   2  1.0000e-06        4914       5070         164         137 0.6419 0.6623 0.0214 0.0179
+
   3  1.0000e-06         296         303         12           9 0.9024 0.9238 0.0366 0.0274
   2  1.0000e-07        633         660         16         11 0.0827 0.0862 0.0021 0.0014
+
   3  1.0000e-07          30         44           2           1 0.0915 0.1341 0.0061 0.0030
   3  1.0000e-02         328        328        328        328 1.0000 1.0000 1.0000 1.0000
 
   3  1.0000e-03         328        328         319        323 1.0000 1.0000 0.9726 0.9848
 
   3  1.0000e-04         327         328        282        300 0.9970 1.0000 0.8598 0.9146
 
  3  1.0000e-05        294        316         61          52 0.8963 0.9634 0.1860 0.1585
 
  3  1.0000e-06        205        208           6          7 0.6250 0.6341 0.0183 0.0213
 
   3  1.0000e-07          17         20           1           1 0.0518 0.0610 0.0030 0.0030
 
  
* The algorithm for calculating the hodoscope start time is different between and this is causing part of the difference in focal quantities. If the start time is fixed to a constant value in both codes then the disagreement is less as can be seen in the table.
+
 
   Track      cut         XP        YP          X          Y
+
== Compare HCANA to ENGINE for Golden track ==
   1  1.0000e-02      79748      79748      79735      79740 1.0000 1.0000 0.9998 0.9999
+
===Replay the data ===
   1  1.0000e-03      79732      79745      79695      79722 0.9998 1.0000 0.9993 0.9997
+
*Replay the data with HCANA
   1  1.0000e-04      79702      79728      79690      79698 0.9994 0.9997 0.9993 0.9994
+
** Go to your hcana_replay directory and check that run 52949 is on the cache disk.
   1  1.0000e-05      79692      79715      23364      21295 0.9993 0.9996 0.2930 0.2670
+
** If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
   2  1.0000e-02        7662        7662        7661        7661 1.0000 1.0000 0.9999 0.9999
+
** Type "hcana" and get the prompt:"analyzer [0]"
   2  1.0000e-03        7661        7661        7661        7661 0.9999 0.9999 0.9999 0.9999
+
** type "  .x replay_both.C(52949,1,100000)" to replay up to CODA event ID number =100,000
   2  1.0000e-04        7661        7661        7658        7658 0.9999 0.9999 0.9995 0.9995
+
* Replay the data with ENGINE:
   2  1.0000e-05        7660        7661        2232        1958 0.9997 0.9999 0.2913 0.2555
+
** cd to the replay subdirectory in your "analysis" directory
   3  1.0000e-02        332        332        332        332 1.0000 1.0000 1.0000 1.0000
+
** Type " replay_inter grun=52949 gstop=100000" to replay up to CODA event ID number =100,000
   3  1.0000e-03        332        332        332        332 1.0000 1.0000 1.0000 1.0000
+
** Should create ntuple file paw/hms_dc_52949.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
   3  1.0000e-04        332        332        332        332 1.0000 1.0000 1.0000 1.0000
+
** To make comparison to HCANA replay, convert the hbook file to root file using h2root. Type "h2root ./paw/hms_dc_52949.rzdat ./paw/hms_dc_52949.root"
   3  1.0000e-05        332        332         91         86 1.0000 1.0000 0.2741 0.2590
+
===Macro to compare===
 +
*Compare HCANA and ENGINE:
 +
**Go to your hcana_replay directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
 +
**Type "root"
 +
***.L Macros/analyze_hcana_tree.C
 +
***.L Macros/analyze_engine_tree.C
 +
***.X Macros/comp_goldtrack_engine_hcana.C("./Rootfiles/replay_both_52949.root","../replay/paw/hms_dc_52949.root")
 +
*  You will get the comparison plots shown below.
 +
=== Comparison plots ===
 +
*Golden track parameters [https://hallcweb.jlab.org/wiki/images/6/68/GoldenTrackCord.png parameters]
 +
*Golden track number and chi2/ndf [https://hallcweb.jlab.org/wiki/images/6/68/GoldenTrack.png Delta, momentum, index and chi2/ndf]
 +
*Differences fo Golden track parameters [https://hallcweb.jlab.org/wiki/images/6/68/GoldenTrackDifferences.png Delta, momentum, index and chi2/ndf]
 +
 
 +
== ==
 +
 
 +
== Compare HCANA to ENGINE for SOS drift chambers ==
 +
===Replay the data ===
 +
*Replay the data with HCANA
 +
** Go to your hcana_replay directory and check that run 52949 is on the cache disk.
 +
** If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
 +
** Type "hcana" and get the prompt:"analyzer [0]"
 +
** type "  .x replay_both.C(52949,1,100000)" to replay up to CODA event ID number =100,000
 +
* Replay the data with ENGINE:
 +
** cd to the replay subdirectory in your "analysis" directory
 +
** Type " replay_inter grun=52949 gstop=100000" to replay up to CODA event ID number =100,000
 +
** Should create ntuple file paw/hms_dc_52949.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
 +
** To make comparison to HCANA replay, convert the hbook file to root file using h2root.
 +
===Macro to compare===
 +
*Compare HCANA and ENGINE:
 +
**Go to your hcana_replay directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
 +
**Type "root"
 +
***.L Macros/analyze_hcana_tree.C
 +
***.L Macros/analyze_engine_tree.C
 +
***.x Macros/comp_sos_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")
 +
***  You will get the comparison plots shown below.
 +
=== Comparison plots ===
 +
*Focal plane position and angles for events with number of tracks greater than or equal to one. The plots are 6 histograms: the top plots are X and Y ( or Xp amd Yp (mr)) with results from HCANA (black) plotted are top of ENGINE results (red), the middle plots are the difference between the top histograms, and the bottom plots are for each event the difference between the HCANA and the ENGINE with the scale of +\- 0.0001 . For the bottom plots of the angles the difference is in radians not mr.
 +
**For the 1st track [https://hallcweb.jlab.org/wiki/images/7/7e/Sos-pos-1-52949.png Positions], [https://hallcweb.jlab.org/wiki/images/9/93/Sos-ang-1-52949.png Angles]
 +
**For the 2nd track [https://hallcweb.jlab.org/wiki/images/f/fa/Sos-pos-2-52949.png Positions], [https://hallcweb.jlab.org/wiki/images/f/fe/Sos-ang-2-52949.png Angles]
 +
**For the 3rd track [https://hallcweb.jlab.org/wiki/images/a/a2/Sos-pos-3-52949.png Positions], [https://hallcweb.jlab.org/wiki/images/6/6f/Sos-ang-3-52949.png Angles]
 +
** Table of number of events passing the difference cut for each track number with the ratio to the total number of events in last 4 columns.
 +
Track   cut             XP        YP          X          Y
 +
   1  1.0000e-04        9732        9734        9733        9732 0.9998 1.0000 0.9999 0.9998
 +
   1  1.0000e-05        9731        9731        9723        9720 0.9997 0.9997 0.9989 0.9986
 +
   1  1.0000e-06        9731        9731        4253        7348 0.9997 0.9997 0.4369 0.7549
 +
   1  1.0000e-07        9544        9613        362        988 0.9805 0.9876 0.0372 0.1015
 +
   2  1.0000e-04        254        255        255        254 0.9961 1.0000 1.0000 0.9961
 +
   2  1.0000e-05        254        254        254        254 0.9961 0.9961 0.9961 0.9961
 +
   2  1.0000e-06        254        254        149        172 0.9961 0.9961 0.5843 0.6745
 +
   2  1.0000e-07        250        249          16          24 0.9804 0.9765 0.0627 0.0941
 +
   3  1.0000e-04          57          57          57          57 1.0000 1.0000 1.0000 1.0000
 +
   3  1.0000e-05          57          57          57          57 1.0000 1.0000 1.0000 1.0000
 +
   3  1.0000e-06          57          57          26          43 1.0000 1.0000 0.4561 0.7544
 +
   3  1.0000e-07         57         55          2          5 1.0000 0.9649 0.0351 0.0877
 +
 
 +
== Compare HCANA to ENGINE for raster ==
 +
Before you begin, make sure the interested run is in the cache directory. e.g. run 52947.
 +
===Replay the data ===
 +
*Replay using ENGINE
 +
**Go to the "replay" sub-directory in your "analysis" directory.
 +
**Type " replay_inter grun=52947 gstop=100000" to replay up to CODA event ID number =100,000
 +
**Should create ntuple file paw/hms_dc_52947.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
 +
**To make comparison to HCANA replay, convert the hbook file to root file using "h2root paw/hms_dc_52947.rzdat paw/hms_dc_52947.root".
 +
 
 +
*Replay using HCANA
 +
**Go to your "hcana_replay" directory.
 +
**If you have compiled the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
 +
**Type "./hcana" and get the prompt:"analyzer [0]"
 +
**Type " .x replay_both.C(52947,1,100000)" to replay up to CODA event ID number =100,000
 +
 
 +
===Macro to compare===
 +
*To compare ENGINE and HCANA raster signals,
 +
** Go to your "hcana_replay" directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
 +
**Type "root"
 +
***.L Macros/analyze_hcana_tree.C
 +
***.L Macros/analyze_engine_tree.C
 +
***.x Macros/comp_beam_engine_hcana.C("Rootfiles/replay_both_52947.root","paw/hms_dc_52947.root")
 +
***  You will get the comparison plots shown below.
 +
****raster x signals [[https://hallcweb.jlab.org/wiki/images/c/cc/52497_raster_x_signals.png]]
 +
****raster y signals [[https://hallcweb.jlab.org/wiki/images/5/50/52497_raster_y_signals.png]]
  
 
== Hall A Online GUI software ==
 
== Hall A Online GUI software ==
 
* The code and documentation are available at [https://userweb.jlab.org/~moffit/onlineGUI/ this public directory].
 
* The code and documentation are available at [https://userweb.jlab.org/~moffit/onlineGUI/ this public directory].

Latest revision as of 09:19, 26 July 2017

Setting up Fortran Analyzer (ENGINE) and Replay

Get copy of Analyzer and Replay directories

  • The ENGINE code has been put in a github repository.
    • To checkout and contribute using github:
      • Create an account on github.com and following the directions for storing your public ssh key on the site.
        • NOTE: The github instructions ask you to install a program called "xclip" to help upload your public key. This is unnecessary - you can just "click and paste".
      • Once you have signed into github then go to https://github.com/JeffersonLab/engine.
        • Select Watch to be notified of changes to engine repo and the click on the Fork button to create your own Github copy of the repo.
      • On the computer that you want to run the code
        • Create an "analysis" directory for doing the ENGINE replay.
        • In the "analysis" directory type: git clone git@github.com:Githib-Username/engine.git where Githib-Username is your github username.
        • This creates the subdirectory engine.
        • Now "origin" remote is to your personal Github repository. After cloning you will be in the "master" branch. You need to use the "mkj" branch.
      • Always work in the "mkj" branch or in a new branch that uses "mkj" branch as starting point. Make your local changes and commit them to your local copy. You can update the github repository by command: git push origin mkj . If you want to have these changes incorporated into the JeffersonLab repository then go to your github account Githib-Username/engine and go to branch "mkj". Click on the pull request button. This will notify the person monitoring the JeffersonLab repository and your changes can be pulled in.
      • To have access to the changes in the JeffersonLab GitHub repository, in your newly created engine directory
        • One time need to execute the command: git remote add upstream --track mkj git@github.com:JeffersonLab/engine
        • The command git fetch upstream/mkj will fetch changes
        • The command git merge upstream/mkj will merge any changes fetched into your working files
  • Use the ENGINE code:
    • go to engine subdirectory
    • git checkout mkj
    • The "mkj" branch has been updated to work on the JLab CentOS 6.2 machines (ifarm). It will work on the CentOS 5.2 machines (ifarml64) but these are being phased out at JLab. The branch also has modifications to make comparisions to HCANA code. The version of the ENGINE is based on the inclusive data analysis.
    • Type "setup cernlib/2005" to set CERN=/site/cernlib/x86_64_rhel6 , CERN_ROOT=/site/cernlib/x86_64_rhel6/2005, CERN_LEVEL=2005 on CentOS 6 machine.
    • Type "make" in engine subdirectory. This will take some time with lots of WARNINGs and should create the executable Linux/bin/engine-replay ( Linux is a subdirectory of the "analysis" directory).

Get the ENGINE replay files directory

  • The ENGINE replay files have been put in a github repository.
    • To checkout and contribute using github ( assume you have account):
      • Once you have signed into github then go to https://github.com/JeffersonLab/replay.
        • Select Watch to be notified of changes to the repo and the click on the Fork button to create your own Github copy of the repo.
      • On the computer that you want to do the replay
        • In the "analysis" directory type: git clone git@github.com:Githib-Username/replay.git where Githib-Username is your github username.
        • This creates the subdirectory replay.
        • Now "origin" remote is to your personal Github repository. After cloning you will be in the "master" branch.
      • Make your local changes and commit them to your local copy. You can update the github repository by command: git push origin master . If you want to have these changes incorporated into the JeffersonLab repository then go to your github account Githib-Username/replay. Click on the pull request button. This will notify the person monitoring the JeffersonLab repository and your changes can be pulled in.
      • To have access to the changes in the JeffersonLab GitHub repository, in your newly created engine directory
        • One time need to execute the command: git remote add upstream git@github.com:JeffersonLab/replay
        • The command git fetch upstream will fetch changes
        • The command git merge upstream will merge any changes fetched into your working files

Updates to the "mkj" branch of ENGINE

  • Add SOS Drift chamber variables to h_dc_ntuple .
    • Move call h_dc_ntuple_keep to g_keep_results so that it is called for all event types
    • Update h_dc_ntuple_keep
      • put SOS DC variables into ntuple
      • have HMS variables start with hdc
      • hardwire to only write out SOS events (evtype =2)
    • Update h_dc_ntuple_open
      • have HMS variables start with hdc
      • add SOS DC variables under SDCINFO common block
      • add iquest(10)=65000 to allow larger ntuple file size
    • In h_keep_results : remove call h_dc_ntuple_keep
    • In gen_pawspace.cmn increase size of G_sizeHBOOK to 8000000
    • Update h_dc_ntuple.cmn
      • have HMS variables start with hdc
      • add SOS DC variables under SDCINFO common block
  • In HTRACKING/h_targ_trans.f : Set hut(5) = 0.0 to match HCANA until beam is put into HCANA. Skip the COSY sums part that is explicitly for Jan05 analysis.
  • In HTRACKING/h_sp_multiwire.f : Put in an "if" statement to skip the reordering of the space point hits to match what is done in HCANA. Has no effect on results.
  • Add parameter hdc_fix_propcorr. When a hit gets put into a stub, the distance of the hit from the discriminator can then be estimated. In the engine, a correction to the drift time (and thus drift distance) is applied. However, if that hit ends up in another stub, the correction will get applied again, resulting in a over correction. Setting this flag to 1 will give that hit a different correction for each stub that it is in.
  • Add parameter hdc_fix_lr. Historically, in the ENGINE, if a hit is used in multiple space points/stubs, the left/right assignment for that hit, which is later used in track fitting, is that assigned for the last stub encountered with that hit. Properly, the left right assignment should be allowed to be different in different space points. If this parameter is set to zero, then the original ENGINE behavior is used. For new analyses, it should be set to one.
  • Modified "gstart" and "gstop" parameters to refer to the CODA event ID number. Makes it easier to compare to HCANA when HCANA is replayed with analyzer->SetCountMode( 2 ) so that it is counting based on the CODA event ID number.
  • Created column-wise ntuple with the name defined by parameter h_dc_ntuple_file .
    • In ENGINE added code h_dc_ntuple_clear.f, h_dc_ntuple_init.f, h_dc_ntuple_keep.f, h_dc_ntuple_register.f, h_dc_ntuple_shutdown.f,h_dc_ntuple_close.f,h_dc_ntuple_open.f, h_dc_ntuple_change.f .
    • In INCLUDE added h_dc_ntuple.cmn, h_dc_ntuple.dte
    • In ENGINE modified Makefile.Unix, g_ntuple_init.f, g_ntuple_shutdown.f, h_keep_results.f, h_register_variables.f
    • To add varaibles to the ntuple:
      • In INCLUDE/h_dc_ntuple.cmn, one defines the common blocks and variables that will be included in the ntuple.
      • In ENGINE/h_dc_ntuple_open.f, one makes the call HBNAME for each common block.
      • In ENGINE/h_dc_ntuple_keep.f, fill the variables.
      • Presently there are variables for HMS tracking.

Getting data from the MSS

  • Most of examples are for run 52949 which might already be on the cache disk since people are using the file.
  • For detailed instructions see new jcache commands)
  • An example is : jcache get /mss/hallc/daq04/raw/daq04_52949.log.0

Replaying a run with the ENGINE

  • Need to have run number 52949 from daq04 experiments on the cache.
  • cd to the replay subdirectory in your "analysis" directory
  • Type " replay_inter grun=52949 gstop=10000 gtrig2=1 gtrig3=0 gtrig4=1"
    • This will replay up to event number =10000 and analyze only HMS and COIN event types and create the hbook file ( paw/52949.hbook) and a paw kumac which has the aliases for the histograms ( paw/52949.kumac ).
    • gtrig2=1 (or 0) means analyze (or do not analyze) HMS trigger (event type 1)
    • gtrig3=1 (or 0) means analyze (or do not analyze) SOS trigger (event type 2)
    • gtrig4=1 (or 0) means analyze (or do not analyze) COIN trigger (event type 3)
  • To make comparison to HCANA replay, convert the hbook file to root file using h2root.

Replaying a run with the HCANA

  • Need to have run number 52949 from daq04 experiments on the cache.
  • Assumes that one has checked out the hcana repository and has compile the hcana code.
  • Mark Jones created a separate hcana replay directory from the normal hcana/examples subdirectory.
  • The hcana replay files have been put in a github repository. To get the code follow the same directions used to get hcana, but replace "hcana" with "hcana_replay". When setting up the "upstream" remote, leave off the "--track develop" argument.
  • In the "analysis" directory :
    • extract the hcana replay files: "git clone git@github.com:GitHub-Username/hcana_replay.git". This creates the subdirectory replay.
    • Create symbolic link: " ln -sf ../replay/DBASE ."
    • Create symbolic link: " ln -sf ../replay/DATFILES ."
    • Create symbolic link: " ln -sf ../replay/MAPS ."
    • Create symbolic link: " ln -sf ../replay/PARAM ."
    • For raster decoding, we had to modify the ENGINE type map files by adding a new detector ID and a plane ID.
      • For replaying jan05 data, a new map file "july04_hcana.map" and new database file "jan05.database" have been created and the hcana macros call "jan05.database"
      • In general to replay with other "replay" directories
        • Use the script "/Macros/mapedit_rasterbcm.pl" to convert ENGINE type map files to this modified type.
        • So as to not interfere in the engine replay directory, create a new map as e.g. "cp MAPS/july04.map july04_hcana.map"
        • Copy the database file that you use for the engine replay and edit it to use the new map file.
  • Replay a run
    • cd to the hcana_replay.
    • If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
    • Type "hcana" and get the prompt:"analyzer [0]"
    • To analyze, Type ".x replay_both.C(52949,1,100000)" at the prompt. Creates the file replay_both_52949.root in the Rootfiles directory.

Compare HCANA to ENGINE for HMS hodoscope and shower

  • The root macros assume that the ENGINE root file is in the paw directory that is a subdirectory.
    • Type" ln -sf ../replay/paw paw" to create this subdirectory.
    • Then one can do : "h2root paw/52949.hbook paw/52949.root".
    • Type "root" in the hcana_replay directory
  • All plots show the ENGINE (red line) plotted over the HCANA (blue line) in one column. If perfect then just see red line. In other column is the difference between the ENGINE and the HCANA plot. If perfect then zero counts in the histogram.
  • For hodoscope ADC hit map:".x Macros/plot_hodo_adc.C(52949)".
  • For hodoscope TDC hit map:".x Macros/plot_hodo_tdc.C(52949)".
  • For hodoscope focal plane time:".x Macros/plot_fptime.C(52949)"
  • For hodoscope comparing focal plane times and start time on per event basis: ".x Macros/comp_hms_hodo_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")"
    • plot of focal plane times for all HMS triggers.
    • plot of difference between ENGINE and HCANA focal plane times. All within 1x10-5.
    • plots of start time (top plot) and difference (bottom) between ENGINE and HCANA start times. All within 1x10-5.
  • For calorimeter ADC hit map:".x Macros/plot_shower_adc.C(52949)".
  • For calorimeter individial ADCs :".x Macros/plot_shower_ind_adc.C(52949)".

Compare HCANA to ENGINE for HMS drift chambers

Replay the data

  • Replay the data with HCANA
    • Go to your hcana_replay directory and check that run 52949 is on the cache disk.
    • If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
    • Type "hcana" and get the prompt:"analyzer [0]"
    • type " .x replay_both.C(52949,1,100000)" to replay up to CODA event ID number =100,000
  • Replay the data with ENGINE:
    • cd to the replay subdirectory in your "analysis" directory
    • Type " replay_inter grun=52949 gstop=100000" to replay up to CODA event ID number =100,000
    • Should create ntuple file paw/hms_dc_52949.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
    • To make comparison to HCANA replay, convert the hbook file to root file using h2root.

Macro to compare

  • Compare HCANA and ENGINE:
    • Go to your hcana_replay directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
    • Type "root"
      • .L Macros/analyze_hcana_tree.C
      • .L Macros/analyze_engine_tree.C
      • .x Macros/comp_hms_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")
      • You will get the comparison plots shown below.
    • You can modify comp_hms_engine_hcana.C to print out track information. For example:
hcana event number = 1038 event type = 1
Number of Total hits  = 22
Number of Tracks  = 2
Track focal plane  x (cm)    y (cm)    dx/dz     dy/dz
   1              -20.3977    7.8901  -0.029469  0.012129
   2              -20.3970    7.7412  -0.029492  0.016835
Print track focal plane is not sorted by chi-squared
Track target        y (cm)   dx/dz     dy/dz       delta      chi2
  1                -0.778     0.023   -0.01325    -4.86606   67.85777
  2                 1.523     0.021   -0.02869    -4.88804   256.37274
Print track target info sorted by chi-squared
Engine event number = 1038 event type = 1
Number of Tracks  = 2
Track focal plane  x (cm)    y (cm)    dx/dz     dy/dz
   1              -20.4031    7.7859  -0.029295  0.015258
   2              -20.4029    7.7468  -0.029301  0.016664
Print track focal plane is not sorted by chi-squared
Track target        y (cm)   dx/dz     dy/dz       delta      chi2
  1                 1.433     0.021   -0.02821    -4.90070   248.31000
  2                 0.719     0.021   -0.02392    -4.89441   517.14258
Print track target info sorted by chi-squared
Hit return to see next event

Comparison plots

  • Focal plane position and angles for events with number of tracks greater than or equal to one. The plots are 6 histograms: the top plots are X and Y ( or Xp amd Yp (mr)) with results from HCANA (black) plotted are top of ENGINE results (red), the middle plots are the difference between the top histograms, and the bottom plots are for each event the difference between the HCANA and the ENGINE with the scale of +\- 0.0001 . For the bottom plots of the angles the difference is in radians not mr.
    • For the 1st track Positions, Angles
    • For the 2nd track Positions, Angles
    • For the 3rd track Positions, Angles
    • Table of number of events passing the difference cut for each track number with the ratio to the total number of events in last 4 columns.
Track       cut         XP         YP          X          Y
 1   1.0000e-04       79726       79736       79722       79718 0.9998 0.9999 0.9998 0.9997
 1   1.0000e-05       79704       79719       22415       21652 0.9995 0.9997 0.2811 0.2715
 1   1.0000e-06       71066       71935        2293        2312 0.8912 0.9021 0.0288 0.0290
 1   1.0000e-07        9519        9917         240         210 0.1194 0.1244 0.0030 0.0026
 2   1.0000e-04        7653        7655        7652        7651 0.9997 1.0000 0.9996 0.9995
 2   1.0000e-05        7650        7651        2168        1967 0.9993 0.9995 0.2832 0.2570
 2   1.0000e-06        6896        6818         254         192 0.9008 0.8907 0.0332 0.0251
 2   1.0000e-07         898         895          29          20 0.1173 0.1169 0.0038 0.0026
 3   1.0000e-04         328         328         328         328 1.0000 1.0000 1.0000 1.0000
 3   1.0000e-05         328         328          95          87 1.0000 1.0000 0.2896 0.2652
 3   1.0000e-06         296         303          12           9 0.9024 0.9238 0.0366 0.0274
 3   1.0000e-07          30          44           2           1 0.0915 0.1341 0.0061 0.0030


Compare HCANA to ENGINE for Golden track

Replay the data

  • Replay the data with HCANA
    • Go to your hcana_replay directory and check that run 52949 is on the cache disk.
    • If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
    • Type "hcana" and get the prompt:"analyzer [0]"
    • type " .x replay_both.C(52949,1,100000)" to replay up to CODA event ID number =100,000
  • Replay the data with ENGINE:
    • cd to the replay subdirectory in your "analysis" directory
    • Type " replay_inter grun=52949 gstop=100000" to replay up to CODA event ID number =100,000
    • Should create ntuple file paw/hms_dc_52949.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
    • To make comparison to HCANA replay, convert the hbook file to root file using h2root. Type "h2root ./paw/hms_dc_52949.rzdat ./paw/hms_dc_52949.root"

Macro to compare

  • Compare HCANA and ENGINE:
    • Go to your hcana_replay directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
    • Type "root"
      • .L Macros/analyze_hcana_tree.C
      • .L Macros/analyze_engine_tree.C
      • .X Macros/comp_goldtrack_engine_hcana.C("./Rootfiles/replay_both_52949.root","../replay/paw/hms_dc_52949.root")
  • You will get the comparison plots shown below.

Comparison plots

Compare HCANA to ENGINE for SOS drift chambers

Replay the data

  • Replay the data with HCANA
    • Go to your hcana_replay directory and check that run 52949 is on the cache disk.
    • If you have compile the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
    • Type "hcana" and get the prompt:"analyzer [0]"
    • type " .x replay_both.C(52949,1,100000)" to replay up to CODA event ID number =100,000
  • Replay the data with ENGINE:
    • cd to the replay subdirectory in your "analysis" directory
    • Type " replay_inter grun=52949 gstop=100000" to replay up to CODA event ID number =100,000
    • Should create ntuple file paw/hms_dc_52949.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
    • To make comparison to HCANA replay, convert the hbook file to root file using h2root.

Macro to compare

  • Compare HCANA and ENGINE:
    • Go to your hcana_replay directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
    • Type "root"
      • .L Macros/analyze_hcana_tree.C
      • .L Macros/analyze_engine_tree.C
      • .x Macros/comp_sos_engine_hcana.C("Rootfiles/replay_both_52949.root","paw/hms_dc_52949.root")
      • You will get the comparison plots shown below.

Comparison plots

  • Focal plane position and angles for events with number of tracks greater than or equal to one. The plots are 6 histograms: the top plots are X and Y ( or Xp amd Yp (mr)) with results from HCANA (black) plotted are top of ENGINE results (red), the middle plots are the difference between the top histograms, and the bottom plots are for each event the difference between the HCANA and the ENGINE with the scale of +\- 0.0001 . For the bottom plots of the angles the difference is in radians not mr.
    • For the 1st track Positions, Angles
    • For the 2nd track Positions, Angles
    • For the 3rd track Positions, Angles
    • Table of number of events passing the difference cut for each track number with the ratio to the total number of events in last 4 columns.
Track   cut             XP         YP          X          Y
 1   1.0000e-04        9732        9734        9733        9732 0.9998 1.0000 0.9999 0.9998
 1   1.0000e-05        9731        9731        9723        9720 0.9997 0.9997 0.9989 0.9986
 1   1.0000e-06        9731        9731        4253        7348 0.9997 0.9997 0.4369 0.7549
 1   1.0000e-07        9544        9613         362         988 0.9805 0.9876 0.0372 0.1015
 2   1.0000e-04         254         255         255         254 0.9961 1.0000 1.0000 0.9961
 2   1.0000e-05         254         254         254         254 0.9961 0.9961 0.9961 0.9961
 2   1.0000e-06         254         254         149         172 0.9961 0.9961 0.5843 0.6745
 2   1.0000e-07         250         249          16          24 0.9804 0.9765 0.0627 0.0941
 3   1.0000e-04          57          57          57          57 1.0000 1.0000 1.0000 1.0000
 3   1.0000e-05          57          57          57          57 1.0000 1.0000 1.0000 1.0000
 3   1.0000e-06          57          57          26          43 1.0000 1.0000 0.4561 0.7544
 3   1.0000e-07          57          55           2           5 1.0000 0.9649 0.0351 0.0877

Compare HCANA to ENGINE for raster

Before you begin, make sure the interested run is in the cache directory. e.g. run 52947.

Replay the data

  • Replay using ENGINE
    • Go to the "replay" sub-directory in your "analysis" directory.
    • Type " replay_inter grun=52947 gstop=100000" to replay up to CODA event ID number =100,000
    • Should create ntuple file paw/hms_dc_52947.rzdat . If not then check that h_dc_ntuple variable is set in the PARM_FILES/REPLAY_FARM_COIN.PARM
    • To make comparison to HCANA replay, convert the hbook file to root file using "h2root paw/hms_dc_52947.rzdat paw/hms_dc_52947.root".
  • Replay using HCANA
    • Go to your "hcana_replay" directory.
    • If you have compiled the hcana code then you should have the environment variable HCANALYZER define, then make symbolic link : " ln -sf $HCANALYZER/hcana hcana"
    • Type "./hcana" and get the prompt:"analyzer [0]"
    • Type " .x replay_both.C(52947,1,100000)" to replay up to CODA event ID number =100,000

Macro to compare

  • To compare ENGINE and HCANA raster signals,
    • Go to your "hcana_replay" directory. Assume that you have a softlink to the paw directory to have " ln -sf $SOME_DIR/analysis/replay/paw paw"
    • Type "root"
      • .L Macros/analyze_hcana_tree.C
      • .L Macros/analyze_engine_tree.C
      • .x Macros/comp_beam_engine_hcana.C("Rootfiles/replay_both_52947.root","paw/hms_dc_52947.root")
      • You will get the comparison plots shown below.
        • raster x signals [[1]]
        • raster y signals [[2]]

Hall A Online GUI software