GithubHelp home page GithubHelp logo

tzwi's Introduction

TZWi

Yet another CMS NanoAOD tools focusing on specific analyses.

We'd like to cover:

  • ttbar dilepton analysis
    • inclusive cross section, differential cross section
    • ttbar+bbbar cross section ratio to ttbar+jets
  • ttbar rare decays
    • t->qZ, ttbar and single top

See also

Installation

#unset SCRAM_ARCH ## just in case if you need this...
cmsrel CMSSW_10_2_20_UL
cd CMSSW_10_2_20_UL/src
cmsenv
git-cms-init
git cms-merge-topic cms-nanoAOD:master-102X
git checkout -b nanoAOD cms-nanoAOD/master-102X
git clone https://github.com/cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
git clone https://github.com/cms-kr/TZWi
scram b -j

Changing the module file in the NanoAODTools

After #151 was merged,
you need to change the 'btagSFproducer.py' in the NanoAODTools before producing the ntuple with deepflavour discriminator.
Go to the nanoAOD-tools/tree/master/python/postprocessing/modules/btv directory,

#Modifying the btagSFproducer.py file
1. line 35
#This modification should be substitute to change the '01_proc_ntuple.sh' or the 'btagWeightProducer.py' ASAP.
change the algo='csvv2' -> algo='deepjet' & selectedWPs=['M', 'shape_corr'] -> selectedWPs=['L', 'shape_corr']

* origin:
def __init__(self, era, algo='csvv2', selectedWPs=['M', 'shape_corr'], sfFileName=None, verbose=0, jesSystsForShape=["jes"]):
* change:
def __init__(self, era, algo='deepjet', selectedWPs=['L', 'shape_corr'], sfFileName=None, verbose=0, jesSystsForShape=["jes"]):

2. after the line 325
Adding the new lambda function "btagSFLegacy2016" because key of deepjet for 2016 name is "Legacy2016"
btagSFLegacy2016 = lambda : btagSFProducer("Legacy2016")

(Optional) Customized NanoAOD production

cd TZWi/NanoAODProduction/test
./generateConfig.sh ## This will produce 3 sets of 3 cfg files...
crab submit...

List up NanoAOD samples

Update sample list, produce file lists

tzwi-updatedataset $CMSSW_BASE/src/TZWi/NanoAODProduction/data/datasets/NanoAOD/2016/*.yaml
tzwi-updatedataset $CMSSW_BASE/src/TZWi/NanoAODProduction/data/datasets/NanoAOD/2017/*.yaml

Run postprocessors

Assume we are working at KISTI Tier2/3 and cms-kr/hep-tools package is installed.

./01.1_submit.py

Wait for the jobs to be finished, check output files, resubmit failed jobs.

Tip to list up failed job and resubmit them:

./01.2_checkFailed.sh

You can process failed ones manually:

cat failed.txt | sed 's;nano_postproc.py;;g' | xargs -P$(nproc) -L1 nano_postproc.py

Tip to extract all ntuples:

find *NANOAOD*/ -name 'result_*.tgz' | awk '{print "xzf "$1" ./ntuple"}' | xargs -L1 -P$(nproc) tar

Make histograms

This step will draw all histograms including systematics variations using maximum 20 CPUs in parallel.

./02_make_histograms.py

To the plotting steps

Run the followings

./03_scalemerge.py
./04_drawPlots.py

Then you will have plots in "plots" directory.

tzwi's People

Contributors

jeongsumin avatar jhgoh avatar yhlee52 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

tzwi's Issues

HLT name mismatch

Some failures during ntupling.

Traceback (most recent call last):
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/bin/slc6_amd64_gcc700/nano_postproc.py", line 51, in <module>
    p.run()
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/python/PhysicsTools/NanoAODTools/postprocessing/framework/postprocessor.py", line 131, in run
    (nall, npass, timeLoop) = eventLoop(self.modules, inFile, outFile, inTree, outTree)
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/python/PhysicsTools/NanoAODTools/postprocessing/framework/eventloop.py", line 48, in eventLoop
    m.beginFile(inputFile, outputFile, inputTree, wrappedOutputTree)
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/python/TZWi/TopAnalysis/postprocessing/CombineHLT.py", line 62, in beginFile
    self.initReaders(inputTree)
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/python/TZWi/TopAnalysis/postprocessing/CombineHLT.py", line 69, in initReaders
    setattr(self, "b_"+name, tree.valueReader(name))
  File "/cms/ldap_home/jhgoh/work/CMS/NanoAOD/CMSSW_10_2_11/python/PhysicsTools/NanoAODTools/postprocessing/framework/treeReaderArrayTools.py", line 38, in getValueReader
    if not tree.GetBranch(branchName): raise RuntimeError, "Can't find branch '%s'" % branchName
RuntimeError: Can't find branch 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL'

Complete workflow: Step2-Histogram production

  • 각 cut flow별 정의된 histogram들 만들기 cross section normalization은 여기서는 하지 않음
  • num event로 normalization도 하지 않음
  • 각종 event weight는 곱한 상태
  • systematics를 위한 다양한 조합별로 histogram들을 모두 생성

tzwi-updatedataset and voms-proxy

voms-proxy 없이 사용하면 빈 디텍토리만 만들어집니다.

반드시 DBS 질의를 위해 proxy 인증서가 필요합니다만, 없어도 에러가 발생하지 않습니다.

Complete workflow: Step1-ntuple production

Complete developing ntuple production step

  • TopAnalysis/test/토픽/prod_ntuple에서 각 샘플, 파일별로 run.sh 실행

  • 적당한 /xrootd 유저 디렉토리에 저장해서 위치 공유하기

  • Apply lumi JSON file

  • reco level postprocessor: object selection

  • reco level postprocessor: event selection / cut flow

  • gen level postprocessor: gen level object selector

  • gen weights

  • puweight + systematics

  • JES/JER on the fly + systematics

  • lepton SF event weight + systematics

  • b tag SF event weight + systematics

  • nEvent histogram

Changing 2016 MC Tune

We need to change the 2016 MC tune soon: CUETP8M2T4 (CUETP8M1) -> CP5.
(Maybe... in this year?)

From the PAG meeting on 2020 Feb. 5th,
https://indico.cern.ch/event/885400/contributions/3732106/attachments/1982229/3301574/topSyst_05022020.pdf

Top systematic page recommended changing the 2016 MC tune from the old to the new one.

In the topSystematics twiki page,
https://twiki.cern.ch/twiki/bin/viewauth/CMS/TopSystematics#Parton_shower_Color_Reconnection

They note about the tune:
"If you are using the CUETP8M2T4 (CUETP8M1) tune for the top quark pair (single top) production in the 2016 MC, you should consider switching to the MC samples with the CP5 tune."

Ntuple structure for the dilepton analysis

Finalize ntuple structure for the dilepton analysis

  • Dilepton "good" physics objects branches
  • Combined trigger bits
  • Combined MET filter flags
  • Cut flow bits (or step)
  • Gen level top quarks and additional jets
  • nVertex
  • PU weights
  • b tag weights
  • lepton efficiency scale factors
  • HLT scale factors
  • gen weight, pdf weights, scale weights, etc

Estimate computing resources

Estimate computing resources to produce ntuples

  • CPU time (RD2017, ttbarDoubleLepton) = 2.9kHz
  • Disk space (RD2017, ttbarDoubleLepton friend tree) = 70MB
    • Input file size = 1.5GB

Rough estimation: 1.5GB/970s => (388GB/70h for SingleMuon dataset)

Conclusion: Submit condor jobs to produce ntuples

Complete workflow: Step4-Plotting

  • cross section과 numEvents에 맞춰 scale해서 그림
  • 각종 syst. 를 고려해 syst. band그림
  • 최종 결과에 사용될 plot 몇 개 선정해 histogram들과 syst band 추출

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.