Muon Segment Reconstruction

Combinatorial Algorithm

(Draft 2.0, written by A.Kostritsky)



            General information about muon reconstruction and identification in Run II can be found here.

            This document describes only combinatorial algorithm of segment reconstruction.  There is another algorithm of segment reconstruction (Linked List Algorithm) that can be used in muon reconstructing. Its documentation is located here.

Algorithm description


            The algorithm can be divided in the following steps:

1.      Transform  ‘global’ hits to ‘local’ hits.

Because the segment finder will try to reconstruct segment in a given muon detector section, all hits are sorted by lists that correspond to detector sections. In the case of WAMUS, a section is associated with a given octant and barrel. In the case of FAMUS a section corresponds a given octant. 

After it hit coordinates are transformed to a local coordinate system, with the y-axis along the drift direction and the z –axis along the wire. The y-axis of local coordinate is defined such that it is more sensitive to measurement of a track bending and as a consequence to a momentum resolution of reconstructed track.

2.      Pattern recognition.

Pattern recognition is performed in the local (x,y) plane. Pairs of hits (called base hits) from two different outermost planes are used to form roads for adding hits in the remaining planes.  The size of a road is adjustable (rcp parameters are MaxWamusDriftRes and MaxFamusDriftRes, for Wamus and Famus, respectively). If a segment road associated with selected base hits exists, all other hits in the section are checked to be in the road and, if it is so, the hit is added to the list of hits that formed a segment. The minimum number of hits in one segment is a parameter and equals to the number of planes in the section (It is changed at step 4). Segment candidates with no missing hits are fitted. The c2 is calculated as a sum of the squares of the residuals divided by position resolution (equal to drift distance error of reconstructed hits), allowing for one hit cell. Quality of segment is defined as c2/ndf. The segment position is defined as a center of gravity of hit positions.

That process is repeated for all possible combination of base hits. Thus, a list of all possible segments in one detector section has been created. It needs to note here the created list can contain the segments that shared the same hits.

3.      Select the best segments.

To remove the effect of hit sharing the best segment is selected from all segments shared one hit. The selection is based on the number of hits on a segment, and, for two segments with equal number of hits, on the fit quality. Hits on the selected segments are marked and are not used for further segment finding.

4.      Loop over steps 2, and 3.

The steps 2-3 are repeated, with the minimum number of planes contributing to the segment decremented by one, as long as the number is >= 3, and there remain unmarked hits to define new roads.

At this step the list of all segments found in the detector section has been created.

5.      Match found segments with scintillator hits.

In the current algorithm the segment-to-scintillator match is performed for FAMUS segments only. Before matching all global scintillator hits move to local hits. If the segment matches to a scintillator (a line associated with the current position and direction of segment goes throw scintillator) z-coordinate of all segment hits is updated. In the case of combined BC segment the update is only carried out if difference between j positions of B and C scintillators is less than 0.1.   IMPORTANT: Scintillator hits are not included in the list of hits that forms the segment. After it the direction of segment is refitted and, hence, a new segment quality is calculated.

6.      Transform local segment to global segments.


Algorithm control parameters

The algorithm process can be controlled with RCP parameters that are located in muo_segmentreco/rcp/MuoSegmentReco.rcp file.

PackageName                                     The name of framework package (“MuoSegmentReco”). Don’t change it, please.

SegmentAlgorithm                              The name of segment algorithm (“Combinatorial” or “LinkedList”)

debugLevel                                          Control of printout amount for debugging purpose (“0” means a minimum printout)

combineBC                                          Switch on/off  B and C layers combining for segment reconstructing


Special patrameters are listed under the header “Combinatorial algorithm parameters”:

MaxWamusDriftRes                            Drift distance resolution of WAMUS tubes (in cm)

MaxWamusAxialRes                           Axial distance resolution of WAMUS tubes (in cm)

MaxFamusDriftRes                             Drift distance resolution of FAMUS tubes (in cm)

MaxWamusAxialRes                           Axial distance resolution of FAMUS tubes (in cm)


Algorithm implimentation

            Classes and methods that are reasonable for the algorithm are described at this part of the document.


MuoSegmentReco::processEvent method


MuoSegmentRecoCombi::findSegment method

1.      const MuonHitCollection::WireMap& wireMap

2.      const MuonHitCollection::ScintMap& scintMap

1.      LocalWireHit describes the hit in local coordinate system.

2.      ListOfHits list of hits in one plane.

3.      ListOfPlanes list of plane in one section.

4.      ListOfSections list of all muon detector sections. The section is defined as a logical unit in what the segment search is performed. For example, it is an A-layer FAMUS octant. In the case of BC-combining the B and C planes are combined in one section.

5.      MuoLocalSegment class – a muon segment in local coordinate system.

6.      ListOfSegments – list of MuoLocalSegments.

7.      MuoSegment class – a muon segment in global coordinate system.

q       Call MuoSegmentAlgCombi::createSegments to find a list of MuoLocalSegments in each ListOfSections.

q       Call MuoSegmentAlgCombi::matchSegments to match found MuoLocalSegment with reconstructed MuoScintHits.

o       Loops over all found MuoLocalSegments in ListOfSections and make a transformation from MuoLocalSegment (local coordinate system) to MuoSegment (global coordinate system).


MuoSegmentRecoCombi::createLocalHit method

·        Purpose: Transform MuoWireHits from the global to a local coordinate system and create ListOfHits that are combined to ListOfPlanes and ListOfSections.

·        Inputs: const MuoHitCollection::WireMap& wireMap – hit collection created in the findSegment method.

·        Used objects:

1.      ListOfHits list of hits in one plane.

2.      ListOfPlanes list of plane in one section.

3.      ListOfSections list of all muon detector sections.

4.      MuoWireHit is adaptor for wire hits.

5.      MuoIndex is muon index.

6.      MuoXForm is container of the coordinate transformation for different part of muon detector.

7.      SwapXYZ describes the coordinate transformation for given part of the muon system.

·        Workflow:

o       Loop over all hits in the wireMap and sort it by ListOfHits, ListOfPlanes, and ListOfSections.

o       Transform the position of each hit from global to local coordinate system. The transformation is performed by SwapXYZ::apply method that applies the coordinate transformation for given part of muon system. IMPORTANT: At the time the transformation doesn’t take into account alignment information of the muon detector. It must be changed in the future.

o       In the case a BC-combining has been selected in the RCP parameter call MuoSegmentRecoCombi::combineBC method to combine B and C hit sections in one section.


MuoSegmentAlgCombi::createSegments method

·        Purpose: Create a list of MuoLocalSegments for the given section of muon detector.

·        Inputs: ListOfPlanes of a section.

·        Used objects:

·        Workflow:

o       Select two base planes and call MuoSegmentAlgCombi::createSegments4Planes method to create a list of all possible segments for a selected base planes. The base plane is a plane that contains a hit, which is used to build a road within that all segment hits are located.  The MuoSegmentAlgCombi::createSegments4Planes method takes a minimum number of hits that can build a segment (that is to be located within the segment road) as a parameter.

o       Loop over all combinations of base planes.

o       If the number of found MuoLocalSegments is more then 1, call MuoSegmentAlgCombi::cleanSegments method to check the existence of segments that are shared the same hits, and to select the best segment.

o       Loop over all possible minimum number of hits. This initial value is equal the number of planes in the section; the minimal value is 3.


MuoSegmentAlgCombi::createSegments4Planes method

1.      ListOfPlanes                     – list of planes for given section of muon detector

2.      const int nPlanes               – total number of planes in the detector section

3.      const int plane1                 the number of first base plane

4.      const int plane1                 the number of second base plane

5.      const int minN                  the minimum number of hits that can build one segment.

o       Call createRoads method and create segment roads for given hit pair from base plane. Each pair of hits corresponds to four roads, because there is a left-right ambiguity of hit drift position. So, every hit could be located in one of two possible positions and, hence, there are four roads for two given hits. The size of a road is adjustable (rcp parameters are MaxWamusDriftRes and MaxFamusDriftRes, for Wamus and Famus, respectively).

o       Loop over all hits from other planes, check is they in the road and add hits (MuoLocalSegment::addHit method) to a segment that corresponds to a given road.

o       Check the number of hits in a segment is larger than the min number.  Select “best” segment from four segments, which are associated with four roads. The “best” segment has smallest value of segment quality. Because the segments had not been fitted yet, the quality is calculated as a summa of square distance from position of a given hit to the middle line of road.

o       Loop over all combinations of hit pairs for given base planes and create a list of “best” segments.

o       Perform the fit of all segments to determine a direction of each segment. At this step the quality of segment is also re-calculated and becomes to equal to c2 /ndf of the fit (MuoLocalSegment::fit method). Actual fitting are performed by LineFitterCwt::fit method. This method calculates c2 as  (where yhit, and yfit are a hit and fit result positions, respectively, and si is an error of hit position), value of ndf equals to the number of fitted hits that have . The error of hit position corresponds to drift-distance and axial distance resolution and is determined with MDTGeometryHit class and PDTGeometryHit class for FAMUS and WAMUS, respectively.


MuoSegmentAlgCombi::cleanSegments method


MuoSegmentAlgCombi::createRoads method

1.      const LocalWireHit & hit1 – reference to the first base hit;

2.      const LocalWireHit & hit2 – reference to the second base hit;


MuoSegmentAlgCombi::matchSegments method

1.      ListOfSegments * segList – list of found segments

2.      const MuoHitCollection::ScintMap& scintMap – collection of scintillator hits