Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
= HMS Monte Carlo physics reweighting framework
= Author: Eric Christy,
= Framework: Eric Pooser,

\ Eric C.'s How-To

To run the code requires the following:

1.  A uniform generation MC ntuple (example c1_30_1.1.rzdat)

2.  A file containing the radiative cross section on a grid in W^2, theta for the beam 
energy of interest.  The code assumes this file is named 


Be sure to link the proper file.

The format is:

 Ebeam, W^2, theta, cross section, radiative correction factor
For inelastic kinematics a grid spacing of 1 degree is usually fine, but for QE and 
resonance kinematics a finer spacing might be required for best results.  I typically 
use a E' spacing corresponding to a bin width in W^2 of 0.04 for a given Ebeam, theta.

3. mc_recon expects to read from an input file called 


This should have the following format:

- input MC ntuple filename (example c1_30_1.1.rzdat)
- number of events to reweight (this can be less than the number in the original rzdat)
- the generation range in X' (this is given as the 1/2 range and assumed to be symmetric, 
  example 100. mrad)
- the generation range in Y'
- maximum generation range in dp/p in %
- minimum generation range in dp/p in %
- option to calculate charge-symmetric background weight factor (0 = no, 1 = yes)
- Option to calculate born cross section from interpolated file (0 = no, 1 = yes)

* Note that the charge-symmetric parametrization must be provided to the code for each 
beam energy and angle.

** Note that the generation limits must be the same as used for generating the original 
MC ntuple.  The code will use this to calculate the generated phasespace for determining 
the MC luminosity.

4.  recon_mc requires a file called


which contains the scaler information on target type, kinematics, beam charge, and 
efficiencies.  This is generated by running a perl script and supplying the run #, eg.

./get_scaler_info.prl 53214


There is a shell script which runs get_scaler_info.prl and then runs the code.  It is called


-> To produce an physics weighted ntuple run the shell script a above.  This should produce 
the following:

1.  weighted MC ntuple called mc"runnumber".rzdat (eg. mc53214.rzdat)
2.  log file called "runnumber".log (eg. 53214.log)

The log file will contain a record of the scalar information, run options, and the MC scale 
factor.  The scale factor must be applied to the events in the reweighted ntuple for proper 
normalization to the data.  


-> There is a paw script called 


which will plot the data versus the MC.  In this file you will find the section for defining 
the run number and scale factor.  It should look like:

** C1 @ 2.3 at 30 deg **

runnum = 53214
mcscale = 0.00188994245

-> The MC events should be weighted by the factor



born:   born cross section
rci:    radiative correction factor (sig_born / sig_rad)
rce:    not used any longer, should be = 1.0
csback: charge-symmetric background factor

A plot of the comparisons will be printed to a postscript file called 


\ Eric P.'s README

This repository is a "container" for the framework to perform the mc-reweighting in
an orgainzed fashion.  The only code in the repository is the source code
which has been customized to work in this particular framework and the paw macro
used to make histograms. 

In order to run the example on the ifarm, you will need to unpack the 
file /u/group/hallc/pooser/mc-reweight-example-data/input.tar.gz in 
the top level directory via. the command:
tar -xvf /u/group/hallc/pooser/mc-reweight-example-data/input.tar.gz 
This will overwrite your current input directory however, it will maintain 
the structure and fill the directories with the input files needed 
to run the example.

Prior to running the example you MUST define the explicit location of the report file gen53214.txt
in the perl script get_scaler_info.prl at line 29.  This should be fixed!

To run the example in place simply do:
cd SRC
cd ../
./ 53214
cd paw/macros
  exec extract_cs.kumac

/ Directroy structure

SRC: contains the source code to build the executable named "mc_recon"

  build with make clean; make
  To rebuild files not included in the Makefile use ./

input: contains the necessary input files to execute the mc-reweighting

  hms-data:    HMS data needed for the calculations, e.g. hms53214.rzdat
  monte-carlo: Uniformly generated MC ntuple produced by single arm MC code, e.g. c1_30_1.1.rzdat
  rad-corr:    Radiative cross section grid, produced by rad-corr code, e.g. rc94_c1_2.3.dat
  recon-mc:    Input data file called by recon_mc.f, e.g. input_c1_30_1.1.dat
  reports:     Report file from hcana contains efficiencies, scalers, etc., e.g. gen53214.txt
  target:      Target input data file, called by recon_mc.f, e.g. targetdata.dat

output: contains the output from recon-mc

  logs:       contains the print out from recon_mc, e.g. 53214.log
  mc-ntuples: contains the mc re-weighted ntuple produced by recon_mc, e.g. mc53214.rzdat

paw: contains the paw specific files 

  input:  contains paw input specific files 
    scalers: contains parsed scaler info from get_scaler_info.prl, e.g.
  macros: contains paw macros, e.g. extract_cs.kumac
  output: contains paw output specific files
    data:   contains output data files created by extract_cs.kumac, e.g. cskin.dat, sigma53214.dat
    plots:  contains plots produced by extract_cs.kumac, e.g.
    tables: contains tables produced by extract_cs.kumac, e.g. nhd.tbl1, nhd.tbl2
  settings: contains paw settings, e.g. pawopts.kumac

get_scaler_info.prl: Perl script that parses report file as needed for mc-reweighting Shell script to execute the mc-reweighting code, usuage: ./ 53214

| General Usage Notes

To execute the paw macro you must have PAW installed and the proper environment setup.  Good luck!
Path of least resistance, do it on the farm...
  On the ifarm do: setup cernlib
  Descend into paw/macros and enter "paw++"
  In the interactive session enter "exec extract_cs.kumac"


Monte-Carlo Physics Re-weighting Code



No releases published


No packages published