Giter VIP home page Giter VIP logo

crab's Introduction

CRAB

Generate events or process miniAOD files with CRAB3.

Table of Contents

Installation

First, get this repository:

git clone https://github.com/IzaakWN/CRAB CRAB
cd CRAB

then install the relevant CMSSW in this directory, e.g.:

CMSSW=CMSSW_10_6_19
export SCRAM_ARCH=slc7_amd64_gcc700
cmsrel $CMSSW
cd $CMSSW/src
cmsenv
scram b -j4
cd ../..

You can find a list of supported CMSSW versions and architectures on this page. When you want to use CRAB, you need to source the relevant setup script:

source $VO_CMS_SW_DIR/crab3/crab_slc6.sh  # for SLC6
source $VO_CMS_SW_DIR/crab3/crab.sh       # for SLC7

Make sure you have a valid VOMS proxy,

voms-proxy-info --timeleft              # check how many seconds you have left
voms-proxy-init -voms cms -valid 400:0  # renew proxy if it is too short
source setupVOMS.sh                     # OR, source this script instead of the above two lines

Before submitting jobs to CRAB, make sure that in submit_crab.py you have specified the correct tier storage element that you have writing permissions to. For example with 'T2_CH_CSCS' for PSI's T2:

sed "s/\(site\s*=\s*\)'\w+'/\1'T2_CH_CSCS'/" submit_crab.py

DeepTau2017v2p1

In case you want to use DeepTau2017v2p1 in 102X samples, see this this TWiki page, and setup CMSSW as

CMSSW=CMSSW_10_2_16_patch1
export SCRAM_ARCH=slc6_amd64_gcc700
cmsrel $CMSSW
cd $CMSSW/src/
cmsenv
git cms-merge-topic -u cms-tau-pog:CMSSW_10_2_X_tau-pog_DeepTau2017v2
git cms-merge-topic -u cms-tau-pog:CMSSW_10_2_X_tau-pog_deepTauVetoPCA
sed 's/idDeepTau2017v2/idDeepTau2017v2p1/g' PhysicsTools/NanoAOD/python/taus_cff.py -i
sed 's/rawDeepTau2017v2/rawDeepTau2017v2p1/g' PhysicsTools/NanoAOD/python/taus_cff.py -i
scram b -j 4
cd ../..

Environment setup

With each new shell session, do something like

cd CRAB
source setupVOMS.sh
source $VO_CMS_SW_DIR/cmsset_default.sh
source $VO_CMS_SW_DIR/crab3/crab_slc6.sh
export SCRAM_ARCH=slc7_amd64_gcc700
cd CMSSW_10_6_19/src
cmsenv
cd ../..

Event processing

Local run

Get some files with e.g.

dasgoclient --limit=0 --query="dataset=/DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM file" | head -n1
xrdcp -f root://cms-xrd-global.cern.ch//store/mc/RunIIAutumn18MiniAOD/DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/100000/042C8EE9-9431-5443-88C8-77F1D910B3A5.root ./test.root

Reprocess miniAOD to add DeepTau2017v2p1 with

cmsRun pset_miniAOD_rerun.py

Process miniAOD to nanoAODv5 with

cmsRun pset_nanoAODv5.py

Check output

Check the content of a miniAOD file with

edmProvDump input/VLQ-p_M1100_2017_rerun.root > dump.log

or use as an example (see this TWiki page)

./checkMiniAOD.py

CRAB submission

Collect your favorite samples in the respective python file, sorted in a dictionary per year:

samples_miniAOD.py
samples_nanoAOD.py

Then you can submit a specific parameter-set configuration file as

./submit_crab.py pset_nanoAODv5.py -y 2017

To filter a specific sample, do e.g.

./submit_crab.py -y 2017 -s DY*Jets

To run test job(s), do e.g.

./submit_crab.py -y 2017 -t    # one test job
./submit_crab.py -y 2017 -t 2  # two test jobs

Check the task status, and resubmit if needed as:

crab status -d crab_projects/crab_<request>
crab resubmit -d crab_projects/crab_<request>

replacing <request>. Or, use the local crab.sh script to check many directories at once

crab.sh status crab_projects/crab_*
crab.sh resubmit crab_projects/crab_*

If you publish your output files (default, if it is not a test job), you can retrieve them in DAS with (replacing <user>)

dasgoclient --limit=0 --query="dataset=/*/<user>*/USER instance=prod/phys03"

Event generation

MadGraph gridpack generation

Before you can generate MadGraph events with CMSSW, it's useful to create a gridpack, as described here, or install

cd $CMSSW_BASE/src/
git clone [email protected]:cms-sw/genproductions.git genproductions

and in a clean shell session (i.e., without an CMSSW environment sourced), run

source $VO_CMS_SW_DIR/cmsset_default.sh
cd genproductions/bin/MadGraph5_aMCatNLO/
./gridpack_generation.sh <process name without _proc_card.dat> <card dir>

To produce a large set of MadGraph cards with varying parameters (mass, coupling strenghts, ...), you can prepare some template cards like the examples in cards/ScalarLQ_Single/ScalarLQ_Single_template_*.dat, and use create_cards.py as e.g.

./create_cards.py cards/ScalarLQ_Single/ScalarLQ_Single_template_*.dat -m 1000 -p LAMBDA=0.1,1.0,1.5

Produce the cards and gridpacks in series with generate_gridpacks.py, e.g.

./generate_gridpacks.py cards/ScalarLQ_Single ScalarLQ_Single -m 1000 -p LAMBDA=0.1,1.0,1.5 -C CMSSW_10_6_19

Local event generation

Produce events with a gridpack with pset_GENSIM.py as e.g.

cmsRun pset_GENSIM.py nevents=100 gridpack=ScalarLQ_Single_M500_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz

Submit fragment to HTCondor

To submit a MCM fragment and produce GENSIM events on HTCondor for quick studies, do e.g.

mkdir -p test_DYJetsToMuTauh && cd test_DYJetsToMuTauh
curl -s -k https://cms-pdmv.cern.ch/mcm/public/restapi/requests/get_test/TAU-RunIISummer20UL18wmLHEGEN-00006 > setup_DYJetsToMuTauh.sh
sed -i 's/exit $GEN_ERR/echo "# IGNORE ERROR $GEN_ERR from request_fragment_check.py"/' setup_DYJetsToMuTauh.sh
sed -i 's/EVENTS=[0-9]\+/EVENTS=500/' setup_DYJetsToMuTauh.sh
bash setup_DYJetsToMuTauh.sh # setup CMSSW, fragment and generate GENSIM
./submit_fragment.py -t _DYJetsToMuTauh test_DYJetsToMuTauh/TAU-RunIISummer20UL18wmLHEGEN-00006_1_cfg.py -N 100 -n 10000 -v2

Instructions to get the fragment are below.

Notes

CRAB3

NanoAOD

More notes.

Samples

PPD Run II summary table

PSet fragments

To get a fragment of a PSet configuration file with cmsDriver.py is explained in the NanoAOD Workbook.

cmsDriver.py myNanoProdMc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --no_exec --conditions MyGlobalTag --era MyEraModifiers
cmsDriver.py myNanoProdData -s NANO --data --eventcontent NANOAOD --datatier NANOAOD --no_exec --conditions MyGlobalTag --era MyEraModifiers

Get a fragment of a PSet configuration file for a particular sample:

  1. Go to MCM.
  2. Go to 'Request' > 'Output Dataset', and type in the DAS path of your favorite sample, e.g.
/DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM
  1. In the 'Actions' column, click on the 'Get setup command' symbol (circle with down arrow).
    https://cms-pdmv.cern.ch/mcm/public/restapi/requests/get_setup/MUO-RunIIAutumn18MiniAOD-00016
    https://cms-pdmv.cern.ch/mcm/public/restapi/requests/get_fragment/MUO-RunIIAutumn18MiniAOD-00016
  2. Copy-paste the cmsDriver.py the command line (in a CMSSW environment).
  3. You will find a configuration file called <prep-id>.py.

crab's People

Contributors

izaakwn avatar

Watchers

 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.