Giter VIP home page Giter VIP logo

multijet-jec-fit's Introduction

Residual jet corrections

This package implements the fit of residual (i.e. pT-dependent) jet corrections, providing an alternative to the standard global fit. It is focused on the measurement in the multijet topology, although it is generic enough to perform a simultaneous fit using inputs from different analyses. Placeholders for Z+jet and γ+jet measurements are provided.

Inputs from the multijet analysis are prepared using the setup in this repository. The computation of the χ2 from this analysis is implemented in class MultijetCrawlingBins. The computation is summarized in this talk.

Build instructions

The code base consists of C++ and Python domains. The former one implements a fast computation of the χ2 to be minimized in the fit, while the Python code provides a convenient interface to the loss function and results of the fit.

Recommended dependencies for the C++ part are as follows:

  • Compiler with support of C++17
  • CMake 3.11
  • Boost 1.69
  • ROOT 6.16

Slightly older versions are likely to be supported. The code of this package is expected to be compliant with C++14 standard.

Requirements for the Python part:

  • Python 3.6
  • ROOT 6.16
  • NumPy 1.14
  • Matplotlib 2.2
  • PyYAML 3.13

All the dependencies are satisfied in environment LCG_95apython3, which can be set up from /cvmfs/ with

. /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_95apython3 x86_64-slc6-gcc8-opt

To build the package, execute

. ./env.sh
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
cd ..

Basic fitting

Residual jet correction can be fit from the multijet analysis alone using program fit:

inputdir="https://aapopov.web.cern.ch/aapopov/jec_inputs"
fit --multijet $inputdir/multijet.root --balance PtBal --output fit.out

Providing flag --balance MPF will run the MPF version of the measurement. The standard two-parameter functional form is used for the correction. The results, including the fitted values for the parameters of the correction, are printed in the standard output and also saved in file fit.out.

The same can be achieved with a Python wrapper:

./fit.py --multijet $inputdir/multijet.root --method PtBal --period 2016BCD --output fit.json

The data-taking period is specified for book-keeping. By default, the standard 2-parameter correction is fitted; to use a spline correction instead, provide flag --corr spline.

The results obtained by fit.py are saved in JSON format, and this is the format expected by other scripts discussed below. Program jq is useful to work with such files. In particular, multiple files with fit results can be merged by running

jq -s '.' fit1.json fit2.json > fits.json

Usually the executable for jq can just be downloaded and put under $PATH; there is no need to build it from source.

Important note: Input files from the multijet analysis typically don't have any upper cut on the pT of the leading jet, but the χ2 in bins of pT of the leading jet becomes unreliable for underpopulated bins. These should be excluded from the fit, which can be done using method MultijetCrawlingBins::SetPtLeadRange. The typical threshold is 1.6 TeV (see here). The corresponding selection is currently hard-coded here for C++ and here for Python.

Diagnostic plots

Several scripts to produce diagnostic plots are provided. Fitted jet corrections and pre- and post-fit residuals can be plotted with

plot_correction.py fits.json --period 2016BCD --method PtBal -o fig/corr.pdf
multijet_residuals.py $inputdir/multijet.root fits.json \
    --period 2016BCD --method PtBal -o fig/residuals.pdf

Here fits.json is a file with fit results produced as described above and flags --period and --method are used to identify a specific set of results within the file (and also for labels in the plots). Running

plot_parameters.py fits.json

generates plots with post-fit values of parameters of interest and nuisances.

Finally, 1D and 2D scans of the χ2 for the standard 2-parameter correction can be produced with

scan_chi2.py --multijet $inputdir/multijet.root 
    --period 2016BCD --method PtBal -o fig/scans/

The χ2 is minimized with respect to all nuisance parameters. Unlike all the scripts above, running the scans takes a good portion of an hour.

multijet-jec-fit's People

Contributors

andrey-popov avatar kirschen avatar lattaud avatar sordini avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

multijet-jec-fit's Issues

In binned sum, incorporate division by ptLead

In the binned sum method, incorporate the division by pT(1) (as here) into the PtJetSumProj histogram. This way the degradation of the precision due to the finite binning in pT will only affect the balance observable through the L3Res correction but not the denominator. Eventually, this might allow using a coarser binning.

Store jet pt treshold in input γ+jet files

At the moment the jet pT threshold used in the binned-sum γ+jet analysis is hard-coded in the code. It should better be stored in input files (as it is frozen by the definition of the balance observable used for simulation) and then read in a way similar to what is done for multijet.

@sordini, this would require a change in the format of input files.

Add Python wrapper

Add a Python wrapper for the library. A summary of possible approaches is available in this thread. Used a toy implementation based on ctypes in task 2018.06.14_L3Res-Fall17_17Nov2017_V10 (inspired by this answer).

Allow migration between bins of photon's pt

In the binned-sum γ+jet method, account for the migration between bins of pT of the photon due to the change of photon's pT scale, similarly to what is done for multijet. Not sure if this is an important effect, but better take it into account to be on the safe side. (For the moment?) allow this migration to mix different trigger bins.

Implementing this would require extending the range of photon's pT in all input histograms in data. Extending by 5% at both ends would do. @sordini, input files will need to be changed accordingly.

@lattaud, adding you to the watch list.

Nuisance parameters

Reconsider the way nuisance parameters are used in the infrastructure. They should probably be fed into JetCorrBase::Eval in order to be able to include systematic uncertainties in the parameterization of jet correction.

Allow specifying constraints when nuisances are defined, as opposed to doing it in a class derived from CombLossFunction. This would also allow to distinguish between floating and external nuisances automatically by setting zero variances for the latter ones.

Try to incorporate constraints on the nuisances in the loss function automatically. Might have to describe them with a map after all.

Implement FSR extrapolation

Implement FSR extrapolation in Run 1 style γ+jet and Z+jet analyses. Waiting for documentation of the current combined fit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.