Skip to content
musella edited this page May 31, 2016 · 7 revisions

Control plots

Control plots can be run out of the output of the files produced by the ntuplization code. The corresponding scripts are configures with JSON files like, e.g. diphotons/Analysis/macros/basic_plots.json.

Quick intro to to the structure of the plots JSON files

The JSON files for the plotting scripts contains three sets of datasets: data, bkg and sig. The scripts generally make data/MC comparison plots of pre-filled histograms contained in the files. The list of plots to be run is specified in plots.
The data, sig and bkg entries have the following formats:

    "data" : [
	      ["Data","Data",
	      [["SetBinErrorOption",1],["colors","kBlack"],["SetLineWidth",2],["SetFillStyle",0],["Scale",1],["legopt","pe nostack"],["SetMarkerStyle","kFullCircle"],["SetFillColor","kWhite"]],
	      { "Data_13TeV:__infile__/%(sel)s" : [] }
	      ]
	     
], 

Each list has the following fields: name, title, list of customization options, map with component samples. The latter has the format { "key" : [list of specific customization options] }. The key format is <sample_name>[:<input_file>/<input_folder>].

The template configuration item determines how each histogram is then read.
"template": "histograms/%(sample)s_%(cat)s%(name)s"

In this case, for each plot, sample, and category the histogram is read from <input_file>/<input_folder>/histograms/<sample_name>_<category><histogram_name>.

Diphoton control plots

The script running the diphoton control plots is diphotons/Analysis/macros/control_plots.sh

To run the script.
./control_plot.sh [options] <path_to_the_ntuples_task_folder> [output_web_folder]

The MC is normalized to 1/fb by default, so the luminosity should be specified as one of the options.
./control_plot.sh --lumi <lumi_in_fb> <path_to_the_ntuples_task_folder> [output_web_folder] On top of that, the MC can be scaled up or down using the --fudge option.

The script contains command lines used to run standard data/MC comparisons, efficiency plots and purity plots. The two latter are commented by default.

./basic_plots.py --load basic_plots.json  -O $www/$target/selection  --input-dir $src $lumi $data_file $opts
## ./basic_plots.py --load purity_plots.json -O $www/$target/purity     --input-dir $src 
## ./eff_plots.py --load eff_plots.json      -O $www/$target/efficiency --input-dir $src 

The plots are created in the folder <output_web_folder>/<path_to_the_ntuples_task_folder>. This can be overridden by the -O option.

To compare data and MC which live in different file, the absolute path to the MC file can be specified as --mc-file <absolute_path>.

Zee control plots

The script to run Zee control plots is analogous to the diphoton one and it is located in
diphotons/blob/master/Analysis/macros/zee_plots.sh.

Hacking the JSON files

The control plots are produced for several categories and selections, which are controlled by the JSON file. In the input files, events are split in 4 categories, EBEBHighR9, EBEBLowR9, EBEEHighR9, and EBEEHighR9: the scripts can combine arbitrarily these categories when making plots. This is controlled by the groups option.

    "groups": {
        "EBEB"       : ["EBHighR9","EBLowR9"],
        "EEEE"       : ["EEHighR9","EELowR9"],
        "EBEBHighR9" : ["EBHighR9"],
        "EBEELowR9"  : ["EBLowR9"],
        "EBEEHighR9" : ["EEHighR9"],
        "EBEELowR9"  : ["EELowR9"]
    }, 

The list of event selections for which the plots are made can also be specified.

    "selections" : [
        ["cic",""],
        ["cicNoChIso","noChIso"],
        ["cicNoSigmaIetaIeta","noSiEiE",["mass","leadSigmaIeIe","subleadSigmaIeIe"]],
        ["cicNoPhoIso","noPhoIso",["mass","leadPhoIso","subleadPhoIso","nvtx","rho"]],
        ["cicNoHoverE","noHoE",["mass","leadHoE","subleadHoE"]],
        ["cicNoEleVeto","noEleVeto",["mass","leadPassEleVeto","subleadPassEleVeto","leadPixSeed","subleadPixSeed"]],
        ["cicSBNoChIsoSingleSB","chIsoSingleSB",["mass","leadChIso","subleadChIso","nvtx","rho","phoRndConeChIso"]],
        ["cicSBNoChIsoDoubleSB","chIsoDoubleSB",["mass","leadChIso","subleadChIso","nvtx","rho","phoRndConeChIso"]]

    ],

For each entry, the syntax is <selection_name>,<output_folder>,[plots_subset_to_draw].

Making plots from ntuples

The auto_plotter.py script can create new plots starting from the trees in the input file and produce histograms with the correct structure needed by the plot scripts. An example command line to unsmear the Zee MC is:

    ./auto_plotter.py --selection cic \
        --file  $input/output.root --move cicNoChIsoGenIso:cicNoChIso,cicNoChIsoNonGenIso:cicNoChIso,cicGenIso:cic,cicNonGenIso:cic \
        --cut "1" \
        --process "*DY*" \
        --prescale DY\*:10 \
        --histograms "nvtx>>nvtx(51,0.5,50.5);rho>>rho(20,0,50);mass*sqrt((leadInitialEnergy*subLeadInitialEnergy)/(leadEnergy*subLeadEnergy))>>lowmass(560,60,200)" \
    --output $output/output_mc.root

Explanation of the options:

  • --input, --output, and --cut have obvious meanings
  • --process select the list of processes for which to produce the plots. Omitting it causes all processes found in the input files to be analyzed.
  • --histograms specifies the list of histogras to be plot. The syntax is analogous to one used by the flashgg dumpers.