Skip to content

cp3-llbb/ZA_RunIIFullAnalysis

Repository files navigation

H/A ->Z A/H ->llbb : RunII Full Analysis

  • Analysis use Bamboo RDataFrame and works with NanoAODv{5,7,8 and 9}, check .yml configuration in bamboo_/config/ directory to run ZA anslysis with your favourite NanoAOD version.
  • You can find more about Bamboo in the UserGuide. Also feel free to report any issue you encounter in ~bamboo channel on the CERN mattermost, or on Gitlab.

Bamboo Installation(1st time):

mkdir bamboodev
cd bamboodev
# make a virtualenv
source /cvmfs/sft.cern.ch/lcg/views/LCG_100/x86_64-centos7-gcc10-opt/setup.sh
python -m venv bamboovenv
source bamboovenv/bin/activate
# clone and install bamboo
git clone -o upstream https://gitlab.cern.ch/cp3-cms/bamboo.git
pip install ./bamboo
# clone and install plotIt
git clone -o upstream https://github.com/cp3-llbb/plotIt.git
mkdir build-plotit
cd build-plotit
cmake -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV ../plotIt
make -j2 install
cd -
#To use scalefactors and weights in the new CMS JSON format, the correctionlib package should be installed with
pip install --no-binary=correctionlib correctionlib

Environment Setup (Always *):

  • In your ~/.bashrc add:
function cms_env() {
    module purge
    module load grid/grid_environment_sl6
    /cvmfs/cms.cern.ch/cmsset_default.sh
    module load crab/crab3
    module load slurm/slurm_utils
    module load cms/cmssw
}
alias bamboo_env="source /cvmfs/sft.cern.ch/lcg/views/LCG_100/x86_64-centos7-gcc10-opt/setup.sh"
alias bambooenv="source $HOME/bamboodev/bamboovenv/bin/activate"
  • Then every time you want to setup your bamboo enviroment:
cms_env
voms-proxy-init --voms cms
bamboo_env
bambooenv

Update Bamboo :

cd bamboodev/bamboo
git checkout master
git pull upstream master
pip install --upgrade . 
# if the previous did not work try : 
# python -m pip install --upgrade .

Re-install plotIt:

cd (path to)/plotIt/build-plotit
rm CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV ..
make -j4 install

How to run ?

I do recommend to test locally first with --maxFiles=1, to check that the module runs correctly in all cases before submitting to a batch system. If all right you can submit to slurm with --distributed=driver. Avoid as well using -v/--verbose for slurm submission, will make your jobs slower.

  • -s/--systematics add to your plots PSweight (FSR , ISR), PDFs and six QCD scale variations, ele_id, ele_reco, pu, BtagWeight, DY, top ...
  • -v /--verbose: give you more print out for debugging.
  • -m /--module : your analysis script.
  • -dnn /--DNN_Evaluation : Pass TensorFlow model and evaluate DNN output
  • --split: if True run2 reduced set of JES uncertainty splited by sources and JER systematic variation will be splitted between kinematics regions to decorrelate the nuisance parameters.
  • --hlt: Produce HLT efficiencies maps
  • --blinded: blinded data from 0.6 to 1 bin for the dnn output
  • --nanoaodversion: EOY-latest v7 or Ulegacy campaign-working version v8 or the latest v9
  • --doMETT1Smear: This correction is a propagation of L2L3 JEC to pfMET, see MET Type1 and Type2 corrections for more details.
  • --dobJetEnergyRegression:
  • --yields:
  • --skim:
  • --backend:

Note: Tensorflow does not work on ingrid-ui1, you need to run on a worker node with a more recent CPU, so run as follow before bambooRun command whenever -dnn flag is set to True:

srun --partition=cp3 --qos=cp3 --time=0-02:00:00 --pty bash
bambooRun --distributed=driver -v -s -m ZAtollbb.py:NanoHtoZA config/choose_One_.yml -o ~/path_to_your_Output_dir/

In case you want to run plotIt again (after changing few options such fill color, legend position, unable systematics, etc...)

plotIt -i /path_to_your_dir/ -o /path_to_your_dir/plots_{add_era: 2016, 2017 or 2018} -y -e era /path_to_your_Output_dir/plots.yml

Or simply run with --onlypostas follow:

bambooRun --onlypost -v -s -m ZAtollbb.py:NanoHtoZA config/choose_One_.yml -o ~/path_to_your_Output_dir/

Make Skim:

You can run bambooRun command for differnt --args or you can use runSkimmer.py to submit all of them at once.

python runSkimmer.py --process ggH --output skim_dir --submit 

# ZAtollbbSkimmer is deprecated( please use the command above) 
bambooRun --distributed=driver -sel 2Lep2bJets -reg resolved  -cat MuMu -Tag DeepFlavour -wp M -proc ggH -s -m ZAtollbbSkimmer.py:Skimedtree_NanoHtoZA config/*.yml -o ~/path_to_your_Output_dir/
  • --submit: driver, worker , max1 or onlypost . --driver option will submit the independent tasks to a batch scheduler (currently HTCondor and Slurm are supported) instead of running them sequentially, wait for the results to be ready, and combine them (the worker tasks will run the same module, but with --worker and the actual input and results file names as input and output arguments). max1 same as --maxFiles=1
  • -o/--output: skim output dir
  • -p/--process: ggH for gg-fusion and bbH for b-associated production
  • -s/ --systematics: add systematics variations

Produce 2D Efficiencies Maps for Btagging:

bambooRun --distributed=driver -v -s -m BtagEfficiencies.py:ZA_BTagEfficiencies config/mc.yml -o outputdir

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published