Instructions to create analysis input files for the MultijetJESUncertaintyProvider


This page contains a set of instructions to run the JetPerformance code (authors: S. Adomeit, F. Balli, C. Doglioni, F. Guescini, C. Sawyer) to generate the .root files that are needed as input to the MultijetJESUncertaintyProvider to estimate the flavour composition uncertainty.

Setting up your work area

The basic building block is RootCore, to be checked out and configured.

svn co svn+ssh:// RootCore

In order to build RootCore you have to have ROOT set up in your current shell. Then you can follow the instructions on:

Then check out the package and its dependencies (some are there for later):

svn co svn+ssh:// TruthToolCode
svn co svn+ssh:// HistoWeighter 
svn co svn+ssh:// TruthToolPrunSubmission
svn co svn+ssh:// ApplyJetCalibration

Then setup RootCore (you have to do this every time you start a new session):

source RootCore/scripts/

and build everything.


Configuring your job

All the information needed to configure your job is read in from configFileJES201.config located in the Run/ directory of the TruthToolCode package.

Tree Name

  • Specify the name of the tree in your NTuple (qcd, physics,...)
       #Tree name of the D3PD
       TreeName:   qcd

Jet collections and calibration

Settings for your configuration file:

  • Flag to switch on / switch off recalibration of jets
       ApplyRecalibration: true

  • Specify the name of the calibration configuration file
       CalibConfigFile:  CalibrationConfigs/Rel17_JES.config

  • RecoCalibName: These names are passed to the calibration tool:
       RecoCalibName   AntiKt4TopoEM
       +RecoCalibName  AntiKt6TopoEM
       +RecoCalibName  AntiKt4LCTopo
       +RecoCalibName  AntiKt6LCTopo

  • RecoPrefix: The prefix of the jet collection in your D3PD:
         RecoPrefix   jet_AntiKt4TopoEM_
         +RecoPrefix   jet_AntiKt6TopoEM_
         +RecoPrefix   jet_AntiKt4LCTopo_
         +RecoPrefix   jet_AntiKt6LCTopo_
    • NTUP_TOP:
         # AntiKt4TopoEM
         RecoPrefix   jet_
         # AntiKt4LCTopo
         +RecoPrefix   jet_AntiKt4LCTopoJets_

  • TruthPrefix: The prefix of the corresponding truth (0.4/0.6) jet in your D3PD:
         TruthPrefix   AntiKt4TruthNew_
         +TruthPrefix   AntiKt6TruthNew_
    • NTUP_TOP:
         TruthPrefix   jet_antiKt4Truth_

Isolation requirement

Consider only isolated jets, i.e. no further jet with emscale pt > 7 GeV within deltaR < 1.0 (0.4 jets) / 1.5 (0.6 jets)

Configuration file settings:

#Apply jet isolation cut
ApplyIsolationCut  true

#Reco jets: consider only reco jets with ptEM>ClosestRecoPtMin and EEM>ClosestRecoEMin for the calculation of dRclosest (in MeV)
ClosestRecoPtMin   7000.
ClosestRecoEMin    0.

Plot definition


The binning (pt, eta and NPV) is passed as a ':'-separated list via the config file. The default settings are:

  • eta bins:
EtaBins      0:0.3:0.8:1.2:2.1:2.8:3.6:4.4
  • pt bins:
PtBins      15:20:30:45:60:80:110:160:210:260:310:400:500:600:800:1000:1200:1500:1800:2500
  • NPV bins (currently we use one large NPV bin here, i.e. we are interested in the NPV inclusive histograms):
NPVBins         0:50

Flavour response plots

  • The DoGluLight flag in your config file needs to be set to true to obtain all plots (response, resolution and nJets vs pt) separately for light quark and gluon jets
DoGluLight:   true

  • If one is also interested in the c-/and b-jet plots
DoCB:      true

Flavour composition plots

See Flavour response settings

Adding your analysis cuts

Add your object/event selection cuts to TruthToolCode.cxx. As an alternative one can also create an NTuple with objects and events passing the selection criteria and use these as input to the unmodified TruthToolCode. However, please note that jets are recalibrated in the Fill(...) method of TruthToolCode.cxx so make sure to provide the uncalibrated values.

Howto: Running the code locally

  • provide a comma separated list of input files in Run/input.txt
  • adapt the settings in ConfigFileJES2011.config according to these instructions
  • in your root session do .x run.cxx (.x run.cxx is located in the Run/ directory)

Howto: Running the code on the grid

Using the code in TruthToolCodeGridSubmission:

  • modify the settings in TruthToolCodeGridSubmission/ConfigFileJES2011.config according to these instructions
  • in TruthToolCodeGridSubmission/ specify your input (=--inDS) and output (--outDS) dataset (and add further options according to this twiki if needed)
  • setup prun using
  • don't forget to setup RootCore before submitting your jobs to the grid: source RootCore/scripts/
  • submit your job using

Generating performance plots

For each jet collection the following input graphs need to be provided:

  • Response Plot : (flavour inclusive) response in the analysis sample divided by the (flavour inclusive) response in the nominal (Pythia dijets) sample
  • Gluon Fraction Plot : fraction of gluon jets in the analysis sample
  • Gluon Fraction Uncertainty Plot : uncertainty on the gluon fraction in the analysis sample

Response Plot

You need to run the code separately on the analysis sample(s) (i.e. signal + background(s)) and the Pythia JX samples (105009-105017) according to the instructions in the previous section. If possible one should not mix MC11a/b/c responses (e.g. MC11b sample response and MC11a Pythia response).

Please note that after running the TruthToolCode on the nominal sample the various JX output .root files need to be merged according to their cross sections.

For the further reprocessing of the respVsPtAll/Light/GluAntiKt4EMTopo_absEta_etaLow_etaHigh_NPV_0_50_pt_ptLow_ptHigh histograms (there is one for each and bin in the output .root file) pick up the MakePerformancePlots.cpp macro located in the scripts/ directory of the TruthToolCode package. The macro will perform a Gaussian fit to the distributions and produce TGraphErrors plots of the fitted mean values (= response) as a function of (one for each bin).

  • in the main() function of the MakePerformancePlots.cpp specify the location of your configuration file (which was used to produce the raw plots) as well as the .root file with the raw plots:
int main () {


  • compile and run the code:
g++ -o MakePerformancePlots.exe MakePerformancePlots.cpp `$ROOTSYS/bin/root-config --cflags --glibs`
If everything goes right this will produce a .root file (called out_OriginalBinning_PerformancePlots.root) with the various resp_VsP_tAll/Ligh/Glu_AntiKt4_EMTopo_absEta_etaLow_etaHigh_NPV_0_50_pt_ptLow_ptHigh TGraphErrors response plots.

Gluon Fraction Plot (MC based)

The macro MakeGluonFractionPlots.cpp (located in the scripts/ directory) evaluates the gluon fraction based on the nJetsVsPtFLAVORKt4EMTopo_absEta_etaLow_etaHigh_pt_ptLow_ptHigh (where FLAVOR = All/Light/Glu/Other) distributions in the TruthToolCode output .root file. The usage is similar to that of the MakePerformancePlots.cpp macro, i.e. :

  • specify the location of your configuration file and the .root file with the raw plots in the main() function

  • compile and run the code:
g++ -o MakeGluonFractionPlots.exe MakeGluonFractionPlots.cpp `$ROOTSYS/bin/root-config --cflags --glibs`

Note: The fraction of gluon jets is calculated w.r.t. all matched (i.e. all - unmatched) jets.

Gluon Fraction Uncertainty Plot

One way is to compare the gluon fraction in one or more reference MC samples (different generator, parton shower,... w.r.t the default sample) and quote the gluon fraction difference as uncertainty. Note: The absolute (not relative) uncertainty on the gluon fraction needs to be provided (e.g. ).

Creating the MultijetJESUncertaintyProvider .root File

  • for each of your jet collections you need the following plots:
    • vs , one per bin ( = flavour inclusive response in the analysis sample, = flavour inclusive response in the Pythia dijets sample)
    • vs , one per bin in the analysis sample
    • vs , one per bin (i.e. the absolute uncertainty on the gluon fraction)

  • for each of these plots create a 2D histo with the pt bins on the x- and the eta bins on the y-axis

  • make sure your histograms follow these naming conventions (otherwise they cannot be picked up by the MultijetJESUncertaintyProvider)
    • response histograms:
            rSample_rIncl_AntiKt4Topo_EMJES    //AntiKt4 jets, EM+JES
            rSample_rIncl_AntiKt6Topo_EMJES    //AntiKt6 jets, EM+JES
            rSample_rIncl_AntiKt4Topo_LCJES    //AntiKt4 jets, LC+JES
            rSample_rIncl_AntiKt6Topo_LCJES    //AntiKt6 jets, LC+JES
    • gluon fraction:
            gluonFraction_AntiKt4Topo_EMJES    //AntiKt4 jets, EM+JES
            gluonFraction_AntiKt6Topo_EMJES    //AntiKt6 jets, EM+JES
            gluonFraction_AntiKt4Topo_LCJES    //AntiKt4 jets, LC+JES
            gluonFraction_AntiKt6Topo_LCJES    //AntiKt6 jets. LC+JES
    • gluon fraction uncertainty:
            gluonFractionError_AntiKt4Topo_EMJES    //AntiKt4 jets, EM+JES
            gluonFractionError_AntiKt6Topo_EMJES    //AntiKt6 jets, EM+JES
            gluonFractionError_AntiKt4Topo_LCJES    //AntiKt4 jets, LC+JES
            gluonFractionError_AntiKt6Topo_LCJES    //AntiKt6 jets, LC+JES

Merging files

More complete instructions can be found on this twiki.

First of all, download your output dataset with DQ2:

dq2-get -f \*.root\* user.doglioni.JetPerformance.mc11_7TeV.1050*.J*_pythia_jetjet.merge.NTUP_JETMET.e815_s1273_s1274_r2923_r2900_p832_YReso/

Then copy the script from the HistoWeighter package in the top directory (you should have all directories with .root files inside below):

cp ~/scratch0/IsolationStudies/HistoWeighter/Run/ .

Run it, and you'll find a filelist.txt in the same directory:


[lxplus301] /tmp/doglioni/MC11b_YReso > ls fileList.txt

Now go back to the Run directory of the HistoWeighter package, and copy the fileList there with a name of your choice:

[lxplus301] /afs/ > cp /tmp/doglioni/MC11b_YReso/fileList.txt fileListMC11b_YReso.txt

Then prepare an input file for the HistoWeighter code containing this filelist as input, the output file name and the type of weights applied (for now, we'll assume these are Pythia JX dijets):

#       Config file test

#Specify sample collection
SampleName                    Pythia

#Specify (full path to) input .txt file with paths to the .root files with the histograms
InputFile                      fileListMC11b_YReso.txt

#Specify out file name
OutFileName                    MC11b_NoIsoCalibYReso

#Specify path to out file
OutFilePath                    ./

#Name of the histogram with the number of MC events
EventHistoName                EventCounter

#Bin number where the number of events is stored
NEventBin                     1

#Integrated luminosity (in pb-1 in case we are making use of the predefined Pythia MC map in MCsampleCollection.h)
Luminosity                    1.0

must not end without line break - TEnv bug!

Feed this config file to your run.cxx macro which calls the reweight.cxx code doing the actual reweighting:

  gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");
  gROOT->ProcessLine(".L reweight.cxx++");
  std::string config ="configFileMC11b_NoIsoCalibYReso.config";

Now you can run the macro through ROOT, and you'll find the output .root file in the same directory.

[lxplus301] /afs/ > root -l -b -q runPythia_MC11b_NoIsoCalibYReso.cxx

Tag History

  • TruthToolCode-00-00-01: no overlap removal, partons are matched to reco jets (revision 262259)
  • TruthToolCode-00-00-02: no overlap removal, partons are matched to truth jets (revision 285702)
  • TruthToolCode-00-00-03: like TruthToolCode-00-00-02, adding scripts/ directory with macros to create performance plots, updated config file in Run/
  • TruthToolCode-00-00-04: like TruthToolCode-00-00-03, using vector of jet collections (from TruthToolCode-00-00-02-branch)
  • TruthToolCode-00-00-05: like TruthToolCode-00-00-04, fixing bug that prevented jets with negative eta to enter histograms

Major updates:
-- CaterinaDoglioni - 25-Jan-2012

%RESPONSIBLE% StefanieAdomeit
%REVIEW% Never reviewed

-- StefanieAdomeit - 21-Nov-2011

Edit | Attach | Watch | Print version | History: r25 < r24 < r23 < r22 < r21 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r25 - 2012-07-05 - CaterinaDoglioni
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback