Making pre selection - jniedzie/SVJanalysis_wiki GitHub Wiki
Overview
Code in directory preSelection
The pre-selections to apply must be defined in a script having a function called process
. The -p
flag should point to this script (without the .py
extension).
An example can be found here.
The pre-selection can be easily performed by using high-level syntax:
events.filter_collection("Jet", (events.Jet_pt > 30) & (abs(events.Jet_eta) < 2.4) & (events.Jet_jetId == 6))
events.filter(events.nJet >= 2, inplace=True)
The cut flow information can be easily updated using high-level syntax:
update_cut_flow(cut_flow, "2GoodAk4Jets", events)
Usage
usage: makePreSelection.py [-h] -i INPUT_FILE_NAME -o OUTPUT_FILE_NAME -p PROCESS_MODULE_NAME [-xsec GEN_CROSS_SECTION] [-rcf] [-t TEST] [-kw KWARGS] [-bd BRANCHES_TO_DROP]
optional arguments:
-h, --help show this help message and exit
-i INPUT_FILE_NAME, --input_file_name INPUT_FILE_NAME
Input ROOT file name
-o OUTPUT_FILE_NAME, --output_file_name OUTPUT_FILE_NAME
Output ROOT file name
-p PROCESS_MODULE_NAME, --process_module_name PROCESS_MODULE_NAME
Script with a process function (without .py)
-xsec GEN_CROSS_SECTION, --gen_cross_section GEN_CROSS_SECTION
Sample cross section (in pb) before pre-selection
-rcf, --reset_cut_flow
Make cut flow table with Initial and Final, both set equal
-t TEST, --test TEST Test on N events
-kw KWARGS, --kwargs KWARGS
Optional keyword arguments to be passed to the processor
-bd BRANCHES_TO_DROP, --branches_to_drop BRANCHES_TO_DROP
Optional list of branches to ignore/not store
Output
The output skimmed ROOT files have the same trees as the input ROOT files with the following updates:
Events
: contains now only events passing event-level cuts and objects passing object-level cutsCutFlow
: number of events (sum of generator weights) after each cut are added to the tree. If the tree does not already exist, number of events in the input file before cuts is used as initial number of events.MetaData
: TTree with the following branchesGenCrossSection
: cross-section in pb (before any selection), if the-xsec
flag is provided.OriginalFormat
: a code to know the original format of the file if need be (not used in the FW at the moment)