Skip to content

AndrissP/JMECoffea

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JMECoffea

This code contains a columnar-based calculation of MC jet energy corrections (JEC) and flavor uncertainties, following the perscriptions of arxiv:1607.03663. At the moment, the code (L5_flavour_dep_corr branch) is adapted for the calculation of L5 flavor JEC and L2/L3 correction part is not tested.

The main structure of the code:

  • run_processor.py runs the suplied coffea processor (e.g., CoffeaJERCProcessor_L5.py) and saves the results in .coffea files.
  • fit_response_distributions.py fits the response distributions and stores the results in .txt/.json files.
  • correction_fitter.ipynb or correction_fitter.py reads the response fit results, fits them vs the reco pt and stores JEC as .txt files.
  • flavor_fractions_and_uncertainties.ipynb reads the response histograms, response fits and the flavor corrections and produces flavor uncertainties and relevent plots. Also, it produces the plots of the fractions of each jet flavor in bins of jet pt.
  • plotters/Plotting_comparison.ipynb allows to plot different responses and corrections vs pt or jet_eta.

Set-up

Several set-up options exist depending if you are running on lxplus, lpc or coffea casa. Running on any lxpus or lpc using singularity is possible but not stated here.

Set up coffea on the lxplus with the lcg environment and running using dask on HTCondor:

Load the lcg environment with the relevant packages including coffea

source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/latest/x86_64-centos7-gcc11-opt/setup.sh

Follow the instruction of installing the repo.

Instructions for the LPC (and singularity)

  1. Inside the JMECoffea directory:
wget https://raw.githubusercontent.com/CoffeaTeam/lpcjobqueue/main/bootstrap.sh
bash bootstrap.sh
./shell
  1. Install the repo

Instructions for Coffea Casa

  1. Log into https://coffea.casa/hub/login?next=%2Fhub%2F with your CERN account
  2. Go to the "Git" menu and select "Clone a repository"

Install the repo

Clone the repo

git clone git@github.com:AndrissP/JMECoffea.git

Install the package in the editable state in a virtual environment. Explanation of this is in the stackoverflow page:

python -m venv venv
pip install -e .

Every time logging in, activate the virtual environment and after that load the lcg

. venv/bin/activate
source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/latest/x86_64-centos7-gcc11-opt/setup.sh

ssh port forwarding in to use jupyter notebooks:

To use jupyter notebooks you have to log into lxplus using port forwarding

ssh -L <local_port>:localhost:<remote_port> <username>@lxplus.cern.ch
jupyter notebook --no-browser --port=<remote_port>

e.g

ssh -L 8099:localhost:8095 <username>@lxplus.cern.ch
source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/latest/x86_64-centos7-gcc11-opt/setup.sh
jupyter notebook --no-browser --port=8095

Then copy the link in the output and connect in to your broswer, replacing the remote_port valur with local_port. Here you are mapping the port local_port (e.g 8099) of the localhost (your machine) to the port remote_port (e.g. 8095) of the remote server (lxplus.cern.ch). We assume that the two ports are free and therefore available.

Running the code:

Running the L5 (or L2L3Rel) processors

Run the histogram creation (for testing, change test_run=True under 'Parameters of the run and switches' in run_processor.py)

python run_processor.py

By default it runs the CoffeaJERCProcessor_L5.py. The results are stored in .coffea files in out/.

Fitting and plotting the response distributions

Change the appropriate data_tags over which to run the data in fit_response_distributions.py. Run the fits:

python fit_response_distributions.py

The fit results are stored in .txt files in out_txt/ and plots in fig/.

Fitting respponses and creating output txt files

python correction_fitter.py

Or follow correction_fitter.ipynb.

Fitting the flavor uncertainties

Follow flavor_fractions_and_uncertainties.ipynb.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.2%
  • Other 0.8%