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
orcorrection_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.
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.
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.
- Inside the JMECoffea directory:
wget https://raw.githubusercontent.com/CoffeaTeam/lpcjobqueue/main/bootstrap.sh
bash bootstrap.sh
./shell
- Install the repo
- Log into https://coffea.casa/hub/login?next=%2Fhub%2F with your CERN account
- Go to the "Git" menu and select "Clone a repository"
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
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.
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/
.
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/
.
python correction_fitter.py
Or follow correction_fitter.ipynb
.
Follow flavor_fractions_and_uncertainties.ipynb
.