Local Muon Reconstruction Tutorial

Complete: 5

Goals of this page:

Learn how to perform muon segment reconstruction in the drift tubes (DT) and in the cathode strip chambers (CSC), and hit reconstruction in the resistive plate chambers (RPC), starting from digis or raw data.


The reconstruction in the muon system starts from the reconstruction of the hits within the cell (DTRecHit1D) for the DT, from the 2-Dimensional hits on the CSC plane (CMS.CSCRecHit2D) and 1D rechits in the RPCs (RPCRecHit). At this stage some ambiguities must be solved, therefore a combinatorial pattern recognition is performed (DT and CSC segment reconstruction). The segments are then used as input for the seed/track reconstruction.

This example shows how to:

the corresponding CMS.DataFormat object is given between parenthesis.
Further information are available on the CMSSW reference manual about: local reconstruction in DT (DTRecHit, DTSegment)

Concept Schema

Concept schema

Global View

Let's start!

Set up your Environment

scramv1 project CMSSW CMSSW_1_8_0_pre2
cd CMSSW_1_8_0_pre2/src
eval `scramv1 runtime -csh` or eval `scramv1 runtime -sh`, depending on your shell
project CMSSW

This tutorial has been updated to run in CMSSW_1_8_0_pre2. Please be aware that changes may be required for newer or older releases of CMSSW. In particular

  • in CMSSW_1_6_X considerable modifications were introduced to use conditions data (e.g. calibration data) for both real and simulated data.
  • from CMSSW_1_7_X to CMSSW_1_8_X there were big modifications to the configuration files for DT local reconstruction.
  • minor modifications have been made to the DT Calibration for simulated data passing from from CMSSW_1_7_X to CMSSW_1_8_X


You can use your favorite sample, or you can generate one (cf. DT Digi and CSC Digi tutorials).

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

  • the DT digis
  • the CSC digis
  • the RPC digis

Get the required Configuration Files

The CalibMuon/Configuration/data package contains blocks of configuration files and sequences needed for the DT and CSC Calibration and Alignment.
The RecoLocalMuon/Configuration/data package constains the blocks of configuration files and sequences needed for the Muon Local 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 using the replace keyword in the .cfg.

An example of .cfg file to perform Muon Local Reconstruction (loading the required calibration constants for simulated data) is RecoLocalMuon/Configuration/test/RecoLocalMuon.cfg. You can Checkout it with the command

cvs co -r V00-01-11  RecoLocalMuon/Configuration/test

With the -r option you checkout the specified version of the package; without this option you checkout the HEAD (last committed) version of the package which might -- and is likely to -- have been modified since this tutorial was prepared.

How the config files work: includes and parameters

In general, to run the segment producers starting from a file containing the digis, the configuration file should contain
  • source block to specify a digi file
  • the magnetic field and the geometry cfi files
  • the module blocks included via cfi files to read the Calibration constants
  • the module blocks included via cfi files for the actual reconstruction
    • the 1DRecHit producer module for the DT (dt1DRecHits)
    • the 2DRecHit producer module for the CSC (csc2DRecHits)
    • the 2D and the 4D segments producer modules for the DT (dt2DSegments and dt4DSegments)
    • the segment producer module for the CSC (cscSegments)
    • the 1D RecHit producer module for the RPC (rpcRecHits)
  • the named module out to define an output file
  • the execution path to instantiate the modules
The module blocks for Calibration and Alignment are
# DT Calibration
include "CalibMuon/Configuration/data/DT_FakeConditions.cff"
# CSC Calibration
include "CalibMuon/Configuration/data/CSC_FakeConditions.cff"
# Muon alignment
include "CalibMuon/Configuration/data/Muon_FakeAlignment.cff"

The magnetic field and geometry cfi files as well as the cfi files for the actual reconstruction are included via the

include RecoLocalMuon/Configuration/data/RecoLocalMuon.cff
The muonlocalreco path is also defined in the cff file as sequence muonlocalreco = {dtlocalreco & csclocalreco & rpcRecHits} which is a list of the following composite sequences
# DT sequence
sequence dtlocalreco = {dt1DRecHits, dt2DSegments, dt4DSegments}
# CSC sequence
sequence csclocalreco = {csc2DRecHits, cscSegments}
Therefore if you put the muonlocalreco sequence in your path (as is done in RecoLocalMuon.cfg) you will get the full local reconstruction chain in the muon system. Of course you can leave out the part related to DTs or CSCs or RPCs if you are interested in one subsystem only.

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.


The alignment constants loaded in the CalibMuon/Configuration/data/Muon_FakeAlignment.cff are the fake ones, i.e. they reproduce a perfectly aligned detector.
In order to have a more realistic simulation you can include the CalibMuon/Configuration/data/Muon_FrontierAlignment.cff file and then you can load your favourite set of Alignment constants using the replace parameter, see for example Configuration/StandardSequences/data/Frontier100pbConditions.cff
(more info in the Muon Alignment twiki).

DT Calibration

The calibration conditions loaded in the CalibMuon/Configuration/data/DT_FakeConditions.cff are the fake ones, i.e. they reproduce the ideal behaviour of the detector (no mis-calibration at all).
In order to have a more realistic simulation you can include the CalibMuon/Configuration/data/DT_FrontierConditions.cff file and then you can load your favourite set of calibration constants using the replace parameter, see for example Configuration/StandardSequences/data/Frontier100pbConditions.cff
(more info in the DT Calibration twiki).

DTRecHits and DTSegments

Currently two kinds of 1D reconstruction algorithm are available:
  • Linear Drift Velocity: assumes a costant drift velocity to compute a position from the drift time
    • you can use the same fixed value of drift velocity for all the detectors
    • you can read from database at different value of drift velocity for each superlayer (obviously you must have created the database before!)
  • Parametrized Drift Velocity: uses the GARFIELD parametrization of the cell. The distance from the wire is a function of the digi time, the local magnetic field and the incidence angle.
Both 2D and 4D DT segment producers depend on the 1D algos. They update the 1D rechits when more information is available (second step: info on incidence angle, third step: info on position along the wire). You can choose what algo you prefer simply including the apropriate .cfi in your .cfg:
  • For the 2D-segments reconstruction one of:
  include "RecoLocalMuon/DTSegment/data/dt2DSegments_CombPatternReco2D_ParamDrift.cfi"
  include "RecoLocalMuon/DTSegment/data/dt2DSegments_CombPatternReco2D_LinearDrift.cfi"
  include "RecoLocalMuon/DTSegment/data/dt2DSegments_CombPatternReco2D_LinearDriftFromDB.cfi"
  • For the 4D-segments reconstruction one of:
  include "RecoLocalMuon/DTSegment/data/dt4DSegments_CombPatternReco4D_ParamDrift.cfi"
  include "RecoLocalMuon/DTSegment/data/dt4DSegments_CombPatternReco4D_LinearDrift.cfi"
  include "RecoLocalMuon/DTSegment/data/dt4DSegments_CombPatternReco4D_LinearDriftFromDB.cfi"

If you want to modify the parameters of the algos you can use the replace key-word. For example, in the 4D producer, you can directly extract the theta-segments from the event (if they have been produced) avoiding to re-reconstruct them. The following line modifies the default parameter AllDTRecHits = true.

replace dt4DSegments.Reco4DAlgoConfig.AllDTRecHits = false
All the parameters can be replaced in this way. For more info on the cfg key-words, refer to Cfg File Usage.


The current default algorithm for reconstruction of space points (hits) in the CSC system is CSCRecHitB. The older package, CSCRecHit, which was ported from ORCA, does not make use of realistic conditions data, and was also slower due to its use of Minuit for fitting cluster shapes on strips.


There are several possible reconstruction algorithms for the CSC-segment reconstruction, as described in the CSCSegment Reference Manual Page. (This page is unfortunately not yet up-to-date.) The particular choice is made by including one of

  • "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmSK.cfi"
  • "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmTC.cfi"
  • "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmDF.cfi"
  • "RecoLocalMuon/CSCSegment/data/CSCSegmentAlgorithmST.cfi"

To switch from one to the other you can simply override the algo_type card, which is defined in the CSCSegmentProducer:

  • replace cscSegments.algo_type = 1 for the SK algo
  • replace cscSegments.algo_type = 2 for the TC algo
  • replace cscSegments.algo_type = 3 for the DF algo
  • replace cscSegments.algo_type = 4 for the ST algo

The current recommended default algorithm is the ST algorithm (type 4).

Run the Producers all together!

In the following we will run an example job to produce RPC, DT and CSC rechits and segments:

  1. Modify the RecoLocalMuon/Configuration/test/RecoLocalMuon.cfg 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 PoolOutputModule: untracked string fileName ="/tmp/RecoLocalMuon.root"
  2. Run the job: cmsRun RecoLocalMuon.cfg >&! $SCRATCH/RecoLocalMuon.out & in the RecoLocalMuon/Configuration/test/ directory.

At the end of the job the /tmp/RecoLocalMuon.root output file will contain all the objects produced by the muon local reconstruction. You can then analyze it either using your favourite analyzer or browsing it with a ROOT TBrowser.

Run starting from Raw Data

With very few changes it is possible to run the reconstruction starting from the raw data. What we need is:
  • change the input source
  • include the raw data unpacker (to create digis), and put it at the beginning of the execution path
  • include the proper calibration files

An example of .cfg file to perform Muon Local Reconstruction (loading the needed calibration constants for real data) is RecoLocalMuon/DTSegment/test/testDTRecSegment_fromData.cfg. You can Checkout it with the command

cvs co -r V02-01-07 RecoLocalMuon/DTSegment/test/

Within the testDTRecSegment_fromData.cfg file we can recognize the above items:

  • the input source:
    • source = DaqSource{ ... }
  • the es_sources:
    • es_source roMapping = PoolDBESSource { ... } for the channel mapping
    • es_source TTrig = PoolDBESSource { ... } for the ttrig calibration
    • es_source t0 = PoolDBESSource { ... } for the t0 calibration
  • the unpacker:
    • module dtunpacker = DTUnpackingModule{ ... }
  • the new execution path:
    • path p = {dtunpacker, dt1DRecHits, dt2DSegments, dt4DSegments}

To run it type the command
cmsRun testDTRecSegment_fromData.cfg >&! out_from_data.log &
in the RecoLocalMuon/DTSegment/test/ directory.

Run the visualization

There are two ways to run the visualization:

If you have a look at the above files you could see that they aren't different with respect to the ones used for the production of the segments, in fact we can use them as well. Then, where is the difference? Just in the exe command: for the visualization we have to use iguana instead of cmsRun. So for example (in RecoLocalMuon/DTSegment/test/):

iguana -p testDTRecSegment_fromData.cfg

... and enjoy!

Review status

Reviewer/Editor and Date (copy from screen) Comments
JennyWilliams - 21 Jun 2006 Editing for pdf maker to work
KatiLassilaPerini - 09 Jun 2006 Some editing to uniform the style
AnneHeavey - 14 Mar 2006 Copied Riccardo Bellan's tutorial from MuTutorialSegments, no images or editing yet
GianlucaCerminara - 08 Feb 2007 Update to CMSSW_1_2_2
JennyWilliams - 23 Mar 2007 reinstated manual contents section for pdf generation

Responsible: RiccardoBellan
Last reviewed by: GianlucaCerminara - 08 Feb 2007

Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif DT_CSC_tree.gif r1 manage 45.5 K 2006-06-19 - 15:04 RiccardoBellan Concept schema
PNGpng globalview.png r1 manage 104.3 K 2006-06-20 - 16:08 RiccardoBellan global view
Edit | Attach | Watch | Print version | History: r50 < r49 < r48 < r47 < r46 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r50 - 2008-09-11 - AndrewKubik

    • 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-2023 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