LPC Hands-on Advanced Tutorials Session (HATS) on MET

Instructions for HATS on MET at FNAL LPC in March 2014

Contact: Tai Sakuma


Introduction

This topic includes instructions for LPC HATS on MET, which takes place in March 2014.

Hands-on 1: Check out CMSSW and MET recipe

Computing Environment at FNAL LPC

This exercise uses the LPC Cluster cmslpc-sl5.fnal.gov. After logging into cmslpc-sl5.fnal.gov, you need to set up the CMS environment by sourcing one of two files depending on the shell that you are using. For bash users,

source /uscmst1/prod/sw/cms/shrc prod # for bash

For tcsh users,

source /uscmst1/prod/sw/cms/cshrc prod # for tcsh

More information about cmslpc-sl5.fnal.gov can be found at CMSPublic.WorkBookRemoteSiteSpecifics.

CMSSW Environment

You need to move to a directory in which you would like to practice this exercise.

mkdir -p ~/your/work/dir
cd ~/your/work/dir

Please replace ~/your/work/dir with a path to the directory of your choice.

Then, you can check out a CMSSW release. This exercise uses CMSSW_5_3_15.

scramv1 project CMSSW CMSSW_5_3_15

Move down two directories and enter the CMSSW runtime environment:

cd CMSSW_5_3_15/src
cmsenv

MET Recipe

In order to work out this twiki, you need to check out several extra files from github repositories.

A git environment needs to be properly set up in order to be able to check out extra packages from github repositories. The instruction can be found at http://cms-sw.github.io/cmssw/faq.html.

Check out extra files with the following commands:

git cms-addpkg PhysicsTools/PatAlgos # PAT Recipe
git cms-merge-topic cms-analysis-tools:5_3_15-addCSCTightHaloFilter # PAT Recipe
git cms-merge-topic -u TaiSakuma:53X-met-140217-01

These commands are for CMSSW_5_3_15. The commands for other CMSSW versions are listed on

Build

Now, you can build with the scram command:

scram build -j 9

More information about scram can be found at

Exercise files

This exercise uses files in the branch hats_2014_mar_fnal at the github repo TaiSakuma/WorkBookMet:

Clone this repo to your local directory.

git clone git@github.com:TaiSakuma/WorkBookMet

If the above command doesn't work, you can try instead

git clone git://github.com/TaiSakuma/WorkBookMet

Checkout the branch hats_2014_mar_fnal with the following commands.

cd WorkBookMet/
git checkout hats_2014_mar_fnal
cd ..


Hands-on 2: Explore datasets

Sample AOD files

This exercise uses two sample AOD files stored in an EOS at FNAL LPC:

255M  /eos/uscms/store/user/cmsdas/2014/MET/ZeroBias_Run2012C_22Jan2013-v1_AOD_numEvent1000.root
62M  /eos/uscms/store/user/cmsdas/2014/MET/MET120_Run2012C_22Jan2013-v1_AOD_numEvent201.root 
41M  /eos/uscms/store/user/cmsdas/2014/MET/TTJets_AODSIM_532_numEvent100.root
The 1st file contains 1000 events which were triggered by HLT_ZeroBias_* in the run 200491 in Run2012C, which were certified (json), and which were stored in /MinimumBias/Run2012C-22Jan2013-v1/AOD (DAS).

The 2nd file contains 201 events which were triggered by HLT_MET120_* in the run 200491 in Run2012C, which were certified (json), and which were stored in /MET/Run2012C-22Jan2013-v1/AOD (DAS).

The 3rd file contains 100 MC simulated events from /TTJets_MassiveBinDECAY_TuneZ2star_8TeV-madgraph-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM (DAS).

...

These are the commands used to create the 1st and 2nd files:
cmsrel CMSSW_5_3_15
cd CMSSW_5_3_15/src
cmsenv
git clone git@github.com:TaiSakuma/WorkBookMet
git checkout hats_2014_mar_fnal
cd ..
cmsRun WorkBookMet/copyPickMerge_cfg.py \
    inputFiles=/store/data/Run2012C/MinimumBias/AOD/22Jan2013-v1/20001/0434D6A7-FB73-E211-9655-003048F01140.root,/store/data/Run2012C/MinimumBias/AOD/22Jan2013-v1/20001/0C8412FC-BD73-E211-B041-003048F1C9DA.root \
    outputFile=ZeroBias_Run2012C_22Jan2013-v1_AOD.root \
    certFile=WorkBookMet/Cert_20140114_01_200491_JSON.txt \
    triggerConditions=HLT_ZeroBias_\* \
    maxEvents=2057  # <- chosen so that the number of events become 1000 after trigger conditions
mv ZeroBias_Run2012C_22Jan2013-v1_AOD_numEvent2057.root ZeroBias_Run2012C_22Jan2013-v1_AOD_numEvent1000.root 
cp ZeroBias_Run2012C_22Jan2013-v1_AOD_numEvent1000.root /eos/uscms/store/user/cmsdas/2014/MET
cmsRun WorkBookMet/copyPickMerge_cfg.py \
    inputFiles=/store/data/Run2012C/MET/AOD/22Jan2013-v1/10000/00C31E85-BE91-E211-8AEC-003048FFD720.root,/store/data/Run2012C/MET/AOD/22Jan2013-v1/10000/08537154-A091-E211-9DA7-003048678E92.root \
    outputFile=MET120_Run2012C_22Jan2013-v1_AOD.root \
    certFile=WorkBookMet/Cert_20140114_01_200491_JSON.txt \
    triggerConditions=HLT_MET120_\* \
    maxEvents=2000
mv MET120_Run2012C_22Jan2013-v1_AOD_numEvent2000.root MET120_Run2012C_22Jan2013-v1_AOD_numEvent201.root 
cp MET120_Run2012C_22Jan2013-v1_AOD_numEvent201.root /eos/uscms/store/user/cmsdas/2014/MET


Exercises

The AOD sample files contain data collected in the run 200491.

  • Find answers to the following questions by using CMS web services: CADI, iCMS, TWiki, DAS, WBM, PREP, DocDB, LXR, HLT Config Browser.
    • When were the data collected?
    • What was the HLT key used in the run?
    • Which versions of HLT_ZeroBias_* are HLT_MET120_* were used? (What were '*'s in the HLT paths in this run?)
    • What were the pre-scale columns for these HLT paths?
    • Which pre-scale column was actually used?
    • Which PDs are the data triggered by these HLT paths stored?
    • How do you locate the data?
    • Are the data currently stored at Fermilab?

  • Find the same information by the command line?


Hands-on 3: Access to MET objects in AOD

Here, we will access to pfMet, particle-flow MET, which is the negative of the vector sum of pT of all reconstructed particle flow candidates in the event.

\[ {\hspace{0.1ex}\not\mathrel{\hspace{-0.1ex}\vec{E}}}_\textrm{T}^\textrm{raw} = -\sum_{i\in \textrm{all}} \vec{p}_{\textrm{T}i} \]

We sometimes call it raw pfMet to distinguish from corrected pfMet, which we will produce later.

Note: In CMSSW_5_3_X, which was used to produce the sample files, pfMet is the negative of the vector sum of ET instead of pT. We switched from ET to pT at CMSSW_6_0_X.

We will use the python script:

This script uses FWLite.Python, introduced at WorkBookFWLitePython.

We will use this script to access pfMet in the MC AOD sample file introduced above:

Execute the script:

./WorkBookMet/printMet_AOD.py --inputPath=/eos/uscms/store/user/cmsdas/2014/MET/ZeroBias_Run2012C_22Jan2013-v1_AOD_numEvent1000.root

The script will print event contents as follows:

   run       lumi     event     met.pt     met.px     met.py    met.phi
200491        212 255053363      7.186     -1.839      6.946     104.83
200491        212 255247499     13.971     13.532      3.472      14.39
200491        212 255280539     32.086      9.459     30.660      72.85
200491        212 255343555     31.557     27.650     15.210      28.81
200491        212 255501891     23.574     19.861     12.700      32.60
200491        212 255649379      1.585      1.414     -0.716     -26.84
200491        212 255881363     18.739     13.624    -12.866     -43.36
200491        212 255988467     23.115     22.483      5.366      13.42
200491        212 256203515     13.184     -7.333    -10.956    -123.80
200491        212 256238275     27.825    -16.356    -22.511    -126.00
200491        212 256326827     31.791    -12.983    -29.019    -114.10
200491        212 256323987     20.441     19.904      4.654      13.16
200491        212 256351491     16.441     -2.489    -16.252     -98.71
200491        212 256352459     22.466    -19.864    -10.495    -152.15
200491        212 255259541     13.226     -7.177    -11.109    -122.87
200491        212 255304645     27.764     27.641     -2.611      -5.40

  • run, lumi, event are the run number, the luminosity section, and the event id.
  • met.pt is the magnitude of MET. MET is, in principle, a vector on the px-py plane. However, we often casually call its magnitude MET as well.
  • met.px, met.py are the x and y components of MET respectively.
  • met.phi is the azimuth of MET.

Exercises

  • Modify WorkBookMet/printMet_AOD.py and make histograms of met.px, met.py, and met.pt.
    • Why are they distributed in the way they are?
    • What are possible distribution functions?
    • Do met.px, met.py have Gaussian with the mean zero and the same variance? If so, what will be the distribution for met.pt?

To create a file in python

outFile = ROOT.TFile('filename.root', 'RECREATE')

To create a histogram in python

hist = ROOT.TH1D("hist_name", "hist_title", 80, -40, 40)

To fill a histogram

hist.Fill(value)

To save the histogram in the file and close the file

outFile.Write()
outFile.Close()


Hands-on 4: Apply MET filters

Large MET is caused not only by interesting physics processes in collisions such as production of invisible particles. In fact, large MET has more often uninteresting causes such as detector noise, cosmic rays, and beam-halo particles. MET with uninteresting causes is called false MET, anomalous MET, or fake MET. For an accurate reconstruction of MET, it is, therefore, not sufficient to reconstruct all visible particles produced in collisions.

We developed several algorithms to identify false MET. These algorithms, for example, use timing, pulse shape, and topology of signal. After the identified false MET is removed, the agreement of the MET spectrum with MC, in which causes of false MET are not explicitly simulated, will typically improve significantly.

Here, we will apply a set of MET filters. We will use the python configuration file:

In the configuration file, we use the Global Tag FT_R_53_V21::All at L25.

process.GlobalTag.globaltag = cms.string("FT_R_53_V21::All")

The Global Tag specifies a set of alignment and calibration constants stored in the database to be used in cmsRun. If you use the configuration file met_filters_cfg.py other than for this HATS, you might need to find the correct Global Tag at

The MET group recommends a set of MET filters to be used for physics analyses. The recommendation is documented at

Run the filters on a sample AOD file,

cmsRun WorkBookMet/met_filters_cfg.py inputFiles=file:/eos/uscms/store/user/cmsdas/2014/MET/MET120_Run2012C_22Jan2013-v1_AOD_numEvent201.root

Exercises

  • The sample AOD file contains 201 events triggered by HLT_MET120_*.
    • How many events are rejected by which filters?
    • How many events are not rejected by any filter?

  • Look at events with cmsShow.

cmsShow /eos/uscms/store/user/cmsdas/2014/MET/MET120_Run2012C_22Jan2013-v1_AOD_numEvent201.root


Hands-on 5: Apply MET corrections

MET objects accessed above are called raw MET. The raw MET is systematically different from true MET, i.e., the transverse momentum carried by invisible particles, for many reasons including the non-compensating nature of the calorimeters and detector misalignment. To make MET a better estimate of true MET, we will apply MET corrections with the python configuration file:

cmsRun ./WorkBookMet/corrMet_cfg.py inputFiles=file:/eos/uscms/store/user/cmsdas/2014/MET/TTJets_AODSIM_532_numEvent100.root

This will produce a file corrMet.root, which contains various MET collections, each with different combinations of the MET corrections as summarized in the table.

module name descriptions
pfMetT0rt pfMET + Type-0RT
pfMetT0rtT1 pfMET + Type-0RT + Type-I
pfMetT0pc pfMET + Type-0PC
pfMetT0pcT1 pfMET + Type-0PC + Type-I
pfMetT0rtTxy pfMET + Type-0RT + xy-Shift
pfMetT0rtT1Txy pfMET + Type-0RT + Type-I + xy-Shift
pfMetT0pcTxy pfMET + Type-0PC + xy-Shift
pfMetT0pcT1Txy pfMET + Type-0PC + Type-I + xy-Shift
pfMetT1 pfMET + Type-I
pfMetT1Txy pfMET + Type-I + xy-Shift

The python script printMet_corrMet.py shows an exmple how to access to the corrected METs in corrMet.root.

./WorkBookMet/printMet_corrMet.py --inputPath=./corrMet.root

This will simply print the contents as follows.

   run       lumi     event             module     met.pt     met.px     met.py    met.phi
     1      34734  10417901              pfMet     36.837     18.857    -31.645     -59.21
     1      34734  10417901          pfMetT0rt     32.819      9.912    -31.286     -72.42
     1      34734  10417901        pfMetT0rtT1     37.309     -0.433    -37.307     -90.67
     1      34734  10417901          pfMetT0pc     32.296      9.728    -30.796     -72.47
     1      34734  10417901        pfMetT0pcT1     36.822     -0.618    -36.816     -90.96
     1      34734  10417901            pfMetT1     38.615      8.511    -37.665     -77.27
     1      34734  10417901       pfMetT0rtTxy     29.873     10.417    -27.998     -69.59
     1      34734  10417901     pfMetT0rtT1Txy     34.018      0.072    -34.018     -89.88
     1      34734  10417901       pfMetT0pcTxy     29.349     10.233    -27.508     -69.59
     1      34734  10417901     pfMetT0pcT1Txy     33.528     -0.113    -33.528     -90.19
     1      34734  10417901         pfMetT1Txy     35.539      9.016    -34.377     -75.30
     1      34734  10417902              pfMet     19.955    -16.211    -11.636    -144.33
     1      34734  10417902          pfMetT0rt     15.390     -9.634    -12.002    -128.76
     1      34734  10417902        pfMetT0rtT1     12.675     -5.521    -11.410    -115.82
     1      34734  10417902          pfMetT0pc     16.339    -13.267     -9.537    -144.29
     1      34734  10417902        pfMetT0pcT1     12.799     -9.153     -8.945    -135.66
     1      34734  10417902            pfMetT1     16.381    -12.098    -11.044    -137.61
     1      34734  10417902       pfMetT0rtTxy     14.504     -9.535    -10.929    -131.10
     1      34734  10417902     pfMetT0rtT1Txy     11.672     -5.421    -10.337    -117.68
     1      34734  10417902       pfMetT0pcTxy     15.653    -13.167     -8.465    -147.27
     1      34734  10417902     pfMetT0pcT1Txy     11.998     -9.054     -7.873    -138.99
     1      34734  10417902         pfMetT1Txy     15.601    -11.998     -9.971    -140.2


Hands-on 6: Learn MET in pile-up interactions

Exercises

In the Exercises in Hands-on 3, we modified WorkBookMet/printMet_AOD.py and made histograms of met.px, met.py, and met.pt. Here we study how these distributions change with the number of the pile-up interactions.

  • Modify WorkBookMet/printMet_AOD.py further and make the same histograms of met.px, met.py, and met.pt for each of the four different ranges of the number of the reconstructed vertices: [1, 9], [10, 19], [20, 26], and [27, ∞].

You can make handle for vertices as

handleVertex = Handle("std::vector<reco::Vertex>")

With this handle, the number of the reconstructed vertices can be obtained with the following piece of code:

event.getByLabel(("offlinePrimaryVertices", "", ""), handleVertex)
vertices = handleVertex.product()
nvtx = len(vertices)



-- TaiSakuma - 18 Mar 2014

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r15 - 2014-03-26 - TaiSakuma
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback