Skip to content

JeffersonLab/mc-reweight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
= HMS Monte Carlo physics reweighting framework
=
= Author: Eric Christy, christy@jlab.org
= Framework: Eric Pooser, pooser@jlab.org
=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

\--\--\--\--\--\--\
\ 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 

"rc94.dat"

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 

"input.data"

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

"reconmc.in"

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

"mc-reweight.sh"

-> 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 

"extract_cs.kumac"

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/rci/rce*csback*[mcscale]

where 

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 

"mccomp53214.ps"

\--\--\--\--\--\--\
\ 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
  make
cd ../
./mc-reweight.sh 53214
cd paw/macros
paw++
  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 ./makemod.sh

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. scalers.in
  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. mccomp53214.ps
    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

mc-reweight.sh: Shell script to execute the mc-reweighting code, usuage: ./mc-reweight.sh 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"

About

Monte-Carlo Physics Re-weighting Code

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages