Giter VIP home page Giter VIP logo

plotting-macro's Introduction

Table of Contents

Created by gh-md-toc

Common information

These macro needs uproot and matplotlib packages.

On lxplus this is available with CMSSW_11_2_4 onwards.

Simple plotting using variables from file

If you want to plot one variable on one canvas. Then add each variable with its nbins, minX and maxX info in the file variableListToPlot.py. Then run the macro ReadTree.py.

Example use:

python ReadTree.py -i <ROOT_FileWithPath> -t <TreeName> --dir <DirToKeepPlots> -var_file variableListToPlot.py

# Example
python ReadTree.py -i /afs/cern.ch/user/r/rasharma/work/h4L_analysis/UFHZZAnalyzer/CMSSW_10_6_12/src/Sync_1031_2018_GluGluHToZZTo4L_final.root -t Ana/passedEvents --dir h4l_plots -var_file variableListToPlot.py

python ReadTree.py -i /afs/cern.ch/user/r/rasharma/work/h4L_analysis/UFHZZAnalyzer/CMSSW_10_6_12/src/all.root  --dir h4l_MELA_ggh_vbf_wph -v mela

Help message:

$ python ReadTree.py --help
usage: ReadTree.py [-h] [-i INPUT_FILE] [-t TREE_NAME] [-var_file VAR_FILE]
                   [-d DEBUG] [-dir DIR_TO_SAVE_PLOTS]

    Example Command:
    ----------------
    python ReadTree.py -i InputRootFile.root  -t TreeName  --dir temp -var_file variableListToPlot.py

    ----------------


optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input_file INPUT_FILE
                        Input root file
  -t TREE_NAME, --tree_name TREE_NAME
                        tree name of input root file
  -var_file VAR_FILE, --var_file VAR_FILE
                        text file having list of all variables.
  -d DEBUG, --debug DEBUG
                        debug true or false
  -dir DIR_TO_SAVE_PLOTS, --dir_to_save_plots DIR_TO_SAVE_PLOTS
                        Directory name to keep plots

Search branch using sub-string then plot for all of them

If you want to plot all branches from the tree having a particular pattern then use the macro ReadTree2.py.

Help message:

$ python ReadTree2.py --help
usage: ReadTree2.py [-h] [-i INPUT_FILE] [-t TREE_NAME] [-nBin NBIN]
                    [-xmin XMIN] [-xmax XMAX] [-branch_text BRANCH_TEXT]
                    [-d DEBUG] [-dir DIR_TO_SAVE_PLOTS]

    Search all branch having a sub-string. Then make histogram for
    all the available branches.

    Example Command:
    ----------------
    python ReadTree2.py -i InputRootFile.root  -t TreeName -branch_text "D_"  --dir temp

    ----------------


optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input_file INPUT_FILE
                        Input root file
  -t TREE_NAME, --tree_name TREE_NAME
                        tree name of input root file
  -nBin NBIN, --nBin NBIN
                        number of bins
  -xmin XMIN, --xmin XMIN
                        min value of x-axis
  -xmax XMAX, --xmax XMAX
                        max value of x-axis
  -branch_text BRANCH_TEXT, --branch_text BRANCH_TEXT
                        search string in a tree branch
  -d DEBUG, --debug DEBUG
                        debug true or false
  -dir DIR_TO_SAVE_PLOTS, --dir_to_save_plots DIR_TO_SAVE_PLOTS
                        Directory name to keep plots

plotting-macro's People

Contributors

ram1123 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.