PAT Tutorial Week Exercise: How to analyse Top-Quarks using PAT



This TWiki page describes the exercise program for the PAT Tutorial week at cern or in other places. It is accompanied by a set of lectures linked from the WorkBookPATTutorial TWiki. This TWiki page has been setup for the PAT Tutorial week in December 2011.

  • The agenda for the PAT tutorial can be found here
  • The e-space can be found here
  • Please use the "Discussion forum" in the e-space to pose your questions/problems.


This web course is part of the PAT Tutorial, which takes regularly place at cern and in other places. When you follow the TWiki pages that have been linked below and encounter questions marked in RED, the answers to these questions should be filled into the exercise form in the e-space that has been introduced at the beginning of the tutorial. Also the solutions to the all Exercises that you will find on this TWiki page and on the TWiki pages that have been linked below should be filled into the same form. The exercises are marked in three colours, indicating whether this exercise is basic (obligatory), continuative (recommended) or optional (free). The colour coding is summarized in the table below:

Color Code Explanation
red Basic exercise, which is obligatory for the PAT Tutorial.
yellow Continuative exercise, which is recommended for the PAT Tutorial to deepen what has been learned.
green Optional exercise, which shows interesting applications of what has been learned.

All basic exercises ( red ) that you encounter during the PAT Tutorial are obliged and the solutions to the exercises should be filled into the exercise form. For a better overview all exercises of the week are linked from the week calender below. On this TWiki page you will also find additional exercises. We view these additional exercises being part of a Week Spanning Exercise Program complementary to the Daily Exercise Program. The exercises of this Week Spanning Exercise Program mark one or the other step/milestone of an integral analysis, following an integral path through an analysis of events containing Top Quark Pairs. They should help you to figure out how all the individual tools and technical aspects that you learn about PAT during each day of the week come into play and how they play together to make your life easier when doing our analysis.

All of these exercises of the Week Spanning Exercise Program are optional ( green ). Nevertheless we strongly recommend you to take the time to follow them and to discuss them with us in case you have the feeling of getting lost under a big stream of technical information or when struggling to keep the big picture. We are happy to help you at any time of the week and beyond!

Organization of the Week:

The general structure of the Tutorial week is consists of a set of short lectures (in the morning and/or the afternoon) outlining the basic principles of the software to you, followed by the Daily Exercise Program to understand and digest what you have learned. These exercises are lined out on the common TWiki pages shown on the main WorkBookPATTutorial TWiki. For a better overview we also have listed them in the week calender below. We anticipate that this is a lot of work on its own. Please note that in general you can not do any of your usual work aside of the PAT Tutorial. To get maximal gain out of this Tutorial requires your full time and awareness. You should seriously consider it as genuine working time. You will see that it is literal work to go through the very packed program.

We assume that you manage to get through the daily Exercise Program till the afternoon. Nevertheless our experience is that a serious backlog build up on the obliged exercises latest after the third day for many of the participants. Don't worry this is normal. We try therefore to keep the afternoon and the evenings free. We assume that you use this time to work on the exercises that you did not manage to finish yet and to have a look into the week spanning exercise program in case of interest. We will be available for any discussion on these additional exercises and provide suggestions hints and solutions. These will not be unique black and white solutions. Most of the exercises of the week spanning exercise will have more than one possible solution and even more ways to get there, with one or the other advantage or disadvantage over the others.

Week Calender (for Exercises)


Daily Exercise Program (obligatory):


  • Learn the Basics of PAT, how to create a PAT tuple and how to access information from the a pat::Candidate.


Week Spanning Exercise Program (optional):


  • Starting from the standard PAT workflow implement your own basic selection for semi-muonic ttbar events.
  • Write an Analyzer, which shows the M3-Mass distribution for semi-muonic ttbar events and non semi-muonic ttbar events (make your first plots).
  • Reduce the tuple size so that only necessary collections are saved (first steps of workflow/n-tuple optimization).


yellow Week Exercise 1 a):

  • Create a new folder within your CMSSW environment and copy the patTuple_standard_cfg.py to that folder.
  • Investigate it with your favourite tool edmConfigBrowser, or python -i editor
  • Use these ttbar samples:
          process.source.fileNames = cms.untracked.vstring('file:/afs/cern.ch/sw/lcg/tmp/PAT_Tutorial_Summer14/PATWeekExercise/ttbarEvents_semiMutagged_background.root')
          # or
          # process.source.fileNames = cms.untracked.vstring('file:/afs/cern.ch/sw/lcg/tmp/PAT_Tutorial_Summer14/PATWeekExercise/ttbarEvents_semiMutagged_signal.root')
  • Search for possible places for a selection implementation. You should select events with these features (a very basic selection):
    • There should be one or more muons with pt > 20 GeV and |eta| < 2.1
    • There should be four or more jets with pt > 30 GeV and |eta| < 2.4
  • Use 1000 events:
    • Make some control plots, that check, if your selected jets and muons fulfill above requirements ( i.e. muon/jet pt/eta plots).
    • Plot the multiplicities of your selected muons and jets (without their multiplicity requirements)
    • Redo the plots for the semi-muonic events: selected muons/jets: pt, eta and multiplicities.
  • How many events of the two given samples are selected by your basic selection (i.e. one muon and four jets)? What is your signal (semi-muonic ttbar events) efficiency?
  • Which selection effciency do you obtain for non semi-muonic ttbar events (i.e. ttbar background)?

yellow Week Exercise 1 b):
The selected events should be used to compare the M3-Mass distribution of semi-muonic and non semi-muonic ttbar events. Use the selected pat::Jets and calculate the invariant mass of the three leading jets in pt. You can choose freely whether you want to use an EDM-tuple, FWLite, or an EDAnalyzer. Fill a histogram with 75 bins from 0. to 750. What is the mean and the width of the M3-Mass distribution? Compare the number of entries in the histogram with the original number of ttbar events that you processed. What is the efficiency of you selection? (Don't forget also to count the overflow bins).

green Week Exercise 1 c):
Currently you need only the selected pat::Jets to create the M3-Mass distribution. Event size is always an issue when analyzing large data samples. Reduce the size of your tuples by dropping the remaining collections. Hint: Use the edmEventSize tool and edmDumpEventContent to investigate the size of your tuple. Remove also all generator matching. The following file might be of further help for you strippedPatTuple_cff.py. Obtain the PatExamples package by:

git cms-merge-topic -u CMS-PAT-Tutorial:CMSSW_7_1_0_patTutorial

If you want to use it, add following line to your config file:


green Week Exercise 1 d):
The following exercises are optional:

  • Modify your cfg file in a way that only every ten events a report is displayed
  • Modify your cfg file in a way that a summary is displayed at the end
  • Redo the M3-Mass plot with another jet collection.


Daily Exercise Program (obligatory):


  • Learn more about how PAT supports and facilitates high level analysis tasks.
  • Learn about the access of b-tagging information, the application of jet energy corrections and the estimate of jet energy uncertainties using the PAT.


Week Spanning Exercise Program (optional):


  • Appy and use bTags
  • Be able to apply jet energy corrections and smear jets.
  • Be able to use Tools like addJetCollection and runMETUncertainties.

yellow Week Exercise 2 a):
Extend your Top Quark selection by requiring two b tagged jets. How much is the number of ttbar events reduced due to this selection?

yellow Week Exercise 2 b):
Require that one of the jets for M3 should be b-tagged. Vary the jet energy scale and check the impact on the M3 mass plot for the down/up variation is. Which mean values do you obtain with a decreased/increased jet energy scale +- 10% ?

green Week Exercise 2 c):
Apply flavour dependent jet energy corrections for the b-tagged jets. Which mean value for the M3 distribution do you get?

-- RogerWolf - 09-Nov-2011

Edit | Attach | Watch | Print version | History: r47 < r46 < r45 < r44 < r43 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r47 - 2014-07-01 - FelixHoehle
    • 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