Configuration Files - TC01/Treemaker GitHub Wiki
Configuration Files
Much like CMSSW, and crab, Treemaker requires a configuration file to run. The good news is, there is an easy-to-use automated tool that can make configuration files for you.
Create a plaintext file with a list of plugins you want to run, in the order you want them to be executed in. For example, here is a plugin list from one of my projects (some of these plugins are included in this repository as examples):
jhu_ca8_jets
met_vars
lep_vars
lep_nu_wcand
nearest_jet_cuts
top_cand
had_top_cand
mc_ttbar
is_w_cut
is_b_cut
is_loose_lepton
MC_Pruner
event_weight
mc_vars
The order you specify could be important: the jhu_ca8_jets
plugin saves
the first few CA8 jets, for example, and other plugins use those quantities
without having to read them off of the ttree.
Once you have a plugins list, you can auto-generate a config file using the
treemaker-config
tool. Here is an example:
treemaker-config -p plugins.list /eos/uscms/store/user/bjr/ntuples/Gstar_Semilep_1500GeV/
You can pass other options to treemaker-config
. To set the name of config file that
will be generated, pass -n name_of_cfg
(with or without the trailing cfg
suffix). To tell Treemaker that the dataset you are running over is Data and not Monte
Carlo, pass the -d
flag. For a full list of options, run treemaker-config -h
.
Job Splitting
See the Job Splitting page for a discussion of job splitting. You can specify
which type of splitting to use (the default is no splitting) at a configuration file level
by adding the arguments --split-into N
or --split-by N
(trying to specify both
is an error).
You can also set the splitting manually by editing the config file afterwards, of course. If a splitting option is set to -1, it means that it will be ignored. So setting both split_into and split_by to -1 means no splitting will happen.
Plugin Priorities
Above, we discussed how the order of execution matters for plugins. You can, however, make things slightly more complicated than merely "order the plugins in execution order" by editing the configuration file directly.
In the example config file below, you'll see that under the [plugins] section, each plugin has a number associated with it. That number is the plugin's priority. Plugins with lower priorities must run before plugins with higher priorities. Two plugins can have the same priority.
When you run treemaker-config
plugins are given priorities based on the order in which
they appear on the text file.
If you wish to disable a plugin from running for testing purposes, give it the priority 0 and it will not run.
Example Config File
Here is an example config file and the command that was used to generate it.
treemaker-config -t tree -p zprime.list -n Gstar_Semilep_1500GeV /eos/uscms/store/user/bjr/ntuples/gstar/Gstar_Semilep_1500GeV/normal -o Gstar_Semilep_1500GeV --split-by 5
[dataset]
directory = /eos/uscms/store/user/bjr/ntuples/gstar/Gstar_Semilep_1500GeV/normal
is_data = False
output_file_name = Gstar_Semilep_1500GeV
output_tree_name = tree
[splitting]
split_into = -1
split_by = 5
[plugins]
jhu_ca8_jets = 1
met_vars = 2
lep_vars = 3
lep_nu_wcand = 4
nearest_jet_cuts = 5
top_cand = 6
had_top_cand = 7
mc_ttbar = 8
is_w_cut = 9
is_b_cut = 10
is_loose_lepton = 11
MC_Pruner = 12
mc_vars = 13
Plugin Parameters
A discussion of the Parameters feature and how to use it in your configuration files can be found on the Writing Plugins page. But to briefly summarize, add a [parameters] section to the config file and any entries you define will be accessible as variables from within your plugins.