Stand-Alone Muon Reconstruction

Complete: 5

Goals of this page

This tutorial shows how to run the reconstruction of muon tracks in the CMS muon spectrometer (muon system alone).


The muon reconstruction chain starts with the "local reconstruction", i.e. the reconstruction of hit positions in DT, CSC and RPCs. Hits within each DT and CSC chamber are then matched to form "segments" (track stubs).

In the off-line reconstruction, the segments are collected and matched to generate "seeds", consisting of a position and direction and an estimate of the muon transverse momentum. This initial estimate is used as a seed for the actual track fit, which is performed using segments and hits from DT, CSC and RPC chambers. The result is a reco::Track in the muon spectrometer, and is called "standalone muon". Standalone muon tracks are then matched with tracker tracks to generate "global muon" tracks, featuring the full CMS resolution.

A schematic view of the steps of muon reconstruction is shown below.


The local reconstuction chain and all details of the production of DT and CSC segments have been presented in the Tutorial on local muon reconstruction. In the present tutorial we focus on the standalone muon track reconstruction, starting from a data file containing already reconstructed segments.

Set up your Environment

Set your runtime environment (shown for release %WBRELEASENEW%):

You don't need to checkout and compile any package to run the reconstruction, you simply need a sample and a configuration file.


You can use your favorite sample, or you can generate one. The output of the Tutorial on local muon reconstruction can be used as input for this step.

For this tutorial we assume that the sample used in the following already contains:

  • the DT segments
  • the CSC segments
  • the RPC rechits.

Configuration file

Checkout the following package.

addpkg RecoMuon/StandAloneMuonProducer
cvs co -r V01-00-05-04 RecoMuon/StandAloneMuonProducer/test/
This package constains the blocks of configuration files and sequences needed for the Muon Standalone Reconstruction. These files contain default values for the parameters, and can be included in cfg files. The user is not supposed to modify these files, but can override a card modifying the values of parameters in the cfg file.

  • python/ directory: cff files that you can include in your cfg file to run the Muon Track Reconstruction;
  • test/ directory: provide some cfg files as example.

In the following we will use the configuration file.

The Production Chain

In general, to run the Standalone Muon production starting from the output of the Muon Local Reconstruction the cfg file needs to contain:

  • the Source block to specify a file containing DT, CSC and RPC segments and rechits
  • the magnetic field, the geometry cfi files and some services
  • the module blocks included as cfi files for the actual reconstruction:
    • the Muon Seed producer module (MuonSeed)
    • the Standalone Muon Track producer module (standAloneMuons)
  • the OutputModule to define an output file
  • the Path defining the sequence of modules to be executed
    • process.p = cms.Path(process.MuonSeed * process.standAloneMuons)

You can get the configuration files for these modules with the simple include statement:


You may also want to add one or more analyzer modules. To do this you have to specify them and to add them at the end of the execution path.

Run an Example Production Job

In the following we will run the example job:

which produces the Muon Seeds and Muon Stand-AloneTracks.

To run the job you must:

  1. Modify the file in order to use your sample and decide where to write the output file:
    1. Modify the Source section to point to your favorite sample
    2. Modify the OutputModule: fileName = cms.untracked.string('/tmp/RecoSTAMuons.root')
  2. Run the job: cmsRun -p > & ! $SCRATCH/StandAloneMuon.out &

At the end of the job the /tmp/StandAloneMuon.root output file will contain all the objects produced by the muon Stand-Alone reconstruction. You can then analyze it either using a CMSSW analyzer or browsing it with a ROOT TBrowser.

Run An Example Analyzer

We also add a simple analyzer to fill a histogram of the pT resolution of the muons. It is implemented in: RecoMuon/StandAloneMuonProducer/test/ STAMuonAnalyzer.h and

Note: you can have a look at the code to find an example about how to access the collection of muon reco::Track in the event, loop on it and extract relevant information.

In the configuration file, the analyzer is specified as:

process.STAMuonAnalyzer = cms.EDAnalyzer("STAMuonAnalyzer",
                                         DataType = cms.untracked.string('SimData'),
                                         StandAloneTrackCollectionLabel = cms.untracked.string('standAloneMuons'),
                                         MuonSeedCollectionLabel = cms.untracked.string('MuonSeed'),
                                         rootFileName = cms.untracked.string('STAMuonAnalyzer.root')

We can add it to our path to have the histograms produced in the same job of the reconstruction.

Note: you will find both the analyzer module and the relative path commented in You only need to uncomment them (and comment the default path) to have the analyzer run.

The analyzer produces the output file STAMuonAnalyzer.root containing the pT and 1/pT resolution plots.


Review status

Reviewer/Editor and Date (copy from screen) Comments
RiccardoBellan - 30 Nov 2006 Added initial info
GianlucaCerminara - 09 Feb 2007 Update to CMSSW_1_2_2
JennyWilliams - 23 Mar 2007 reinstated manual contents to enable pdf generation
DanieleTrocino - 24 Feb 2009 Update to CMSSW_2_1_12, cfg moved to StandAloneMuonProducer package

Responsible: RiccardoBellan, Nicola Amapane
Last reviewed by: DanieleTrocino - 24 Feb 2009

Topic attachments
I Attachment History Action Size Date WhoSorted ascending Comment
GIFgif MuonReco.gif r1 manage 4.7 K 2006-11-27 - 11:12 CMSUserSupport  
GIFgif res.gif r1 manage 10.2 K 2006-11-27 - 11:12 CMSUserSupport  
Edit | Attach | Watch | Print version | History: r29 < r28 < r27 < r26 < r25 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r26 - 2009-02-24 - DanieleTrocino

    • 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