PAT Tutorial JTerm - Fermilab - 4 August 2009

Introduction

In this tutorial we will do 8 PAT exercises. It assumes that you are working on cmslpc cluster so that you can copy scripts from my area - /uscms_data/d2/malik/JTERM_August2009/CMSSW_3_1_2/src/. We will use the release CMSSW_3_1_12 which has all the latest and greatest tags for PAT. In principle, if you are just working and modifying configuration files and unless you write you own analyzer (C++ code) you do not need to compile i.e. scram b. We will do exercises 1 to 6 WITHOUT compiling anything. In Exercise 7, we will use our own analyzer and in Exercise 8 we will modify this. Hence we would do scram b for Exercise 7 and 8.

Setting up the environment

Setup a Release in CMSSW_3_1_2 and copy the tutorial material

Login to cmslpc or lxplus
If on cmslpc execute the next command. If on lxplux, skip it.
source /uscmst1/prod/sw/cms/cshrc uaf 

cmscvsroot CMSSW
mkdir YOURWORKINGAREA
cd YOURWORKINGAREA
scram p CMSSW CMSSW_3_1_2
cd CMSSW_3_1_2/src
cmsenv
mkdir PhysicsTools
mkdir PhysicsTools/PatExamples
If on lxplus, you should do
cp -r /afs/cern.ch/cms/software/tutorials/JTERM_August2009/CMSSW_3_1_2/src/* ./
If on cmslpc, you should do
cp -r /uscms_data/d2/malik/JTERM_August2009/CMSSW_3_1_2/src/* ./

After these steps:

  • notice that you have in your current working area, a directory PhysicsTools/ and
  • a PAT Tuple myTuple_selectedLayer1.root that we will use in Exercise 8. I have already made this PAT Tuple to save time.
  • However, in Exercise 1, we will create a PAT Tuple called myTuple_Exercise1.root that we will use in Exercise 7.

NOTE: You will execute all cmsRun commands from YOURWORKINGAREA/CMSSW_3_1_2/src where you already are. So please stay and work in this directory.

Make your Pat Tuple

  • First look at the python configuration file: patLayer1_fromAOD_full_cfg.py
    • See how all exercises are commented out. From Exercise 1 to 6 we will uncomment and comment few lines in this python configuration file and also see the size of the output root file created. For every exercise you uncomment the lines for that exercise and comment back the lines in previous exercise.
    • In order to edit this file use your favorite editor. This file is located here: YOURWORKINGAREA/CMSSW_3_1_2/src/PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py.
  • All the scripts are in YOURWORKINGAREA/CMSSW_3_1_2/src/PhysicsTools/PatExamples/test directory
  • The analyzer PatBasicAnalyzer.cc is in the directory YOURWORKINGAREA/CMSSW_3_1_2/src/PhysicsTools/PatExamples/plugins/
  • Just to add here, for Exercise 7 and 8 we will use/modify analyzePatBasics_cfg.py python configuration script and use/modify the analyzer PatBasicAnalyzer.cc and compile it.

Exercise 1

We produce Pat Tuple with default PAT settings. In this exercise we will process all 1300 events and produce our own PAT Tuple. This will take about 10 minutes. We will use this PAT Tuple in Exercise 7. To make this PAT Tuple you need to edit the patLayer1_fromAOD_full_cfg.py first. Use your favorite editor as you like. For example,
pico PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py
is one way to edit.

First look for lines that say Exercise - 1 and uncomment the lines below them. Thus you will uncomment the following lines

#process.maxEvents.input = -1
#process.out.fileName = 'myTuple_Exercise1.root'

Now do:

cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py
you should see an output like this on the screen as the events are processed:

02-Aug-2009 16:59:58 CDT  Initiating request to open file dcap://cmsdca.fnal.gov:24137/pnfs/fnal.gov/usr/cms/WAX/11/store/relval/CMSSW_3_1_0/RelValTTbar/GEN-SIM-RECO/STARTUP31X
_V1-v1/0001/D48CD6F6-8F66-DE11-B835-001D09F2983F.root

......................
......................
.....................

Begin processing the 179th record. Run 1, Event 429, LumiSection 666674 at 02-Aug-2009 17:05:54 CDT
Begin processing the 180th record. Run 1, Event 430, LumiSection 666674 at 02-Aug-2009 17:05:54 CDT
Begin processing the 181st record. Run 1, Event 431, LumiSection 666674 at 02-Aug-2009 17:05:55 CDT
Begin processing the 182nd record. Run 1, Event 432, LumiSection 666674 at 02-Aug-2009 17:05:55 CDT
Begin processing the 183rd record. Run 1, Event 433, LumiSection 666674 at 02-Aug-2009 17:05:56 CDT
Begin processing the 184th record. Run 1, Event 434, LumiSection 666674 at 02-Aug-2009 17:05:56 CDT
Begin processing the 185th record. Run 1, Event 435, LumiSection 666674 at 02-Aug-2009 17:05:57 CDT
Begin processing the 186th record. Run 1, Event 436, LumiSection 666674 at 02-Aug-2009 17:05:58 CDT
Begin processing the 187th record. Run 1, Event 437, LumiSection 666674 at 02-Aug-2009 17:05:58 CDT
Begin processing the 188th record. Run 1, Event 438, LumiSection 666674 at 02-Aug-2009 17:05:59 CDT
Begin processing the 189th record. Run 1, Event 439, LumiSection 666674 at 02-Aug-2009 17:05:59 CDT

......................
......................
......................

TimeReport   0.000174   0.000197   0.000174   0.000197   0.000174   0.000197 metJESCorIC5CaloJetMuons
TimeReport   0.000328   0.000356   0.000328   0.000356   0.000328   0.000356 layer1METs
TimeReport   0.000444   0.000416   0.000444   0.000416   0.000444   0.000416 allLayer1Summary
TimeReport   0.000235   0.000243   0.000235   0.000243   0.000235   0.000243 selectedLayer1Electrons
TimeReport   0.000071   0.000084   0.000071   0.000084   0.000071   0.000084 selectedLayer1Muons
TimeReport   0.000828   0.000819   0.000828   0.000819   0.000828   0.000819 selectedLayer1Taus
TimeReport   0.000117   0.000122   0.000117   0.000122   0.000117   0.000122 selectedLayer1Photons
TimeReport   0.000320   0.000322   0.000320   0.000322   0.000320   0.000322 selectedLayer1Jets
TimeReport   0.000364   0.000355   0.000364   0.000355   0.000364   0.000355 selectedLayer1Summary
TimeReport   0.000068   0.000069   0.000068   0.000069   0.000068   0.000069 cleanLayer1Muons
TimeReport   0.000184   0.000177   0.000184   0.000177   0.000184   0.000177 cleanLayer1Electrons
TimeReport   0.000102   0.000118   0.000102   0.000118   0.000102   0.000118 cleanLayer1Photons
TimeReport   0.000210   0.000203   0.000210   0.000203   0.000210   0.000203 cleanLayer1Taus
TimeReport   0.000430   0.000452   0.000430   0.000452   0.000430   0.000452 cleanLayer1Jets
TimeReport   0.000279   0.000270   0.000279   0.000270   0.000279   0.000270 cleanLayer1Hemispheres
TimeReport   0.000192   0.000186   0.000192   0.000186   0.000192   0.000186 cleanLayer1Summary
TimeReport   0.000028   0.000031   0.000028   0.000031   0.000028   0.000031 countLayer1Electrons
TimeReport   0.000027   0.000026   0.000027   0.000026   0.000027   0.000026 countLayer1Muons
TimeReport   0.000033   0.000027   0.000033   0.000027   0.000033   0.000027 countLayer1Taus
TimeReport   0.000039   0.000035   0.000039   0.000035   0.000039   0.000035 countLayer1Leptons
TimeReport   0.000015   0.000022   0.000015   0.000022   0.000015   0.000022 countLayer1Photons
TimeReport   0.000098   0.000106   0.000098   0.000106   0.000098   0.000106 countLayer1Jets
TimeReport   0.000062   0.000061   0.000062   0.000061   0.000062   0.000061 TriggerResults
TimeReport   0.010539   0.010567   0.010539   0.010567   0.010539   0.010567 out
TimeReport        CPU       Real        CPU       Real        CPU       Real Name
TimeReport             per event        per module-run      per module-visit 

T---Report end!


=============================================

MessageLogger Summary

 type     category        sev    module        subroutine        count    total
 ---- -------------------- -- ---------------- ----------------  -----    -----
    1 fileAction           -s PoolSource:sourc                       2        2
    2 fileAction           -s PostModule                             1        1

 type    category    Examples: run/evt        run/evt          run/evt
 ---- -------------------- ---------------- ---------------- ----------------
    1 fileAction           pre-events       pre-events       
    2 fileAction           1/5400                            

Severity    # Occurrences   Total Occurrences
--------    -------------   -----------------

After this is done, you should see a PAT Tuple myTuple_Exercise1.root file as follows in your working current directory. This has been made with default PAT settings. We will use this later in Exercise -7.

-rw-r--r--  1 malik us_cms 27210011 Aug  2 14:24 myTuple_Exercise1.root

Event Content

In this section we do exercises 2 to 6 and see also how the size of the PAT Tuple varies if we apply cuts, add additional information etc. We will also learn how to check the disk size of branches in root files using couple of tools available.

Event size with default PAT settings

In this exercise we run patLayer1_fromAOD_full_cfg.py We change only the number of events to 100 and choose a different output root file name. We are applying no cuts etc. and adding/reducing no information than the default.

Exercise 2

Look for lines that say Excercise -1 and Comment these lines using #

process.maxEvents.input = -1
process.out.fileName = 'myTuple_Exercise1.root'

Look for lines that say Exercise -2 and Uncomment the following lines

#process.maxEvents.input = 100 
ABOVE LINE (#process.maxEvents.input = 100 ) REMAINS UNCOMMENTED IN ALL THE SUBSEQUENT EXERCISES
#process.out.fileName = 'myTuple_Exercise2.root'
Then do:
cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py

You will now process 100 events. A file myTuple_Exercise2.root is created in your current directory. A snapshot of this root file is shown here:

Snapshot_AsItIs.png

Note:

  • PAT cleanLayer1Objects branches. We see cleanLayer1Objects since we ran the sequence process.out.outputCommands.extend(patEventContent) in our patLayer1_fromAOD_full_cfg.py file. The contents of this sequence are here.
  • If you modified (which you can try later) the sequence to patEventContentNoLayer1Cleaning one would get selectedLayer1Objects instead of cleanLayer1Objects. Notice that MET does not have prefix clean as there is nothing to clean.

In fact I created the the PAT Tuple myTuple_selectedLayer1.root using the sequence patEventContentNoLayer1Cleaning because we wanted to do cleaning ourselves ( Exercise 8). So we needed unclean PAT Tuple.

Now if you list your present directory, it should look like this:

[malik@cmslpc05 src]$ ll
total 29120
-rw-r--r--  1 malik us_cms  2552735 Aug  2 17:36 myTuple_Exercise2.root
-rw-r--r--  1 malik us_cms 27210011 Aug  2 17:15 myTuple_Exercise1.root

Note the size of myTuple_Exercise2.root as we will compare it to other root files in subsequent exercises.

Selection of objects with cuts

The most straight forward way to reduce the event size is to apply cuts on the PAT objects. This can be done by:
  • String base selectors
    • allows you to make selection on the layer 1 produced objects. The config files for this are here. By defaults no cuts are applied.
  • Selectors for making layer 1 objects - example - process.selectedLayer1Jets.cut = 'pt > 30. & abs(eta) < 2.5'
  • More details about selection cut parser are here

In this exercise we apply eta and phi cut on the selectedLayer1Jets

Exercise 3

Comment the following line

process.out.fileName = 'myTuple_Exercise2.root'

Look for lines that say Exercise - 3 and Uncomment the following lines

#process.selectedLayer1Jets.cut = 'pt > 30. & abs(eta) < 2.5'
#process.out.fileName = 'myTuple_Exercise3_WithCut.root'

Note that we are applying cuts on the selectedLayer1Jets which are IC5 by default. Then do

cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py

Now another root file called myTuple_Exercise3_WithCut.root is created and your current directory looks like this

-rw-r--r--  1 malik us_cms 27210011 Aug  2 17:15 myTuple_Exercise1.root
-rw-r--r--  1 malik us_cms  2552735 Aug  2 17:36 myTuple_Exercise2.root
-rw-r--r--  1 malik us_cms  2302734 Aug  2 17:57 myTuple_Exercise3_WithCut.root

As you can see by applying cuts you have reduced the files size from 2552735 bytes to 2302734.

Keep reco information in PAT Tuple

On may want to retain some reco information in their PAT tuple to be able to have access to it. In this exercise we keep recoCalo tower information in the PAT Tuple produced.

Exercise 4

Look for lines that say Exercise -3 and Comment the following lines

process.selectedLayer1Jets.cut = 'pt > 30. & abs(eta) < 2.5'
process.out.fileName = 'myTuple_Exercise3_WithCut.root'

Look for lines that say Exercise-4 and Uncomment the following lines

# ,'keep *_towerMaker_*_*'
#process.out.fileName = 'myTuple_Exercise4_towerMaker.root'
Then do
cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py
We want to keep reco Calo towers in case one may want to match, say electrons, to them. Now your current directory looks like this
-rw-r--r--  1 malik us_cms 27210011 Aug  2 17:15 myTuple_Exercise1.root
-rw-r--r--  1 malik us_cms  2552735 Aug  2 17:36 myTuple_Exercise2.root
-rw-r--r--  1 malik us_cms  2302734 Aug  2 17:57 myTuple_Exercise3_WithCut.root
-rw-r--r--  1 malik us_cms  4706273 Aug  2 18:10 myTuple_Exercise4_towerMaker.root

As you can see by keeping the calo tower information in the PAT Tuple the file size increase from 2552735 bytes to 4706273.

If you browse the root file you created you see that there is addition branch with calo tower information

Snapshot_CaloTower.png

Embedding of objects

The RECO/AOD objects contain several Ref's giving access to related information, pointing to parts of collections in other branches on the file. Sometimes considerable size sample gains can be obtained by retaining only the referenced objects, and dropping the overall collection being referred to. CaloJets for example contain Ref's to the CaloTowers they were constructed from. It can be beneficial though to only keep the CaloTowers belonging to your selected jets, rather than the full collection. In the PAT there is a feature called "embedding" which foresees the machinery to implement the above-mentioned use case in a way transparent to the user. The advantage is clear: embedding only the necessary information, the redundant information can be dropped from the event. The configuration parameters to use this feature are all defined in the *cfi.py files here: embedTrack, embedCaloTowers, embedSuperCluster, embedCombinedMuon,...

For more details see: Embedding

In this exercise we embed the =CaloTower=informtion in the PAT Tuple.

Exercise 5

Look for lines with Exercise - 4 Comment the following lines

 ,'keep *_towerMaker_*_*'
process.out.fileName = 'myTuple_Exercise4_towerMaker.root'

Look for lines with Exercise - 5 and Uncomment the following lines

#process.allLayer1Jets.embedCaloTowers=True
#process.out.fileName = 'myTuple_Exercise5_EmbedCaloTower.root'

Then do

cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py

Now your current directory looks like this

-rw-r--r--  1 malik us_cms 27210011 Aug  2 17:15 myTuple_Exercise1.root
-rw-r--r--  1 malik us_cms  2552735 Aug  2 17:36 myTuple_Exercise2.root
-rw-r--r--  1 malik us_cms  2302734 Aug  2 17:57 myTuple_Exercise3_WithCut.root
-rw-r--r--  1 malik us_cms  4706273 Aug  2 18:10 myTuple_Exercise4_towerMaker.root
-rw-r--r--  1 malik us_cms  3174278 Aug  2 18:22 myTuple_Exercise5_EmbedCaloTower.root

As you can see embedding takes less disk space (3174278 bytes )than keeping all the reco calo tower information (4706273).

NOTE: You can uncomment the line jetTowers_->Fill(jet->getCaloConstituents().size()); = in the code =PatBasicAnalyzer.cc used in Exercise - 7 to access this embedded information. BUT you will have to use the PAT Tuple that has the embedded information as is produced ( like he one produced by this Exercise - 5) otherwise you will get an error message.

Adding Jet Collection

By default the Jet collection present is IC5 ( Iterative Cone 0.5). You can add or switch the jet collection to say KT4, SC5 or SC7. In this exercise we add KT4 Jet collection to PAT Tuple in addition to the default IC5. The default shows up just as selectedLayer1Jets in the PAT Tuple. You can look at all the JET information here.

Exercise 6

Look for lines with Exercise - 5 and Comment the following lines

process.allLayer1Jets.embedCaloTowers=True
process.out.fileName = 'myTuple_Exercise5_EmbedCaloTower.root'

Look for lines with Exercise - 6 and uncomment the following lines

#from PhysicsTools.PatAlgos.tools.jetTools import *
#addJetCollection(process,cms.InputTag('kt4CaloJets'),'KT4',
#                        doJTA=True,doBTagging=True,jetCorrLabel=('KT4','Calo'),doType1MET=True,doL1Counters=False,
#                        genJetCollection=cms.InputTag("kt4GenJets"))

#                                ,'keep *_selectedLayer1Jets*_*_*'

#process.out.fileName = 'myTuple_Exercise6_addJetKT4Collection.root'

Then do

cmsRun PhysicsTools/PatExamples/test/patLayer1_fromAOD_full_cfg.py

Now your current directory looks like this

-rw-r--r--  1 malik us_cms 27210011 Aug  2 17:15 myTuple_Exercise1.root
-rw-r--r--  1 malik us_cms  2552735 Aug  2 17:36 myTuple_Exercise2.root
-rw-r--r--  1 malik us_cms  2302734 Aug  2 17:57 myTuple_Exercise3_WithCut.root
-rw-r--r--  1 malik us_cms  4706273 Aug  2 18:10 myTuple_Exercise4_towerMaker.root
-rw-r--r--  1 malik us_cms  3174278 Aug  2 18:22 myTuple_Exercise5_EmbedCaloTower.root
-rw-r--r--  1 malik us_cms  3587402 Aug  2 18:33 myTuple_Exercise6_addJetKT4Collection.root

If you browse the root file you created you see that there is addition branch with selectedLayer1jetsKT4

Snapshot_KT4.png

There are two tools you can use to measure the disk size of your PATtuples besides doing ls -al

  • edmEventSize
  • diskSize.pl

Due to ROOT compression, the event size depends on the number of events in the a file and so should be measured only on sufficiently large files ( atleast one thousand events, more is better).

You can use edmEventSize to know the size of different branches in, say, myTuple_Exercise6_addJetKT4Collection.root as follows

[malik@cmslpc05 src]$ edmEventSize -v  myTuple_Exercise6_addJetKT4Collection.root
File myTuple_Exercise6_addJetKT4Collection.root Events 100
patJets_selectedLayer1JetsKT4__PAT. 50191.4 19289.9
patJets_cleanLayer1Jets__PAT. 45172.3 18611.5
patJets_selectedLayer1Jets__PAT. 44907.1 18645.5
patElectrons_cleanLayer1Electrons__PAT. 24682.7 16103.8
patMuons_cleanLayer1Muons__PAT. 13418 10876.1
patPhotons_cleanLayer1Photons__PAT. 10633.6 7287.18
patTaus_cleanLayer1Taus__PAT. 8736.07 6208.63
patMETs_layer1METs__PAT. 3080.71 2908.95
patHemispheres_cleanLayer1Hemispheres__PAT. 1413.16 1112.97
EventAuxiliary 144 144

You can use diskSize.pl as follows

[malik@cmslpc05 src]$ ./PhysicsTools/PatExamples/diskSize.pl myTuple_Exercise6_addJetKT4Collection.root > myTuple.html
Getting list of branches ...
Events: 100
Getting items in the collections (it can take a while) ...
[malik@cmslpc05 src]$ 
You can copy myTuple.html to your public_html area, and view the size of different branches. It should look like THIS.

We are DONE with patLayer1_fromAOD_full_cfg.py script. We will not use this script further. Now we switch to making our own EDAnalyzer in Exercise - 7.

Access pat::Candidates and Running your own analyzer

One can access pat objects using an EDAnlyzer (C++ code) where you can do your own manipulations of object variables and make your own histograms.

Exercise 7

In this exercise you will find how to access the most important PAT candidates using a simple EDAnalyzer. This EDAnalyzer is PatBasicAnalyzer.cc and the configuration file we will run is analyzePatBasics_cfg.py

For further details on this analyzer see here. Go through the details to see explanation for different parts of this analyzer.

Before you go further and do the exercise, you need to compile by doing

scram b

The python configuration script analyzePatBasics_cfg.py is located in the directory here:

PhysicsTools/PatExamples/test/

To edit it do

pico PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py

In the analyzePatBasics_cfg.py look for lines with Exercise - 7 and uncomment the following lines:

#     'file:myTuple_Exercise1.root'
#                                   fileName = cms.string('analyzePatBasics.root')
#process.p = cms.Path(process.analyzeBasicPat)

NOTE: You are now using and running on the PAT Tuple myTuple_Exercise1.root that you created in Exercise -1

Then do

cmsRun PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py

After you run successfully, you will see a file called analyzePatBasics.root in your current directory.

Browse through the file analyzePatBasics.root and look at the histograms you intended to plot.

To see pat::Objects (like pat::Muons, pat::Jets) refer to SWGuidePATDataFormats.

Cleaning

The high-level analysis objects (muons, electrons, etc.) are provided by dedicated reconstruction groups, the Physics Object Groups (POG). Each object basically belongs to a separate POG. As a consequence, it may happen that some low-level detector information (e.g., energy deposit in the calorimeters) is used to reconstruct several candidates. As an example, clustered energy in the electromagnetic calorimeter (ECAL) may lead to the reconstruction of a photon. If a track points to the cluster, an isolated electron might also be formed. Finally, the energy deposit might also appear as a jet candidate in the event. See more information on PAT cleaning at SWGuidePATCleaning

First of all, to run cleaning, Exercise 8, you need uncleaned objects. There is PAT Tuple called myTuple_selectedLayer1.root in you working directory which contains objects that are not cleaned. We will run PAT cleaning on them and see if it worked.

We will use default value of dR=0.5 to find jets that overlap electrons. You can discard such over lapping jets if you wish in your analysis.

Exercise 8

To do this exercise we will modify PatBasicAnalyzer.cc code to look like THIS, which you can copy and paste entirely. For further details on this code see here.

So now you need to edit two files PatBasicAnalyzer.cc & analyzePatBasics_cfg.py



The analyzer PatBasicAnalyzer.cc is located in the directory here:

PhysicsTools/PatExamples/plugins/

To edit PatBasicAnalyzer.cc do:

pico PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc

Remove all the contents of this file and paste everything from HERE. Save the file. You can later see the differences in the two files ( before and after cut paste) later. The changes you have made in the analyzePatBasics_cfg.py and PatBasicAnalyzer.cc are explained on the twiki SWGuidePATCleaningExercises.


DO NOT CHANGE YOUR CURRENT WORKING DIRECTORY


The python configuration script analyzePatBasics_cfg.py is located in the directory here:

PhysicsTools/PatExamples/test/

To edit analyzePatBasics_cfg.py do:

pico PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py

To modfiy the analyzePatBasics_cfg.py search for lines that say Exercise - 7 and comment back the following lines from your current analyzePatBasics_cfg.py.

     'file:myTuple_Exercise1.root'
      fileName = cms.string('analyzePatBasics.root')

process.p = cms.Path(process.analyzeBasicPat)

Look for lines with Exercise -8 and uncomment the following lines

#     'file:myTuple_selectedLayer1.root'

#                                   fileName = cms.string('cleaning.root')

#process.load("PhysicsTools.PatAlgos.cleaningLayer1/cleanLayer1Objects_cff")
#process.p = cms.Path(process.cleanLayer1Objects*process.analyzeBasicPat)

Now compile again as you have modified the analyzer. For this do

scram b
again.

NOTE: You are now using and running on the PAT Tuple myTuple_selectedLayer1.root that was already provided to you when you copied tutorial material. It is also explained down couple of lines from here, how it was made.

Then do:

cmsRun PhysicsTools/PatExamples/test/analyzePatBasics_cfg.py

After you run successfully, you will see a root file called cleaning.root


*************************************************************************************************************************************************
Before you browse the root file, there are few things to know. The PAT tuple myTuple_selectedLayer1.root on which ran our cleaning analyzer was made by running the sequence patEventContentNoLayer1Cleaning. This sequence is defined in PatEventContent_cff.py. We wanted to clean objects ourselves so we just wanted selectedLayer1Objects and not cleanLayer1Objects. This sequence just gave us uncleaned objects as we asked for. We ran our analyzer on selectedLayer1Objects and produced cleaned object distributions. The cleaning criteria was dR=0.5 (jets,electrons) and picked up from here.

We can also make cleanLayer1Objects, by running the sequence patEventContent. In this case the cleaning we did (through our analyzer) on selectedLayer1Objects is run actually for us in PAT by running the process cleanLayer1Objects defined in cleanLayer1Objects_cff.py. This process uses process like cleanLayer1Jets defined in jetCleaner_cfi.py and included via the statement from PhysicsTools.PatAlgos.cleaningLayer1.jetCleaner_cfi import * in cleanLayer1Objects_cff.py. The code that does it is PATCleaner.cc.
*************************************************************************************************************************************************

Browse through the root file cleaning.root for the histograms we have filled.

First, we check the ΔR distributions between the jets and the closest electron, with and without overlap. We see that, as expected, the jet cleaner considers there is overlap if ΔR is smaller than 0.5:

dRelejetOverlap.png

Then we can plot the number of overlaps: although most jets do not overlap, we even find cases where there is multiple overlap:

noOverlaps.png

Next, we can have a look at the pt distributions. We find that overlapping electrons do not exhibit a significantly different behaviour from electrons in general. Notice how the first bin is lower, because there is a reconstruction cut at 3 GeV:

eptAll_Ov.png

This is not true for jets, where we find that low-pt jets seem to have relatively less overlap. Also, there doesn't seem to be any cut-off in the pt! The first exercise set will correct that...

jptAll_Ov.png

Another important check is the ratio of pt between the jet and the electron. We actually find that sometimes a jet is considered to overlap with an electron that has a much lower pt. This certainly calls for some refinement! But it is reassuring to see that this can be checked at the analysis level, isn't it?

ejptratio.png

You can pursue further exercises in cleaning at SWGuidePATCleaningExercises. See more information on PAT cleaning at SWGuidePATCleaning.

Some Useful Tips

  • Use edmDumpEventContent to see what class names etc. to use in order to access the objects in the RECO file ( the RECO file used in patLayer1_fromAOD_full_cfg.py).
    • To do this do
       edmDumpEventContent    dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_0/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V1-v1/0001/D48CD6F6-8F66-DE11-B835-001D09F2983F.root 
      • Note how /pnfs/cms/WAX/11/ has been prefixed to the file name. Adding this gives you the physical location of the file at Fermilab.
    • A dump of above is here.
  • Use edmProvDump to see what modules were run, CMSSW version etc. used when the RECO file was made. To use it do
    • To do this do
       edmProvDump   dcap:///pnfs/cms/WAX/11/store/relval/CMSSW_3_1_0/RelValTTbar/GEN-SIM-RECO/STARTUP31X_V1-v1/0001/D48CD6F6-8F66-DE11-B835-001D09F2983F.root 
    • A dump of provenance for the above is here.

Suggestions - Further exercises

  • There are several other PAT examples here. For example, you can see MC Matching, adding Trigger information etc.
  • There also useful config files here that one can try to understand and run.
  • Several analysis examples also exist as follows:

References

-- SudhirMalik - 02 Aug 2009

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatcc PatBasicAnalyzer.cc r2 r1 manage 4.2 K 2009-09-08 - 20:18 SudhirMalik  
Unknown file formatcc PatBasicAnalyzerCleaning.cc r2 r1 manage 5.2 K 2009-09-08 - 20:18 SudhirMalik  
PNGpng Snapshot_AsItIs.png r1 manage 25.0 K 2009-08-03 - 03:57 SudhirMalik  
PNGpng Snapshot_CaloTower.png r1 manage 24.9 K 2009-08-03 - 03:58 SudhirMalik  
PNGpng Snapshot_KT4.png r1 manage 25.7 K 2009-08-03 - 03:58 SudhirMalik  
Texttxt analyzePatBasics_cfg.py.txt r2 r1 manage 1.7 K 2009-08-03 - 05:32 SudhirMalik  
PNGpng dRelejetAll.png r1 manage 18.6 K 2009-08-02 - 06:28 SudhirMalik  
PNGpng dRelejetOverlap.png r1 manage 18.6 K 2009-08-02 - 06:27 SudhirMalik  
PNGpng ejptratio.png r1 manage 17.3 K 2009-08-02 - 06:24 SudhirMalik  
PNGpng eptAll_Ov.png r1 manage 17.5 K 2009-08-02 - 06:26 SudhirMalik  
PNGpng jptAll_Ov.png r1 manage 17.0 K 2009-08-02 - 06:25 SudhirMalik  
PNGpng noOverlaps.png r1 manage 17.2 K 2009-08-02 - 06:27 SudhirMalik  
Texttxt patLayer1_fromAOD_full_cfg.py.txt r1 manage 3.1 K 2009-08-03 - 07:52 SudhirMalik  
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r18 - 2010-06-14 - JulieMalcles
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 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