Jet Reconstruction in CMSSW 1_2_0

Complete: 5
Detailed Review status

Goals of this page

The purpose of this tutorial is to give an idea about what Jet and MET objects are in CMSSW and how to work with them. CMSSW is in continuous development so the syntax for particular commands may change. To resolve this issue separate tutorial pages for different CMSSW releases is provided.
Other versions of this tutorial may be found on the primary Jet Reconstruction tutorial page WorkBookJetAnalysis.

Authors: Fedor Ratnikov and Robert Harris with contributions from Richard Cavanaugh

Contents

Set up your Environment

Set your runtime environment (shown for release 1_2_0):
cd CMSSW_1_2_0/src
eval `scramv1 runtime -csh` or eval `scramv1 runtime -sh`, depending on your shell
project CMSSW

No files need to be copied at this step - necessary files will be refered later.

Jet Reconstruction Basics

A few steps are necessary to walk from calorimeter digis (a.k.a. frames), which are essentially non-linear ADC counts, to Jet and MET objects:

Dataflow for Jet Reconstruction

  1. convert ADC counts to energy in one calorimeter cell
    • HcalSimpleReconstructor does this calculation for HCAL
    • ECAL does it in two steps
      • first produces uncalibrated hits: EcalWeightUncalibratedRecHitProducer
      • then calibrates hits: EcalAnalFitUncalibratedRecHitProducer
  2. combine ECAL and HCAL cells into projective towers corresponding to HCAL granularity
    • CaloTowersCreator does this operation
  3. convert CMS.CaloTowers into standard objects CaloTowerCandidateCreator (see more details in the next section)
  4. a. run clustering algorithm to produce Jets
    • Three basic algorithms and corresponding producers are currently implemented for CMS
      • Midpoint Cone algorithm: MidpointJetProducer <-- used in this tutorial
      • Iterative Cone algorithm: IterativeConeJetProducer
      • KT algorithm: KtJetProducer
  5. b. combine all towers into single MET (Missing ET) object
    • METProducer

Different Jet Flavors

Jet clusterization algorithms are very generic and may run on any set of 4-momenta. This feature is used to separate the jet algorithm itself from the physical nature of the jet constituents. Before running jet algorithm on the set of objects, these objects are converted into standard format a.k.a. Candidates.

In this tutorial we use two kinds of input objects for Jet/MET analysis:

  • CMS.CaloTowers - as described above
  • Generator level MC particles

Two corresponding flavors of jets are produced:

  • CaloJet
  • GenJet

Jets of any flavor always contain generic jet information. In addition some extra information specific to particular jet flavors is also available.

Generic Jet Properties

Every jet contains information about its 4-momentum. This is the quantity to use for generic kinematics analysis.

Specific Jet Properties

CaloJet also contains information about the fraction of energy deposited in a particular calorimeter compartment or group of compartments: ECAL, HCAL, HB(barrel), HO(outer), HE(endcap), HF(forward). GenJet contains information about fraction from different types of generated particles, i.e. from charged hadrons.

Run Jet Reconstruction

The jet reconstruction procedure is defined in an example configuration file, reco-jetmet-allinone.cfg. This file essentially includes fragments necessary to make full chain of event processing:
  • Generating single pion events with fixed pT of 50 GeV/c
  • GEANT simulation of detector response
  • Digitization - simulation of detector readout
  • Local calorimetry reconstruction
  • Combining hits into Calorimetry Towers
  • Running et and MET reconstruction
  • Running Jet and MET reconstruction directly on MC particles
  • Applying Jet and MET corrections

Details of the configuration file syntax are discussed elsewhere.

To run full chain of Jet/MET reconstruction:

> cmsRun reco-jetmet-allinone.cfg
Note: you may want to direct output to another file by changing PoolOutputModule filename parameter in module in the configuration file.

Jet Analysis

#CMS.DataSamples

Data samples

In following examples we will explore two data samples. One file is reco-calorimetry-particlegun-all.root produced on the previous step and containing 50 single pion events. Another is publically available file containg Z'(700) to dijet events sample with logical name available in CMS DBS catalog (see Locating Data Samples section for more details). The corresponding data file is located at FNAL and is accessible via dCache as

=_dcap://cmsdca.fnal.gov:24136/pn_fs/fnal.gov/usr/cms/WAX/11/store/RelVal/2006/ 11/3/RelVal120pre4ZPrimeDijets700/D61917D6-2E6C-DB11-BBBA-0030487074C3.root_= (one line)

Bare ROOT

> root.exe reco-calorimetry-particlegun-all.root
root [0] TBrowser b;

Now you can browse EDM objects available in the file: Objects list,

particularly CMS.CaloJets: CaloJet, or GenJets: GenJet, or MET object: MET.

Note: clicking on the leaf is equivalent to executing "Draw" command from the ROOT prompt:

   root [2] Events->Draw("recoCaloJets_midPointCone5CaloJets__ALL.obj.p4_.fCoordinates.fT");
 
produces energy distribution for reconstructed jets

Aliases

The name of the ROOT branch containing jet objects strongly depends from the process name of the job producing jets. To be able to address jets independently from the process name used, a well-defined generic alias is assigned to every Jet collection. The following branch name aliases are produced for the standard jet reconstuction algorithms and inputs

MC5CaloJet = recoCaloJets_midPointCone5CaloJets_X (Midpoint Cone, R=0.5, calorimeter jets)
MC7CaloJet = recoCaloJets_midPointCone7CaloJets_X (Midpoint Cone, R=0.7, calorimeter jets)
IC5CaloJet = recoCaloJets_iterativeCone5CaloJets_X   (Iterative Cone, R=0.5, calorimeter jets)
KT10CaloJet = recoCaloJets_ktCaloJets_X                    (Kt, D=1.0, calorimeter jets)

MC5GenJet = recoGenJets_midPointCone5CMS.CaloJets_X (Midpoint Cone, R=0.5, HEPMC particle jets)
MC7GenJet = recoGenJets_midPointCone7CMS.CaloJets_X (Midpoint Cone, R=0.7, HEPMC particle jets)
IC5GenJet = recoGenJets_iterativeCone5GenJets_X     (Iterative Cone, R=0.5, HEPMC particle jets)
KT10GenJet = recoGenJets_ktGenJets_X                      (Kt, D=1.0, HEPMC particle jets)
In general, the alias contains a number which is equal to R times 10 (cone algorithm) or D times 10 (Kt algorithm) rounded to the nearest integer. When making plots interactively the user can simply substitute the short alias name for the long branch name, making things easier to type, and insuring that the user is picking up the last processing of the jets. For, examle, the same energy distribution as in previous section may be plot using alias for the branch:
  root [2] Events->Draw("MC5CaloJet.p4_.fCoordinates.fT");

Users can also employ aliases within root analysis scripts and Framework Lite. To do this they must translate the alias back to the branch name using GetAlias, for example

  TBranch *branch = tree->GetBranch(tree->GetAlias("MC5CaloJet"));
will get the branch corresponding to the alias "MC5CaloJet" for the root tree called "tree".

Using aliases makes data addressing much easier, so we will use aliases whenever possible in following examples.

FWLite Analysis

FWLite mode allows one to address not only members of objects, but also object's methods. For example:
  root [3] Events->Draw("MC5CaloJet.energy()");
Corresponding methods are indicated by the exclamation leaf in the browser window.

You may ask: Why use FWLite? Well....In order to analyse a dataset without FWLite, one must typically use the equivalent of "MakeClass" from ROOT, which is rather awkward and difficult to maintain: see Events.h and Events.C.

Alternatively, FWLite is both simple to use and easy to maintain: analyzeJets_head.C and analyzeJets.C. FWLite allows one to run an event loop with complete sophisticated analysis of objects in the event. The following example demonstrates simple data analisys which runs on dijet sample and makes histograms for properties of two leading jets, and stores histograms in the file:

> root.exe 
root [0] .x analyzeJets_head.C
root [1] .x analyzeJets.C
.q

Here is the reference histogram file produced by this example.

A similar FWLite example for MET can be found here : analyzeMET.C .

FWLite with TChain

To process several files in one event loop, one should use TChain ROOT feature. This requires slightly different organization of the event loop. Details may be found elsewhere.

Access from Framework

The following example demonstrates use of an EDAnalyzer for both CaloJets and GenJets. It analyzes the simulated Z'->Dijet data file mentioned [[#CMS.DataSamples[above]]. The file is addressed by the logical name. This file is physically available at Fermilab. If you are not running at Fermilab you can easily change the file names in jetPlots.cfg below to point at your files and it should run on them, provided the data format is compatible with this release.
scramv1 project CMSSW CMSSW_1_2_0_pre4
cd CMSSW_1_2_0_pre4/src
eval `scramv1 runtime -csh`
cmscvsroot CMSSW 
cvs co -r JetTutorial_1_2_0 RecoJets/JetAnalyzers
     (first time you do it you will need to "cvs login" with password 98passwd)
cd RecoJets/JetAnalyzers
scramv1 b
cd test
cmsRun jetPlots.cfg
The analysis is done in the file JetPlotsExample.cc which loops over the two leading CaloJets and GenJets in the event, makes some basic histograms, and writes them to a file named histo.root. The algorithm used to make the CaloJets and GenJets that we read from the event is specified by a label in the configuration file jetPlots.cfg. The labels are specified by the lines
    string CaloJetAlgorithm ="midPointCone5CMS.CaloJets"
    string GenJetAlgorithm = "midPointCone5GenJets"
Here we chose the midpoint algorithm, but other algorithms should work as well, provided jets from those algorithms are in the event. You should browse the input data file in root to see what algorithms are currently available and what their label is (the second field Y in the branch name X_Y_Z). The label will also indicate whether the jet has been corrected (currently this is specified with "cor"). If the label for the algorithm changes in future releases then the user will need to change the label in the config file. As mentioned above, the user will need to change the input file names in the configuration file to point at whatever data file needs to be read.

Examples

This tutorial illustrates basics of how to use Jet and MET objects. No special drawing option is used. Tutorials how to produce fancy plots with ROOT may be found elsewhere

Examples with Z'(700) to di-jets data sample

Load dijet data file (in a single line):

  > root.exe dcap://cmsdca.fnal.gov:24136/pnfs/fnal.gov/usr/cms/WAX/11/store/RelVal/2006/11/3/
     CMS.RelVal120pre4ZPrimeDijets700/D61917D6-2E6C-DB11-BBBA-0030487074C3.root

1. View total and electromagnetic energy in CMS.CaloTowers for single event #10 in di-jet file:

Events->Draw ("CaloTowersSorted_towerMaker__T.obj.obj.id().iphi():
CaloTowersSorted_towerMaker__T.obj.obj.id().ieta()", 
"CaloTowersSorted_towerMaker__T.obj.obj.emEnergy() * (EventAux.id_.event_==10)", "LEGO");
Events->Draw ("CaloTowersSorted_towerMaker__T.obj.obj.id().iphi():
CaloTowersSorted_towerMaker__T.obj.obj.id().ieta()", 
"CaloTowersSorted_towerMaker__T.obj.obj.energy() * (EventAux.id_.event_==10)", "LEGO");

2. Et distribution for Midpoint Cone 0.5: !GenJets and !CMS.CaloJets:

Events->Draw("MC5GenJet.et()");
Events->Draw("MC5CaloJet.et()");
These distributions show that we have huge contribution of soft jets.

Hint: Use logarithmic scale to see high Et jets

3. Correlation and difference for phi's of high Et GenJets and CMS.CaloJets:

Events->Draw("MC5CaloJet.phi():MC5GenJet.phi()","MC5CaloJet.et()>100 && MC5GenJet.et()>100");
Events->Draw("MC5CaloJet.phi()-MC5GenJet.phi()","MC5GenJet.et()>100 && MC5GenJet.et()>100");
These distributions shows that we have matched or back-to-back generated and reconstructed jets.

4. Correlations between eta and energies of matched GenJet and CaloJet:

Events->Draw("MC5CaloJet.eta():MC5GenJet.eta()","MC5CaloJet.et()>100
   && MC5GenJet.et()>100 && abs (MC5CaloJet.phi()-MC5GenJet.phi())<0.5");
Events->Draw("MC5CaloJet.et():MC5GenJet.et()","MC5CaloJet.et()>100 
  && MC5GenJet.et()>100 && abs (MC5CaloJet.phi()-MC5GenJet.phi())<0.5");

These distributions confirm that generator-based and CaloTower-based jets are strongly correlated indeed

5. Missing Et based on generated particles and reconstructed CMS.CaloTowers:

Events->Draw("recoGenMETs_genMet__T.obj.pt()");
Events->Draw("recoCaloMETs_met__T.obj.pt()");

These distributions shows very little generated MET but significant reconstructed MET in di-jet events

Example FwLite analysis CINT script for MET analogous to "analyzeJets.C"

* analyzeMET.C

Examples with single pion pT=50 GeV/c data sample

Load produced single pion data file:
  > root.exe root.exe reco-calorimetry-particlegun-all.root

1. View transverse momentum for generated jets:

Events->Draw("MC5GenJet.py():MC5GenJet.px()");

This confirms that indeed we have fixed pt data sample

2. View reconstructed MET:

Events->Draw("recoCaloMETs_met__ALL.obj.pt()");

Single pion sample is indeed imbalanced

3. View correlation between MET and Jet energy:

Events->Draw("recoCaloMETs_met__ALL.obj.pt():MC5CaloJet.pt()");

MET and reconstructed single jet are strongly correlated

Quiz

Using single pion sample, make MET distribution:
Events->Draw("recoGenMETs_genMet__ALL.obj.pt()");
What is the reason for the tail in this distribution?

Puzzled? Here is a hint distribution:

Events->Draw("MC5GenJet.eta():recoGenMETs_genMet__ALL.obj.pt()");
And another hint:
Events->Draw("MC5GenJet.eta():MC5GenJet.energy()");

Enjoy CMSSW Jet and MET objects!

Association of jets to the primary vertex

One of the most experimentally challenging aspects of LHC physics is the issue of in time pile-up, where minimum-bias interactions can introduce additional jets into the event. A technique to efficiently associate jets with the signal vertex is needed to reduce the large luminosity-dependent instrumental background from pile-up jets. The CMS tracker can provide this information by associating reconstructed charged tracks to primary vertices and to jets. To associate a jet with a signal vertex, defined by a lepton or other high-pT tracks of interest, a significant fraction of the tracks in the jet should originate from this primary vertex.

Two approaches have been investigated to test whether jets originate from the signal vertex or not. They differ in the use of the calorimeter jet energy measurement. The detailed description of the method could be found in CMS NOTE-2006/091.

Method A: 1) The variable ALPHA is determined for each jet as the ratio of the sum of transverse momenta of all tracks found inside the jet cone and having the same vertex as the signal (by a Z matching residual) to the transverse momentum of the jet as measured by the calorimeters; 2) If ALPHA > ALPHA_0, this jet is assigned to the signal vertex.

Method B: 1) The variable BETA is determined for each jet as the ratio of the sum of transverse momenta of all tracks found inside the jet cone and having the same vertex as the signal to the transverse momentum of all tracks inside the jet cone; 2) If BETA > BETA_0, this jet is assigned to the signal vertex.

scramv1 project CMSSW CMSSW_1_2_0
cd CMSSW_1_2_0/src
eval `scramv1 runtime -csh`
cmscvsroot CMSSW 
cvs login (with password 98passwd)
cvs co -r CMSSW_1_2_0 JetMETCorrections/JetVertexAssociation
cd JetMETCorrections/JetVertexAssociation
scramv1 b
cd test
cmsRun test.cfg
cmsRun test_analysis.cfg

Jet Corrections using MC Jet

Corrections to calorimeter reconstructed jets (CMS.CaloJets) as a function of jet ET and eta are available in the MCJet package of JetMETCorrections.

MC Jet corrections take as input a collection of CMS.CaloJets and write as output a collection of corrected CMS.CaloJets. The correction was derived from measurements of jet response, CaloJet ET/GenJet ET, from all jets in a QCD sample w/o pileup. The correction scales the CaloJet Lorentz vectors so that on average the corrected CaloJet response is equal to 1.

The correction is available in CVS tag JetResponseV8 of the MCJet package. The .cff file to apply this calibration is

JetMETCorrections/MCJet/data/JetCorrections120.cff
and it will correct the algorithms Midpoint Cone R=0.5 and R=0.7, and Iterative Cone R=0.5 for the 120 data sample. There are also the following individual .cff files if you are only want to correct a single jet algorithm:
JetMETCorrections/MCJet/data/JetCorrections120mcone5.cff
JetMETCorrections/MCJet/data/JetCorrections120mcone7.cff
JetMETCorrections/MCJet/data/JetCorrections120icone5.cff

An example of using it to apply the calibration for Midpoint Cone R=0.5 and access the corrected jets is in

RecoJets/JetAnalyzers/test/CorJetsExample.cfg.
Here are instructions to build and run that example against CMSSW_1_2_0 data:

   scramv1 project CMSSW CMSSW_1_2_0
   cd CMSSW_1_2_0/src
   cmscvsroot CMSSW
   cvs co -r JetResponseV8 JetMETCorrections/MCJet
   cvs co -r V00-00-07b RecoJets/JetAnalyzers
   eval `scramv1 runtime -csh`
   scramv1 b
   cd RecoJets/JetAnalyzers/test
   cmsRun CorJetsExample.cfg

Please note that these corrections are only appropriate for CMSSW_1_2_0 data and not earlier releases in which the calibration in the endcap was significantly different. The corrections were made from the CMSSW_1_2_0 QCD data sample without pileup.

References

  • [[https://twiki.cern.ch/twiki/bin/view/CMS/May06CPTweekFrameworkDemo[][How to setup project and use CMSSW Framework]]
  • How MC data are produced
  • Following web page contains useful up to date examples

Review status

Reviewer/Editor and Date (copy from screen) Comments
Main.rharris - 13 Mar 2007 Added MC Jet Corrections
Main.cgtully - 19 Dec 2006 Final review before workbook publication
Main.fedor - 27 Nov 2006 Retrofit for CMSSW_1_2_0

Responsible: Fedor Ratnikov
Last reviewed by: Main.cgtully - 19 Dec 2006

Topic attachments
I Attachment History Action Size Date Who Comment
C source code filec Events.C r1 manage 1.4 K 2006-11-29 - 02:17 UnknownUser  
Header fileh Events.h r1 manage 451.2 K 2006-11-29 - 02:15 UnknownUser  
C source code filec analyzeJets.C r1 manage 2.5 K 2006-11-29 - 19:59 UnknownUser  
C source code filec analyzeJets_head.C r1 manage 0.3 K 2006-11-28 - 01:19 UnknownUser FWLite analyzer setup
C source code filec analyzeMET.C r1 manage 2.6 K 2006-12-06 - 14:29 UnknownUser Example FwLite analysis CINT script for MET which is analogous to "analyzeJets.C"
PNGpng etaphi1.png r1 manage 45.2 K 2006-11-30 - 00:25 UnknownUser  
PNGpng etaphi2.png r1 manage 45.5 K 2006-11-30 - 00:26 UnknownUser  
PNGpng etavseta.png r1 manage 15.6 K 2006-11-30 - 00:26 UnknownUser  
PNGpng etcalo.png r1 manage 14.8 K 2006-11-30 - 00:26 UnknownUser  
PNGpng etgen.png r1 manage 15.0 K 2006-11-30 - 00:27 UnknownUser  
PNGpng etvset.png r1 manage 17.7 K 2006-11-30 - 00:27 UnknownUser  
PNGpng evseta.png r1 manage 19.5 K 2006-11-30 - 00:58 UnknownUser  
PNGpng genmet.png r1 manage 17.4 K 2006-11-30 - 00:57 UnknownUser  
PNGpng genmetvseta.png r1 manage 18.1 K 2006-11-30 - 00:58 UnknownUser  
Unknown file formatroot jet_hists.root r1 manage 5.2 K 2006-11-29 - 20:03 UnknownUser  
PNGpng metgendijet.png r1 manage 16.0 K 2006-11-30 - 00:28 UnknownUser  
PNGpng metrecodijet.png r1 manage 17.0 K 2006-11-30 - 00:28 UnknownUser  
PNGpng metsp.png r1 manage 17.4 K 2006-11-30 - 00:56 UnknownUser  
PNGpng metvspt.png r1 manage 18.4 K 2006-11-30 - 00:57 UnknownUser  
PNGpng phiminusphi.png r1 manage 17.0 K 2006-11-30 - 00:29 UnknownUser  
PNGpng phivsphi.png r1 manage 17.1 K 2006-11-30 - 00:36 UnknownUser  
PNGpng pigun_CaloJet.png r1 manage 58.9 K 2006-11-29 - 01:28 UnknownUser CaloJet
PNGpng pigun_CaloMET.png r1 manage 60.2 K 2006-11-29 - 01:41 UnknownUser  
PNGpng pigun_GaloMET.png r1 manage 60.2 K 2006-11-29 - 01:34 UnknownUser CaloMET
PNGpng pigun_GenJet.png r1 manage 47.6 K 2006-11-29 - 01:28 UnknownUser GenJet
PNGpng pigun_click.png r1 manage 25.0 K 2006-11-29 - 02:09 UnknownUser  
PNGpng pigun_edist.png r1 manage 12.2 K 2006-11-29 - 01:51 UnknownUser  
PNGpng pigun_energy.png r1 manage 11.5 K 2006-11-29 - 02:09 UnknownUser  
PNGpng pigun_objects.png r1 manage 46.6 K 2006-11-29 - 01:27 UnknownUser All objects
PNGpng pyvspxgen.png r1 manage 16.9 K 2006-11-30 - 00:56 UnknownUser  
Unknown file formatcfg reco-jetmet-allinone.cfg r1 manage 1.3 K 2006-11-29 - 00:48 UnknownUser fixed pT pions full production chain
Edit | Attach | Watch | Print version | History: r20 < r19 < r18 < r17 < r16 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r20 - 2008-01-24 - CMSUserSupport
 
    • 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