Fast algorithm for track segment and hit reconstruction in the CMS Cathode Strip Chambers

In this note, we propose an algorithm for fast and efficient track segment reconstruction in Cathode Strip Chambers used by the Compact Muon Solenoid experiment for muon detection in the forward direction. The algorithm is designed to be CPU-efficient and is targeted for High Level Trigger (HLT, online reconstructed events pre-selection) purposes. The segment finding efficiency and the spatial resolution attainable with the proposed algorithm as well as the required CPU time are benchmarked using the Cosmics Muon data and found to surpass the HLT requirements.


Introduction
The Endcap Muon (EMU) system [1,2] of the Compact Muon Solenoid (CMS) experiment [3] is now being commissioned for the Large Hadron Collider (LHC) [4]. The technology of choice for the EMU system is Cathode Strip Chambers (CSCs), the concept of which was first proposed by G. Charpak more than 30 years ago [5]. The CMS CSCs will detect muons in the pseudorapidity [6] range 0.9 < |η| < 2.4. At the time of the LHC start-up, the CMS Endcap Muon system will consist of 468 six-plane CSCs. The total sensitive area of all CSC planes is about 5 000 m 2 and the total number of wires is about 2 000 000.
The CMS Cathode Strip Chambers are mounted on the steel disks enclosing the CMS magnet and set perpendicular to the beam axis as shown in Fig. 1. The CMS Cathode Strip Chambers are comprised of six planes of anode wires interleaved between seven trapezoidal cathode panels, as shown in Fig. 2 (left). Most of the CSCs have a gas gap of about 1 cm. An electron avalanche caused by a muon traversing a gas gap produces a signal on anode wires (Fig. 2, right top) and induces a distributed charge on cathode strips (Fig. 2, right bottom). By reading out signals from wires and strips, CMS CSCs measure two muon coordinates in each of the 6 planes.
Wires run azimuthally and define muon track's coordinate Y in chamber's local coordinate system (or coordinate (r) in CMS global coordinate system) as shown in Fig. 2 (left). For readout purposes, the wires are ganged in groups of about 1-5 cm width since the requirements on the radial coordinate precision are very loose. Wire group signals are amplified and shaped to a standard pulse. A general idea of a pattern of wire group hits left behind by a muon is illustrated in Fig. 3 (left). Such patterns are also known as anode local charged tracks (anode LCTs, or ALCTs).
Strips are milled on cathode panels and run lengthwise at constant ∆Φ s width. The angular strip width ∆Φ s varies for different chamber types from ∼ 2-5 mrad, while the spatial width -from ∼ 4-16 mm, depending on the chamber type and local chamber coordinate Y . By comparing signal amplitudes on nearby strips, CMS CSC electronics allows for a quick measurement of muon X-coordinate with a half-strip width precision [10]. Figure 3 (right) illustrates a pattern of induced charges on strips and half-strip bits left behind by a muon. Among all such comparator hits in a chamber, electronics search for patterns consistent with muon track segments, socalled cathode local charged tracks (cathode LCTs, or CLCTs).
ALCTs and CLCTs are used by the muon Level-1 trigger (the first level of online events selection).
Strip signals are also digitized by 12-bit ADCs. By interpolating such digitized signals in all six planes, muon's X-coordinate in a chamber is measured with a precision of ∼ 75-150 µm. This information is available for High-Level Trigger (HLT, the final level of online event selection) and offline analyzes.
In this paper, we present a fast and efficient algorithm specifically developed for fast and efficient track segment reconstruction in CSCs at the High-Level Trigger. The spatial resolution attainable with the presented algorithm  remains well adequate for HLT purposes. The algorithm performance is validated using cosmic ray data taken in situ with 36 chambers.

HLT requirements for a local track segment reconstruction in CSCs
Muon reconstruction in the High Level Trigger (HLT) starts by finding local track segments in muon chambers (for the endcap muon system, in six-plane cathode strip chambers). The local track segments found in all muon chambers and the reconstructed hits, RecHits, associated with them are then used for a standalone muon reconstruction. An event will be accepted by the L2 trigger (the first stage of the HLT event selection), if there is at least one muon with transverse momentum p T > 19 GeV/c or if there are at least two muons with p T > 7 GeV/c each. The following stages of HLT involve calorimeter (L2.5-muon isolation) and reconstruction of tracks in the tracker (L3-refined momentum and muon isolation). More details on the CMS High Level Trigger can be found elsewhere [11].
The four main criteria required of a track segment finding algorithm are as follows: • low CPU time per event and operational code robustness; • high efficiency of finding segments associated with muons of interest; • good spatial resolution for localizing such segments; • low rate of finding spurious segments not directly associated with a muon of interest.
The allowable CPU time per event is derived from the size of overall HLT Event Filter Farm size (4000 CPUs) and the maximum L1 trigger rate of 100 kHz. Given these numbers, one has only 40 ms per event for the whole HLT processing, which includes the L2 stage (standalone muon) with 100% weight, L2.5 (calorimeter isolation) with ∼30% weight, and L3 (tracks in the tracker) with ∼20% weight. The weights come from the fact that each next level trigger sees only a faction of the incoming events. The local segment reconstruction within a single chamber is among the simplest operations in the HLT and, therefore only a very small fraction of the overall 40-ms budget can be allotted to it. A typical L1-trigger event is expected to have on average three CSCs with tracks [12] (note that CSCs are readout only if there are LCTs . At the time of writing this note, the HLT algorithms have not been optimized for time performance and, therefore it is not possible to set a quantitative specification on the maximum CPU allotment for a local segment reconstruction, but clearly it is limited to no more than a few milliseconds per CSC. The efficiency of finding muon track segments is desired to be at least 99% over the sensitive chamber area (the area in every sensitive CSC plane with parts around HV segment borders and chamber physical borders excluded to ensure a muon passes through responsive areas in all 6 CSC planes). This will allow for reconstruction of muon tracks in the whole system with high efficiency and small systematic uncertainties.
The spatial resolution per segment at HLT is not required to be much better than ∼0.5 mm. This can be illustrated by the following simple considerations (see Appendix II): As far as the standalone muon reconstruction is concerned (L2-part of HLT), the error in a sagitta for the ME1-ME2-ME3 stations due to multiple scattering in the 60-cm iron disks separating them for a muon with p T =20 GeV at η=2.0 (p=75 GeV) is about 1 mm. The error for sagitta based on IP-ME1-ME2 (IP-interaction point) for the same muons is larger than 3 mm.
For matching a reconstructed standalone muon to tracks in the Si Tracker (or vice versa, matching Si tracks to muon stubs in the muon chambers), one needs to make an extrapolation through the calorimeters. The extrapolation error due to multiple scattering for the same benchmark muons (p T =20 GeV at η=2.0) is about 4 mm.
Once the tracker hits are included in the muon reconstruction, the muon momentum resolution is then completely defined by the tracker up to 200 GeV [13]. Therefore, below the highest p T threshold of 19 GeV, the final muon momentum measurement at HLT is completely insensitive to the muon chamber resolution.
The rate of finding secondary segments not directly associated with a muon of interest is another very important figure of merit for segment finding performance both for HLT and offline muon reconstruction. Secondary segments can originate from physical secondary tracks (e.g., jet punchthrough and electromagnetic showers associated with high-energy muon bremsstrahlung). Combinatorial fakes resulting from all possible pairings of anode and cathode hits as one forms 2d-hits and/or segments are yet another source of secondary segments. A single secondary segment, simply by an incorrect association with a physical soft muon, can result in a dramatic mismeasurement of a muon momentum typically promoting it to a much higher p T . At the trigger level this leads to larger rates of fake high-p T muons and, even worse, to flattening of the trigger rate vs. muon p T threshold, thus resulting in inability to control muon trigger rates. In offline data analyses one would have to cope with the associated high rates of fake high p T muons with poorly understood systematic uncertainties.

Principles of the algorithm
The track segment finding algorithm described in this note was suggested by the University of Florida group and has become known as the UF algorithm. For brevity and to distinguish the new algorithm from the others (SK, TC, DF, ST, see for example [14] for details), we will further refer to it under this nickname. The UF algorithm is particularly fast, and built on the following principles.
1. Instead of starting by pairing anode and cathode strip charge clusters in individual planes to form 2d-RecHits and then trying to build 2d-segments from them, the UF algorithm starts by finding 1d-segments, Anodeand CathodeSegments, and pairs them to build 2d-ProtoSegments. This approach substantially reduces the CPU time needed to reconstruct complex events with more than just one hit per plane.
2. Having found 2d-ProtoSegments, the UF algorithm then takes only those strip charge clusters that fall within close proximity of the segments found and reconstructs their precise coordinates. To speed up calculations, the reconstruction is done without accessing any calibrations or databases. By default, we use the ratio-method [15]. The ratio method requires no iterations, is very fast, and delivers a spatial resolution substantially better than that required for HLT purposes.
3. The last step is to refine the parameters of the 2d-ProtoSegments and remove "bad" RecHits. To do this, we make a linear fit of all RecHits originally associated with each 2d-ProtoSegment. If the χ 2 of the fit is not satisfactory, some RecHits can be removed. This is also a linear non-iterative procedure taking very little time. The final linear fit defines the RefinedSegment parameters.
Additional layers of sophistication can be added to each of the three steps of the UF algorithm, provided the gain in performance does not lead to unacceptable computational time.

ProtoSegment building
In the simplest implementation of the UF algorithm, to define 2d-ProtoSegments we just use the ALCT (Anode Local Charged Track) and CLCT (Cathode Local Charged Track) trigger primitives for AnodeSegment and Cath-odeSegment. These trigger primitives (patterns of raw hits consistent with muons originating from the interaction point) are already found by the frontend electronics and reported in the data stream of all raw data. Details concerning the electronic architecture and functions can be found in the Muon Technical Design Report [1]. Up to two ALCTs (ALCT0 and ALCT1) and two CLCTs (CLCT0 and CLCT1) can be found for each bunch crossing. If more than one primitive is found in either projection, then we form all possible combinations to form 2d-ProtoSegments, of which we can have 1, 2 or 4 per chamber. The two coordinates of a 2d-ProtoSegment are the ALCT's KeyWireGroup and the CLCT's KeyHalfStrip. Building ProtoSegments in this way requires very little CPU time.
It is important to note that whenever two ALCTs and/or two CLCTs are reported by the frontend electronics, they are always the two very best muon candidates from all possible hit combinations. It is expected that the chance of finding two prompt muons within one chamber is very small. So, in fact, limiting ourselves to the best two muon segment candidates is probably more of an advantage than a limitation as long as the efficiency of finding the segment corresponding to the muon of interest remains high (see below).
Also worthwhile stressing is that this approach does not introduce any potential inefficiency as compared to any other algorithm that starts from raw data. By design, the CSC readout in CMS is intrinsically zero-suppressed and raw data are only readout if a trigger primitive is found [1].
Efficiencies of finding trigger primitives were extensively studied in the past using chamber prototypes operating in a muon beam or cosmic rays, in a muon beam with a superimposed flux of random hits [16], and with high energy muons accompanied by bremsstrahlung radiation due to muons passing through an iron slab in front of a chamber [17]. More recently, these efficiencies were studied in situ with 36 chambers installed in CMS and operating in cosmic rays [18]. In all these cases, the efficiency of finding trigger primitives was measured to be higher than 99%. For example, the latter studies gave an efficiency of 99.9±0.03% for finding ALCT×CLCT 2d-patterns for muons passing through the chamber sensitive volume.

RecHits and their coordinates
As was mentioned earlier, the default UF algorithm does not use any calibration constants and does not access any databases. All information on the internal chamber geometry needed for the local reconstruction is taken from the chamber drawings (it also can be alternatively accessed using the framework tools).
Below are a few notations and definitions to be used later in the note: • Noise associated with a single time sample (the first time sample in CFEB readout) is σ 1 . Three samples added together have a spread of σ 3 .
• The averages of the first two SCA samples in CFEB readout, measured on event-by-event and channel-bychannel basis, define pedestals for the current event. Below, in the section on the validation of the algorithm, we show that using tabulated pedestals allows one to achieve an even better resolution, but at an additional CPU cost.
• A CFEBCluster is defined as a 3×3 matrix = (3 strips)×(3 SCA samples) with the central sample being a local maximum. For a cluster to be identified as such, the amplitude of the central strip is required to be larger than kσ 1 (k is a configurable parameter; by default, k=10). For each strip in a cluster, three time samples are added together (pedestal subtracted). This way the 9-sample information in a cluster is reduced to three charges: Q l , Q c , Q r (left, central, right). The cluster charge is Q = Q l + Q c + Q r .
• Throughout this note, noise, pedestals, and charges are expressed in terms of ADC counts.
For each ProtoSegment present in the chamber, the following procedure is followed. Starting from the or a Pro-toSegment's coordinates (KeyHalfStrip, KeyWireGroup), the nearest CFEBCluster in each plane within ±n strips around the KeyHalfStrip is identified (n is a configurable parameter; by default, n=5). At the moment, clusters from different planes are not required to coincide in time. Strip signal charges Q l , Q c , Q r for such clusters are calculated and used to build the ratio r defined as follows: This ratio changes monotonically, but not linearly from -0.5 to 0 to 0.5 as the true hit coordinate in strip width units changes from -0.5 to 0 to 0.5 (at points -0.5, 0, and 0.5, they coincide). The cluster's local coordinate in strip width units is then calculated via a function x = f (r, w) that corrects for non-linearity between r and x (see Appendix I for details). The strip width parameter w in this function is derived from the chamber geometry and the ProtoSegment's coordinates (KeyHalfStrip, KeyWireGroup). Note that x, being measured in strip width units, can be thought of as a φ-coordinate of a hit in units of strip ∆φ-width.
The x-coordinate is then given an offset, according to the number of its central strip and taking into account the ±0.25 staggering of strip patterns in odd/even planes in the large chambers.
It is important to note that, being built from charge differences, the ratio method is intrinsically not very sensitive to cross talk variations. Another important feature is that for hits close to strip edges, the ratio r basically becomes the ratio of two large charges on nearby strips and has almost no sensitivity to charge fluctuations on the third strip with a very small share of the induced charge (and, thus, very little useful information). This is not the case for a center-of-gravity position estimate.
By default, the UF algorithm assigns errors to the x-coordinates of reconstructed RecHits according to tabulated functions σ x (CSCtype, HV segment, |x|) for five ranges of |x|. The values for these functions were obtained directly from MTCC data. More details are given below where we discuss the algorithm validation.
By default, the algorithm does not attempt to correct the errors in x for the charge in a cluster. To take into account the charge, a good understanding of charge-dependent and charge-independent contributions is needed. Note that at nominal gas gain, the errors for x-coordinates in the area between strips, where the resolution is the best, are already dominated by charge-independent contributions. Therefore, a charge-dependent assignment of errors may improve performance somewhat, but the effect is not expected to be dramatic. These studies are in progress.
If CFEB data are not present, then the x-coordinate is given by the center of the nearest half-strip with a comparator response. Again, as in the case with CFEBClusters, the search is performed in the range of ±n strips around the KeyHalfStrip. The error in this case is defined as σ x = 0.5/ √ 12 = 0.144.
RecHits are assigned local y-coordinates according to the center-of-gravity of anode hits in the corresponding plane which fall within the envelope of the corresponding AnodeSegment pattern. To calculate the RecHit's y-coordinate in ME1/1 chambers with tilted wires one also needs to take into account the RecHit's x-coordinate.

RefinedSegment
To refine the x-coordinate of the original ProtoSegment, we make a standard non-iterative weighed linear fit of the x-coordinates of all RecHits associated with the segment. The fitted parameters are an intercept x segment at local coordinate z=0 (center of the middle chamber panel), its estimated error, the slope dx/dz with its estimated error, and the χ 2 /d.o.f. The local x-coordinate is directly related to the φ-coordinate of the CMS coordinate system.
If the χ 2 /d.o.f.> χ 2 cut , we successively re-fit the line, leaving out one plane at a time. The best fit gives new parameters for the RefinedSegment. Another round of such pruning is allowed (with the same criteria on χ 2 ) as long as the number of remaining hits does not fall below four, i.e. the final refined segment must have at least four RecHits associated with it.
For a 2d-RefinedSegment, the local y-coordinate is improved (in comparison to what one gets by taking just the KeyWireGroup) by taking the center of gravity of actual hits belonging to the AnodeSegment pattern. The local y-coordinate can be easily converted into the CMS global coordinates r and η.
Note that the refinement of 2d-segments means just that, refinement; i.e. the previously-found 2d-segments do not get removed, nor are new segments added in this process.

Algorithm Validation at MTCC
During August-October 2006, a slice of the CMS Detector was used to take cosmic ray data during the first activation of the CMS solenoid. This important CMS milestone was named the Magnet Test and Cosmic Challenge (MTCC). This section describes the performance of the UF algorithm on the MTCC data.
Measurements of the processing time for the default UF algorithm were done on an Intel P4 2.8 GHz Dual Xeon Server with the CMSSW version 1.2.0 as the default framework. To benchmark the algorithm performance we used the CMS Global Run No. 4188. On average, the UF algorithm was found to take ∼0.36 ms per matched LCT. This time includes finding segments, reconstruction of RecHits associated with these segments, and refining segment parameters.

ProtoSegments
As was mentioned earlier, in the current version of the UF algorithm, the ProtoSegment is defined as a matched pair of trigger primitive patterns, ALCT×CLCT. The efficiency of finding such correlated LCTs and their properties have been extensively studied elsewhere [18]. Here we just summarize the main results of those studies: • For muons going through a fully sensitive chamber area (i.e. excluding areas next to the HV segment and chamber borders), the efficiency of finding a correlated LCT was measured in data to be 99.9±0.03%.
• The highest-quality correlated LCT found in a chamber was near the muon position predicted from external chambers; the distribution spread of 0.5-2 cm was consistent with the strip/wiregroup widths and the multiple scattering of cosmic ray muons in 60-cm thick iron disks between chambers.
Therefore the MTCC data confirm the earlier results showing that ALCT and CLCT patterns provide a very robust method of identifying muons. In contrast to the earlier results obtained in beam tests with only a small portion of a chamber (∼ 0.01m 2 ) illuminated by muons, the MTCC studies were done with cosmic rays probing nearly the entire area of 8 large chambers (∼ 20m 2 ) operated in situ together with the rest of the CMS detectors participating in the MTCC.

Spatial Resolution
Signal-to-noise ratio is among the key parameters affecting the chamber performance. As described earlier, a strip charge in the UF algorithm is defined as a three-time-sample sum. Figure 4 (left) shows the three-sample sum distribution in the absence of a signal-the Gaussian sigma of this distribution is σ 3 ∼5.6 ADC counts. Figure 4 (right) shows the charge distribution, the sum for 3-strip charge clusters, which looks like the expected Landau distribution. The average charge is around 550 ADC counts. Therefore, the MTCC data were taken with the gas gain corresponding to signal-to-noise ratio of approximately 100:1.  shows the two-sample sum distribution in an absence of a signal-the Gaussian sigma of this distribution is σ 2 ∼4.5 ADC counts. The two-sample sum is of special interest for further considerations. The UF algorithm assumes two modes of operation. The first, default, mode does not use any calibration constants, including pedestals. The pedestals for individual channels are evaluated on event-by-event basis from the first two samples, where signal is not present: ped = (sample1 + sample2)/2. This dynamically-defined pedestal is subtracted from all three samples used to form a three-sample-sum charge. This procedure contributes an additional error in determination of the charge: (σ 2 /2) × 3 = 6.9 ADC counts. Combined with σ 3 = 5.5, the total error in charge measurements becomes 8.8 ADC counts, which is 1.6 times worse than 5.5 ADC counts one could have, if tabulated (calibrated) pedestals were used. This is a substantial penalty for not using calibrated pedestals.  Therefore, we single out pedestals from all calibration constants and implement a second mode of the UF algorithm that does use pre-defined pedestals. The UF algorithm takes ∼0.45 ms per matched LCT using tabulated pedestals.

Resolution for high-p T muons
Very good chamber resolution is important only for high-p T muons whose track stubs are nearly perpendicular to anode wires. Soft muons undergo large multiple scattering and a good detector resolution is less important. To evaluate the chamber resolution performance in this context, we select events according to the following criteria: • We require only one ALCT and only one CLCT per chamber. This allowed us to extract the spatial resolution parameters intrinsic to the chambers themselves and unobscured by the presence of showers.
• CLCT patterns are required to be half-strip patterns only (di-strip patterns are invoked for finding highly inclined muons in the absence of half-strip patterns).
• Also, to avoid edge effects, we require that the ProtoSegment's KeyWireGroup is at least one wire group away from chamber edges and dead areas separating HV segments, and the KeyHalfStrip is at least 2 strips away from the chamber sides.
• We require six charge clusters to be associated with a ProtoSegment, which removes incomplete tracks.
• The resolution is evaluated via residuals between a hit coordinate in the 3rd plane and the track coordinate in this plane as predicted from a straight line fit of hits in the remaining 5 planes (1, 2, -, 4, 5, 6). These residuals give a conservative estimate of the chamber resolution as they include track prediction errors. We do not attempt to correct for this effect.
• We expect a few percent of δ-electrons per plane. The fraction of corrupted 5-plane fits due to δ-electrons in at least one plane is consequently five times larger. Therefore, to make sure that the reference prediction is not dramatically compromised, we cut events whose 5-plane fit χ 2 /dof = χ 2 /3 > 10. This removes about 25% of tracks. Since typical δ-electrons do not have enough energy to penetrate from plane to plane, this cut does not bias the measurement in the test plane number 3. It rather ensures that the reference prediction for the hit position in the 3rd plane is self-consistent.  These σ i 's allow one to evaluate the overall six-plane (full-chamber) resolution as follows: Figure 7 shows single-plane and full-chamber resolutions for all HV segments for ME23/2 chambers. For completeness, the results are shown both in units of strip widths and microns. Figure 8 show similar results for another distinct chamber type: ME1/1. Clearly, the resolutions obtained by far surpass the HLT goal of approximately 0.5 mm. These results do not make use of any calibration constants. Nor do we correct for internal plane mis-alignment, which, from the FAST site measurements, is estimated to contribute about 50 µm RMS per plane [21].

Resolution for high-p T muons with tabulated pedestals
Measuring pedestals dynamically (on an event-by-event basis) allows one not to use calibrations and is important at very high rates when pedestals are expected to float. However, as it was mentioned earlier, these benefits come with a penalty-the electronic noise results in errors in the measured pedestals, which makes a significant contribution to the final errors in charge measurements.
To evaluate the effect quantitatively, we measured pedestals directly from data and used them in the analysis. The 3rd-plane residuals obtained with tabulated pedestals are then used to evaluate the full six-plane resolution for ME23/2 chambers. The results are shown in Figure 9. The left plot is for dynamically measured pedestals, the right plot is for tabulated pedestals. The gain in resolution is quite tempting. As long as the rate of hits in chambers is not too high, one can certainly take advantage of this option, especially in the offline analysis.
As far as the HLT is concerned, the improvement in resolution, however impressive it might be, is not critical (the resolution with dynamic pedestals is already better than needed). Nevertheless, the option of using tabulated pedestals certainly can be used for the HLT as well. As was mentioned earlier, with this option ON, the program takes ∼ 0.45 msec per matched LCT (compared to ∼ 0.36 msec for dynamic pedestals).

Resolution for low-p T , or highly-inclined, muons
Very low p T tracks will have a noticeable angle of inclination α = dx/dz due to the magnetic field and multiple scattering. For example, muons with p T ∼3 GeV/c at η=1.6 (which just reach the ME1/1 chambers) will go through     ME1/1 chambers at an angle of α B ∼ 0.35 rad. For other stations, the angle α B is smaller. In the current version of the CLCT-finding firmware, such "highly-inclined" muons are captured by CLCT di-strip patterns. The resolution for such segments is worse due to smearing of the ionization charge along the anode wires (see below). But the requirements on the resolution for such soft muons are much more relaxed; they scale as 1/p T .
To evaluate the spatial resolution attainable with the UF algorithm for "highly-inclined" muons, we selected Pro-toSegments based on LCT=(di-strip CLCT)×ALCT in ME23/2 chambers. This is a conservative estimate as the effect of worsening in ME1/1 chambers will be smaller. The results are shown in Figure 10. The left plot shows angles for track segments reconstructed from di-strip CLCTs. One can see that the range is much wider than expected for a few GeV p T muons. The right plot is the resolution per six-plane chamber-clearly, the resolution is still much better than the few-millimeter resolution needed for such soft muons.

Resolution for high-p T muons with charge-dependent sigmas
An additional layer of sophistication can be added to the RecHit reconstruction by adjusting the errors on RecHit coordinates σ(CSCtype, HV segment, |x|) according to the actual charges in clusters. Before implementing such an adjustment, one must perform detailed studies of the relative interplay of different sources of errors in the hit reconstruction. Among these contributions are electronic noise (improvement in resolution with charge as ∼1/Q), δ-electrons (degradation of resolution for too large charges), and a number of constant terms (placeto-place variations and event-to-event fluctuations, in induced charge shape, mis-calibrations, mechanical plane misalignment, etc.), Given that the spatial resolution that we obtain without any of these corrections is already much better than what is needed for HLT, these corrections, once properly tuned, would make much more sense for offline analysis than for HLT. Of course, they can be used at HLT as well.

RefinedSegments
As was outlined in section on the algorithm principles, a 2d-RefinedSegment is basically a 2d-ProtoSegment whose parameters have been refined using the precise coordinates of RecHits. The final step in building RefinedSegments is pruning of seemingly "bad" RecHits. This is done by identifying and throwing away one-two "bad" RecHits that make dramatically bad contributions to a linear fit χ 2 . We derive the χ 2 -cut criteria from MTCC data as follows.
We select ProtoSegments based on LCT=(half-strip CLCT)×ALCT in ME23/2 chambers and suppress complicated events with showers by requiring that there is only one ProtoSegment per chamber. To minimize edge effects, we require that the ProtoSegment's KeyWireGroup is at least a unit away from the chamber edges and the borders separating HV segments, and KeyHalfStrip is at least 2 strips away from the chamber sides. The chamber ME2/3/28 is excluded from further analysis as it had one HV segment switched off. Figure 11 (left) shows how many charge clusters are found on such ProtoSegments. Note that by the UF algorithm design only one cluster per plane can be associated with a given ProtoSegment. Figure 11 (right) shows the probability of a particular plane from 1st to 6th to have a charge cluster. Figure 12 (left) shows the χ 2 /dof distribution for a linear fit for events with six, five, and four clusters associated with a ProtoSegment. The distributions have a long tails due to δ-electrons and other possible sources of hit corruption (e.g., showers). Figure 12 (right) shows a scatter plot of min(χ 2 5 /dof) vs. χ 2 6 /dof for events with six-cluster ProtoSegments. Here, χ 2 6 /dof is obtained for a six-plane fit, min(χ 2 5 /dof) is a minimum between 6 five-plane fits with one plane dropped from the fit. The choice of cuts for pruning bad hits is shown by the straight lines. The probability of having 6-hit, 5-hit, and 4-hit RefinedSegments is then 78%, 13%, 9% correspondingly. We do not prune bad hits from segments with only four remaining hits. Figure 13 (left) shows that the distribution of |x|-coordinates for RefinedSegments remains flat, which demonstrates that the pruning of hits does not bias segments. Figure 13 (right) shows pulls (normalized deviations) for all retained RecHits (i.e., RecHits associated with RefinedSegments. One can see an obvious reduction in tails in  The final optimization of the χ 2 cuts can be done when a good reference for a whole segment is available (e.g., in detector Monte Carlo simulation, provided that Monte Carlo is shown to reproduce data at an adequate level of detail). In principle, more sophisticated additional criteria for pruning can be further employed: e.g., one can take into account the charge cluster shape and number of anode hits associated with a RecHit. These were studied in the past and shown to have some, albeit very limited, discriminating power against "bad" hits. However, their use for HLT purposes is hardly justifiable.

Conclusions
A new fast algorithm for reconstructing track segments in Cathode Strip Chambers is proposed. The algorithm was validated with the real cosmic ray data taken with 36 CSC chambers operated as a part of CMS-wide MTCC test program in the second half of 2006. The algorithm proved to provide high speed, high efficiency, and good spatial precision-all well within the High Level Trigger requirements. After charges Q l , Q c , Q r on left, central, and right strips are measured, their ratio is built as follows: Figure 14 (right) shows the ratio r as a function of a local coordinate x calculated for the induced charged distribution according to Gatti et al. [19] (same Figure, left). The local coordinate x is assumed to be in strip units, x=0 corresponds to the strip center, and x = ±0.5 corresponds to the right/left strip edges. This ratio r is a monotonic, but not linear, function of the hit position across a strip x. The "wedge" effect is taken into account using different strip widths in perpendicular direction to wire groups.
We find the conversion function from r to x in two steps.
The first correction is an approximate inversion of the "theoretical" function r(x, w). Figure 15 (left) shows a correction that one needs to add to r to obtain the coordinate x. The points correspond to the "theoretical" Gatti function. We find that the 1st-order correction can be parameterized quite well with the following empirical function (w is a strip width in cm): where a=0.27 (0.11), b=2.7 (2.9), c=1.25 (1.25) for large (and ME1/1) chambers.
After applying this correction, the 1st-order corrected coordinate x 1 = r + g(r, w) is expected to be within 1% of the true coordinate x-see Fig. 15 (left). This is already sufficient for HLT purposes. However, this correction is purely theoretical and must be checked against reality. Figure 15 (right) shows the experimental occupancy distribution dN/dx 1 . It has an obvious "wave", which is a manifestation of the fact that the induced charge does not quite follow the "theoretical" Gatti. Curiously enough, Figure 15: Left: Correction that must be added to the measured ratio r to obtain the hit position across a strip. Points correspond to the "theoretical" Gatti-based curve from Fig. 14, while the lines correspond to an empirical approximation described in the text as the 1st-order correction. Right: An occupancy distribution for the 1st-order corrected coordinate x 1st . Figure 16: Left: The second-order correction that must be added to x 1 to obtain the hit position across a strip x 2 Right: An occupancy distribution for the 2nd-order corrected coordinate x 2 (as expected, the distribution now is almost perfectly flat).
the shape of the wave looks very similar for all parts of all chambers, i.e. it is very similar for different strip widths. This allows us to introduce a second-order empirical correction in a strip-width independent manner. This correction can be derived directly from the shape of the dN/dx 1 occupancy distribution and can be parameterized as follows: where b 1 = −11, b 2 = −6.5, c 1 = 0.070273, c 2 = −0.072769, and c 0 = −(c 1 +c 2 ). The second-order correction x 2 − x 1 is actually quite modest (see Fig. 16). However, it does make the distribution of x 2 almost perfectly flat.
The sensitivity of the ratio method to the typical electronics noise, calibration errors, and cross-talk uncertainties are shown in Figs. 17, 18, 19. The typical values used to make these plots are the results of pre-installation testing of all 396 large chambers at the Final Assembly and System Test sites [21].
The typical noise is ∼1% of the average cathode cluster charge when the chambers operate at nominal gas gain. In addition to the FAST site measurements, the noise levels were again measured in situ during data taking for Figure 17: Sensitivity of the ratio method to electronic noise. The curves are given for δQ strip /Q cluster = 0.01, which corresponds to the nominal operation conditions. Pedestals are assumed to be tabulated. When pedestals are defined on the event-by-event basis, the noise contribution increases by a factor of 1.6. The resolution is given in units of strip width (left) and in microns (right) Figure 18: Sensitivity of the ratio method to errors in electronic gain calibrations. The curves are given for δGain/Gain = 0.01. The choice of this number is driven by the actual measurements of strip electronic gain variations between nearby strips (this is the only thing that matters), which gave 1.1%. The resolution is given in units of strip width (left) and in microns (right).
all installed chambers and found to remain unchanged. If one does not use calibration constants, the spread of electronic channel gains between nearby strips is found to be ∼1%. The differences in crosstalk between strips for chambers of the same type are very small; the 2% number used for making Fig. 19 represents the RMS value of all crosstalk values regardless of chamber type.
One can see that variation in channel gain calibrations and crosstalk values are the least of our concerns. The noise contribution to the resolution of the hit coordinate measurement between strips is also very small. These figures allows one to gauge how the electronics performance may contribute to the CSC spatial resolution when the ratio method is used.

Appendix II: Multiple Scattering in the Endcap Muon System.
This Appendix gives estimates of the multiple scattering for muons with p T ∼ 20 GeV in the endcap region (η ∼ 2) in order to evaluate the precision requirements on measuring muon's coordinates. The estimates are based Figure 19: Left: Sensitivity of the ratio method to uncertainties in cross talks between strips. The curves are obtained for a 2% uncertainty in crosstalk, which corresponds closely to variations in crosstalk values between different chamber types (sizes). The resolution is given in units of strip width (left) and in microns (right).
on the CMS detector geometry and material budget and the mathematics of multiple scattering summarized in the Review of Particle Physics by DPG [22]. To get a resolution requirement from CSC detectors only (no Tracker hits) one have to consider a set of CSCs in different stations as resolution of one CSC is not enough to measure muon track parameters and that uncertainty is actually larger than multiple scattering effect on measurements in first stations CSCs. Figure 20 shows a muon undergoing multiple scattering as it passes through three distinct regions: d 0 , d 1 , d 2 , where we will assume that the lengths of these regions in radiation length units are 0, L 1 , and L 2 . Filled circles denote 3 points where muon coordinates are measured. These points could be IP (Interaction Point), ME1, and ME2 stations. Or they can be ME1, ME2, ME3 stations (d 0 in this case can be set to zero).
The muon starts out with x 0 = 0 and angle dx/dz = 0. As it crosses the first block (d 0 ), nothing happens to it. As it passes through the next block (d 1 ), it scatters and emerges displaced by x 1 = δ 1 and at an angle θ 1 , for which we can write: θ 2 1 = 0.0136 2 p 2 L 1 (1 + 0.038 ln L 1 ) 2 , Figure 20: A sketch of a muon undergoing multiple scattering as it passes through three distinct regions: d 0 , d 1 , d 2 . Filled circles denote 3 points where muon coordinates are measured.