Analyzer/Comparisons
From HallCWiki
Revision as of 09:56, 11 October 2013 by Jones (talk | contribs) (→Get copy of Analyzer and Replay directories)
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 get the code follow the same directions used to get hcana, but replace "hcana" with "engine"
- Create an "analysis" directory for doing the ENGINE replay.
- In the "analysis" directory extract the ENGINE code: "git clone git@github.com:GitHub-Username/engine.git" . This creates the subdirectory engine.
- 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
- Send email to Mark Jones ( jones@jlab.org) to get permission to access the git repository.
- In the "analysis" directory extract the replay files: "git clone git@hallcgit.jlab.org:jones/replay.git" . This creates the subdirectory replay.
Updates to the "mkj" branch of ENGINE
- 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 submit default /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"
- This will replay 1000 pedestal events and 10000 physics events and create the hbook file ( paw/52949.hbook) and a paw kumac which has the aliases for the histograms ( paw/52949.kumac ).
- 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.
- In the "analysis" directory extract the hcana replay files: "git clone git@hallcgit.jlab.org:jones/hcana_replay.git". This creates the subdirectory replay.
- 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]"
- For hodo and shower analysis. Type ".x compare_hodo.C(52949,11000)" at the prompt. This replays the 1000 pedestal events and then 10000 physics events. Creates the file compare_hodo_52949.root in the Rootfiles directory.
Compare HCANA to ENGINE for 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 HCANA (red line) plotted over the ENGINE (blue line) in one column. If perfect then just see red line. In other column is the difference between the HCANA and the ENGINE 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)"
- Run 52949 plot of focal plane times
- One can see that the difference plot shows that the HCANA and ENGINE do not match perfectly at this point. The reason for the difference is explained in the contribution to the April 16th 2013 software meeting.
- For calorimeter ADC hit map:".x Macros/plot_shower_adc.C(52949)".
- For calorimeter individial ADCs :".x Macros/plot_shower_ind_adc.C(52949)".
- Col A Neg 1-6, Col A Pos 1-6, Col A Neg 7-13, Col A Pos 7-13.
- Col B Neg 1-6, Col B Pos 1-6, Col B Neg 7-13, Col B Pos 7-13.
- need to modify the macro to look at columns C and D.
Compare HCANA to ENGINE for drift chambers
- 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 compare_dc.C(52949,1,100000)" to replay up to CODA event ID number =100,000
- Replay the data with the ENGINE:
- cd to the replay subdirectory in your "analysis" directory
- Type " replay_inter grun=52949 gstop=10000" 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.
- 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/scan_hcana.C
- .L Macros/engine.C
- .x Macros/scan_comp.C("Rootfiles/compare_dc_52949.root","paw/hms_dc_52949.root")
- The code scan_comp.C loops through the root files. Presently it is set to print out track information when TMath::Abs(myhcana->H_dc_yp[0]-myengine->dc_ypfp[0]) >= 0.001 . 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
- Once you scan through the entire run one gets the following histograms:
- For run 52949, made comparison between HCANA and ENGINE for drift chambers.
Hall A Online GUI software
- The code and documentation are available at this public directory.