7.8 Muon Analysis

Complete: 4

Detailed Review status

Goals of this page

This document explains how to get access to muon tracks and associated information available in the event record, which can be used for muon identification purposes as well as analyses. Brief summary of muon reconstruction algorithms and of muon selectors is provided. (See WorkBookSetComputerNode for instructions on how to set up a proper CMSSW computing environment.)

Nota bene: We will access muon information in miniAOD files. Please, check the muon information stored in the miniAOD. This link here could be very useful to get familiar with muons in the miniAOD too.

Introduction to muon reconstruction

Muon reconstruction overview:


The muon reconstruction chain starts with the "local reconstruction". First, hits in DTs, CSCs and RPCs are reconstructed from digitized electronics signals. Hits within each DT and CSC chamber are then matched to form "segments" (track stubs). The production of hits and segments in muon sub-systems is discussed in detail in the tutorial on local muon reconstruction. The reconstruction of the tracks inside the silicon tracker is described in the tutorial on track reconstruction.

Standalone muons

In the offline reconstruction, the segments reconstructed in the muon chambers are used to generate "seeds" consisting of position and direction vectors and an estimate of the muon transverse momentum. These initial estimates are used as seeds for the track fits in the muon system, which are performed using segments and hits from DTs, CSCs and RPCs and are based on the Kalman filter technique. The result is a collection of reco::Track objects reconstructed in the muon spectrometer, which are referred to as "standalone muons". To improve the momentum resolution, a beam-spot constraint can be applied in the fit. Two collections of "standalone muons", with and without the beam-spot constraint, are available in the event record (in both RECO and AOD). A more detailed description of the reconstruction of tracks in the muon system alone can be found in Section 4 of CMS AN 2008/097. A tutorial explaining how to run standalone muon reconstruction and to analyze its results is available at this link.

Global muons

For each standalone muon track, a search for tracks matching it among those reconstructed in the inner tracking system (referred to as "tracker tracks", "inner tracks" or "silicon tracks") is performed, and the best-matching tracker track is selected. For each "tracker track" - "standalone muon" pair, the track fit using all hits in both tracks is performed, again based on the Kalman filter technique. The result is a collection of reco::Track objects referred to as "global muons". More details on the reconstruction of global muons can be found in Section 5 of CMS AN 2008/097.

References to the matching tracker tracks, standalone muon tracks, and global muon tracks are assembled into one single collection of reco::Muon objects described below.

Tracker muons

An approach complementary to the global-muon reconstruction consists in considering all tracker tracks to be potential muon candidates and in checking this hypothesis by looking for compatible signatures in the calorimeters and in the muon system. Tracker tracks identified as muons by this method are referred to as "tracker muons". A detailed description of the reconstruction of tracker muons can be found in Section 6 of CMS AN 2008/097.

The tracker-muon algorithm is particularly useful for the identification of low-pT muons (with pT of the order of several GeV), which may not leave enough hits in the muon stations for a standalone muon to be reconstructed. The default criteria for tagging a tracker track as "tracker muon" are very loose (in CMSSW_3_X_Y series, every track with p > 2.5 GeV and pT > 0.5 GeV matched with at least one segment in the muon stations is labeled as "tracker muon"), so tracker muons should in general not be used without further requirements. Several sets of such requirements recommended by the muon POG are described in Sections 6-8 of CMS AN 2008/098; the corresponding flags can be retrieved from the reco::Muon object (see WorkBook section on muon ID).


RPC muons

An approach similar to Tracker Muons is followed to define the RPC Muons: in this case a match is sought between the extrapolated inner track and hits on the RPC muon detectors. A description of the algorithm and the performance measurements is contained in the CMS AN-2012/482 . The effects of including the RPC hits in the global muon reconstruction have also been studied and are described in M.S.Kim, JINST 8 (2013) T03001 . The main twiki page documenting the RPC Muon algorithm is linked HERE .

Calorimeter-based muons

Calorimeter-based muons, or "calo muons" for short, represent a subset of all tracker tracks reconstructed in the event, which includes tracks with energy depositions in the calorimeters compatible with those of a minimum-ionizing particle. The fake rate of these muon candidates is high and they should not be used when muon purity is essential. A typical use case for "calo muons" is the reconstruction of the J/ψ decaying to low-momentum muons that have little or no information in the muon system, thus improving signal to background ratio compared with the inner tracks. In the event record, "calo muons" are stored in a collection of dedicated objects, reco::CaloMuon's.

Available information

The information on various types of muons discussed above is assembled in one single collection of reco::Muon objects, "muons". This collection serves as the main entry point for accessing muon-related information in CMSSW: various quantities are either directly included in the reco::Muon objects, or can be accessed from there via provided references. One exception to this rule is "calo muons", which are stored in a separate collection of reco::CaloMuon objects. The full list of muon collections available in the event record is available in SWGuideDataFormatRecoMuon.


Full description of the reco::Muon class can be found here: DataFormats/MuonReco/interface/Muon.h.

Brief summary of available information:

  • Methods to check to which category of muon candidates a given reco::Muon object belongs: isStandAloneMuon(), isGlobalMuon(), isTrackerMuon() (isCaloMuon() is currently not used). Note that a single object can belong to more than one category.
  • References to the corresponding reco::Track objects for tracks reconstructed in the inner tracker (tracker track), muon system alone (standalone muon track with a beam-spot constraint), and to a combined tracker-muon fit (global muon track). High-pT muons can be accessed through isHighPtMuon.
  • For tracker muons:
    • Energy depositions in ECAL, HCAL and HO in crossed elements as well as 3x3 shapes around them.
    • Compatibility with muon hypothesis based on energy depositions in calorimeters.
    • Vector of muon segments matched with the extrapolated tracker track and some other track-segments matching information.
  • Summary of muon isolation information: sums of pT/ET and numbers of tracks and jets for two cones of dR = √(dφ^2 + dη^2) = 0.3 and 0.5 around the muon trajectory (see below).
  • Identification flags (see below).
  • Timing information (see below).

reco::Muon timing information

Timing information is calculated from information in the DT, CSC and ECAL (RPC timing information is not available for offline at all; efforts to implement HCAL timing are currently under way). Information is stored in reco::MuonTime format. It contains a summary of the combined fit of all subdetector data with two estimates of time at the interaction point and its error, assuming an outside-in or inside-out β=1 particle, plus an estimate of the muon's direction.

More detailed information about muon timing (time, velocity with and without the assumption of the muon being produced in-time, etc.) separated into subsystems is available in a set external products of type reco::MuonTimeExtra linked to the muons via association maps. If necessary, these objects can be regenerated independent of the muon reconstruction chain using the MuonTimingProducer.

For a simple example of accessing all the information, please take a look at MuonTimingValidator.cc in here. For more details on the interpretation of the different quantities and performance in early data, see CMS IN-2010/003.

Muon identification

Detailed information about muon identification and the various selection algorithms can be found in the CMS AN-2008/098 analysis note. There is a detailed accounting of changes made to the tracker-muon-based muon identification algorithms since AN-2008/098 (over 1.5 years ago as of this writing) at SWGuideTrackerMuons. Below is a brief summary.

There are several categories of muon identification algorithms that have been developed:

  • Cut-based ID for global muons, which consists of a set of track-quality requirements
  • Likelihood-based ID for tracker muons, which uses compatibility of the calorimeter response with the muon hypothesis and the presence of matched segments in the muon system
  • Cut-based ID for tracker muons, which selects muons on the basis of the track-penetration depth in the detector

The muon id selection function and selection types exist outside of the reco::Muon object. This means that one should use an external function

bool muon::isGoodMuon( const reco::Muon& muon, muon::SelectionType type )

which returns true if the muon passes the given selection type. The following selection types are available:

namespace muon {
enum SelectionType {
All = 0,                      // dummy options - always true
AllGlobalMuons = 1,           // checks isGlobalMuon flag
AllStandAloneMuons = 2,       // checks isStandAloneMuon flag
AllTrackerMuons = 3,          // checks isTrackerMuon flag
TrackerMuonArbitrated = 4,    // resolve ambiguity of sharing segments
AllArbitrated = 5,            // all muons with the tracker muon arbitrated
GlobalMuonPromptTight = 6,    // global muons with tighter fit requirements
TMLastStationLoose = 7,       // penetration depth loose selector
TMLastStationTight = 8,       // penetration depth tight selector
TM2DCompatibilityLoose = 9,   // likelihood based loose selector
TM2DCompatibilityTight = 10,  // likelihood based tight selector
TMOneStationLoose = 11,       // require one well matched segment
TMOneStationTight = 12,       // require one well matched segment
TMLastStationOptimizedLowPtLoose = 13, // combination of TMLastStation and TMOneStation
TMLastStationOptimizedLowPtTight = 14, // combination of TMLastStation and TMOneStation
GMTkChiCompatibility = 15,    // require tk stub have good chi2 relative to glb track
GMStaChiCompatibility = 16,   // require sta stub have good chi2 compatibility relative to glb track
GMTkKinkTight = 17,           // require a small kink value in the tracker stub
TMLastStationAngLoose = 18,   // TMLastStationLoose with additional angular cuts
TMLastStationAngTight = 19,   // TMLastStationTight with additional angular cuts
TMOneStationAngLoose = 20,    // TMOneStationLoose with additional angular cuts
TMOneStationAngTight = 21,    // TMOneStationTight with additional angular cuts
TMLastStationOptimizedBarrelLowPtLoose = 22, // combination of TMLastStation and TMOneStation with low pT optimization in barrel only
TMLastStationOptimizedBarrelLowPtTight = 23  // combination of TMLastStation and TMOneStation with low pT optimization in barrel only

The isGoodMuon method and the available selection types are defined in DataFormats/MuonReco/interface/MuonSelectors.h, so one must include this header file to utilize the selectors.

The muon-identification algorithms recommended by the muon POG can be found in SWGuideMuonId. Tracker-muon selectors (TMLastStationLoose, etc.) are described in SWGuideTrackerMuons. GlobalMuonPromptTight consists of the following requirements, designed to suppress hadronic punch-throughs and muons from decays in flight:

muon.isGlobalMuon() && muon.globalTrack()->normalizedChi2() < 10. && muon.globalTrack()->hitPattern().numberOfValidMuonHits() > 0

that is:

  • the track is identified as a global muon
  • χ2/ndof of the global muon fit < 10
  • number of valid muon-detector hits used in the global fit > 0

The following additional track-quality cuts using the tracker-track information are recommended to further suppress non-prompt muons, although they are not explicitly included in the selection types above:

  • Transverse impact parameter of the tracker track (or global muon) relative to the beam spot position, |d0|, < 2 mm. This loose cut preserves efficiency for muons from decays of b and c hadrons.
  • Number of hits in the tracker track, Nhits, > 10.

One can also impose cuts on the last point in the global fit to reject punch-throughs that terminate in the first station of the muon detector:

// barrel region
if ( abs(z) < 660 && r > 400 && r < 480)  keepMuon = false;

// endcap region
if ( abs(z) > 600 && abs(z) < 650 && r < 300)  keepMuon = false; 
if ( abs(z) > 680 && abs(z) < 730 && r < 480)  keepMuon = false; 

This can reduce the fake rate by ~20% with minimal loss in efficiency.

More information can be found in CMS AN 2008/098, in SWGuideTrackerMuons, and in several dedicated talks: "Muons in CMSSW_2_1_X", "Global Muon Selections" and "Summary of the Muon ID Note".

The muon-identification criteria used by the Vector-Boson Task Force of the Electroweak PAG follow closely muon-POG recommendations and can be found here.

Muon isolation

For each muon candidate, a number of quantities is computed that can help to distinguish isolated muons from the muons embedded in jets. The following data can be obtained directly from the reco::Muon class:

  • Scalar sum of pT of all tracks reconstructed in cones of R = 0.3 and 0.5 around the direction of a muon, and the number of such tracks.
  • Scalar sum of transverse energy depositions ET in ECAL, HCAL, and HO in cones of R = 0.3 and 0.5, and the total number of jets in these cones.
Additional information allowing to calculate other isolation-related quantities is stored in the event record as associations (IsoDepositMap); a detailed descripition can be found in SWGuideMuonIsolation.

Muons in missing ET calculations

Muons in Physics Analysis Tools


The example provided is for "CMSSW_9_2_3_patch2", it allows for quick demonstration of some basic concepts on how to get access to information.
We will created an EDAnalyzer within our CMSSW work area. The analyzer should iterate over the reconstructed muons stored in the miniAOD and fill histograms with the momenta components of the reconstructed muons. Use the TFileService object to store the histograms. We also make a vertex to reconstruct the "Jpsi" particle (see figure).

source /cvmfs/cms.cern.ch/cmsset_default.sh 
export SCRAM_ARCH=slc6_amd64_gcc530
cmsrel CMSSW_9_2_3_patch2
cd CMSSW_9_2_3_patch2/src/
cp -r /afs/cern.ch/user/j/jmejiagu/public/miniAODmuonexample/CMSSW_9_2_3_patch2/src/myAnalyzers .
voms-proxy-init -voms cms -valid 192:00
scram b -j8
cd myAnalyzers/JPsiKsPAT/test/
cmsRun miniAODmuonsRootupler.py

Review status

Reviewer/Editor and Date (copy from screen) Comments
RiccardoBellan - 30 Nov 2006 Added initial info
JennyWilliams - 12 Jan 2006 Added info from very similar page by ChangLiu and remove that page
GianlucaCerminara - 09 Feb 2007 Update to CMSSW_1_2_2
JennyWilliams - 23 Mar 2007 reinstated manual contents for pdf generation
DmytroKovalskyi - 17 Feb 2008 Modified the workbook to include full spectrum of muon information available
MartijnMulders - Feb 2008 Updated in course of documentation review
Main.Aresh - 27 Feb 2008 Changes in verbatim elements because of some lines too long for printable version
PiotrTraczyk - 06 Oct 2008 Updated TeV muon part
MartijnMulders - 07 Oct 2008 Updated muon identification part
SlavaValuev - Feb 2009 Updated in course of documentation review
PiotrTraczyk - 31 Aug 2010 Muon timing part made up-to-date
JhovannyMejia 30 Aug 2017 Some information made up-to-date. Update all the links. Create a example on how to get access to Muon information in the miniAOD.
Responsible: DmytroKovalskyi
Last reviewed by: SlavaValuev - 04 Mar 2009
Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng Jpsimass.png r1 manage 3.8 K 2017-08-30 - 03:41 JhovannyMejia  
GIFgif MuonReco.gif r2 r1 manage 4.7 K 2006-07-19 - 11:43 NicolaAmapane Schema of the muon local reco
GIFgif lastLoose.gif r1 manage 7.7 K 2010-11-12 - 14:13 ShuklaPrashant  
PNGpng muonreco.png r2 r1 manage 5.9 K 2008-02-17 - 07:32 DmytroKovalskyi Muon reconstruction overview
GIFgif res.gif r1 manage 10.2 K 2006-10-09 - 18:28 RiccardoBellan  
Edit | Attach | Watch | Print version | History: r92 < r91 < r90 < r89 < r88 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r92 - 2017-08-30 - JhovannyMejia



    • 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