CMS Data Analysis School, Short Exercise MET

Instructions for short exercise MET at CMS Data Analysis School at FNAL LPC in January 2014

Facilitators: Tai Sakuma, Markus Stoye


This is a revived exercise on missing transverse momentum (MET). The last time the school had short exercise on MET was January 2011 (web, twiki). Since then, the primary challenge that we have in MET reconstruction has drastically changed.

The primary challenge in 2011 was to identify and remove the causes of large fake MET, such as HCAL noise, cosmic rays, beam halos. In fact, the short exercise in 2011 focused on how to find large fake MET. By the time the LHC Run-I ended in early 2013, we had developed a matured set of MET filters to reject such large fake MET. Some of the filters were even used in HLT.

In LHC Run-II, the new primary challenge will be to reconstruct MET in high pile-up events. Pile-up interactions do not contain large true MET because they produce only few invisible particles, e.g., neutrinos from Hyperon decays; therefore, a few pile-up interactions do not affect MET reconstruction much. However, in Run-II, the number of pile-up interactions could exceed 100, each one of which will be an inelastic proton-proton interaction at 13-14 TeV. Thus, pile-up interactions will release a very large amount of energy, making accurate MET reconstruction a great challenge.

This short exercise is an introduction to MET in CMS. It covers the basics of MET reconstruction and MET corrections in CMS. The exercise was made based on WorkBookMetAnalysis.

Note: This short exercise is only introductory and doesn't cover the details of advanced MET reconstruction in high pile-up events. If you are interested in learning about or participating the development of advanced MET reconstruction in high pile-up events, you might consider attending "LPC Workshop: JetMET at High Pile-up, Preparation for LHC Run II" (, which will be held two and half weeks after this CMSDAS.

Lecture Slides

This short exercise includes an introductory lecture on missing transverse momentum (MET). The lecture slides can be found at the Indico contribution page at:


Computing Environment at FNAL LPC

This exercise uses the LPC Cluster After logging into, 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 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_14_patch2.

scramv1 project CMSSW CMSSW_5_3_14_patch2

Move down two directories and enter the CMSSW runtime environment:

cd CMSSW_5_3_14_patch2/src

MET Recipe

In order to work out this exercise, you need to check out several extra files with the following commands:

git cms-addpkg PhysicsTools/PatAlgos
git cms-merge-topic -u TaiSakuma:53X-met-131120-01

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


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 cmsdas_2014_jan_fnal at the github repo TaiSakuma/WorkBookMet:

Clone this repo to your local directory and checkout the branch cmsdas_2014_jan_fnal with the following commands.

git clone
cd WorkBookMet/
git checkout cmsdas_2014_jan_fnal
cd ..

Sample AOD files

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

41M  /eos/uscms/store/user/cmsdas/2014/MET/TTJets_AODSIM_532_numEvent100.root
32M  /eos/uscms/store/user/cmsdas/2014/MET/MET_Run2012C_AOD_532_numEvent100.root 
The 1st file is 41Mbyte and contains 100 MC simulated events from /TTJets_MassiveBinDECAY_TuneZ2star_8TeV-madgraph-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM (DAS).

The 2nd file is 32Mbyte and contains 100 events of data collected in 2012 from /MET/Run2012C-24Aug2012-v1/AOD (DAS).


These are the commands used to create the sample files:
cmsrel CMSSW_5_3_8
cd CMSSW_5_3_8/src
edmCopyPickMerge \
  inputFiles=/store/mc/Summer12_DR53X/TTJets_MassiveBinDECAY_TuneZ2star_8TeV-madgraph-tauola/AODSIM/PU_S10_START53_V7A-v1/0000/FED775BD-B8E1-E111-8ED5-003048C69036.root \
  outputFile=TTJets_AODSIM_532.root \
curl -O
cmsRun ./WorkBookMet/ \
    inputFiles=/store/data/Run2012C/MET/AOD/24Aug2012-v1/00000/FE9CCF41-6AFB-E111-82AF-003048679294.root \
    certFile=Cert_198022-198523_8TeV_24Aug2012ReReco_Collisions12_JSON.txt \
    outputFile=MET_Run2012C_AOD_532.root \

Exercise 1: Access to MET objects in AOD

We will access MET objects stored in AOD. Several MET objects are produced in the CMS central reconstruction by the CMS offline group and stored in RECO and AOD. The MET objects stored in RECO and AOD are listed on

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. We sometimes call it raw pfMet to distinguish from corrected pfMet, which we will produce in Exercise 3 below.

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/ --inputPath=/eos/uscms/store/user/cmsdas/2014/MET/TTJets_AODSIM_532_numEvent100.root 

The script will print event contents as follows:

   run       lumi     event             module     met.px    met.phi
     1      34734  10417901              pfMet     36.837     18.857    -31.645     -59.21
     1      34734  10417902              pfMet     19.955    -16.211    -11.636    -144.33
     1      34734  10417903              pfMet     38.794     -9.340    -37.652    -103.93
     1      34734  10417919              pfMet     96.502    -24.198    -93.419    -104.52
     1      34734  10417920              pfMet     22.568    -14.566    -17.238    -130.20
     1      34734  10417921              pfMet     78.944     21.847    -75.861     -73.93
     1      34734  10417927              pfMet     22.652     22.544      2.210       5.60
     1      34734  10417928              pfMet     36.733      9.029    -35.606     -75.77
     1      34734  10417936              pfMet     25.595      3.383    -25.370     -82.41
     1      34734  10417941              pfMet     52.227     51.470     -8.859      -9.77
     1      34734  10417945              pfMet     86.469    -32.518     80.122     112.09
     1      34734  10417949              pfMet     17.556    -16.386     -6.303    -158.96

  • run, lumi, event are the run number, the luminosity section, and the event id.
  • module is the name given to the module that produced the MET when AOD was created. Here it is pfMet. In this particular case, module is sufficient to identify the event content unambiguously. However, in general, four quantities, which are listed at WorkBookCMSSWFramework, are needed to identify uniquely the event content.
  • 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, are the x and y components of MET respectively.
  • met.phi is the azimuth of MET.

Here is the explaination of how we accessed the MET object in WorkBookMet/

First, at L43, the handle of the PFMET collection is created as:

handlePFMETs = Handle("std::vector<reco::PFMET>")

The MET collection is retrieved when getByLabel() of event was called. The collection is specified by the first argument, the same strings that you would give to cms.InputTag() in the cmsRun configuration file. The second argument is the handle created above. At [[ ][L62]],

event.getByLabel(("pfMet", '', 'RECO'), handlePFMETs)

The MET collection can be obtained by calling handleMETs.product(). However, since exactly one MET can be reconstructed per MET definition per event, the collection always contains exactly one object. We obtain the MET object and assigned to met at L63:

met = handlePFMETs.product().front()

In the script, we accessed several variables of MET and printed them on the screen at L69-L72:

print '%10.3f' %,
print '%10.3f' % met.px(),
print '%10.3f' %,
print '%10.2f' % (met.phi()/math.pi*180.0),

All methods of reco::PFMET can be found at Doxygen reco::PFMET.

Exercise 2: 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:

To run on the sample data AOD file,

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

If you scroll up the output text on the terminal screen, you will find the following text:

TrigReport ---------- Modules in Path: p ------------
TrigReport  Trig Bit#    Visited     Passed     Failed      Error Name
TrigReport     1    0        100         80         20          0 HBHENoiseFilter
TrigReport     1    0         80         80          0          0 CSCTightHaloFilter
TrigReport     1    0         80         80          0          0 hcalLaserEventFilter
TrigReport     1    0         80         80          0          0 EcalDeadCellTriggerPrimitiveFilter
TrigReport     1    0         80         80          0          0 goodVertices
TrigReport     1    0         80         80          0          0 trackingFailureFilter
TrigReport     1    0         80         80          0          0 eeBadScFilter
TrigReport     1    0         80         80          0          0 ecalLaserCorrFilter
TrigReport     1    0         80         80          0          0 manystripclus53X
TrigReport     1    0         80         80          0          0 toomanystripclus53X
TrigReport     1    0         80         80          0          0 logErrorTooManyClusters

HBHENoiseFilter rejected 20 events. No other filters rejected any other event.

In the configuration file, we used 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 other than for this short exercise, 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

Exercise 3: 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/ 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 shows an exmple how to access to the corrected METs in corrMet.root.

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

This will simply print the contents as follows.

   run       lumi     event             module     met.px    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

-- TaiSakuma - 02 Jan 2014

Edit | Attach | Watch | Print version | History: r24 < r23 < r22 < r21 < r20 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r24 - 2014-12-01 - 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-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback