🚑 ask for help if things are not working 💥
For readability there is a README for each step, if deeper adjustments have to be done:
- configs
- plottinscripts
- util WIP
- data: not used right now, change structure to have files local
- standaloneTools: files not correlated to the pyroot-plotscript but Karim insists on keeping them
export SCRAM_ARCH=slc7_amd64_gcc700CMSSW_11_1_0_pre4
- create/adjust a plotconfig file named
pltcfg_STR.py, that includes all samples that shall be used in the pyroot-plotscript and the nominal weight expression. Two lists of SamplessamplesDataControlPlots(data samples)samples(simulated samples) add Sample using, withSAMPLENAMEINCSVCONFIGbeing the process name in the used systematics csv fileSTR_systematics.csv
plotClasses.Sample(SAMPLENAMEONPLOTS,COLOR, PATH/TO/SAMPLE, SELECTION, SAMPLENAMEINCSVCONFIG, samDict=sampleDict, readTrees=doReadTrees)
- create/adjust the nominal weight expression
nominalweight="STR"
- create/adjust a systematics csv file
STR_systematics.csv, add entries regarding the columns:- Uncertainty name of the uncertainty, add
#to skip - Type type of the uncertainty
- Construction construction type of the uncertainty,
rateforlnN,variationandweightforshape - Up add the weight expression or
SAMPLENAMEfor the up shape - Down add the weight expression or
SAMPLENAMEfor the down shape - Plot use
1to plot uncertainty - PROCESSES contains at least all processes used in
pltcfg_STR.py, add1to activate shape for specific process
- Uncertainty name of the uncertainty, add
create/adjust a plottingscript plotLimits_STR.py, define variables and analysis options in the first paragraph of the main function
Navigate to the plottinscripts directory and run the plottingscript plotLimits_STR.py
python `plotLimits_STR.py`- first train separate DNNs with the
DRACO_MLfoyFramework on theOdd/Evensubsamples by appending the options--evenor--oddto the execution of the train script (this of course requires a previous preprocessing ofOddandEvenMC events) - generate a new set of DNNs with the following structure:
NAME_OF_DNN_SET
----/DNNS_OF_FIRST_JT_REGION
--------/ODD
------------checkpointfiles
--------/EVEN
------------checkpointfiles
----/DNNS_OF_SECOND_JT_REGION
...
- generate a new
plt_configwith theutils/tools/dNNInterfaces/MLfoyInterface.pyand specify the option-xto activate the cross evaluation setup. Activating this option creates input-feature-plots and output-discriminator-plots for each jet-tag-region by combining the subfolders (EVEN/ODD). If the option is not specified when creating the newplt_config, separate plots are created for the subfolder checkpoint files. - add the created config to the
plt_configvariable in your top-level-script. - check your
configfile and remove the(Evt_Odd==0)*2.0selection if it still exists and replace it by1.0to select all events and remove the adjusted weight. - add the variable
Evt_Oddto yourvariable_cfgif it does not exist yet. - add the option
crossEvaluationto youranalysisOptionsdictionary in the top-level-script if it does not exist yet and set it toTrue. If the option is set toFalsethec++code that is written will evaluate all DNNs separately, so you also need aplt_configthat was not created with the-xoption. - set the path to your new DNNSet in the
dnnInterfacedictionary in the top-level-script. - execute the top-level-script as usual.
- module
util/scaleFactorCreator.pycan be called in a top level script to create SF histograms - SF are caluclated as ratios between nominal template and dummy systematic templates for each variable and process
- example configs are added in
configs/sfPatch/ - example scripts are added in
plottingscripts/sfPatch/derive_X.py
- sf histograms are added to the
data/btagSFCorrection/directory - three different binnings are available for each year (which one to use is still to be decided)
- sf histograms are available for all ttbar, ttbb, ttH and ttZ processes
- C++ module
SFCorrectionHelperhas been included - module is loaded per default into the created C script
- add the following excerpt to the top level script
sfCorrection = {}
sfCorrection["sfFile"] = pyrootdir+"/data/btagSFCorrection/sf_2018_deepJet_fineBinning.root"
# variables for the correction
sfCorrection["corrections"] = {}
sfCorrection["corrections"]["HT_vs_NJet"] = ["Evt_HT_jets", "N_Jets"]
# in root file sf histograms exist with some naming scheme
sfCorrection["nameTemplate"] = "$BINNING__$PROCESS__$NAME"
# SF_ is always preprended by default, that should not be changed
# $BINNING = "_vs_".join(corrections[X])
# DANGER: order of variables is important
# name of corrections to be applied (should match whats defined in syst.csv or samples.py)
sfCorrection["names"] = ["btag_NOMINAL"]
- pass information to
plotParallelviapP.setSFCorrection(sfCorrection) - new SFs can for example be applied by using variables with naming scheme
sf__$BINNING__$NAME
e.g.
sf__HT_vs_NJet__btag_NOMINAL
friend trees can be used to get additional variables (i.e. branches) from other root ntuple files.
Creation of such friend tree files is currently implemented in the karim framework for reconstruction information.
The friend tree files need to have the same order of events as the original ntuple files. In the current implementation it is also required to have the same folder structure for the original ntuple files and the friend tree files:
BASEPATH/
----/SAMPLEA/
----/----/FILE1.root
----/----/FILE2.root
----/SAMPLEB/
----/----/FILE3.root
...
The current implementation of friend trees replaces the BASEPATH of the original ntuple files with a new path where the friend trees are supposed to be stored.
To activate the use add a dictionary to your sample config, e.g.
friendTrees = {
"friendTreeName": "/new/base/path/to/friend/trees/",
...
}
and add pP.SetUseFriendTrees(True) to your top level script.
If the name of a branch you want to access is unique between the friend trees and the original tree, you can just use the variable name.
If the same variable exists in a friend tree and your original tree, the content of the original tree will be accessed when you call the plain variable name.
To access any variable in a friend tree, you can use the variable name friendTreeName.variableName.